mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Merge branch 'nostr-external-viewers' into 'main'
Add ditto.external property to accounts and statuses Closes soapbox#1673 See merge request soapbox-pub/ditto!396
This commit is contained in:
commit
961cb070f0
5 changed files with 16 additions and 0 deletions
|
|
@ -63,6 +63,14 @@ class Conf {
|
|||
static get localDomain(): string {
|
||||
return Deno.env.get('LOCAL_DOMAIN') || `http://localhost:${Conf.port}`;
|
||||
}
|
||||
/** Link to an external nostr viewer. */
|
||||
static get externalDomain(): string {
|
||||
return Deno.env.get('NOSTR_EXTERNAL') || 'https://njump.me';
|
||||
}
|
||||
/** Get a link to a nip19-encoded entity in the configured external viewer. */
|
||||
static external(path: string) {
|
||||
return new URL(path, Conf.externalDomain).toString();
|
||||
}
|
||||
/**
|
||||
* Heroku-style database URL. This is used in production to connect to the
|
||||
* database.
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ export interface MastodonAccount {
|
|||
username: string;
|
||||
ditto: {
|
||||
accepts_zaps: boolean;
|
||||
external_url: string;
|
||||
};
|
||||
pleroma: {
|
||||
deactivated: boolean;
|
||||
|
|
|
|||
|
|
@ -39,4 +39,7 @@ export interface MastodonStatus {
|
|||
expires_at?: string;
|
||||
quotes_count: number;
|
||||
};
|
||||
ditto: {
|
||||
external_url: string;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ async function renderAccount(
|
|||
username: parsed05?.nickname || npub.substring(0, 8),
|
||||
ditto: {
|
||||
accepts_zaps: Boolean(getLnurl({ lud06, lud16 })),
|
||||
external_url: Conf.external(npub),
|
||||
},
|
||||
pleroma: {
|
||||
deactivated: names.has('disabled'),
|
||||
|
|
|
|||
|
|
@ -124,6 +124,9 @@ async function renderStatus(event: DittoEvent, opts: RenderStatusOpts): Promise<
|
|||
uri: Conf.local(`/${note}`),
|
||||
url: Conf.local(`/${note}`),
|
||||
zapped: Boolean(zapEvent),
|
||||
ditto: {
|
||||
external_url: Conf.external(note),
|
||||
},
|
||||
pleroma: {
|
||||
emoji_reactions: reactions,
|
||||
expires_at: !isNaN(expiresAt.getTime()) ? expiresAt.toISOString() : undefined,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue