diff --git a/.env.sample b/.env.sample index 8c756bf..f788be1 100644 --- a/.env.sample +++ b/.env.sample @@ -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 diff --git a/config.ts b/config.ts index f9985e9..edc6a9c 100644 --- a/config.ts +++ b/config.ts @@ -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"), diff --git a/feeds.ts b/feeds.ts index 63e9759..d853fdf 100644 --- a/feeds.ts +++ b/feeds.ts @@ -14,7 +14,7 @@ export function profileAtomFeed(profile: Profile, articles: Article[]) { ${articleId} ${article.title} - + ${isoDate(article.updatedAt)} ${article.summary} ${article.html} diff --git a/models/article.ts b/models/article.ts index d24b539..66d5df4 100644 --- a/models/article.ts +++ b/models/article.ts @@ -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";