feat/api-prox: add custom episode source hooks + iframe path

This commit is contained in:
Kentai Radiquum 2025-07-03 00:47:08 +05:00
parent 648486e992
commit d646a946cc
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
4 changed files with 412 additions and 0 deletions

View file

@ -19,6 +19,35 @@ const port = 7001;
const loadedHooks: LoadedHook[] = [];
app.get("/iframe", async (req, res) => {
const url = req.query.url || null;
res.status(200);
res.set({
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,HEAD,POST,OPTIONS",
"Cache-Control": "no-cache",
"Content-Type": "text/html; charset=utf-8",
});
if (!url) {
res.send("<h1>No url query found!</h1>");
return;
}
res.send(`
<!DOCTYPE html>
<html>
<head>
<title>Веб-плеер</title>
<meta name='viewport' content='width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=yes' />
<style>body, html {height: 100%; width: 100%; margin: 0px;padding: 0px;border: 0px;}</style>
</head>
<body>
<iframe src="${url}" width='100%' height='100%' frameborder='0' AllowFullScreen allow="autoplay"></iframe>
</body>
</html>
`);
});
app.get("/*path", async (req, res) => {
if (req.path == "/favicon.ico") return asJSON(res, {}, 404);