commit
7011594d12
@ -11,6 +11,7 @@ import ejs from "ejs";
|
|||||||
import getRoute from "./routes/get";
|
import getRoute from "./routes/get";
|
||||||
import parseRoute from "./routes/parse";
|
import parseRoute from "./routes/parse";
|
||||||
import indexRoute from "./routes/index";
|
import indexRoute from "./routes/index";
|
||||||
|
import rawHtml from "./routes/raw-html";
|
||||||
|
|
||||||
class App {
|
class App {
|
||||||
config: IConfigService;
|
config: IConfigService;
|
||||||
@ -38,6 +39,7 @@ class App {
|
|||||||
fastify.register(indexRoute);
|
fastify.register(indexRoute);
|
||||||
fastify.register(getRoute);
|
fastify.register(getRoute);
|
||||||
fastify.register(parseRoute);
|
fastify.register(parseRoute);
|
||||||
|
fastify.register(rawHtml);
|
||||||
|
|
||||||
fastify.listen({ port: Number(this.config.get("PORT")) }, (err) => {
|
fastify.listen({ port: Number(this.config.get("PORT")) }, (err) => {
|
||||||
err && console.log(err);
|
err && console.log(err);
|
||||||
|
20
src/routes/raw-html.ts
Normal file
20
src/routes/raw-html.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { FastifyInstance } from "fastify";
|
||||||
|
|
||||||
|
import { GetRequest } from "../types/requests";
|
||||||
|
import handlePage from "../handlers/main";
|
||||||
|
import { generateRequestUrl } from "../utils";
|
||||||
|
|
||||||
|
export default async function rawHtml(fastify: FastifyInstance) {
|
||||||
|
fastify.get("/raw-html", async (request: GetRequest) => {
|
||||||
|
return (
|
||||||
|
await handlePage(
|
||||||
|
request.query.url,
|
||||||
|
generateRequestUrl(
|
||||||
|
request.protocol,
|
||||||
|
request.hostname,
|
||||||
|
request.originalUrl
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).content;
|
||||||
|
});
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user