Rename Conf.url() to Conf.local(), replace it with a URL of localDomain

This commit is contained in:
Alex Gleason
2023-07-09 18:26:33 -05:00
parent 5ec40f285d
commit be6aa89c39
7 changed files with 16 additions and 15 deletions

View File

@@ -3,7 +3,7 @@ import { Conf } from '@/config.ts';
import type { Context } from '@/deps.ts';
function instanceController(c: Context) {
const { host, protocol } = new URL(Conf.localDomain);
const { host, protocol } = Conf.url;
return c.json({
uri: host,

View File

@@ -31,7 +31,7 @@ const acctSchema = z.custom<URL>((value) => value instanceof URL)
.transform((uri) => uri.pathname)
.pipe(z.string().email('Invalid acct'))
.transform((acct) => acct.split('@') as [username: string, host: string])
.refine(([_username, host]) => host === new URL(Conf.localDomain).hostname, {
.refine(([_username, host]) => host === Conf.url.hostname, {
message: 'Host must be local',
path: ['resource', 'acct'],
});
@@ -66,7 +66,7 @@ interface RenderWebfingerOpts {
/** Present Nostr user on Webfinger. */
function renderWebfinger({ pubkey, username, subject }: RenderWebfingerOpts): Webfinger {
const apId = Conf.url(`/users/${username}`);
const apId = Conf.local(`/users/${username}`);
return {
subject,
@@ -92,7 +92,7 @@ function renderWebfinger({ pubkey, username, subject }: RenderWebfingerOpts): We
}
const hostMetaController: AppController = (c) => {
const template = Conf.url('/.well-known/webfinger?resource={uri}');
const template = Conf.local('/.well-known/webfinger?resource={uri}');
c.header('content-type', 'application/xrd+xml');
return c.body(