instance: add urls.nostr_relay and pubkey properties to instance
This commit is contained in:
parent
887c68f052
commit
baf4c00fee
|
@ -5,6 +5,9 @@ import type { Context } from '@/deps.ts';
|
||||||
function instanceController(c: Context) {
|
function instanceController(c: Context) {
|
||||||
const { host, protocol } = Conf.url;
|
const { host, protocol } = Conf.url;
|
||||||
|
|
||||||
|
/** Protocol to use for WebSocket URLs, depending on the protocol of the `LOCAL_DOMAIN`. */
|
||||||
|
const wsProtocol = protocol === 'http:' ? 'ws:' : 'wss:';
|
||||||
|
|
||||||
return c.json({
|
return c.json({
|
||||||
uri: host,
|
uri: host,
|
||||||
title: 'Ditto',
|
title: 'Ditto',
|
||||||
|
@ -35,10 +38,15 @@ function instanceController(c: Context) {
|
||||||
user_count: 0,
|
user_count: 0,
|
||||||
},
|
},
|
||||||
urls: {
|
urls: {
|
||||||
streaming_api: `${protocol === 'http:' ? 'ws:' : 'wss:'}//${host}`,
|
/** Base URL for the streaming API, so it can be hosted on another domain. Clients will add `/api/v1/streaming` to it. */
|
||||||
|
streaming_api: `${wsProtocol}//${host}`,
|
||||||
|
/** Full URL to the Nostr relay. */
|
||||||
|
nostr_relay: `${wsProtocol}//${host}/relay`,
|
||||||
},
|
},
|
||||||
version: '0.0.0 (compatible; Ditto 0.0.1)',
|
version: '0.0.0 (compatible; Ditto 0.0.1)',
|
||||||
email: Conf.adminEmail,
|
email: Conf.adminEmail,
|
||||||
|
/** Ditto admin pubkey, so clients can query and validate Nostr events from the server. */
|
||||||
|
pubkey: Conf.pubkey,
|
||||||
rules: [],
|
rules: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue