diff --git a/src/handlers/main.ts b/src/handlers/main.ts index cd483f1..6769283 100644 --- a/src/handlers/main.ts +++ b/src/handlers/main.ts @@ -7,17 +7,20 @@ import { DOMWindow } from "jsdom"; import readability from "./readability"; import google from "./google"; -import { generateProxyUrl } from "../utils"; -import isLocalResource from "../islocal"; +import { generateProxyUrl } from "../utils/generate"; +import isLocalResource from "../utils/islocal"; -import { InvalidParameterError, LocalResourceError, NotHtmlMimetypeError } from "../errors/main"; +import { + InvalidParameterError, + LocalResourceError, + NotHtmlMimetypeError, +} from "../errors/main"; export default async function handlePage( - url: string, // remote URL - requestUrl: URL, // proxy URL + url: string, // remote URL + requestUrl: URL, // proxy URL engine?: string ): Promise { - const urlObj = new URL(url); if (await isLocalResource(urlObj)) { diff --git a/src/routes/get.ts b/src/routes/get.ts index f2d19f8..dbd1e59 100644 --- a/src/routes/get.ts +++ b/src/routes/get.ts @@ -2,7 +2,7 @@ import { FastifyInstance } from "fastify"; import { GetSchema, IGetSchema } from "../types/requests"; import handlePage from "../handlers/main"; -import { generateRequestUrl } from "../utils"; +import { generateRequestUrl } from "../utils/generate"; export default async function getRoute(fastify: FastifyInstance) { fastify.get( diff --git a/src/routes/parse.ts b/src/routes/parse.ts index 5523ff3..bca6363 100644 --- a/src/routes/parse.ts +++ b/src/routes/parse.ts @@ -1,7 +1,7 @@ import { EngineRequest, IParseSchema, parseSchema } from "../types/requests"; import { FastifyInstance } from "fastify"; import handlePage from "../handlers/main"; -import { generateRequestUrl } from "../utils"; +import { generateRequestUrl } from "../utils/generate"; export default async function parseRoute(fastify: FastifyInstance) { fastify.get( diff --git a/src/routes/raw-html.ts b/src/routes/raw-html.ts index 38fad4b..30c520f 100644 --- a/src/routes/raw-html.ts +++ b/src/routes/raw-html.ts @@ -2,7 +2,7 @@ import { FastifyInstance } from "fastify"; import { GetRequest, IParseSchema, rawHtmlSchema } from "../types/requests"; import handlePage from "../handlers/main"; -import { generateRequestUrl } from "../utils"; +import { generateRequestUrl } from "../utils/generate"; export default async function rawHtml(fastify: FastifyInstance) { fastify.get( diff --git a/src/utils.ts b/src/utils/generate.ts similarity index 100% rename from src/utils.ts rename to src/utils/generate.ts diff --git a/src/islocal.ts b/src/utils/islocal.ts similarity index 100% rename from src/islocal.ts rename to src/utils/islocal.ts