mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-28 18:29:03 +01:00
remove /mobile qwq
This commit is contained in:
parent
0adb077c54
commit
19757f793c
1 changed files with 1 additions and 67 deletions
68
server.js
68
server.js
|
@ -78,68 +78,6 @@ const config = {
|
|||
|
||||
// pages
|
||||
|
||||
app.get("/mobile", async function (req, res) {
|
||||
/*
|
||||
* QUERYS
|
||||
* v = Video ID
|
||||
* e = Embed
|
||||
* r = Recommended videos
|
||||
* f = Recent videos from channel
|
||||
* t = Piwik OptOut
|
||||
*/
|
||||
var v = req.query.v;
|
||||
var e = req.query.e;
|
||||
var r = req.query.r;
|
||||
var f = req.query.f;
|
||||
var t = req.query.t;
|
||||
|
||||
const video = await fetch(config.tubeApi + `video?v=${v}`);
|
||||
var fetching = await fetcher(v);
|
||||
|
||||
const json = fetching.video.Player;
|
||||
const h = await video.text();
|
||||
const k = JSON.parse(toJson(h));
|
||||
if (!v) res.redirect("/");
|
||||
|
||||
// video
|
||||
const j = fetching.video.Player.Formats.Format,
|
||||
j_ = Array.isArray(j) ? j[j.length - 1] : j;
|
||||
let url;
|
||||
if (j_.URL != undefined) url = j_.URL;
|
||||
|
||||
// channel info
|
||||
const engagement = fetching.engagement;
|
||||
const channel = await fetch(config.tubeApi + `channel?id=${json.Channel.id}&tab=videos`);
|
||||
const c = await channel.text();
|
||||
const tj = JSON.parse(toJson(c));
|
||||
|
||||
// lyrics
|
||||
const lyrics = await lyricsFinder(json.Title);
|
||||
if (lyrics == undefined) lyrics = "Lyrics not found";
|
||||
|
||||
// redirect to pc version
|
||||
|
||||
if(!req.useragent.isMobile){
|
||||
res.redirect(`/watch?v=${v}`);
|
||||
}
|
||||
|
||||
renderTemplate(res, req, "poketube-mobile.ejs", {
|
||||
url: url,
|
||||
color: await getColors(`https://i.ytimg.com/vi/${v}/maxresdefault.jpg`).then((colors) => colors[0].hex()),
|
||||
engagement: engagement,
|
||||
video: json,
|
||||
date: moment(k.Video.uploadDate).format("LL"),
|
||||
e: e,
|
||||
k: k,
|
||||
tj: tj,
|
||||
r: r,
|
||||
f: f,
|
||||
t: config.t_url,
|
||||
optout: t,
|
||||
lyrics: lyrics.replace(/\n/g, " <br> "),
|
||||
});
|
||||
});
|
||||
|
||||
app.get("/watch", async function (req, res) {
|
||||
/*
|
||||
* QUERYS
|
||||
|
@ -180,11 +118,6 @@ app.get("/watch", async function (req, res) {
|
|||
if (lyrics == undefined) lyrics = "Lyrics not found";
|
||||
|
||||
|
||||
// redirect to mobile version
|
||||
if(req.useragent.isMobile){
|
||||
res.redirect(`/mobile?v=${v}`);
|
||||
}
|
||||
|
||||
|
||||
renderTemplate(res, req, "poketube.ejs", {
|
||||
url: url,
|
||||
|
@ -195,6 +128,7 @@ app.get("/watch", async function (req, res) {
|
|||
e: e,
|
||||
k: k,
|
||||
sha384:sha384,
|
||||
isMobile:req.useragent.isMobile,
|
||||
tj: tj,
|
||||
r: r,
|
||||
f: f,
|
||||
|
|
Loading…
Reference in a new issue