From 9120b37c1fc89a47bdd725ac5dc006eafa899ec2 Mon Sep 17 00:00:00 2001 From: Lhcfl Date: Wed, 22 May 2024 17:18:50 +0800 Subject: [PATCH 1/5] Use elements as API Document --- packages/backend/assets/redoc.html | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/packages/backend/assets/redoc.html b/packages/backend/assets/redoc.html index 403af4bbfa..3af7dec4d4 100644 --- a/packages/backend/assets/redoc.html +++ b/packages/backend/assets/redoc.html @@ -1,23 +1,19 @@ + + Firefish API - - - - - - + + + - - + From b1ba863a0ba3eeb3458bde457f6938b369116c0d Mon Sep 17 00:00:00 2001 From: Lhcfl Date: Wed, 22 May 2024 17:41:38 +0800 Subject: [PATCH 2/5] add crossorigin="anonymous" --- packages/backend/assets/redoc.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/assets/redoc.html b/packages/backend/assets/redoc.html index 3af7dec4d4..834f645607 100644 --- a/packages/backend/assets/redoc.html +++ b/packages/backend/assets/redoc.html @@ -5,7 +5,7 @@ Firefish API - + From 37998e8bc36f0837dcdc5e3fb75cddd511be808a Mon Sep 17 00:00:00 2001 From: Lhcfl Date: Sun, 2 Jun 2024 23:54:50 +0800 Subject: [PATCH 3/5] Ensure unique operationId --- packages/backend/src/server/api/openapi/gen-spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/server/api/openapi/gen-spec.ts b/packages/backend/src/server/api/openapi/gen-spec.ts index 79dc48a8bb..84991156e2 100644 --- a/packages/backend/src/server/api/openapi/gen-spec.ts +++ b/packages/backend/src/server/api/openapi/gen-spec.ts @@ -101,7 +101,7 @@ export function genOpenapiSpec() { } const info = { - operationId: endpoint.name, + operationId: `POST-${endpoint.name}`, summary: endpoint.name, description: desc, externalDocs: { @@ -208,11 +208,11 @@ export function genOpenapiSpec() { }, }; - const path = { + const path: Record = { post: info, }; if (endpoint.meta.allowGet) { - path.get = { ...info }; + path.get = { ...info, operationId: `GET-${endpoint.name}` }; // API Key authentication is not permitted for GET requests path.get.security = path.get.security.filter( (elem) => !Object.prototype.hasOwnProperty.call(elem, "ApiKeyAuth"), From 219131ef6f21312e3b82709406750c16dcc01ec9 Mon Sep 17 00:00:00 2001 From: naskya Date: Wed, 5 Jun 2024 08:35:00 +0900 Subject: [PATCH 4/5] chore (backend-rs): return None if the cached value is invalid --- packages/backend-rs/src/database/cache.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/backend-rs/src/database/cache.rs b/packages/backend-rs/src/database/cache.rs index 77077b8c50..a5dd62a75e 100644 --- a/packages/backend-rs/src/database/cache.rs +++ b/packages/backend-rs/src/database/cache.rs @@ -23,10 +23,8 @@ pub enum Error { Redis(#[from] RedisError), #[error("Redis connection error: {0}")] RedisConn(#[from] RedisConnError), - #[error("Data serialization error: {0}")] - Serialize(#[from] rmp_serde::encode::Error), - #[error("Data deserialization error: {0}")] - Deserialize(#[from] rmp_serde::decode::Error), + #[error("Failed to encode the data: {0}")] + Encode(#[from] rmp_serde::encode::Error), } #[inline] @@ -123,7 +121,7 @@ pub async fn set Deserialize<'a> + Serialize>( pub async fn get Deserialize<'a> + Serialize>(key: &str) -> Result, Error> { let serialized_value: Option> = redis_conn().await?.get(prefix_key(key)).await?; Ok(match serialized_value { - Some(v) => Some(rmp_serde::from_slice::(v.as_ref())?), + Some(v) => rmp_serde::from_slice::(v.as_ref()).ok(), None => None, }) } From 28cfaad330c204edcfba69ccdbe565d2c07ea76e Mon Sep 17 00:00:00 2001 From: naskya Date: Wed, 5 Jun 2024 12:30:05 +0900 Subject: [PATCH 5/5] perf (backend): always use cache in fetch_meta --- packages/backend-rs/index.d.ts | 3 ++- packages/backend-rs/index.js | 3 ++- .../src/federation/nodeinfo/generate.rs | 2 +- .../backend-rs/src/misc/check_server_block.rs | 6 +++--- packages/backend-rs/src/misc/meta.rs | 18 ++++++++++++++---- packages/backend-rs/src/misc/reaction.rs | 2 +- .../src/service/push_notification.rs | 2 +- packages/backend/src/boot/master.ts | 4 ++-- packages/backend/src/daemons/server-stats.ts | 2 +- .../backend/src/misc/fetch-proxy-account.ts | 2 +- packages/backend/src/misc/translate.ts | 2 +- .../src/remote/activitypub/check-fetch.ts | 4 ++-- .../src/remote/activitypub/models/image.ts | 2 +- packages/backend/src/server/activitypub.ts | 16 ++++++++-------- .../backend/src/server/activitypub/featured.ts | 2 +- .../src/server/activitypub/followers.ts | 2 +- .../src/server/activitypub/following.ts | 2 +- .../backend/src/server/activitypub/outbox.ts | 2 +- packages/backend/src/server/api/api-handler.ts | 2 +- packages/backend/src/server/api/call.ts | 2 +- .../src/server/api/endpoints/admin/meta.ts | 2 +- .../server/api/endpoints/antennas/create.ts | 2 +- .../src/server/api/endpoints/custom-motd.ts | 2 +- .../api/endpoints/custom-splash-icons.ts | 2 +- .../backend/src/server/api/endpoints/drive.ts | 2 +- .../server/api/endpoints/drive/files/create.ts | 2 +- .../api/endpoints/federation/instances.ts | 4 ++-- .../src/server/api/endpoints/hashtags/trend.ts | 2 +- .../src/server/api/endpoints/i/import-posts.ts | 2 +- .../backend/src/server/api/endpoints/meta.ts | 2 +- .../api/endpoints/notes/global-timeline.ts | 2 +- .../api/endpoints/notes/hybrid-timeline.ts | 2 +- .../api/endpoints/notes/local-timeline.ts | 2 +- .../endpoints/notes/recommended-timeline.ts | 2 +- .../src/server/api/endpoints/pinned-users.ts | 2 +- .../api/endpoints/recommended-instances.ts | 2 +- .../src/server/api/endpoints/server-info.ts | 2 +- .../src/server/api/endpoints/sw/register.ts | 2 +- .../src/server/api/mastodon/endpoints/meta.ts | 2 +- .../server/api/mastodon/endpoints/status.ts | 4 ++-- .../backend/src/server/api/private/signup.ts | 2 +- .../api/stream/channels/global-timeline.ts | 2 +- .../api/stream/channels/hybrid-timeline.ts | 2 +- .../api/stream/channels/local-timeline.ts | 2 +- .../stream/channels/recommended-timeline.ts | 4 ++-- packages/backend/src/server/index.ts | 2 +- packages/backend/src/server/web/index.ts | 18 +++++++++--------- packages/backend/src/server/web/manifest.ts | 2 +- packages/backend/src/server/web/url-preview.ts | 2 +- .../backend/src/services/drive/add-file.ts | 8 ++++---- .../backend/src/services/drive/delete-file.ts | 2 +- packages/backend/src/services/send-email.ts | 2 +- .../src/services/validate-email-for-account.ts | 2 +- 53 files changed, 93 insertions(+), 81 deletions(-) diff --git a/packages/backend-rs/index.d.ts b/packages/backend-rs/index.d.ts index 6be94d2db1..dd52c4a7b5 100644 --- a/packages/backend-rs/index.d.ts +++ b/packages/backend-rs/index.d.ts @@ -428,7 +428,8 @@ export function isSafeUrl(url: string): boolean export function latestVersion(): Promise export function toMastodonId(firefishId: string): string | null export function fromMastodonId(mastodonId: string): string | null -export function fetchMeta(useCache: boolean): Promise +export function fetchMeta(): Promise +export function updateMetaCache(): Promise export interface PugArgs { img: string | null title: string diff --git a/packages/backend-rs/index.js b/packages/backend-rs/index.js index 1da5b752d7..478f82ce7e 100644 --- a/packages/backend-rs/index.js +++ b/packages/backend-rs/index.js @@ -310,7 +310,7 @@ if (!nativeBinding) { throw new Error(`Failed to load native binding`) } -const { SECOND, MINUTE, HOUR, DAY, USER_ONLINE_THRESHOLD, USER_ACTIVE_THRESHOLD, FILE_TYPE_BROWSERSAFE, loadEnv, loadConfig, stringToAcct, acctToString, fetchNodeinfo, nodeinfo_2_1, nodeinfo_2_0, Protocol, Inbound, Outbound, greet, initializeRustLogger, showServerInfo, isBlockedServer, isSilencedServer, isAllowedServer, checkWordMute, getFullApAccount, isSelfHost, isSameOrigin, extractHost, toPuny, isUnicodeEmoji, sqlLikeEscape, safeForSql, formatMilliseconds, getImageSizeFromUrl, getNoteSummary, isQuote, isSafeUrl, latestVersion, toMastodonId, fromMastodonId, fetchMeta, metaToPugArgs, nyaify, hashPassword, verifyPassword, isOldPasswordAlgorithm, decodeReaction, countReactions, toDbReaction, removeOldAttestationChallenges, cpuInfo, cpuUsage, memoryUsage, storageUsage, AntennaSrc, DriveFileUsageHint, MutedNoteReason, NoteVisibility, NotificationType, PageVisibility, PollNoteVisibility, RelayStatus, UserEmojiModPerm, UserProfileFfvisibility, UserProfileMutingNotificationTypes, updateAntennasOnNewNote, watchNote, unwatchNote, PushNotificationKind, sendPushNotification, publishToChannelStream, ChatEvent, publishToChatStream, ChatIndexEvent, publishToChatIndexStream, publishToBroadcastStream, publishToGroupChatStream, publishToModerationStream, getTimestamp, genId, genIdAt, generateSecureRandomString, generateUserToken } = nativeBinding +const { SECOND, MINUTE, HOUR, DAY, USER_ONLINE_THRESHOLD, USER_ACTIVE_THRESHOLD, FILE_TYPE_BROWSERSAFE, loadEnv, loadConfig, stringToAcct, acctToString, fetchNodeinfo, nodeinfo_2_1, nodeinfo_2_0, Protocol, Inbound, Outbound, greet, initializeRustLogger, showServerInfo, isBlockedServer, isSilencedServer, isAllowedServer, checkWordMute, getFullApAccount, isSelfHost, isSameOrigin, extractHost, toPuny, isUnicodeEmoji, sqlLikeEscape, safeForSql, formatMilliseconds, getImageSizeFromUrl, getNoteSummary, isQuote, isSafeUrl, latestVersion, toMastodonId, fromMastodonId, fetchMeta, updateMetaCache, metaToPugArgs, nyaify, hashPassword, verifyPassword, isOldPasswordAlgorithm, decodeReaction, countReactions, toDbReaction, removeOldAttestationChallenges, cpuInfo, cpuUsage, memoryUsage, storageUsage, AntennaSrc, DriveFileUsageHint, MutedNoteReason, NoteVisibility, NotificationType, PageVisibility, PollNoteVisibility, RelayStatus, UserEmojiModPerm, UserProfileFfvisibility, UserProfileMutingNotificationTypes, updateAntennasOnNewNote, watchNote, unwatchNote, PushNotificationKind, sendPushNotification, publishToChannelStream, ChatEvent, publishToChatStream, ChatIndexEvent, publishToChatIndexStream, publishToBroadcastStream, publishToGroupChatStream, publishToModerationStream, getTimestamp, genId, genIdAt, generateSecureRandomString, generateUserToken } = nativeBinding module.exports.SECOND = SECOND module.exports.MINUTE = MINUTE @@ -353,6 +353,7 @@ module.exports.latestVersion = latestVersion module.exports.toMastodonId = toMastodonId module.exports.fromMastodonId = fromMastodonId module.exports.fetchMeta = fetchMeta +module.exports.updateMetaCache = updateMetaCache module.exports.metaToPugArgs = metaToPugArgs module.exports.nyaify = nyaify module.exports.hashPassword = hashPassword diff --git a/packages/backend-rs/src/federation/nodeinfo/generate.rs b/packages/backend-rs/src/federation/nodeinfo/generate.rs index e5012114bc..e65449b46e 100644 --- a/packages/backend-rs/src/federation/nodeinfo/generate.rs +++ b/packages/backend-rs/src/federation/nodeinfo/generate.rs @@ -63,7 +63,7 @@ async fn statistics() -> Result<(u64, u64, u64, u64), DbErr> { async fn generate_nodeinfo_2_1() -> Result { let (local_users, local_active_halfyear, local_active_month, local_posts) = statistics().await?; - let meta = fetch_meta(true).await?; + let meta = fetch_meta().await?; let metadata = HashMap::from([ ( "nodeName".to_string(), diff --git a/packages/backend-rs/src/misc/check_server_block.rs b/packages/backend-rs/src/misc/check_server_block.rs index fe0c118521..136c43e7c2 100644 --- a/packages/backend-rs/src/misc/check_server_block.rs +++ b/packages/backend-rs/src/misc/check_server_block.rs @@ -20,7 +20,7 @@ /// ``` #[crate::ts_export] pub async fn is_blocked_server(host: &str) -> Result { - Ok(crate::misc::meta::fetch_meta(true) + Ok(crate::misc::meta::fetch_meta() .await? .blocked_hosts .iter() @@ -47,7 +47,7 @@ pub async fn is_blocked_server(host: &str) -> Result { /// ``` #[crate::ts_export] pub async fn is_silenced_server(host: &str) -> Result { - Ok(crate::misc::meta::fetch_meta(true) + Ok(crate::misc::meta::fetch_meta() .await? .silenced_hosts .iter() @@ -75,7 +75,7 @@ pub async fn is_silenced_server(host: &str) -> Result { /// ``` #[crate::ts_export] pub async fn is_allowed_server(host: &str) -> Result { - let meta = crate::misc::meta::fetch_meta(true).await?; + let meta = crate::misc::meta::fetch_meta().await?; if !meta.private_mode.unwrap_or(false) { return Ok(true); diff --git a/packages/backend-rs/src/misc/meta.rs b/packages/backend-rs/src/misc/meta.rs index 5aed617038..3f13f7e510 100644 --- a/packages/backend-rs/src/misc/meta.rs +++ b/packages/backend-rs/src/misc/meta.rs @@ -7,12 +7,22 @@ use std::sync::Mutex; type Meta = meta::Model; static CACHE: Mutex> = Mutex::new(None); -fn update_cache(meta: &Meta) { +fn set_cache(meta: &Meta) { let _ = CACHE.lock().map(|mut cache| *cache = Some(meta.clone())); } #[crate::export] -pub async fn fetch_meta(use_cache: bool) -> Result { +pub async fn fetch_meta() -> Result { + fetch_meta_impl(true).await +} + +#[crate::export] +pub async fn update_meta_cache() -> Result<(), DbErr> { + fetch_meta_impl(false).await?; + Ok(()) +} + +async fn fetch_meta_impl(use_cache: bool) -> Result { // try using cache if use_cache { if let Some(cache) = CACHE.lock().ok().and_then(|cache| cache.clone()) { @@ -24,7 +34,7 @@ pub async fn fetch_meta(use_cache: bool) -> Result { let db = db_conn().await?; let meta = meta::Entity::find().one(db).await?; if let Some(meta) = meta { - update_cache(&meta); + set_cache(&meta); return Ok(meta); } @@ -35,7 +45,7 @@ pub async fn fetch_meta(use_cache: bool) -> Result { }) .exec_with_returning(db) .await?; - update_cache(&meta); + set_cache(&meta); Ok(meta) } diff --git a/packages/backend-rs/src/misc/reaction.rs b/packages/backend-rs/src/misc/reaction.rs index f07d4761cb..423a732f88 100644 --- a/packages/backend-rs/src/misc/reaction.rs +++ b/packages/backend-rs/src/misc/reaction.rs @@ -118,7 +118,7 @@ pub async fn to_db_reaction(reaction: Option<&str>, host: Option<&str>) -> Resul }; }; - Ok(fetch_meta(true).await?.default_reaction) + Ok(fetch_meta().await?.default_reaction) } #[cfg(test)] diff --git a/packages/backend-rs/src/service/push_notification.rs b/packages/backend-rs/src/service/push_notification.rs index 2c06bc2d20..693a9c7f32 100644 --- a/packages/backend-rs/src/service/push_notification.rs +++ b/packages/backend-rs/src/service/push_notification.rs @@ -140,7 +140,7 @@ pub async fn send_push_notification( kind: PushNotificationKind, content: &serde_json::Value, ) -> Result<(), Error> { - let meta = fetch_meta(true).await?; + let meta = fetch_meta().await?; if !meta.enable_service_worker || meta.sw_public_key.is_none() || meta.sw_private_key.is_none() { diff --git a/packages/backend/src/boot/master.ts b/packages/backend/src/boot/master.ts index d839a9593e..25c6d7d0a4 100644 --- a/packages/backend/src/boot/master.ts +++ b/packages/backend/src/boot/master.ts @@ -4,10 +4,10 @@ import semver from "semver"; import Logger from "@/services/logger.js"; import { - fetchMeta, greet, removeOldAttestationChallenges, showServerInfo, + updateMetaCache, type Config, } from "backend-rs"; import { config, envOption } from "@/config.js"; @@ -53,7 +53,7 @@ export async function masterMain() { import("../daemons/server-stats.js").then((x) => x.default()); import("../daemons/queue-stats.js").then((x) => x.default()); // Update meta cache every 5 minitues - setInterval(() => fetchMeta(false), 1000 * 60 * 5); + setInterval(() => updateMetaCache(), 1000 * 60 * 5); // Remove old attestation challenges setInterval(() => removeOldAttestationChallenges(), 1000 * 60 * 30); } diff --git a/packages/backend/src/daemons/server-stats.ts b/packages/backend/src/daemons/server-stats.ts index 2db09e8ae6..04a1542b11 100644 --- a/packages/backend/src/daemons/server-stats.ts +++ b/packages/backend/src/daemons/server-stats.ts @@ -13,7 +13,7 @@ export default async function () { ev.emit(`serverStatsLog:${x.id}`, log.slice(0, x.length || 50)); }); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (!meta.enableServerMachineStats) return; async function tick() { diff --git a/packages/backend/src/misc/fetch-proxy-account.ts b/packages/backend/src/misc/fetch-proxy-account.ts index 8d015da25d..26fb733781 100644 --- a/packages/backend/src/misc/fetch-proxy-account.ts +++ b/packages/backend/src/misc/fetch-proxy-account.ts @@ -3,7 +3,7 @@ import type { ILocalUser } from "@/models/entities/user.js"; import { Users } from "@/models/index.js"; export async function fetchProxyAccount(): Promise { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.proxyAccountId == null) return null; return (await Users.findOneByOrFail({ id: meta.proxyAccountId, diff --git a/packages/backend/src/misc/translate.ts b/packages/backend/src/misc/translate.ts index 3395ce93be..50fa7b2b3b 100644 --- a/packages/backend/src/misc/translate.ts +++ b/packages/backend/src/misc/translate.ts @@ -26,7 +26,7 @@ export async function translate( from: PostLanguage | null, to: PostLanguage, ) { - const instance = await fetchMeta(true); + const instance = await fetchMeta(); if (instance.deeplAuthKey == null && instance.libreTranslateApiUrl == null) { throw Error("No translator is set up on this server."); diff --git a/packages/backend/src/remote/activitypub/check-fetch.ts b/packages/backend/src/remote/activitypub/check-fetch.ts index bff7548983..3ab10f1939 100644 --- a/packages/backend/src/remote/activitypub/check-fetch.ts +++ b/packages/backend/src/remote/activitypub/check-fetch.ts @@ -15,7 +15,7 @@ import type { UserPublickey } from "@/models/entities/user-publickey.js"; import { verify } from "node:crypto"; export async function hasSignature(req: IncomingMessage): Promise { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); const required = meta.secureMode || meta.privateMode; try { @@ -30,7 +30,7 @@ export async function hasSignature(req: IncomingMessage): Promise { } export async function checkFetch(req: IncomingMessage): Promise { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.secureMode || meta.privateMode) { if (req.headers.host !== config.host) return 400; diff --git a/packages/backend/src/remote/activitypub/models/image.ts b/packages/backend/src/remote/activitypub/models/image.ts index 5fb261488f..e8ba7629a8 100644 --- a/packages/backend/src/remote/activitypub/models/image.ts +++ b/packages/backend/src/remote/activitypub/models/image.ts @@ -36,7 +36,7 @@ export async function createImage( apLogger.info(`Creating an image: ${image.url}`); - const instance = await fetchMeta(true); + const instance = await fetchMeta(); let file = await uploadFromUrl({ url: image.url, diff --git a/packages/backend/src/server/activitypub.ts b/packages/backend/src/server/activitypub.ts index 2ada433eb5..0d04ded58b 100644 --- a/packages/backend/src/server/activitypub.ts +++ b/packages/backend/src/server/activitypub.ts @@ -243,7 +243,7 @@ router.get("/notes/:note", async (ctx, next) => { ctx.body = renderActivity(await renderNote(note, false)); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.secureMode || meta.privateMode) { ctx.set("Cache-Control", "private, max-age=0, must-revalidate"); } else { @@ -273,7 +273,7 @@ router.get("/notes/:note/activity", async (ctx) => { } ctx.body = renderActivity(await packActivity(note)); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.secureMode || meta.privateMode) { ctx.set("Cache-Control", "private, max-age=0, must-revalidate"); } else { @@ -328,7 +328,7 @@ router.get("/users/:user/publickey", async (ctx) => { if (Users.isLocalUser(user)) { ctx.body = renderActivity(renderKey(user, keypair)); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.secureMode || meta.privateMode) { ctx.set("Cache-Control", "private, max-age=0, must-revalidate"); } else { @@ -348,7 +348,7 @@ async function userInfo(ctx: Router.RouterContext, user: User | null) { } ctx.body = renderActivity(await renderPerson(user as ILocalUser)); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.secureMode || meta.privateMode) { ctx.set("Cache-Control", "private, max-age=0, must-revalidate"); } else { @@ -432,7 +432,7 @@ router.get("/emojis/:emoji", async (ctx) => { } ctx.body = renderActivity(renderEmoji(emoji)); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.secureMode || meta.privateMode) { ctx.set("Cache-Control", "private, max-age=0, must-revalidate"); } else { @@ -464,7 +464,7 @@ router.get("/likes/:like", async (ctx) => { } ctx.body = renderActivity(await renderLike(reaction, note)); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.secureMode || meta.privateMode) { ctx.set("Cache-Control", "private, max-age=0, must-revalidate"); } else { @@ -502,7 +502,7 @@ router.get( } ctx.body = renderActivity(renderFollow(follower, followee)); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.secureMode || meta.privateMode) { ctx.set("Cache-Control", "private, max-age=0, must-revalidate"); } else { @@ -545,7 +545,7 @@ router.get("/follows/:followRequestId", async (ctx: Router.RouterContext) => { return; } - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.secureMode || meta.privateMode) { ctx.set("Cache-Control", "private, max-age=0, must-revalidate"); } else { diff --git a/packages/backend/src/server/activitypub/featured.ts b/packages/backend/src/server/activitypub/featured.ts index 671c7ac67e..4dc93e734a 100644 --- a/packages/backend/src/server/activitypub/featured.ts +++ b/packages/backend/src/server/activitypub/featured.ts @@ -57,7 +57,7 @@ export default async (ctx: Router.RouterContext) => { ctx.body = renderActivity(rendered); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.secureMode || meta.privateMode) { ctx.set("Cache-Control", "private, max-age=0, must-revalidate"); } else { diff --git a/packages/backend/src/server/activitypub/followers.ts b/packages/backend/src/server/activitypub/followers.ts index 603e93ebe8..92d6e800ea 100644 --- a/packages/backend/src/server/activitypub/followers.ts +++ b/packages/backend/src/server/activitypub/followers.ts @@ -110,7 +110,7 @@ export default async (ctx: Router.RouterContext) => { ctx.body = renderActivity(rendered); setResponseType(ctx); } - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.secureMode || meta.privateMode) { ctx.set("Cache-Control", "private, max-age=0, must-revalidate"); } else { diff --git a/packages/backend/src/server/activitypub/following.ts b/packages/backend/src/server/activitypub/following.ts index be5a4e9643..8ded68b8c4 100644 --- a/packages/backend/src/server/activitypub/following.ts +++ b/packages/backend/src/server/activitypub/following.ts @@ -110,7 +110,7 @@ export default async (ctx: Router.RouterContext) => { ctx.body = renderActivity(rendered); setResponseType(ctx); } - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.secureMode || meta.privateMode) { ctx.set("Cache-Control", "private, max-age=0, must-revalidate"); } else { diff --git a/packages/backend/src/server/activitypub/outbox.ts b/packages/backend/src/server/activitypub/outbox.ts index 06319565e5..f04dcb6bf6 100644 --- a/packages/backend/src/server/activitypub/outbox.ts +++ b/packages/backend/src/server/activitypub/outbox.ts @@ -117,7 +117,7 @@ export default async (ctx: Router.RouterContext) => { setResponseType(ctx); } - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.secureMode || meta.privateMode) { ctx.set("Cache-Control", "private, max-age=0, must-revalidate"); } else { diff --git a/packages/backend/src/server/api/api-handler.ts b/packages/backend/src/server/api/api-handler.ts index 5e65636427..e46d9558f9 100644 --- a/packages/backend/src/server/api/api-handler.ts +++ b/packages/backend/src/server/api/api-handler.ts @@ -84,7 +84,7 @@ export default (endpoint: IEndpoint, ctx: Koa.Context) => // Log IP if (user) { - fetchMeta(true).then((meta) => { + fetchMeta().then((meta) => { if (!meta.enableIpLogging) return; const ip = ctx.ip; const ips = userIpHistories.get(user.id); diff --git a/packages/backend/src/server/api/call.ts b/packages/backend/src/server/api/call.ts index 3107156a9b..2309e3665c 100644 --- a/packages/backend/src/server/api/call.ts +++ b/packages/backend/src/server/api/call.ts @@ -117,7 +117,7 @@ export default async ( } // private mode - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if ( meta.privateMode && ep.meta.requireCredentialPrivateMode && diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts index 9e41e58c0a..052f89452e 100644 --- a/packages/backend/src/server/api/endpoints/admin/meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/meta.ts @@ -470,7 +470,7 @@ export const paramDef = { } as const; export default define(meta, paramDef, async () => { - const instance = await fetchMeta(false); + const instance = await fetchMeta(); return { maintainerName: instance.maintainerName, diff --git a/packages/backend/src/server/api/endpoints/antennas/create.ts b/packages/backend/src/server/api/endpoints/antennas/create.ts index f8e4ed846d..00b0766d88 100644 --- a/packages/backend/src/server/api/endpoints/antennas/create.ts +++ b/packages/backend/src/server/api/endpoints/antennas/create.ts @@ -123,7 +123,7 @@ export default define(meta, paramDef, async (ps, user) => { let userList; let userGroupJoining; - const instance = await fetchMeta(true); + const instance = await fetchMeta(); const antennas = await Antennas.findBy({ userId: user.id, diff --git a/packages/backend/src/server/api/endpoints/custom-motd.ts b/packages/backend/src/server/api/endpoints/custom-motd.ts index ac1012258d..ea3571a362 100644 --- a/packages/backend/src/server/api/endpoints/custom-motd.ts +++ b/packages/backend/src/server/api/endpoints/custom-motd.ts @@ -27,7 +27,7 @@ export const paramDef = { } as const; export default define(meta, paramDef, async () => { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); const motd = await Promise.all(meta.customMotd.map((x) => x)); return motd; }); diff --git a/packages/backend/src/server/api/endpoints/custom-splash-icons.ts b/packages/backend/src/server/api/endpoints/custom-splash-icons.ts index 4eb35aa3e5..2493ea0bde 100644 --- a/packages/backend/src/server/api/endpoints/custom-splash-icons.ts +++ b/packages/backend/src/server/api/endpoints/custom-splash-icons.ts @@ -27,7 +27,7 @@ export const paramDef = { } as const; export default define(meta, paramDef, async () => { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); const icons = await Promise.all(meta.customSplashIcons.map((x) => x)); return icons; }); diff --git a/packages/backend/src/server/api/endpoints/drive.ts b/packages/backend/src/server/api/endpoints/drive.ts index c04f219a9b..f19ccf3b45 100644 --- a/packages/backend/src/server/api/endpoints/drive.ts +++ b/packages/backend/src/server/api/endpoints/drive.ts @@ -35,7 +35,7 @@ export const paramDef = { } as const; export default define(meta, paramDef, async (ps, user) => { - const instance = await fetchMeta(false); + const instance = await fetchMeta(); // Calculate drive usage const usage = await DriveFiles.calcDriveUsageOf(user.id); diff --git a/packages/backend/src/server/api/endpoints/drive/files/create.ts b/packages/backend/src/server/api/endpoints/drive/files/create.ts index 5b2a70bb94..e7d73513dd 100644 --- a/packages/backend/src/server/api/endpoints/drive/files/create.ts +++ b/packages/backend/src/server/api/endpoints/drive/files/create.ts @@ -95,7 +95,7 @@ export default define( name = null; } - const instanceMeta = await fetchMeta(true); + const instanceMeta = await fetchMeta(); try { // Create file diff --git a/packages/backend/src/server/api/endpoints/federation/instances.ts b/packages/backend/src/server/api/endpoints/federation/instances.ts index 362ab098fb..ab636ac2f7 100644 --- a/packages/backend/src/server/api/endpoints/federation/instances.ts +++ b/packages/backend/src/server/api/endpoints/federation/instances.ts @@ -100,7 +100,7 @@ export default define(meta, paramDef, async (ps, me) => { } if (typeof ps.blocked === "boolean") { - const meta = await fetchMeta(false); + const meta = await fetchMeta(); if (ps.blocked) { if (meta.blockedHosts.length === 0) { return []; @@ -116,7 +116,7 @@ export default define(meta, paramDef, async (ps, me) => { } if (typeof ps.silenced === "boolean") { - const meta = await fetchMeta(false); + const meta = await fetchMeta(); if (ps.silenced) { if (meta.silencedHosts.length === 0) { return []; diff --git a/packages/backend/src/server/api/endpoints/hashtags/trend.ts b/packages/backend/src/server/api/endpoints/hashtags/trend.ts index 531a494248..2f606110fa 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/trend.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/trend.ts @@ -66,7 +66,7 @@ export const paramDef = { } as const; export default define(meta, paramDef, async () => { - const instance = await fetchMeta(false); + const instance = await fetchMeta(); const hiddenTags = instance.hiddenTags.map((t) => normalizeForSearch(t)); const now = new Date(); // 5分単位で丸めた現在日時 diff --git a/packages/backend/src/server/api/endpoints/i/import-posts.ts b/packages/backend/src/server/api/endpoints/i/import-posts.ts index f7a4d41465..01f61138f5 100644 --- a/packages/backend/src/server/api/endpoints/i/import-posts.ts +++ b/packages/backend/src/server/api/endpoints/i/import-posts.ts @@ -44,7 +44,7 @@ export const paramDef = { export default define(meta, paramDef, async (ps, user) => { const file = await DriveFiles.findOneBy({ id: ps.fileId }); - const instanceMeta = await fetchMeta(true); + const instanceMeta = await fetchMeta(); if (instanceMeta.experimentalFeatures?.postImports === false) throw new ApiError(meta.errors.importsDisabled); diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index d4a4172426..a9622c2ed3 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -402,7 +402,7 @@ export const paramDef = { } as const; export default define(meta, paramDef, async (ps, me) => { - const instance = await fetchMeta(false); + const instance = await fetchMeta(); const emojis = await Emojis.find({ where: { diff --git a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts index 476375dc0b..a56f4ae9d6 100644 --- a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts @@ -64,7 +64,7 @@ export const paramDef = { } as const; export default define(meta, paramDef, async (ps, user) => { - const m = await fetchMeta(true); + const m = await fetchMeta(); if (m.disableGlobalTimeline) { if (user == null || !(user.isAdmin || user.isModerator)) { throw new ApiError(meta.errors.gtlDisabled); diff --git a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts index e6ab910040..3b5486ec8c 100644 --- a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -71,7 +71,7 @@ export const paramDef = { } as const; export default define(meta, paramDef, async (ps, user) => { - const m = await fetchMeta(true); + const m = await fetchMeta(); if (m.disableLocalTimeline && !user.isAdmin && !user.isModerator) { throw new ApiError(meta.errors.stlDisabled); } diff --git a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts index 2a99c1236c..1d7453e67f 100644 --- a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts @@ -74,7 +74,7 @@ export const paramDef = { } as const; export default define(meta, paramDef, async (ps, user) => { - const m = await fetchMeta(true); + const m = await fetchMeta(); if (m.disableLocalTimeline) { if (user == null || !(user.isAdmin || user.isModerator)) { throw new ApiError(meta.errors.ltlDisabled); diff --git a/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts b/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts index 073a8f8569..a2aba37aa2 100644 --- a/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/recommended-timeline.ts @@ -74,7 +74,7 @@ export const paramDef = { } as const; export default define(meta, paramDef, async (ps, user) => { - const m = await fetchMeta(true); + const m = await fetchMeta(); if (m.disableRecommendedTimeline) { if (user == null || !(user.isAdmin || user.isModerator)) { throw new ApiError(meta.errors.rtlDisabled); diff --git a/packages/backend/src/server/api/endpoints/pinned-users.ts b/packages/backend/src/server/api/endpoints/pinned-users.ts index 03b0b8871d..7762159f11 100644 --- a/packages/backend/src/server/api/endpoints/pinned-users.ts +++ b/packages/backend/src/server/api/endpoints/pinned-users.ts @@ -30,7 +30,7 @@ export const paramDef = { } as const; export default define(meta, paramDef, async (ps, me) => { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); const users = await Promise.all( meta.pinnedUsers diff --git a/packages/backend/src/server/api/endpoints/recommended-instances.ts b/packages/backend/src/server/api/endpoints/recommended-instances.ts index 5c5e267b2e..abdcb420e8 100644 --- a/packages/backend/src/server/api/endpoints/recommended-instances.ts +++ b/packages/backend/src/server/api/endpoints/recommended-instances.ts @@ -27,7 +27,7 @@ export const paramDef = { } as const; export default define(meta, paramDef, async () => { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); const instances = await Promise.all(meta.recommendedInstances.map((x) => x)); return instances; }); diff --git a/packages/backend/src/server/api/endpoints/server-info.ts b/packages/backend/src/server/api/endpoints/server-info.ts index 8f35daa7f8..03faabe5a6 100644 --- a/packages/backend/src/server/api/endpoints/server-info.ts +++ b/packages/backend/src/server/api/endpoints/server-info.ts @@ -17,7 +17,7 @@ export const paramDef = { } as const; export default define(meta, paramDef, async () => { - const instanceMeta = await fetchMeta(true); + const instanceMeta = await fetchMeta(); if (!instanceMeta.enableServerMachineStats) { return { diff --git a/packages/backend/src/server/api/endpoints/sw/register.ts b/packages/backend/src/server/api/endpoints/sw/register.ts index d2561baf47..2d696b1598 100644 --- a/packages/backend/src/server/api/endpoints/sw/register.ts +++ b/packages/backend/src/server/api/endpoints/sw/register.ts @@ -63,7 +63,7 @@ export default define(meta, paramDef, async (ps, me) => { publickey: ps.publickey, }); - const instance = await fetchMeta(false); + const instance = await fetchMeta(); // if already subscribed if (subscription != null) { diff --git a/packages/backend/src/server/api/mastodon/endpoints/meta.ts b/packages/backend/src/server/api/mastodon/endpoints/meta.ts index 69a1822892..0c643202d6 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/meta.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/meta.ts @@ -9,7 +9,7 @@ export async function getInstance( contact: Entity.Account, ) { const [meta, totalUsers, totalStatuses] = await Promise.all([ - fetchMeta(true), + fetchMeta(), Users.count({ where: { host: IsNull() } }), Notes.count({ where: { userHost: IsNull() } }), ]); diff --git a/packages/backend/src/server/api/mastodon/endpoints/status.ts b/packages/backend/src/server/api/mastodon/endpoints/status.ts index 6fa70717e7..e459616827 100644 --- a/packages/backend/src/server/api/mastodon/endpoints/status.ts +++ b/packages/backend/src/server/api/mastodon/endpoints/status.ts @@ -211,7 +211,7 @@ export function apiStatusMastodon(router: Router): void { router.post<{ Params: { id: string } }>( "/v1/statuses/:id/favourite", async (ctx) => { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); const BASE_URL = `${ctx.protocol}://${ctx.hostname}`; const accessTokens = ctx.headers.authorization; const client = getClient(BASE_URL, accessTokens); @@ -233,7 +233,7 @@ export function apiStatusMastodon(router: Router): void { router.post<{ Params: { id: string } }>( "/v1/statuses/:id/unfavourite", async (ctx) => { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); const BASE_URL = `${ctx.protocol}://${ctx.hostname}`; const accessTokens = ctx.headers.authorization; const client = getClient(BASE_URL, accessTokens); diff --git a/packages/backend/src/server/api/private/signup.ts b/packages/backend/src/server/api/private/signup.ts index 59f26b49ba..b8a4c32138 100644 --- a/packages/backend/src/server/api/private/signup.ts +++ b/packages/backend/src/server/api/private/signup.ts @@ -11,7 +11,7 @@ import { validateEmailForAccount } from "@/services/validate-email-for-account.j export default async (ctx: Koa.Context) => { const body = ctx.request.body; - const instance = await fetchMeta(false); + const instance = await fetchMeta(); // Verify *Captcha // ただしテスト時はこの機構は障害となるため無効にする diff --git a/packages/backend/src/server/api/stream/channels/global-timeline.ts b/packages/backend/src/server/api/stream/channels/global-timeline.ts index 1760d5abf7..be6de739b3 100644 --- a/packages/backend/src/server/api/stream/channels/global-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts @@ -16,7 +16,7 @@ export default class extends Channel { } public async init(params: any) { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.disableGlobalTimeline) { if (this.user == null || !(this.user.isAdmin || this.user.isModerator)) return; diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts index 5100a48efd..c0224e5661 100644 --- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts @@ -16,7 +16,7 @@ export default class extends Channel { } public async init(params: any) { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if ( meta.disableLocalTimeline && !this.user!.isAdmin && diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts index 2c9a38d677..6d750d67d7 100644 --- a/packages/backend/src/server/api/stream/channels/local-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts @@ -15,7 +15,7 @@ export default class extends Channel { } public async init(params: any) { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.disableLocalTimeline) { if (this.user == null || !(this.user.isAdmin || this.user.isModerator)) return; diff --git a/packages/backend/src/server/api/stream/channels/recommended-timeline.ts b/packages/backend/src/server/api/stream/channels/recommended-timeline.ts index 5d0d6fc602..b42f936a01 100644 --- a/packages/backend/src/server/api/stream/channels/recommended-timeline.ts +++ b/packages/backend/src/server/api/stream/channels/recommended-timeline.ts @@ -16,7 +16,7 @@ export default class extends Channel { } public async init(params: any) { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if ( meta.disableRecommendedTimeline && !this.user!.isAdmin && @@ -36,7 +36,7 @@ export default class extends Channel { // チャンネルの投稿ではなく、その投稿のユーザーをフォローしている または // チャンネルの投稿ではなく、全体公開のローカルの投稿 または // フォローしているチャンネルの投稿 の場合だけ - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if ( !( note.user.host != null && diff --git a/packages/backend/src/server/index.ts b/packages/backend/src/server/index.ts index b4c015bb5b..765378085d 100644 --- a/packages/backend/src/server/index.ts +++ b/packages/backend/src/server/index.ts @@ -124,7 +124,7 @@ router.get("/avatar/@:acct", async (ctx) => { }); router.get("/identicon/:x", async (ctx) => { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.enableIdenticonGeneration) { const [temp, cleanup] = await createTemp(); await genIdenticon(ctx.params.x, fs.createWriteStream(temp)); diff --git a/packages/backend/src/server/web/index.ts b/packages/backend/src/server/web/index.ts index 51f94842ea..61064e46f2 100644 --- a/packages/backend/src/server/web/index.ts +++ b/packages/backend/src/server/web/index.ts @@ -334,7 +334,7 @@ const getFeed = async ( noRenotes: string, noReplies: string, ) => { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.privateMode) { return; } @@ -482,7 +482,7 @@ const userPage: Router.Middleware = async (ctx, next) => { } const profile = await UserProfiles.findOneByOrFail({ userId: user.id }); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); const me = profile.fields ? profile.fields .filter((filed) => filed.value?.match(/^https?:/)) @@ -531,7 +531,7 @@ router.get("/notes/:note", async (ctx, next) => { const profile = await UserProfiles.findOneByOrFail({ userId: note.userId, }); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); await ctx.render("note", { ...metaToPugArgs(meta), note: packedNote, @@ -565,7 +565,7 @@ router.get("/posts/:note", async (ctx, next) => { if (note) { const _note = await Notes.pack(note); const profile = await UserProfiles.findOneByOrFail({ userId: note.userId }); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); await ctx.render("note", { ...metaToPugArgs(meta), note: _note, @@ -603,7 +603,7 @@ router.get("/@:user/pages/:page", async (ctx, next) => { if (page) { const _page = await Pages.pack(page); const profile = await UserProfiles.findOneByOrFail({ userId: page.userId }); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); await ctx.render("page", { ...metaToPugArgs(meta), page: _page, @@ -635,7 +635,7 @@ router.get("/clips/:clip", async (ctx, next) => { if (clip) { const _clip = await Clips.pack(clip); const profile = await UserProfiles.findOneByOrFail({ userId: clip.userId }); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); await ctx.render("clip", { ...metaToPugArgs(meta), clip: _clip, @@ -660,7 +660,7 @@ router.get("/gallery/:post", async (ctx, next) => { if (post) { const _post = await GalleryPosts.pack(post); const profile = await UserProfiles.findOneByOrFail({ userId: post.userId }); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); await ctx.render("gallery-post", { ...metaToPugArgs(meta), post: _post, @@ -686,7 +686,7 @@ router.get("/channels/:channel", async (ctx, next) => { if (channel) { const _channel = await Channels.pack(channel); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); await ctx.render("channel", { ...metaToPugArgs(meta), channel: _channel, @@ -739,7 +739,7 @@ router.get("/api/v1/streaming", async (ctx) => { // Render base html for all requests router.get("(.*)", async (ctx) => { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); await ctx.render("base", { ...metaToPugArgs(meta), diff --git a/packages/backend/src/server/web/manifest.ts b/packages/backend/src/server/web/manifest.ts index 801e5f047e..cad253bee4 100644 --- a/packages/backend/src/server/web/manifest.ts +++ b/packages/backend/src/server/web/manifest.ts @@ -77,7 +77,7 @@ const manifest = { }; export const manifestHandler = async (ctx: Koa.Context) => { - const instance = await fetchMeta(true); + const instance = await fetchMeta(); manifest.short_name = instance.name || "Firefish"; manifest.name = instance.name || "Firefish"; diff --git a/packages/backend/src/server/web/url-preview.ts b/packages/backend/src/server/web/url-preview.ts index f4ad758dc5..e164f41518 100644 --- a/packages/backend/src/server/web/url-preview.ts +++ b/packages/backend/src/server/web/url-preview.ts @@ -22,7 +22,7 @@ export const urlPreviewHandler = async (ctx: Koa.Context) => { return; } - const meta = await fetchMeta(true); + const meta = await fetchMeta(); logger.info( meta.summalyProxy diff --git a/packages/backend/src/services/drive/add-file.ts b/packages/backend/src/services/drive/add-file.ts index 390fba1a37..1c5412ac2d 100644 --- a/packages/backend/src/services/drive/add-file.ts +++ b/packages/backend/src/services/drive/add-file.ts @@ -78,7 +78,7 @@ async function save( // thunbnail, webpublic を必要なら生成 const alts = await generateAlts(path, type, !file.uri); - const meta = await fetchMeta(true); + const meta = await fetchMeta(); if (meta.useObjectStorage) { //#region ObjectStorage params @@ -363,7 +363,7 @@ async function upload( if (type === "image/apng") type = "image/png"; if (!FILE_TYPE_BROWSERSAFE.includes(type)) type = "application/octet-stream"; - const meta = await fetchMeta(true); + const meta = await fetchMeta(); const params = { Bucket: meta.objectStorageBucket, @@ -505,7 +505,7 @@ export async function addFile({ const usage = await DriveFiles.calcDriveUsageOf(user); const u = await Users.findOneBy({ id: user.id }); - const instance = await fetchMeta(true); + const instance = await fetchMeta(); let driveCapacity = 1024 * 1024 * @@ -577,7 +577,7 @@ export async function addFile({ : null; const folder = await fetchFolder(); - const instance = await fetchMeta(true); + const instance = await fetchMeta(); let file = new DriveFile(); file.id = genId(); diff --git a/packages/backend/src/services/drive/delete-file.ts b/packages/backend/src/services/drive/delete-file.ts index b4b5580a1c..94371f1b0f 100644 --- a/packages/backend/src/services/drive/delete-file.ts +++ b/packages/backend/src/services/drive/delete-file.ts @@ -82,7 +82,7 @@ async function postProcess(file: DriveFile, isExpired = false) { } export async function deleteObjectStorageFile(key: string) { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); const s3 = getS3(meta); diff --git a/packages/backend/src/services/send-email.ts b/packages/backend/src/services/send-email.ts index bcbecce356..daf57a68cd 100644 --- a/packages/backend/src/services/send-email.ts +++ b/packages/backend/src/services/send-email.ts @@ -12,7 +12,7 @@ export async function sendEmail( html: string, text: string, ) { - const meta = await fetchMeta(false); + const meta = await fetchMeta(); const iconUrl = `${config.url}/static-assets/mi-white.png`; const emailSettingUrl = `${config.url}/settings/email`; diff --git a/packages/backend/src/services/validate-email-for-account.ts b/packages/backend/src/services/validate-email-for-account.ts index 5aa091a5ac..616dbccebf 100644 --- a/packages/backend/src/services/validate-email-for-account.ts +++ b/packages/backend/src/services/validate-email-for-account.ts @@ -6,7 +6,7 @@ export async function validateEmailForAccount(emailAddress: string): Promise<{ available: boolean; reason: null | "used" | "format" | "disposable" | "mx" | "smtp"; }> { - const meta = await fetchMeta(true); + const meta = await fetchMeta(); const exist = await UserProfiles.countBy({ emailVerified: true,