mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-23 03:17:47 +01:00
add /version!!!
This commit is contained in:
parent
4bbbb14541
commit
7b70ecf662
1 changed files with 105 additions and 80 deletions
|
@ -1,4 +1,13 @@
|
||||||
const { fetcher,core, wiki,musicInfo, modules, version, initlog, init,} = require("../libpoketube-initsys.js");
|
const {
|
||||||
|
fetcher,
|
||||||
|
core,
|
||||||
|
wiki,
|
||||||
|
musicInfo,
|
||||||
|
modules,
|
||||||
|
version,
|
||||||
|
initlog,
|
||||||
|
init,
|
||||||
|
} = require("../libpoketube-initsys.js");
|
||||||
const {
|
const {
|
||||||
IsJsonString,
|
IsJsonString,
|
||||||
convert,
|
convert,
|
||||||
|
@ -9,9 +18,9 @@ const {
|
||||||
getRandomArbitrary,
|
getRandomArbitrary,
|
||||||
} = require("../ptutils/libpt-coreutils.js");
|
} = require("../ptutils/libpt-coreutils.js");
|
||||||
|
|
||||||
|
const pkg = require("../../../package.json");
|
||||||
|
|
||||||
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) {
|
||||||
var e = req.query.e;
|
var e = req.query.e;
|
||||||
var f = req.query.f;
|
var f = req.query.f;
|
||||||
|
@ -47,7 +56,6 @@ app.get("/embed/:v", async function (req, 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;
|
||||||
|
|
||||||
|
@ -104,12 +112,29 @@ app.get("/api/redirect", async (req, res) => {
|
||||||
res.redirect(red_url);
|
res.redirect(red_url);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/api/opensearch", async (req, res) => {
|
app.get("/api/version.json", async (req, res) => {
|
||||||
res.sendFile(__dirname + `/opensearch.xml`);
|
const response = {
|
||||||
|
pt_version: "v22.1115-abU9-stable",
|
||||||
|
packages: {
|
||||||
|
libpt: version,
|
||||||
|
node: process.version,
|
||||||
|
v8: process.versions.v8,
|
||||||
|
},
|
||||||
|
process: process.versions,
|
||||||
|
dependencies: pkg.dependencies,
|
||||||
|
};
|
||||||
|
|
||||||
|
res.json(response);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/api/instances.json", async (req, res) => {
|
app.get("/api/instances.json", async (req, res) => {
|
||||||
res.sendFile(__dirname + `/instances.json`);
|
const url = `https://codeberg.org/Ashley/poketube/raw/branch/main/instances.json`;
|
||||||
});
|
|
||||||
|
|
||||||
}
|
let f = await modules
|
||||||
|
.fetch(url)
|
||||||
|
.then((res) => res.text())
|
||||||
|
.then((json) => JSON.parse(json));
|
||||||
|
|
||||||
|
res.json(f);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in a new issue