mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 07:18:26 +01:00
Update src/libpoketube/init/pages-api.js
This commit is contained in:
parent
edf4b507a2
commit
5deb6e3780
1 changed files with 31 additions and 39 deletions
|
@ -28,15 +28,15 @@ function getJson(str) {
|
||||||
|
|
||||||
const pkg = require("../../../package.json");
|
const pkg = require("../../../package.json");
|
||||||
const cnf = require("../../../config.json");
|
const cnf = require("../../../config.json");
|
||||||
const { Readable } = require("node:stream");
|
|
||||||
const verfull = "v23.1311-JeSsIcA-MAJOR-stable-dev-nonLTS-git-MTcwMDI5ODc4OQ==";
|
const verfull = "v23.1311-JeSsIcA-MAJOR-stable-dev-nonLTS-git-MTcwMDI5ODc4OQ==";
|
||||||
const versmol = "v23.1311-JeSsIcA";
|
const versmol = "v23.1311-JeSsIcA"
|
||||||
const branch = "dev/master";
|
const branch = "dev/master";
|
||||||
const codename = "jessica";
|
const codename = "jessica";
|
||||||
const versionnumber = "272";
|
const versionnumber = "272";
|
||||||
const relaseunixdate = "MTcwMDI5ODc4OQ==";
|
const relaseunixdate = "MTcwMDI5ODc4OQ=="
|
||||||
const updatequote =
|
const updatequote = "Empty your cup so that it may be filled; become devoid to gain totality. - Bruce Lee"
|
||||||
"Empty your cup so that it may be filled; become devoid to gain totality. - Bruce Lee";
|
|
||||||
|
|
||||||
module.exports = function (app, config, renderTemplate) {
|
module.exports = function (app, config, renderTemplate) {
|
||||||
app.get("/embed/:v", async function (req, res) {
|
app.get("/embed/:v", async function (req, res) {
|
||||||
|
@ -44,64 +44,56 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/admin", async function (req, res) {
|
app.get("/admin", async function (req, res) {
|
||||||
if (req.hostname === "poketube.fun") {
|
if(req.hostname === "poketube.fun") {
|
||||||
res.redirect("https://console.sudovanilla.com/");
|
res.redirect("https://console.sudovanilla.com/")
|
||||||
} else {
|
} else {
|
||||||
res.redirect("/sex");
|
res.redirect("/sex")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/vi/:v/:t", async function (req, res) {
|
app.get("/vi/:v/:t", async function (req, res) {
|
||||||
const { fetch } = await import("undici");
|
var url = `https://invid-api.poketube.fun/vi/${req.params.v}/${req.params.t}`
|
||||||
|
|
||||||
var url = `https://invid-api.poketube.fun/vi/${req.params.v}/${req.params.t}`;
|
let f = await modules.fetch(url + `?cachefixer=${btoa(Date.now())}`, {
|
||||||
|
|
||||||
let f = await fetch(url + `?cachefixer=${btoa(Date.now())}`, {
|
|
||||||
method: req.method,
|
method: req.method,
|
||||||
});
|
});
|
||||||
|
|
||||||
Readable.fromWeb(f.body).pipe(res);
|
f.body.pipe(res);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/avatars/:v", async function (req, res) {
|
app.get("/avatars/:v", async function (req, res) {
|
||||||
const { fetch } = await import("undici");
|
|
||||||
|
|
||||||
var url = `https://invid-api.poketube.fun/ggpht/${req.params.v}`;
|
var url = `https://invid-api.poketube.fun/ggpht/${req.params.v}`;
|
||||||
|
|
||||||
let f = await fetch(url + `?cachefixer=${btoa(Date.now())}`, {
|
let f = await modules.fetch(url + `?cachefixer=${btoa(Date.now())}`, {
|
||||||
method: req.method,
|
method: req.method,
|
||||||
});
|
});
|
||||||
|
|
||||||
Readable.fromWeb(f.body).pipe(res);
|
f.body.pipe(res);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/ggpht/:v", async function (req, res) {
|
app.get("/ggpht/:v", async function (req, res) {
|
||||||
const { fetch } = await import("undici");
|
|
||||||
|
|
||||||
var url = `https://invid-api.poketube.fun/ggpht/${req.params.v}`;
|
var url = `https://invid-api.poketube.fun/ggpht/${req.params.v}`;
|
||||||
|
|
||||||
let f = await fetch(url + `?cachefixer=${btoa(Date.now())}`, {
|
let f = await modules.fetch(url + `?cachefixer=${btoa(Date.now())}`, {
|
||||||
method: req.method,
|
method: req.method,
|
||||||
});
|
});
|
||||||
|
|
||||||
Readable.fromWeb(f.body).pipe(res);
|
f.body.pipe(res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
app.get("/avatars/ytc/:v", async function (req, res) {
|
app.get("/avatars/ytc/:v", async function (req, res) {
|
||||||
const { fetch } = await import("undici");
|
var url = `https://invid-api.poketube.fun/ggpht/ytc/${req.params.v.replace("ytc", "")}`;
|
||||||
|
|
||||||
var url = `https://invid-api.poketube.fun/ggpht/ytc/${req.params.v.replace(
|
let f = await modules.fetch(url + `?cachefixer=${btoa(Date.now())}`, {
|
||||||
"ytc",
|
|
||||||
""
|
|
||||||
)}`;
|
|
||||||
|
|
||||||
let f = await fetch(url + `?cachefixer=${btoa(Date.now())}`, {
|
|
||||||
method: req.method,
|
method: req.method,
|
||||||
});
|
});
|
||||||
|
|
||||||
Readable.fromWeb(f.body).pipe(res);
|
f.body.pipe(res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
app.get("/api/search", async (req, res) => {
|
app.get("/api/search", async (req, res) => {
|
||||||
const query = req.query.query;
|
const query = req.query.query;
|
||||||
|
|
||||||
|
@ -181,15 +173,15 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
|
|
||||||
const response = {
|
const response = {
|
||||||
pt_version: {
|
pt_version: {
|
||||||
version: versmol,
|
version:versmol,
|
||||||
version_full: verfull,
|
version_full:verfull
|
||||||
},
|
},
|
||||||
branch,
|
branch,
|
||||||
updatequote,
|
updatequote,
|
||||||
relaseunixdate,
|
relaseunixdate,
|
||||||
vernum: versionnumber,
|
vernum: versionnumber,
|
||||||
codename,
|
codename,
|
||||||
config: cnf,
|
config:cnf,
|
||||||
packages: {
|
packages: {
|
||||||
libpt: version,
|
libpt: version,
|
||||||
node: process.version,
|
node: process.version,
|
||||||
|
|
Loading…
Reference in a new issue