Refactor config to use a better interface

This commit is contained in:
Alex Gleason
2023-06-10 17:15:08 -05:00
parent 8a62cb604d
commit b5643c4aba
8 changed files with 46 additions and 28 deletions

View File

@@ -1,5 +1,5 @@
import { getAuthor } from '@/client.ts';
import { LOCAL_DOMAIN } from '@/config.ts';
import { Conf } from '@/config.ts';
import { nip19, parseFormData, z } from '@/deps.ts';
import { type Event } from '@/event.ts';
import { lookupNip05Cached } from '@/nip05.ts';
@@ -87,8 +87,8 @@ function buildLinkHeader(url: string, events: Event[]): string | undefined {
const lastEvent = events[events.length - 1];
const { pathname, search } = new URL(url);
const next = new URL(pathname + search, LOCAL_DOMAIN);
const prev = new URL(pathname + search, LOCAL_DOMAIN);
const next = new URL(pathname + search, Conf.localDomain);
const prev = new URL(pathname + search, Conf.localDomain);
next.searchParams.set('until', String(lastEvent.created_at));
prev.searchParams.set('since', String(firstEvent.created_at));