Revert "Merge pull request '[feat] Replace Koa-FavICO with a smaller router' (#9853) from daikei/calckey:modularize-favico into develop"
This reverts commit4f6cae7643
, reversing changes made to64a737d001
.
This commit is contained in:
parent
6271e1880b
commit
431a08d06e
@ -75,6 +75,7 @@
|
|||||||
"koa": "2.13.4",
|
"koa": "2.13.4",
|
||||||
"koa-body": "^6.0.1",
|
"koa-body": "^6.0.1",
|
||||||
"koa-bodyparser": "4.3.0",
|
"koa-bodyparser": "4.3.0",
|
||||||
|
"koa-favicon": "2.1.0",
|
||||||
"koa-json-body": "5.3.0",
|
"koa-json-body": "5.3.0",
|
||||||
"koa-logger": "3.2.1",
|
"koa-logger": "3.2.1",
|
||||||
"koa-mount": "4.0.0",
|
"koa-mount": "4.0.0",
|
||||||
|
@ -8,11 +8,13 @@ import { readFileSync } from "node:fs";
|
|||||||
import Koa from "koa";
|
import Koa from "koa";
|
||||||
import Router from "@koa/router";
|
import Router from "@koa/router";
|
||||||
import send from "koa-send";
|
import send from "koa-send";
|
||||||
|
import favicon from "koa-favicon";
|
||||||
import views from "koa-views";
|
import views from "koa-views";
|
||||||
import sharp from "sharp";
|
import sharp from "sharp";
|
||||||
import { createBullBoard } from "@bull-board/api";
|
import { createBullBoard } from "@bull-board/api";
|
||||||
import { BullAdapter } from "@bull-board/api/bullAdapter.js";
|
import { BullAdapter } from "@bull-board/api/bullAdapter.js";
|
||||||
import { KoaAdapter } from "@bull-board/koa";
|
import { KoaAdapter } from "@bull-board/koa";
|
||||||
|
|
||||||
import { In, IsNull } from "typeorm";
|
import { In, IsNull } from "typeorm";
|
||||||
import { fetchMeta } from "@/misc/fetch-meta.js";
|
import { fetchMeta } from "@/misc/fetch-meta.js";
|
||||||
import config from "@/config/index.js";
|
import config from "@/config/index.js";
|
||||||
@ -96,14 +98,8 @@ app.use(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Favicon Router
|
// Serve favicon
|
||||||
app.use(async (ctx, next) => {
|
app.use(favicon(`${_dirname}/../../../assets/favicon.ico`));
|
||||||
if (ctx.path != "/favicon.ico") return next();
|
|
||||||
const meta = await fetchMeta();
|
|
||||||
if (meta.iconUrl === "")
|
|
||||||
ctx.body = readFileSync(`${_dirname}/../../../assets/favicon.ico`);
|
|
||||||
else ctx.redirect(meta.iconUrl);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Common request handler
|
// Common request handler
|
||||||
app.use(async (ctx, next) => {
|
app.use(async (ctx, next) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user