mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
booru: fix messed up responses
This commit is contained in:
@@ -72,7 +72,7 @@ class BooruService extends Service {
|
||||
this._mode = value;
|
||||
this._baseUrl = APISERVICES[this._mode].endpoint;
|
||||
}
|
||||
get providerName () {
|
||||
get providerName() {
|
||||
return APISERVICES[this._mode].name;
|
||||
}
|
||||
get queries() { return this._queries }
|
||||
@@ -88,7 +88,7 @@ class BooruService extends Service {
|
||||
for (let i = 0; i < userArgs.length; i++) {
|
||||
const thisArg = userArgs[i].trim();
|
||||
if (thisArg.length == 0 || thisArg == '.' || thisArg.includes('*')) continue;
|
||||
else if(!isNaN(thisArg)) page = parseInt(thisArg);
|
||||
else if (!isNaN(thisArg)) page = parseInt(thisArg);
|
||||
else taglist.push(thisArg);
|
||||
}
|
||||
const newMessageId = this._queries.length;
|
||||
@@ -113,6 +113,7 @@ class BooruService extends Service {
|
||||
};
|
||||
let status = 0;
|
||||
// console.log(`${APISERVICES[this._mode].endpoint}?${paramString}`);
|
||||
|
||||
Utils.fetch(`${APISERVICES[this._mode].endpoint}?${paramString}`, options)
|
||||
.then(result => {
|
||||
status = result.status;
|
||||
@@ -122,7 +123,7 @@ class BooruService extends Service {
|
||||
// console.log(dataString);
|
||||
const parsedData = JSON.parse(dataString);
|
||||
// console.log(parsedData)
|
||||
this._responses.push(parsedData.map(obj => {
|
||||
this._responses[newMessageId] = parsedData.map(obj => {
|
||||
return {
|
||||
aspect_ratio: obj.width / obj.height,
|
||||
id: obj.id,
|
||||
@@ -140,7 +141,7 @@ class BooruService extends Service {
|
||||
file_height: obj.file_height,
|
||||
source: getWorkingImageSauce(obj.source),
|
||||
}
|
||||
}));
|
||||
});
|
||||
this.emit('updateResponse', newMessageId);
|
||||
})
|
||||
.catch(print);
|
||||
|
||||
Reference in New Issue
Block a user