refactor(api): ♻️ Use URL literal instead of strings

This commit is contained in:
Jesse Wierzbinski 2025-02-01 16:32:18 +01:00
parent 99fac323c8
commit 76d1ccc859
No known key found for this signature in database
50 changed files with 343 additions and 256 deletions

View file

@ -41,7 +41,7 @@ export const getFetchWorker = (): Worker<FetchJobData, void, FetchJobType> =>
return;
}
await Instance.resolve(uri);
await Instance.resolve(new URL(uri));
await job.log(
`✔ Finished fetching instance metadata from [${uri}]`,

View file

@ -22,7 +22,10 @@ export const getInboxWorker = (): Worker<InboxJobData, void, InboxJobType> =>
if (headers.authorization) {
const processor = new InboxProcessor(
request,
{
...request,
url: new URL(request.url),
},
data,
null,
{
@ -67,7 +70,7 @@ export const getInboxWorker = (): Worker<InboxJobData, void, InboxJobType> =>
"x-signed-by": string;
};
const sender = await User.resolve(signedBy);
const sender = await User.resolve(new URL(signedBy));
if (!(sender || signedBy.startsWith("instance "))) {
await job.log(
@ -106,7 +109,10 @@ export const getInboxWorker = (): Worker<InboxJobData, void, InboxJobType> =>
}
const processor = new InboxProcessor(
request,
{
...request,
url: new URL(request.url),
},
data,
{
instance: remoteInstance,

View file

@ -113,7 +113,7 @@ export const getPushWorker = (): Worker<PushJobData, void, PushJobType> =>
vapidDetails: {
subject:
config.notifications.push.vapid.subject ||
config.http.base_url,
config.http.base_url.origin,
privateKey: config.notifications.push.vapid.private,
publicKey: config.notifications.push.vapid.public,
},