chore (backend): use literals and consts
This commit is contained in:
parent
101e50926b
commit
0de54e02f8
2 changed files with 18 additions and 19 deletions
|
@ -149,7 +149,7 @@ router.get<{ Params: { path: string } }>("/emoji/:path(.*)", async (ctx) => {
|
||||||
return;
|
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 してるのは後方互換性のため
|
// || emoji.originalUrl してるのは後方互換性のため
|
||||||
url.searchParams.append("url", emoji.publicUrl || emoji.originalUrl);
|
url.searchParams.append("url", emoji.publicUrl || emoji.originalUrl);
|
||||||
url.searchParams.append("emoji", "1");
|
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.
|
// As the /@user[.json|.rss|.atom]/sub endpoint is complicated, we will use a regex to switch between them.
|
||||||
const reUser = new RegExp(
|
const reUser = /^\/@(?<user>[^\/]+?)(?:.(?<feed>json|rss|atom)(?:\?[^\/]*)?)?(?:\/(?<sub>[^\/]+))?$/;
|
||||||
"^/@(?<user>[^/]+?)(?:.(?<feed>json|rss|atom)(?:\\?[^/]*)?)?(?:/(?<sub>[^/]+))?$",
|
|
||||||
);
|
|
||||||
router.get(reUser, async (ctx, next) => {
|
router.get(reUser, async (ctx, next) => {
|
||||||
const groups = reUser.exec(ctx.originalUrl)?.groups;
|
const groups = reUser.exec(ctx.originalUrl)?.groups;
|
||||||
if (!groups) {
|
if (!groups) {
|
||||||
|
|
|
@ -5,7 +5,8 @@ import { config } from "@/config.js";
|
||||||
const manifest = {
|
const manifest = {
|
||||||
short_name: "Firefish",
|
short_name: "Firefish",
|
||||||
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: "/",
|
start_url: "/",
|
||||||
scope: "/",
|
scope: "/",
|
||||||
display: "standalone",
|
display: "standalone",
|
||||||
|
@ -17,34 +18,34 @@ const manifest = {
|
||||||
src: "/static-assets/icons/192.png",
|
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",
|
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",
|
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",
|
src: "/static-assets/icons/monochrome.png",
|
||||||
sizes: "512x512",
|
sizes: "512x512",
|
||||||
type: "image/png",
|
type: "image/png",
|
||||||
purpose: "monochrome"
|
purpose: "monochrome",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
share_target: {
|
share_target: {
|
||||||
action: "/share/",
|
action: "/share/",
|
||||||
params: {
|
params: {
|
||||||
title: "title",
|
title: "title",
|
||||||
text: "text",
|
text: "text",
|
||||||
url: "url"
|
url: "url",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
screenshots: [
|
screenshots: [
|
||||||
{
|
{
|
||||||
|
@ -52,28 +53,28 @@ const manifest = {
|
||||||
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",
|
src: "/static-assets/screenshots/2.webp",
|
||||||
sizes: "1080x2340",
|
sizes: "1080x2340",
|
||||||
type: "image/webp",
|
type: "image/webp",
|
||||||
platform: "narrow",
|
platform: "narrow",
|
||||||
label: "Posts"
|
label: "Posts",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
shortcuts: [
|
shortcuts: [
|
||||||
{
|
{
|
||||||
name: "Notifications",
|
name: "Notifications",
|
||||||
short_name: "Notifs",
|
short_name: "Notifs",
|
||||||
url: "/my/notifications"
|
url: "/my/notifications",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Chats",
|
name: "Chats",
|
||||||
url: "/my/messaging"
|
url: "/my/messaging",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
categories: ["social"]
|
categories: ["social"],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const manifestHandler = async (ctx: Koa.Context) => {
|
export const manifestHandler = async (ctx: Koa.Context) => {
|
||||||
|
|
Loading…
Reference in a new issue