chore: remove import assertion

This commit is contained in:
naskya 2024-05-16 04:12:10 +09:00
parent 9cf88f0df6
commit 101e50926b
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
3 changed files with 85 additions and 85 deletions

View file

@ -2,6 +2,10 @@
You can skip intermediate versions when upgrading from an old version, but please read the notices and follow the instructions for each intermediate version before [upgrading](./upgrade.md).
## Unreleased
Firefish is now compatible with [Node v22](https://nodejs.org/en/blog/announcements/v22-release-announce).
## v20240430
### For all users

View file

@ -1,73 +0,0 @@
{
"short_name": "Firefish",
"name": "Firefish",
"description": "An open source, decentralized social media platform that's free forever!",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#1f1d2e",
"theme_color": "#31748f",
"orientation": "natural",
"icons": [
{
"src": "/static-assets/icons/192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "any"
},
{
"src": "/static-assets/icons/512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/static-assets/icons/maskable.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/static-assets/icons/monochrome.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "monochrome"
}
],
"share_target": {
"action": "/share/",
"params": {
"title": "title",
"text": "text",
"url": "url"
}
},
"screenshots": [
{
"src": "/static-assets/screenshots/1.webp",
"sizes": "1080x2340",
"type": "image/webp",
"platform": "narrow",
"label": "Profile page"
},
{
"src": "/static-assets/screenshots/2.webp",
"sizes": "1080x2340",
"type": "image/webp",
"platform": "narrow",
"label": "Posts"
}
],
"shortcuts": [
{
"name": "Notifications",
"short_name": "Notifs",
"url": "/my/notifications"
},
{
"name": "Chats",
"url": "/my/messaging"
}
],
"categories": ["social"]
}

View file

@ -1,27 +1,96 @@
import type Koa from "koa";
import { fetchMeta } from "backend-rs";
import { config } from "@/config.js";
import manifest from "./manifest.json" assert { type: "json" };
const manifest = {
short_name: "Firefish",
name: "Firefish",
description: "An open source, decentralized social media platform that's free forever!",
start_url: "/",
scope: "/",
display: "standalone",
background_color: "#1f1d2e",
theme_color: "#31748f",
orientation: "natural",
icons: [
{
src: "/static-assets/icons/192.png",
sizes: "192x192",
type: "image/png",
purpose: "any"
},
{
src: "/static-assets/icons/512.png",
sizes: "512x512",
type: "image/png",
purpose: "any"
},
{
src: "/static-assets/icons/maskable.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable"
},
{
src: "/static-assets/icons/monochrome.png",
sizes: "512x512",
type: "image/png",
purpose: "monochrome"
}
],
share_target: {
action: "/share/",
params: {
title: "title",
text: "text",
url: "url"
}
},
screenshots: [
{
src: "/static-assets/screenshots/1.webp",
sizes: "1080x2340",
type: "image/webp",
platform: "narrow",
label: "Profile page"
},
{
src: "/static-assets/screenshots/2.webp",
sizes: "1080x2340",
type: "image/webp",
platform: "narrow",
label: "Posts"
}
],
shortcuts: [
{
name: "Notifications",
short_name: "Notifs",
url: "/my/notifications"
},
{
name: "Chats",
url: "/my/messaging"
}
],
categories: ["social"]
};
export const manifestHandler = async (ctx: Koa.Context) => {
// TODO
//const res = structuredClone(manifest);
const res = JSON.parse(JSON.stringify(manifest));
const instance = await fetchMeta(true);
const instance = await fetchMeta(false);
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) {
manifest.short_name = instance.name || "Firefish";
manifest.name = instance.name || "Firefish";
if (instance.themeColor) manifest.theme_color = instance.themeColor;
for (const icon of manifest.icons) {
icon.src = `${icon.src}?v=${config.version.replace(/[^0-9]/g, "")}`;
}
for (const screenshot of res.screenshots) {
for (const screenshot of manifest.screenshots) {
screenshot.src = `${screenshot.src}?v=${config.version.replace(
/[^0-9]/g,
"",
)}`;
}
ctx.set("Cache-Control", "max-age=300");
ctx.body = res;
ctx.body = manifest;
};