From 3bd7588077122a775c8630416663d920e596afa1 Mon Sep 17 00:00:00 2001 From: naskya Date: Fri, 7 Jun 2024 08:41:13 +0900 Subject: [PATCH] remove fetchMeta argument --- packages/backend/src/models/repositories/drive-file.ts | 2 +- .../src/server/api/mastodon/converters/notification.ts | 2 +- packages/backend/src/server/api/mastodon/helpers/auth.ts | 4 ++-- packages/backend/src/server/api/mastodon/helpers/misc.ts | 6 +++--- packages/backend/src/server/api/mastodon/helpers/note.ts | 2 +- .../backend/src/server/api/mastodon/helpers/timeline.ts | 2 +- .../src/server/api/mastodon/streaming/channels/public.ts | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/backend/src/models/repositories/drive-file.ts b/packages/backend/src/models/repositories/drive-file.ts index 6446a6bd12..80ed1727d2 100644 --- a/packages/backend/src/models/repositories/drive-file.ts +++ b/packages/backend/src/models/repositories/drive-file.ts @@ -231,7 +231,7 @@ export const DriveFileRepository = db.getRepository(DriveFile).extend({ if (url.startsWith(`${config.url}/identicon`)) return url; if (url.startsWith(`${config.url}/avatar`)) return url; - const meta = await fetchMeta(true); + const meta = await fetchMeta(); const baseUrl = meta ? meta.objectStorageBaseUrl ?? `${meta.objectStorageUseSsl ? "https" : "http"}://${ diff --git a/packages/backend/src/server/api/mastodon/converters/notification.ts b/packages/backend/src/server/api/mastodon/converters/notification.ts index 26381787c3..727857827b 100644 --- a/packages/backend/src/server/api/mastodon/converters/notification.ts +++ b/packages/backend/src/server/api/mastodon/converters/notification.ts @@ -158,7 +158,7 @@ export class NotificationConverter { subscription: SwSubscription, ctx: MastoContext, ): Promise { - const instance = await fetchMeta(true); + const instance = await fetchMeta(); const result: MastodonEntity.PushSubscription = { id: subscription.id, endpoint: subscription.endpoint, diff --git a/packages/backend/src/server/api/mastodon/helpers/auth.ts b/packages/backend/src/server/api/mastodon/helpers/auth.ts index f372f0ce37..847aef08a3 100644 --- a/packages/backend/src/server/api/mastodon/helpers/auth.ts +++ b/packages/backend/src/server/api/mastodon/helpers/auth.ts @@ -69,7 +69,7 @@ export class AuthHelpers { client_id: app.id, client_secret: app.secret, vapid_key: - (await fetchMeta(true).then((meta) => meta.swPublicKey)) ?? undefined, + (await fetchMeta().then((meta) => meta.swPublicKey)) ?? undefined, }; } @@ -228,7 +228,7 @@ export class AuthHelpers { return { name: app.name, website: app.description, - vapid_key: await fetchMeta(true).then( + vapid_key: await fetchMeta().then( (meta) => meta.swPublicKey ?? undefined, ), }; diff --git a/packages/backend/src/server/api/mastodon/helpers/misc.ts b/packages/backend/src/server/api/mastodon/helpers/misc.ts index 6f3401d993..3af8b78dce 100644 --- a/packages/backend/src/server/api/mastodon/helpers/misc.ts +++ b/packages/backend/src/server/api/mastodon/helpers/misc.ts @@ -43,7 +43,7 @@ export class MiscHelpers { }, order: { id: "ASC" }, }).then((p) => (p ? UserConverter.encode(p, ctx) : null)); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); const res = { uri: config.host, @@ -119,7 +119,7 @@ export class MiscHelpers { }, order: { id: "ASC" }, }).then((p) => (p ? UserConverter.encode(p, ctx) : null)); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); const res = { domain: config.host, @@ -261,7 +261,7 @@ export class MiscHelpers { const user = ctx.user as ILocalUser; const results: Promise[] = []; - const pinned = fetchMeta(true).then((meta) => + const pinned = fetchMeta().then((meta) => Promise.all( meta.pinnedUsers .map((acct) => stringToAcct(acct)) diff --git a/packages/backend/src/server/api/mastodon/helpers/note.ts b/packages/backend/src/server/api/mastodon/helpers/note.ts index 7539bc7b35..dc18d46296 100644 --- a/packages/backend/src/server/api/mastodon/helpers/note.ts +++ b/packages/backend/src/server/api/mastodon/helpers/note.ts @@ -720,7 +720,7 @@ export class NoteHelpers { ctx: MastoContext, ): Promise { const user = ctx.user as ILocalUser; - const instance = await fetchMeta(true); + const instance = await fetchMeta(); const provider = instance.libreTranslateApiUrl ? "LibreTranslate" : instance.deeplAuthKey diff --git a/packages/backend/src/server/api/mastodon/helpers/timeline.ts b/packages/backend/src/server/api/mastodon/helpers/timeline.ts index c9db284064..3be7de7072 100644 --- a/packages/backend/src/server/api/mastodon/helpers/timeline.ts +++ b/packages/backend/src/server/api/mastodon/helpers/timeline.ts @@ -85,7 +85,7 @@ export class TimelineHelpers { } if (!local) { - const m = await fetchMeta(true); + const m = await fetchMeta(); if (m.disableGlobalTimeline) { if (user == null || !(user.isAdmin || user.isModerator)) { throw new Error("global timeline is disabled"); diff --git a/packages/backend/src/server/api/mastodon/streaming/channels/public.ts b/packages/backend/src/server/api/mastodon/streaming/channels/public.ts index 26f3a8538d..f824dbffab 100644 --- a/packages/backend/src/server/api/mastodon/streaming/channels/public.ts +++ b/packages/backend/src/server/api/mastodon/streaming/channels/public.ts @@ -25,7 +25,7 @@ export class MastodonStreamPublic extends MastodonStream { } public async init() { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.disableGlobalTimeline) { if (this.user == null || !(this.user.isAdmin || this.user.isModerator)) return;