mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-11-29 07:18:08 +09:00
Revert "[Fix] remove-trailing-slashes with inhouse script (#9869)"
This reverts commit 07db141fc0f1d0c55a930378f3adc81f23dbda44.
This commit is contained in:
parent
4a7a79c3d5
commit
79d9b1bf13
@ -78,6 +78,7 @@
|
|||||||
"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",
|
||||||
|
"koa-remove-trailing-slashes": "2.0.3",
|
||||||
"koa-send": "5.0.1",
|
"koa-send": "5.0.1",
|
||||||
"koa-slow": "2.1.0",
|
"koa-slow": "2.1.0",
|
||||||
"koa-views": "7.0.2",
|
"koa-views": "7.0.2",
|
||||||
|
@ -10,6 +10,7 @@ import Router from "@koa/router";
|
|||||||
import mount from "koa-mount";
|
import mount from "koa-mount";
|
||||||
import koaLogger from "koa-logger";
|
import koaLogger from "koa-logger";
|
||||||
import * as slow from "koa-slow";
|
import * as slow from "koa-slow";
|
||||||
|
|
||||||
import { IsNull } from "typeorm";
|
import { IsNull } from "typeorm";
|
||||||
import config from "@/config/index.js";
|
import config from "@/config/index.js";
|
||||||
import Logger from "@/services/logger.js";
|
import Logger from "@/services/logger.js";
|
||||||
@ -29,6 +30,7 @@ import proxyServer from "./proxy/index.js";
|
|||||||
import webServer from "./web/index.js";
|
import webServer from "./web/index.js";
|
||||||
import { initializeStreamingServer } from "./api/streaming.js";
|
import { initializeStreamingServer } from "./api/streaming.js";
|
||||||
import { koaBody } from "koa-body";
|
import { koaBody } from "koa-body";
|
||||||
|
import removeTrailingSlash from "koa-remove-trailing-slashes";
|
||||||
import { v4 as uuid } from "uuid";
|
import { v4 as uuid } from "uuid";
|
||||||
|
|
||||||
export const serverLogger = new Logger("server", "gray", false);
|
export const serverLogger = new Logger("server", "gray", false);
|
||||||
@ -37,11 +39,7 @@ export const serverLogger = new Logger("server", "gray", false);
|
|||||||
const app = new Koa();
|
const app = new Koa();
|
||||||
app.proxy = true;
|
app.proxy = true;
|
||||||
|
|
||||||
// Replace trailing slashes
|
app.use(removeTrailingSlash());
|
||||||
app.use(async (ctx, next) => {
|
|
||||||
if (ctx.request.path !== "/" && ctx.request.path.endsWith('/')) return ctx.redirect(ctx.request.path.replace(/\/$/, ""))
|
|
||||||
else next()
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!["production", "test"].includes(process.env.NODE_ENV || "")) {
|
if (!["production", "test"].includes(process.env.NODE_ENV || "")) {
|
||||||
// Logger
|
// Logger
|
||||||
|
Loading…
Reference in New Issue
Block a user