Skip to content
This repository has been archived by the owner on Jan 23, 2020. It is now read-only.

Commit

Permalink
Added fallback for invalid ID
Browse files Browse the repository at this point in the history
  • Loading branch information
owenvoke committed Sep 5, 2016
1 parent c41b0f5 commit 0ecbc60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ module.exports = (pluginContext) => {

if (query_trim.length === 0) {
return res.add({
id: "https://pximg.xyz/browse/",
payload: 'open',
title: "Browse",
desc: 'View all images on PXIMG."'
id: "https://pximg.xyz/browse/",
payload: 'open',
title: "Browse",
desc: 'View all images on PXIMG."'
});
}

Expand All @@ -30,7 +30,13 @@ module.exports = (pluginContext) => {
});

if (isNaN(query_trim)) {
return;
return res.add({
"id": query_trim,
"payload": "none",
"title": "Invalid Image ID: <b>" + query_trim + "</b>",
"desc": "<span style=\"color:#A94442;\">The image id should contain numbers only.</span>",
"icon": "#fa fa-exclamation-triangle"
});
}

let subs = "https://pximg.xyz/api/v2/images/id/" + query_trim + "?api_key=" + api_key;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hain-plugin-pximg",
"version": "0.0.5",
"version": "0.0.6",
"description": "A simple PXIMG search plugin for Hain",
"main": "index.js",
"repository": {
Expand Down

0 comments on commit 0ecbc60

Please sign in to comment.