parent
2589af93ea
commit
836219212c
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "szuru-chrome",
|
||||
"version": "0.7.3",
|
||||
"version": "0.7.4",
|
||||
"description": "Import media from various sites into szurubooru.",
|
||||
"author": "neobooru",
|
||||
"license": "MIT",
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.21.1",
|
||||
"neo-scraper": "^0.4.5",
|
||||
"neo-scraper": "^0.4.6",
|
||||
"vue": "^2.6.11",
|
||||
"webextension-polyfill": "^0.3.1"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ export default class SzuruWrapper {
|
|||
try {
|
||||
return await axios(config);
|
||||
} catch (ex) {
|
||||
const error = ex.response.data as SzuruError;
|
||||
const error = ex.response?.data as SzuruError | undefined;
|
||||
throw error ? error : ex;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,12 @@
|
|||
<div class="popup-container">
|
||||
<div class="popup-messages">
|
||||
<ul class="messages">
|
||||
<li v-for="msg in messages" :key="msg.content" :class="getMessageClasses(msg)" v-html="msg.content"></li>
|
||||
<li
|
||||
v-for="msg in messages"
|
||||
:key="msg.content"
|
||||
:class="getMessageClasses(msg)"
|
||||
v-html="msg.content"
|
||||
></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
@ -134,7 +139,7 @@ class TagViewModel {
|
|||
let x = new TagViewModel(tag.names[0], <BooruTypes.TagCategory>tag.category, tag.usages);
|
||||
|
||||
if (tag.implications) {
|
||||
x.implications = tag.implications.map((x) => TagViewModel.fromMicroTag(x));
|
||||
x.implications = tag.implications.map((y) => TagViewModel.fromMicroTag(y));
|
||||
}
|
||||
|
||||
return x;
|
||||
|
|
@ -202,7 +207,7 @@ export default Vue.extend({
|
|||
});
|
||||
|
||||
if (activeTabs.length > 0) return activeTabs[0].id!;
|
||||
throw "No active tab.";
|
||||
throw new Error("No active tab.");
|
||||
},
|
||||
// Try to scrape the post from the page
|
||||
async grabPost() {
|
||||
|
|
@ -301,7 +306,7 @@ export default Vue.extend({
|
|||
return msg;
|
||||
},
|
||||
// Clear messages of given category. When category is empty clear all messages.
|
||||
clearMessages(category: string | null) {
|
||||
clearMessages(category: string | null = null) {
|
||||
if (category) {
|
||||
for (let i = 0; i < this.messages.length; i++) {
|
||||
if (this.messages[i].category == category) {
|
||||
|
|
@ -340,6 +345,8 @@ export default Vue.extend({
|
|||
this.clearMessages("FIND_SIMILAR");
|
||||
|
||||
const msg = this.pushInfo("Searching for similar posts...", "FIND_SIMILAR");
|
||||
|
||||
try {
|
||||
const res = await this.szuru.reverseSearch(this.selectedPost.contentUrl);
|
||||
|
||||
if (!res.exactPost && res.similarPosts.length == 0) {
|
||||
|
|
@ -364,6 +371,10 @@ export default Vue.extend({
|
|||
);
|
||||
}
|
||||
}
|
||||
} catch (ex) {
|
||||
this.clearMessages();
|
||||
this.pushError("Error: couldn't reverse search.");
|
||||
}
|
||||
},
|
||||
// Returns ScrapedPost for a contentUrl, or undefined if the given contentUrl does not belong to a ScrapedPost.
|
||||
getPostForUrl(contentUrl: string): PostViewModel | undefined {
|
||||
|
|
|
|||
|
|
@ -2690,10 +2690,10 @@ neo-async@^2.5.0, neo-async@^2.6.1:
|
|||
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f"
|
||||
integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==
|
||||
|
||||
neo-scraper@^0.4.5:
|
||||
version "0.4.5"
|
||||
resolved "https://registry.yarnpkg.com/neo-scraper/-/neo-scraper-0.4.5.tgz#86c1d1ebb6c04ad607282b08460dd090990dbe20"
|
||||
integrity sha512-w6xnIv8qKD7ogamhVp6oprNLymtb4bUwnahOiRmEtpxwEx4drzYRDenH7hNFp8MAv6vb2+VUSYgCVwfS6NWpLA==
|
||||
neo-scraper@^0.4.6:
|
||||
version "0.4.6"
|
||||
resolved "https://registry.yarnpkg.com/neo-scraper/-/neo-scraper-0.4.6.tgz#2344c08eb7ddb621a183ed5ef8145a4acaee7407"
|
||||
integrity sha512-DYfnewkfNd3hBbtRq3EFvd+Dmr50O1zp7Gto0GjyGPb+KaSEoynmgymYUMIxsufVi6VTIaCny6wwE4+agX3iDg==
|
||||
|
||||
nice-try@^1.0.4:
|
||||
version "1.0.5"
|
||||
|
|
|
|||
Loading…
Reference in New Issue