mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-28 22:09:05 +01:00
Update server.js
This commit is contained in:
parent
af83ff3718
commit
5238ffad28
1 changed files with 14 additions and 6 deletions
20
server.js
20
server.js
|
@ -45,7 +45,6 @@ const random_words = [
|
||||||
"Minecraft movie trailer",
|
"Minecraft movie trailer",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
const fetch = require("node-fetch");
|
const fetch = require("node-fetch");
|
||||||
const { toJson } = require("xml2json");
|
const { toJson } = require("xml2json");
|
||||||
const fetcher = require("./src/fetcher.js");
|
const fetcher = require("./src/fetcher.js");
|
||||||
|
@ -194,9 +193,9 @@ app.get("/discover", async function (req, res) {
|
||||||
const trends = await fetch(config.tubeApi + `trending`);
|
const trends = await fetch(config.tubeApi + `trending`);
|
||||||
const h = await trends.text();
|
const h = await trends.text();
|
||||||
const k = JSON.parse(toJson(h));
|
const k = JSON.parse(toJson(h));
|
||||||
renderTemplate(res, req, "main.ejs", {
|
renderTemplate(res, req, "main.ejs", {
|
||||||
k:k,
|
k: k,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
app.get("/channel", async (req, res) => {
|
app.get("/channel", async (req, res) => {
|
||||||
const ID = req.query.id;
|
const ID = req.query.id;
|
||||||
|
@ -253,17 +252,26 @@ app.get("/search", async (req, res) => {
|
||||||
q: query,
|
q: query,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/css/:id", (req, res) => {
|
app.get("/css/:id", (req, res) => {
|
||||||
res.sendFile(__dirname + `/css/${req.params.id}`);
|
res.sendFile(__dirname + `/css/${req.params.id}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/js/:id", (req, res) => {
|
app.get("/js/:id", (req, res) => {
|
||||||
res.sendFile(__dirname + `/js/${req.params.id}`);
|
res.sendFile(__dirname + `/js/${req.params.id}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/video/upload", (req, res) => {
|
app.get("/video/upload", (req, res) => {
|
||||||
res.redirect("https://youtube.com/upload?from=poketube_utc");
|
res.redirect("https://youtube.com/upload?from=poketube_utc");
|
||||||
});
|
});
|
||||||
app.get("/", (req, res) => {
|
|
||||||
res.redirect("/discover");
|
app.get("/", async function (req, res) {
|
||||||
|
const trends = await fetch(config.tubeApi + `trending`);
|
||||||
|
const h = await trends.text();
|
||||||
|
const k = JSON.parse(toJson(h));
|
||||||
|
renderTemplate(res, req, "landing.ejs", {
|
||||||
|
k: k,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
app.get("/api/video/download", async function (req, res) {
|
app.get("/api/video/download", async function (req, res) {
|
||||||
var v = req.query.v;
|
var v = req.query.v;
|
||||||
|
|
Loading…
Reference in a new issue