chore (backend): use literals and consts

This commit is contained in:
naskya 2024-05-16 04:22:23 +09:00
parent 101e50926b
commit 0de54e02f8
No known key found for this signature in database
GPG Key ID: 712D413B3A9FED5C
2 changed files with 18 additions and 19 deletions

View File

@ -149,7 +149,7 @@ router.get<{ Params: { path: string } }>("/emoji/:path(.*)", async (ctx) => {
return;
}
let url = new URL(`${config.mediaProxy || config.url + "/proxy"}/emoji.webp`);
const url = new URL(`${config.mediaProxy || `${config.url}/proxy`}/emoji.webp`);
// || emoji.originalUrl してるのは後方互換性のため
url.searchParams.append("url", emoji.publicUrl || emoji.originalUrl);
url.searchParams.append("emoji", "1");
@ -370,9 +370,7 @@ const getFeed = async (
};
// As the /@user[.json|.rss|.atom]/sub endpoint is complicated, we will use a regex to switch between them.
const reUser = new RegExp(
"^/@(?<user>[^/]+?)(?:.(?<feed>json|rss|atom)(?:\\?[^/]*)?)?(?:/(?<sub>[^/]+))?$",
);
const reUser = /^\/@(?<user>[^\/]+?)(?:.(?<feed>json|rss|atom)(?:\?[^\/]*)?)?(?:\/(?<sub>[^\/]+))?$/;
router.get(reUser, async (ctx, next) => {
const groups = reUser.exec(ctx.originalUrl)?.groups;
if (!groups) {

View File

@ -5,7 +5,8 @@ import { config } from "@/config.js";
const manifest = {
short_name: "Firefish",
name: "Firefish",
description: "An open source, decentralized social media platform that's free forever!",
description:
"An open source, decentralized social media platform that's free forever!",
start_url: "/",
scope: "/",
display: "standalone",
@ -17,34 +18,34 @@ const manifest = {
src: "/static-assets/icons/192.png",
sizes: "192x192",
type: "image/png",
purpose: "any"
purpose: "any",
},
{
src: "/static-assets/icons/512.png",
sizes: "512x512",
type: "image/png",
purpose: "any"
purpose: "any",
},
{
src: "/static-assets/icons/maskable.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable"
purpose: "maskable",
},
{
src: "/static-assets/icons/monochrome.png",
sizes: "512x512",
type: "image/png",
purpose: "monochrome"
}
purpose: "monochrome",
},
],
share_target: {
action: "/share/",
params: {
title: "title",
text: "text",
url: "url"
}
url: "url",
},
},
screenshots: [
{
@ -52,28 +53,28 @@ const manifest = {
sizes: "1080x2340",
type: "image/webp",
platform: "narrow",
label: "Profile page"
label: "Profile page",
},
{
src: "/static-assets/screenshots/2.webp",
sizes: "1080x2340",
type: "image/webp",
platform: "narrow",
label: "Posts"
}
label: "Posts",
},
],
shortcuts: [
{
name: "Notifications",
short_name: "Notifs",
url: "/my/notifications"
url: "/my/notifications",
},
{
name: "Chats",
url: "/my/messaging"
}
url: "/my/messaging",
},
],
categories: ["social"]
categories: ["social"],
};
export const manifestHandler = async (ctx: Koa.Context) => {