Compare commits
7 Commits
v1.0.0-alp
...
bc37756097
| Author | SHA1 | Date | |
|---|---|---|---|
|
bc37756097
|
|||
|
3a5733eeee
|
|||
|
7c2549cbfe
|
|||
|
e3bd385c96
|
|||
|
038ce15908
|
|||
|
7aebcfc43f
|
|||
|
b7eccde9d0
|
@@ -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": {
|
||||
|
||||
6
feeds.ts
6
feeds.ts
@@ -20,6 +20,7 @@ export async function profileAtomFeed(
|
||||
<id>${articleId}</id>
|
||||
<title>${article.title}</title>
|
||||
<link href="${article.url}" />
|
||||
<link rel="alternate" type="text/html" href="${article.url}" />
|
||||
<link rel="alternate" type="application/nostr+json" href="nostr:${article.naddr}" />
|
||||
<updated>${isoDate(article.updatedAt)}</updated>
|
||||
<published>${isoDate(article.publishedAt)}</published>
|
||||
@@ -35,12 +36,15 @@ export async function profileAtomFeed(
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<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}" />
|
||||
<id>${feedId}</id>
|
||||
<updated>${isoDate(lastUpdate)}</updated>
|
||||
<icon>${profile.avatarImageUrl}</icon>
|
||||
<author>
|
||||
<name>${name}</name>
|
||||
<name>${profile.name}</name>
|
||||
<uri>${profile.profileUrl}</uri>
|
||||
<nostr:uri>nostr:${profile.nprofile}</nostr>
|
||||
</author>
|
||||
${articlesXml}
|
||||
</feed>
|
||||
|
||||
5
html.ts
5
html.ts
@@ -210,7 +210,8 @@ function feedLinksHtml(profile: Profile) {
|
||||
function profileMetaHtml(profile: Profile) {
|
||||
return `
|
||||
<link rel="icon" href="${profile.avatarImageUrl}" type="image/png">
|
||||
<link rel="alternate" type="application/nostr+json" href="nostr:${profile.npub}" title="${profile.name} on Nostr">
|
||||
<link rel="me" type="application/nostr+json" href="nostr:${profile.nprofile}" title="${profile.name}">
|
||||
<link rel="alternate" type="application/nostr+json" href="nostr:${profile.nprofile}" title="${profile.name} on Nostr">
|
||||
<meta property="og:url" content="${profile.profileUrl}">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="${profile.name} on Nostr">
|
||||
@@ -231,6 +232,8 @@ function articleMetaHtml(article: Article, profile: Profile) {
|
||||
return `
|
||||
<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.nprofile}" title="${profile.name}">
|
||||
<meta property="og:url" content="${article.url}">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="${article.title}">
|
||||
|
||||
@@ -59,6 +59,13 @@ export default class Profile {
|
||||
return nip19.npubEncode(this.pubkey);
|
||||
}
|
||||
|
||||
get nprofile(): string {
|
||||
return nip19.nprofileEncode({
|
||||
pubkey: this.pubkey,
|
||||
relays: [config.relay_urls[0]],
|
||||
});
|
||||
}
|
||||
|
||||
get profileUrl(): string {
|
||||
return `${config.base_url}/@${this.username}`;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ describe("Article", () => {
|
||||
describe("#naddr", () => {
|
||||
it("returns a bech32 addressable event ID", () => {
|
||||
expect(article.naddr).toMatch(
|
||||
/naddr1qvzqqqr4gupzq8meqkx80g3yuklzymy0qf/,
|
||||
/^naddr1qvzqqqr4gupzq8meqkx80g3yuklzymy0qf/,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -40,4 +40,12 @@ describe("Profile", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#nprofile", () => {
|
||||
it("returns a bech32 profile ID", () => {
|
||||
expect(profile.nprofile).toMatch(
|
||||
/^nprofile1qyt8wumn8ghj7mn0wd68ytntdaek6mmn9ehhyecqyq0hjpvvw73zfed7yf/,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user