mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-14 23:08:52 +01:00
test
This commit is contained in:
parent
de98d86101
commit
1cde1c23ef
1 changed files with 11 additions and 9 deletions
|
@ -153,16 +153,18 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
try {
|
try {
|
||||||
const headers = {};
|
const headers = {};
|
||||||
|
|
||||||
const xmlData = await fetch(
|
let searchUrl;
|
||||||
`${config.invapi}/search?q=${encodeURIComponent(
|
if (req.query.from === 'hashtag') {
|
||||||
query
|
searchUrl = `/hashtag/${encodeURIComponent(query)}`;
|
||||||
)}&page=${encodeURIComponent(
|
} else {
|
||||||
continuation
|
searchUrl = `${config.invapi}/search?q=${encodeURIComponent(query)}&page=${encodeURIComponent(continuation)}&date=${date}&type=${type}&duration=${duration}&sort=${sort}&hl=en+gb`;
|
||||||
)}&date=${date}&type=${type}&duration=${duration}&sort=${sort}&hl=en+gb`
|
}
|
||||||
)
|
|
||||||
|
const xmlData = await fetch(searchUrl)
|
||||||
.then((res) => res.text())
|
.then((res) => res.text())
|
||||||
.then((txt) => getJson(txt));
|
.then((txt) => getJson(txt));
|
||||||
|
|
||||||
|
|
||||||
renderTemplate(res, req, "search.ejs", {
|
renderTemplate(res, req, "search.ejs", {
|
||||||
invresults: xmlData,
|
invresults: xmlData,
|
||||||
turntomins,
|
turntomins,
|
||||||
|
|
Loading…
Reference in a new issue