Update server.js

This commit is contained in:
Ashley 2022-07-20 11:58:56 +03:00 committed by GitHub
parent 1a13de138c
commit 864d6128a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -252,26 +252,17 @@ 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("/", async function (req, res) { app.get("/", async function (req, res) {
const trends = await fetch(config.tubeApi + `trending`); res.redirect("/discover");
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;