Use absolute URLs in Atom feed

This commit is contained in:
Râu Cao 2024-10-21 21:18:16 +02:00
parent 74f7b89c15
commit ffd709d2f9
Signed by: raucao
GPG Key ID: 37036C356E56CC51
4 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,5 @@
PORT=8000
BASE_URL=http://localhost:8000
HOME_RELAY_URL=wss://nostr.kosmos.org
LDAP_URL=ldap://10.1.1.116:389
LDAP_BIND_DN=uid=service,ou=kosmos.org,cn=applications,dc=kosmos,dc=org

View File

@ -5,6 +5,7 @@ await load({ envPath: `${dirname}/.env`, export: true });
const config = {
port: Deno.env.get("PORT") || 8000,
base_url: Deno.env.get("BASE_URL") || `http://localhost:8000`,
home_relay_url: Deno.env.get("HOME_RELAY_URL") || "",
ldap: {
url: Deno.env.get("LDAP_URL"),

View File

@ -14,7 +14,7 @@ export function profileAtomFeed(profile: Profile, articles: Article[]) {
<entry>
<id>${articleId}</id>
<title>${article.title}</title>
<link href="/${article.naddr}" />
<link href="${article.url}" />
<updated>${isoDate(article.updatedAt)}</updated>
<summary>${article.summary}</summary>
<content type="html">${article.html}</content>

View File

@ -1,6 +1,7 @@
import { render as renderMarkdown } from "@deno/gfm";
import { nip19 } from "@nostr/tools";
import { NEvent } from "../nostr.ts";
import { render as renderMarkdown } from "@deno/gfm";
import config from "../config.ts";
export default class Article {
event: NEvent;
@ -14,6 +15,10 @@ export default class Article {
return tag ? tag[1] : "";
}
get url(): string {
return `${config.base_url}/${this.naddr}`
}
get title(): string {
const tag = this.event.tags.find((t) => t[0] === "title");
return tag ? tag[1] : "Untitled";