mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-17 02:54:42 -05:00
:p
This commit is contained in:
parent
75d843435d
commit
bedc2a09bb
1 changed files with 27 additions and 5 deletions
32
server.js
32
server.js
|
@ -18,8 +18,22 @@
|
||||||
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 { fetcher, core, wiki, musicInfo, modules } = require("./src/libpoketube/loader.js")
|
const {
|
||||||
const { IsJsonString, convert, getFirstLine, capitalizeFirstLetter, turntomins, getRandomInt, getRandomArbitrary } = require("./src/libpoketube/ptutils/libpt-coreutils.js");
|
fetcher,
|
||||||
|
core,
|
||||||
|
wiki,
|
||||||
|
musicInfo,
|
||||||
|
modules,
|
||||||
|
} = require("./src/libpoketube/loader.js");
|
||||||
|
const {
|
||||||
|
IsJsonString,
|
||||||
|
convert,
|
||||||
|
getFirstLine,
|
||||||
|
capitalizeFirstLetter,
|
||||||
|
turntomins,
|
||||||
|
getRandomInt,
|
||||||
|
getRandomArbitrary,
|
||||||
|
} = require("./src/libpoketube/ptutils/libpt-coreutils.js");
|
||||||
|
|
||||||
const templateDir = modules.path.resolve(
|
const templateDir = modules.path.resolve(
|
||||||
`${process.cwd()}${modules.path.sep}html`
|
`${process.cwd()}${modules.path.sep}html`
|
||||||
|
@ -130,7 +144,7 @@ app.get("/watch", async function (req, res) {
|
||||||
const jj = await info.text();
|
const jj = await info.text();
|
||||||
const ip = JSON.parse(jj);
|
const ip = JSON.parse(jj);
|
||||||
|
|
||||||
for (let i = 0; i < 3 ; i++) {
|
for (let i = 0; i < 3; i++) {
|
||||||
try {
|
try {
|
||||||
core.video(v).then((data) => {
|
core.video(v).then((data) => {
|
||||||
const k = data.video;
|
const k = data.video;
|
||||||
|
@ -664,10 +678,18 @@ app.get("/:v*?", async function (req, res) {
|
||||||
if (isvld) {
|
if (isvld) {
|
||||||
return res.redirect(`/watch?v=${req.params.v}`);
|
return res.redirect(`/watch?v=${req.params.v}`);
|
||||||
} else {
|
} else {
|
||||||
return res.redirect("/discover");
|
if (req.useragent.isMobile) {
|
||||||
|
return res.redirect(`/discover`);
|
||||||
|
} else {
|
||||||
|
return renderTemplate(res, req, "landing.ejs");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return res.redirect("/discover");
|
if (req.useragent.isMobile) {
|
||||||
|
return res.redirect(`/discover`);
|
||||||
|
} else {
|
||||||
|
return renderTemplate(res, req, "landing.ejs");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue