From 9249bfa19ee705c076622ae754c2ee0534a90703 Mon Sep 17 00:00:00 2001 From: Artemy Egorov Date: Sun, 20 Aug 2023 07:50:56 +0300 Subject: [PATCH 1/2] refactor: separate api --- src/routes/parse.ts | 2 +- src/routes/raw-html.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/parse.ts b/src/routes/parse.ts index bca6363..24b5738 100644 --- a/src/routes/parse.ts +++ b/src/routes/parse.ts @@ -5,7 +5,7 @@ import { generateRequestUrl } from "../utils/generate"; export default async function parseRoute(fastify: FastifyInstance) { fastify.get( - "/parse", + "/api/parse", { schema: parseSchema }, async (request: EngineRequest) => { return await handlePage( diff --git a/src/routes/raw-html.ts b/src/routes/raw-html.ts index 30c520f..83ac62f 100644 --- a/src/routes/raw-html.ts +++ b/src/routes/raw-html.ts @@ -6,7 +6,7 @@ import { generateRequestUrl } from "../utils/generate"; export default async function rawHtml(fastify: FastifyInstance) { fastify.get( - "/raw-html", + "/api/raw-html", { schema: rawHtmlSchema }, async (request: GetRequest) => { return ( From 51a190b8cb3174fd82249b0bf661cf77facec383 Mon Sep 17 00:00:00 2001 From: Artemy Egorov Date: Sun, 20 Aug 2023 08:44:48 +0300 Subject: [PATCH 2/2] refactor: hide not api routes in swagger --- src/app.ts | 2 +- src/publicConfig.ts | 2 +- src/types/requests.ts | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app.ts b/src/app.ts index eb3df5c..84f06d7 100644 --- a/src/app.ts +++ b/src/app.ts @@ -48,7 +48,7 @@ class App { description: publicConfig.description, version: publicConfig.version, }, - }, + } }); await fastify.register(fastifySwaggerUi, { routePrefix: "/doc" }); diff --git a/src/publicConfig.ts b/src/publicConfig.ts index 57a09c7..bb34e36 100644 --- a/src/publicConfig.ts +++ b/src/publicConfig.ts @@ -1,5 +1,5 @@ export default { - version: "1.0.0", + version: "1.1.0", description: "HTTP proxy that parses only text, links and pictures from pages reducing internet traffic, removing ads and heavy scripts", }; diff --git a/src/types/requests.ts b/src/types/requests.ts index 157754d..e395149 100644 --- a/src/types/requests.ts +++ b/src/types/requests.ts @@ -31,6 +31,7 @@ export interface IParseSchema { export const indexSchema = { produces: ["text/html"], + hide: true }; export const getQuerySchema = { @@ -70,6 +71,7 @@ export const parseQuerySchema = { export const GetSchema: FastifySchema = { description: "Get page", + hide: true, querystring: getQuerySchema, produces: ["text/html", "text/plain"], };