add new api stuff :3

This commit is contained in:
Ashley 2023-01-11 16:20:38 +00:00
parent 6bcbf9ceb5
commit 0e90b72398

View file

@ -2,7 +2,7 @@
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
it under the terms of the GNU General Public License as published by
@ -18,7 +18,8 @@
along with this program. If not, see https://www.gnu.org/licenses/.
*/
const {
(async function () {
const {
fetcher,
core,
wiki,
@ -27,12 +28,13 @@ const {
version,
initlog,
init,
} = require("./src/libpoketube/libpoketube-initsys.js");
} = 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...");
initlog(
"[Welcome] Welcome To PokeTube :3 " +
"Running " +
`Node ${process.version} - V8 v${
@ -40,9 +42,9 @@ initlog(
} - ${process.platform.replace("linux", "GNU/Linux")} ${
process.arch
} Server - libpt ${version}`
);
);
const {
const {
IsJsonString,
convert,
getFirstLine,
@ -50,32 +52,31 @@ const {
turntomins,
getRandomInt,
getRandomArbitrary,
} = require("./src/libpoketube/ptutils/libpt-coreutils.js");
} = require("./src/libpoketube/ptutils/libpt-coreutils.js");
initlog("Loaded libpt-coreutils");
initlog("Loaded libpt-coreutils");
const templateDir = modules.path.resolve(
const templateDir = modules.path.resolve(
`${process.cwd()}${modules.path.sep}html`
);
);
const sha384 = modules.hash;
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
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 = {}) => {
const renderTemplate = async (res, req, template, data = {}) => {
res.render(
modules.path.resolve(`${templateDir}${modules.path.sep}${template}`),
Object.assign(data)
);
};
};
const random_words = [
const random_words = [
"banana pie",
"how to buy an atom bomb",
"is love just an illusion",
@ -86,26 +87,25 @@ const random_words = [
"is a panda a panda if pandas???",
"Minecraft movie trailer",
"monke",
];
];
/*
/*
this is our config file,you can change stuff here
*/
const config = {
const config = {
tubeApi: "https://tube-srv.ashley143.gay/api/",
invapi: "https://inv.vern.cc/api/v1",
invapi: u + "/api/v1",
dislikes: "https://returnyoutubedislikeapi.com/votes?videoId=",
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", "*");
next();
});
});
sinit(app, config, renderTemplate);
init(app);
sinit(app, config, renderTemplate);
init(app);
})();