Merge pull request #34 from TxtDot/api-isolation

Api isolation
This commit is contained in:
Andrey 2023-08-20 12:00:49 +04:00 committed by GitHub
commit 15772da2e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 4 deletions

View File

@ -48,7 +48,7 @@ class App {
description: publicConfig.description,
version: publicConfig.version,
},
},
}
});
await fastify.register(fastifySwaggerUi, { routePrefix: "/doc" });

View File

@ -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",
};

View File

@ -5,7 +5,7 @@ import { generateRequestUrl } from "../utils/generate";
export default async function parseRoute(fastify: FastifyInstance) {
fastify.get<IParseSchema>(
"/parse",
"/api/parse",
{ schema: parseSchema },
async (request: EngineRequest) => {
return await handlePage(

View File

@ -6,7 +6,7 @@ import { generateRequestUrl } from "../utils/generate";
export default async function rawHtml(fastify: FastifyInstance) {
fastify.get<IParseSchema>(
"/raw-html",
"/api/raw-html",
{ schema: rawHtmlSchema },
async (request: GetRequest) => {
return (

View File

@ -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"],
};