From 5d6f43650fd800479a3024ad1a33b997e360b04b Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Mon, 14 Aug 2023 14:46:13 +0400 Subject: [PATCH] Refactor: rename minify -> handlePage --- src/app.ts | 4 ++-- src/handlers/main.ts | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/app.ts b/src/app.ts index 6b1a415..c1780da 100644 --- a/src/app.ts +++ b/src/app.ts @@ -4,7 +4,7 @@ import { ConfigService } from "./config/config.service"; import NodeCache from "node-cache"; import { readability } from "./handlers/readability"; -import getCorrespondingReaderView from "./handlers/main"; +import handlePage from "./handlers/main"; import Fastify from "fastify"; import middie from "@fastify/middie"; @@ -52,7 +52,7 @@ class App { ? "text/html; charset=utf-8" : "text/plain; charset=utf-8"; - const parsed = await getCorrespondingReaderView(url); + const parsed = await handlePage(url); const content = type === "html" ? parsed?.content : parsed?.textContent; this.cache.set(req.originalUrl || req.url, { diff --git a/src/handlers/main.ts b/src/handlers/main.ts index 4da040d..8d00030 100644 --- a/src/handlers/main.ts +++ b/src/handlers/main.ts @@ -1,11 +1,8 @@ import { IHandlerOutput } from "./handler.interface"; import { readability } from "./readability"; -export default function getCorrespondingReaderView( - url: string -): Promise { +export default function handlePage(url: string): Promise { const host = new URL(url).hostname; - return fallback[host]?.(url) || fallback["*"](url); }