fix a issue about search :3

This commit is contained in:
Ashley 2022-12-30 16:22:29 +00:00
parent 104eb86429
commit 544169c40e

View file

@ -74,17 +74,21 @@ module.exports = function (app, config, renderTemplate) {
var continuation = ""; var continuation = "";
} }
if (!query) {
return res.redirect("/");
}
if (query) {
const search = await modules.fetch( const search = await modules.fetch(
`https://tube-srv.ashley143.gay/api/search?query=${query.replace("&", "and")}&continuation=${continuation}` `https://tube-srv.ashley143.gay/api/search?query=${query.replace(
"&",
"and"
)}&continuation=${continuation}`
); );
const text = await search.text(); const text = await search.text();
const j = JSON.parse(modules.toJson(text)); const j = JSON.parse(modules.toJson(text));
if (!query) {
return res.redirect("/");
}
h = " "; h = " ";
if (j.Search.Results.DynamicItem) { if (j.Search.Results.DynamicItem) {
@ -106,6 +110,7 @@ module.exports = function (app, config, renderTemplate) {
q: query, q: query,
summary, summary,
}); });
}
}); });
app.get("/channel/", async (req, res) => { app.get("/channel/", async (req, res) => {