fix: 🩹 version manifest assets based on instance version
This commit is contained in:
parent
03077a157e
commit
8de79198a1
2 changed files with 13 additions and 7 deletions
|
@ -9,25 +9,25 @@
|
||||||
"orientation": "portrait-primary",
|
"orientation": "portrait-primary",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/static-assets/icons/192.png?v=2",
|
"src": "/static-assets/icons/192.png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any"
|
"purpose": "any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/static-assets/icons/512.png?v=2",
|
"src": "/static-assets/icons/512.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "any"
|
"purpose": "any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/static-assets/icons/maskable.png?v=2",
|
"src": "/static-assets/icons/maskable.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "maskable"
|
"purpose": "maskable"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/static-assets/icons/monochrome.png?v=2",
|
"src": "/static-assets/icons/monochrome.png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"purpose": "monochrome"
|
"purpose": "monochrome"
|
||||||
|
@ -43,14 +43,14 @@
|
||||||
},
|
},
|
||||||
"screenshots": [
|
"screenshots": [
|
||||||
{
|
{
|
||||||
"src": "/static-assets/screenshots/1.webp?v=2",
|
"src": "/static-assets/screenshots/1.webp",
|
||||||
"sizes": "1080x2340",
|
"sizes": "1080x2340",
|
||||||
"type": "image/webp",
|
"type": "image/webp",
|
||||||
"platform": "narrow",
|
"platform": "narrow",
|
||||||
"label": "Profile page"
|
"label": "Profile page"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/static-assets/screenshots/2.webp?v=2",
|
"src": "/static-assets/screenshots/2.webp",
|
||||||
"sizes": "1080x2340",
|
"sizes": "1080x2340",
|
||||||
"type": "image/webp",
|
"type": "image/webp",
|
||||||
"platform": "narrow",
|
"platform": "narrow",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import type Koa from "koa";
|
import type Koa from "koa";
|
||||||
import { fetchMeta } from "@/misc/fetch-meta.js";
|
import { fetchMeta } from "@/misc/fetch-meta.js";
|
||||||
|
import config from "@/config/index.js";
|
||||||
import manifest from "./manifest.json" assert { type: "json" };
|
import manifest from "./manifest.json" assert { type: "json" };
|
||||||
|
|
||||||
export const manifestHandler = async (ctx: Koa.Context) => {
|
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.short_name = instance.name || "Firefish";
|
||||||
res.name = instance.name || "Firefish";
|
res.name = instance.name || "Firefish";
|
||||||
if (instance.themeColor) res.theme_color = instance.themeColor;
|
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.set("Cache-Control", "max-age=300");
|
||||||
ctx.body = res;
|
ctx.body = res;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue