mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-26 08:58:13 +01:00
add try catch :p
This commit is contained in:
parent
389844dc40
commit
3d44c7b6b4
1 changed files with 53 additions and 51 deletions
|
@ -18,7 +18,7 @@ const {
|
|||
getRandomArbitrary,
|
||||
} = require("../ptutils/libpt-coreutils.js");
|
||||
|
||||
const sha384 = modules.hash
|
||||
const sha384 = modules.hash;
|
||||
|
||||
function getJson(str) {
|
||||
try {
|
||||
|
@ -28,7 +28,6 @@ function getJson(str) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = function (app, config, renderTemplate) {
|
||||
app.get("/download", async function (req, res) {
|
||||
var v = req.query.v;
|
||||
|
@ -132,19 +131,19 @@ module.exports = function (app, config, renderTemplate) {
|
|||
}
|
||||
|
||||
//videos
|
||||
const a = await modules.fetch(`${config.invapi}/channels/videos/${ID}/`).then((res) =>
|
||||
res.text()
|
||||
);
|
||||
const a = await modules
|
||||
.fetch(`${config.invapi}/channels/videos/${ID}/`)
|
||||
.then((res) => res.text());
|
||||
|
||||
var tj = await getJson(a);
|
||||
|
||||
|
||||
const community = await modules.fetch(`${config.invapi}/channels/community/${ID}/`).then((res) =>
|
||||
res.text()
|
||||
);
|
||||
const community = await modules
|
||||
.fetch(`${config.invapi}/channels/community/${ID}/`)
|
||||
.then((res) => res.text());
|
||||
|
||||
var c = await getJson(community);
|
||||
|
||||
try {
|
||||
const summary = await wiki.summary(k.Channel.Metadata.Name);
|
||||
|
||||
var w = "";
|
||||
|
@ -188,5 +187,8 @@ module.exports = function (app, config, renderTemplate) {
|
|||
: "Private",
|
||||
desc: d,
|
||||
});
|
||||
} catch {
|
||||
res.redirect("/");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue