6 Commits

Author SHA1 Message Date
cd335a366e Add XML namespace definition, fix wrong closing tag
Some checks failed
CI / Test and lint (push) Has been cancelled
2025-06-03 11:30:40 +04:00
b307d4de03 Generate profile image for feeds if missing 2025-06-03 11:23:46 +04:00
91eff4ad07 Add missing unbind
All checks were successful
CI / Test and lint (push) Successful in 24s
2025-05-21 16:34:12 +04:00
994053e080 Ignore test coverage results dir
All checks were successful
CI / Test and lint (push) Successful in 16s
2025-05-02 13:22:41 +04:00
bc37756097 Add exclude option to compile command
All checks were successful
CI / Test and lint (push) Successful in 18s
2025-05-02 13:09:11 +04:00
3a5733eeee Use nprofile for article author link 2025-05-02 13:04:15 +04:00
6 changed files with 9 additions and 4 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.env
users.yaml
build/
coverage/

View File

@@ -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": {

View File

@@ -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>

View File

@@ -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);

View File

@@ -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}">

View File

@@ -49,6 +49,8 @@ export async function lookupUsernameByPubkey(pubkey: string): Promise<string | u
if (searchEntries.length > 0) {
username = searchEntries[0].cn.toString();
}
await client.unbind();
} catch (e) {
await client.unbind();
throw e;