mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-26 10:18:12 +01:00
add duckduckgo bangs to searcg!! :3
This commit is contained in:
parent
326ace45ac
commit
a403dd8a1a
1 changed files with 8 additions and 7 deletions
|
@ -78,6 +78,11 @@ module.exports = function (app, config, renderTemplate) {
|
|||
}
|
||||
}
|
||||
|
||||
if (query && query.startsWith('!')) {
|
||||
res.redirect("https://duckduckgo.com/?q=" + query)
|
||||
}
|
||||
|
||||
|
||||
if (!query) {
|
||||
return res.redirect("/");
|
||||
}
|
||||
|
@ -154,7 +159,6 @@ module.exports = function (app, config, renderTemplate) {
|
|||
.then((res) => res.text())
|
||||
.then((txt) => getJson(txt));
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch channel data from API:", error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
@ -191,10 +195,7 @@ module.exports = function (app, config, renderTemplate) {
|
|||
var { tj, shorts, stream, c, boutJson } = cache[ID].result;
|
||||
}
|
||||
|
||||
const summary = await wiki.summary(boutJson?.Channel?.Metadata.Name);
|
||||
const wikiSummary = summary.title !== "Not found." ? summary : "none";
|
||||
|
||||
const subscribers = boutJson.Channel.Metadata.Subscribers;
|
||||
const subscribers = boutJson.Channel?.Metadata.Subscribers;
|
||||
const about = boutJson.Channel.Contents.ItemSection.About;
|
||||
const description = about.Description.toString().replace(/\n/g, " <br> ");
|
||||
const dnoreplace = about.Description.toString();
|
||||
|
@ -212,7 +213,7 @@ module.exports = function (app, config, renderTemplate) {
|
|||
turntomins,
|
||||
dnoreplace,
|
||||
continuation,
|
||||
wiki: wikiSummary,
|
||||
wiki: "",
|
||||
getFirstLine,
|
||||
isMobile: req.useragent.isMobile,
|
||||
about,
|
||||
|
|
Loading…
Reference in a new issue