mirror of
https://github.com/Radiquum/AniX.git
synced 2025-09-05 14:05:36 +05:00
feat/api-prox: add custom episode source hooks + iframe path
This commit is contained in:
parent
648486e992
commit
d646a946cc
4 changed files with 412 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue