diff --git a/packages/backend/src/server/web/manifest.json b/packages/backend/src/server/web/manifest.json index 54d2344c13..350710afea 100644 --- a/packages/backend/src/server/web/manifest.json +++ b/packages/backend/src/server/web/manifest.json @@ -9,25 +9,25 @@ "orientation": "portrait-primary", "icons": [ { - "src": "/static-assets/icons/192.png?v=2", + "src": "/static-assets/icons/192.png", "sizes": "192x192", "type": "image/png", "purpose": "any" }, { - "src": "/static-assets/icons/512.png?v=2", + "src": "/static-assets/icons/512.png", "sizes": "512x512", "type": "image/png", "purpose": "any" }, { - "src": "/static-assets/icons/maskable.png?v=2", + "src": "/static-assets/icons/maskable.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" }, { - "src": "/static-assets/icons/monochrome.png?v=2", + "src": "/static-assets/icons/monochrome.png", "sizes": "512x512", "type": "image/png", "purpose": "monochrome" @@ -43,14 +43,14 @@ }, "screenshots": [ { - "src": "/static-assets/screenshots/1.webp?v=2", + "src": "/static-assets/screenshots/1.webp", "sizes": "1080x2340", "type": "image/webp", "platform": "narrow", "label": "Profile page" }, { - "src": "/static-assets/screenshots/2.webp?v=2", + "src": "/static-assets/screenshots/2.webp", "sizes": "1080x2340", "type": "image/webp", "platform": "narrow", diff --git a/packages/backend/src/server/web/manifest.ts b/packages/backend/src/server/web/manifest.ts index 6ca9791ba0..9128ee5166 100644 --- a/packages/backend/src/server/web/manifest.ts +++ b/packages/backend/src/server/web/manifest.ts @@ -1,5 +1,6 @@ import type Koa from "koa"; import { fetchMeta } from "@/misc/fetch-meta.js"; +import config from "@/config/index.js"; import manifest from "./manifest.json" assert { type: "json" }; export const manifestHandler = async (ctx: Koa.Context) => { @@ -12,7 +13,12 @@ export const manifestHandler = async (ctx: Koa.Context) => { res.short_name = instance.name || "Firefish"; res.name = instance.name || "Firefish"; if (instance.themeColor) res.theme_color = instance.themeColor; - + for (const icon of res.icons) { + icon.src = `${icon.src}?v=${config.version.replace(/[^0-9]/g, '')}`; + } + for (const screenshot of res.screenshots) { + screenshot.src = `${screenshot.src}?v=${config.version.replace(/[^0-9]/g, '')}`; + } ctx.set("Cache-Control", "max-age=300"); ctx.body = res; };