Refactor: rename minify -> handlePage

This commit is contained in:
DarkCat09 2023-08-14 14:46:13 +04:00
parent c17bbdbfda
commit 5d6f43650f
No known key found for this signature in database
GPG Key ID: 4785B6FB1C50A540
2 changed files with 3 additions and 6 deletions

View File

@ -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, {

View File

@ -1,11 +1,8 @@
import { IHandlerOutput } from "./handler.interface";
import { readability } from "./readability";
export default function getCorrespondingReaderView(
url: string
): Promise<IHandlerOutput> {
export default function handlePage(url: string): Promise<IHandlerOutput> {
const host = new URL(url).hostname;
return fallback[host]?.(url) || fallback["*"](url);
}