mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 09:58:26 +01:00
add new api stuff :3
This commit is contained in:
parent
174ca0fa3e
commit
d28bee1e7d
1 changed files with 82 additions and 82 deletions
164
server.js
164
server.js
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
PokeTube is an Free/Libre youtube front-end. this is our main file.
|
PokeTube is an Free/Libre youtube front-end. this is our main file.
|
||||||
|
|
||||||
Copyright (C) 2021-2022 POKETUBE (https://github.com/iamashley0/poketube)
|
Copyright (C) 2021-2023 POKETUBE (https://github.com/iamashley0/poketube)
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -18,94 +18,94 @@
|
||||||
along with this program. If not, see https://www.gnu.org/licenses/.
|
along with this program. If not, see https://www.gnu.org/licenses/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const {
|
(async function () {
|
||||||
fetcher,
|
const {
|
||||||
core,
|
fetcher,
|
||||||
wiki,
|
core,
|
||||||
musicInfo,
|
wiki,
|
||||||
modules,
|
musicInfo,
|
||||||
version,
|
modules,
|
||||||
initlog,
|
version,
|
||||||
init,
|
initlog,
|
||||||
} = require("./src/libpoketube/libpoketube-initsys.js");
|
init,
|
||||||
|
} = require("./src/libpoketube/libpoketube-initsys.js");
|
||||||
|
const media_proxy = require("./src/libpoketube/libpoketube-video.js");
|
||||||
|
const { sinit } = require("./src/libpoketube/init/superinit.js");
|
||||||
|
const u = await media_proxy();
|
||||||
|
|
||||||
const { sinit } = require("./src/libpoketube/init/superinit.js");
|
initlog("Loading...");
|
||||||
|
initlog(
|
||||||
initlog("Loading...");
|
"[Welcome] Welcome To PokeTube :3 " +
|
||||||
initlog(
|
"Running " +
|
||||||
"[Welcome] Welcome To PokeTube :3 " +
|
`Node ${process.version} - V8 v${
|
||||||
"Running " +
|
process.versions.v8
|
||||||
`Node ${process.version} - V8 v${
|
} - ${process.platform.replace("linux", "GNU/Linux")} ${
|
||||||
process.versions.v8
|
process.arch
|
||||||
} - ${process.platform.replace("linux", "GNU/Linux")} ${
|
} Server - libpt ${version}`
|
||||||
process.arch
|
|
||||||
} Server - libpt ${version}`
|
|
||||||
);
|
|
||||||
|
|
||||||
const {
|
|
||||||
IsJsonString,
|
|
||||||
convert,
|
|
||||||
getFirstLine,
|
|
||||||
capitalizeFirstLetter,
|
|
||||||
turntomins,
|
|
||||||
getRandomInt,
|
|
||||||
getRandomArbitrary,
|
|
||||||
} = require("./src/libpoketube/ptutils/libpt-coreutils.js");
|
|
||||||
|
|
||||||
initlog("Loaded libpt-coreutils");
|
|
||||||
|
|
||||||
const templateDir = modules.path.resolve(
|
|
||||||
`${process.cwd()}${modules.path.sep}html`
|
|
||||||
);
|
|
||||||
|
|
||||||
const sha384 = modules.hash;
|
|
||||||
|
|
||||||
var app = modules.express();
|
|
||||||
initlog("Loaded express.js");
|
|
||||||
app.engine("html", require("ejs").renderFile);
|
|
||||||
app.use(modules.express.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
|
|
||||||
app.use(modules.useragent.express());
|
|
||||||
app.use(modules.express.json()); // for parsing application/json
|
|
||||||
|
|
||||||
|
|
||||||
const renderTemplate = async (res, req, template, data = {}) => {
|
|
||||||
res.render(
|
|
||||||
modules.path.resolve(`${templateDir}${modules.path.sep}${template}`),
|
|
||||||
Object.assign(data)
|
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
|
||||||
const random_words = [
|
const {
|
||||||
"banana pie",
|
IsJsonString,
|
||||||
"how to buy an atom bomb",
|
convert,
|
||||||
"is love just an illusion",
|
getFirstLine,
|
||||||
"things to do if ur face becomes benjamin frenklin",
|
capitalizeFirstLetter,
|
||||||
"how do defeat an pasta",
|
turntomins,
|
||||||
"can you go to space?",
|
getRandomInt,
|
||||||
"how to become a god?",
|
getRandomArbitrary,
|
||||||
"is a panda a panda if pandas???",
|
} = require("./src/libpoketube/ptutils/libpt-coreutils.js");
|
||||||
"Minecraft movie trailer",
|
|
||||||
"monke",
|
|
||||||
];
|
|
||||||
|
|
||||||
/*
|
initlog("Loaded libpt-coreutils");
|
||||||
|
|
||||||
|
const templateDir = modules.path.resolve(
|
||||||
|
`${process.cwd()}${modules.path.sep}html`
|
||||||
|
);
|
||||||
|
|
||||||
|
const sha384 = modules.hash;
|
||||||
|
|
||||||
|
var app = modules.express();
|
||||||
|
initlog("Loaded express.js");
|
||||||
|
app.engine("html", require("ejs").renderFile);
|
||||||
|
app.use(modules.express.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
|
||||||
|
app.use(modules.useragent.express());
|
||||||
|
app.use(modules.express.json()); // for parsing application/json
|
||||||
|
|
||||||
|
const renderTemplate = async (res, req, template, data = {}) => {
|
||||||
|
res.render(
|
||||||
|
modules.path.resolve(`${templateDir}${modules.path.sep}${template}`),
|
||||||
|
Object.assign(data)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const random_words = [
|
||||||
|
"banana pie",
|
||||||
|
"how to buy an atom bomb",
|
||||||
|
"is love just an illusion",
|
||||||
|
"things to do if ur face becomes benjamin frenklin",
|
||||||
|
"how do defeat an pasta",
|
||||||
|
"can you go to space?",
|
||||||
|
"how to become a god?",
|
||||||
|
"is a panda a panda if pandas???",
|
||||||
|
"Minecraft movie trailer",
|
||||||
|
"monke",
|
||||||
|
];
|
||||||
|
|
||||||
|
/*
|
||||||
this is our config file,you can change stuff here
|
this is our config file,you can change stuff here
|
||||||
*/
|
*/
|
||||||
const config = {
|
const config = {
|
||||||
tubeApi: "https://tube-srv.ashley143.gay/api/",
|
tubeApi: "https://tube-srv.ashley143.gay/api/",
|
||||||
invapi: "https://inv.vern.cc/api/v1",
|
invapi: u + "/api/v1",
|
||||||
dislikes: "https://returnyoutubedislikeapi.com/votes?videoId=",
|
dislikes: "https://returnyoutubedislikeapi.com/votes?videoId=",
|
||||||
t_url: "https://t.poketube.fun/", // def matomo url
|
t_url: "https://t.poketube.fun/", // def matomo url
|
||||||
};
|
};
|
||||||
|
|
||||||
app.use(function (req, res, next) {
|
app.use(function (req, res, next) {
|
||||||
res.header("Access-Control-Allow-Origin", "*");
|
res.header("Access-Control-Allow-Origin", "*");
|
||||||
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
sinit(app, config, renderTemplate);
|
sinit(app, config, renderTemplate);
|
||||||
|
|
||||||
|
init(app);
|
||||||
init(app);
|
})();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue