feat: add redirect to nhentai path

このコミットが含まれているのは:
sinkaroid 2022-06-05 19:07:53 +07:00
コミット 20775a3486
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: A7DF4E245FDD8159
1個のファイルの変更5行の追加0行の削除

ファイルの表示

@ -3,6 +3,7 @@ import { Request, Response, NextFunction } from "express";
import scrapeRoutes from "./router/endpoint";
import { slow, limiter } from "./utils/limit-options";
import { logger } from "./utils/logger";
import { isNumeric } from "./utils/modifier";
import * as pkg from "../package.json";
const app = express();
@ -24,6 +25,10 @@ app.get("/", slow, limiter, (req, res) => {
});
app.use(scrapeRoutes());
app.get("/g/:id", slow, limiter, (req, res) => {
if (!isNumeric(req.params.id)) throw Error("Parameter id must be number");
res.redirect(301, `https://nhentai.net/g/${req.params.id}`);
});
app.use((req: Request, res: Response, next: NextFunction) => {