Compare commits
6 Commits
v1.0.0-alp
...
cd335a366e
| Author | SHA1 | Date | |
|---|---|---|---|
|
cd335a366e
|
|||
|
b307d4de03
|
|||
|
91eff4ad07
|
|||
|
994053e080
|
|||
|
bc37756097
|
|||
|
3a5733eeee
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
.env
|
||||
users.yaml
|
||||
build/
|
||||
coverage/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"tasks": {
|
||||
"dev": "deno run --allow-all --watch server.ts",
|
||||
"server": "deno run --allow-all server.ts",
|
||||
"compile": "deno compile --allow-all --include ./assets/ --output ./build/substr_x86_64-unknown-linux-gnu server.ts",
|
||||
"compile": "deno compile --allow-all --include ./assets/ --exclude ./tests/ --output ./build/substr_x86_64-unknown-linux-gnu server.ts",
|
||||
"test": "DENO_ENV=test deno test --allow-read --allow-env"
|
||||
},
|
||||
"imports": {
|
||||
|
||||
4
feeds.ts
4
feeds.ts
@@ -34,7 +34,7 @@ export async function profileAtomFeed(
|
||||
|
||||
return `
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:nostr="urn:nostr:protocol">
|
||||
<title>${profile.name} on Nostr (Articles)</title>
|
||||
<link rel="alternate" type="text/html" href="${profile.profileUrl}" />
|
||||
<link rel="alternate" type="application/nostr+json" href="nostr:${profile.npub}" />
|
||||
@@ -44,7 +44,7 @@ export async function profileAtomFeed(
|
||||
<author>
|
||||
<name>${profile.name}</name>
|
||||
<uri>${profile.profileUrl}</uri>
|
||||
<nostr:uri>nostr:${profile.nprofile}</nostr>
|
||||
<nostr:uri>nostr:${profile.nprofile}</nostr:uri>
|
||||
</author>
|
||||
${articlesXml}
|
||||
</feed>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { fetchArticlesByAuthor, fetchProfileEvent } from "../nostr.ts";
|
||||
import { profileAtomFeed } from "../feeds.ts";
|
||||
import Profile from "../models/profile.ts";
|
||||
import { notFoundHandler } from "../handlers/errors.ts";
|
||||
import { generateOgProfileImage } from "../magick.ts";
|
||||
|
||||
const userAtomFeedHandler = async function (ctx: Context) {
|
||||
const username = ctx.state.username;
|
||||
@@ -20,6 +21,7 @@ const userAtomFeedHandler = async function (ctx: Context) {
|
||||
const profile = new Profile(profileEvent, username);
|
||||
|
||||
if (profile.nip05) {
|
||||
await generateOgProfileImage(profile);
|
||||
const articles = await fetchArticlesByAuthor(pubkey, 10);
|
||||
const atom = await profileAtomFeed(profile, articles);
|
||||
|
||||
|
||||
2
html.ts
2
html.ts
@@ -233,7 +233,7 @@ function articleMetaHtml(article: Article, profile: Profile) {
|
||||
<link rel="icon" href="${profile.avatarImageUrl}" type="image/png">
|
||||
<link rel="alternate" type="application/nostr+json" href="nostr:${article.naddr}" title="This article on Nostr">
|
||||
<link rel="author" type="text/html" href="${profile.profileUrl}" title="${profile.name}">
|
||||
<link rel="author" type="application/nostr+json" href="nostr:${profile.npub}" title="${profile.name}">
|
||||
<link rel="author" type="application/nostr+json" href="nostr:${profile.nprofile}" title="${profile.name}">
|
||||
<meta property="og:url" content="${article.url}">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="${article.title}">
|
||||
|
||||
Reference in New Issue
Block a user