From 7267e1bcaa0d50bd8fbb252e833d77ce8a92f773 Mon Sep 17 00:00:00 2001
From: wareya
Date: Thu, 2 Jan 2020 19:19:25 -0500
Subject: [PATCH] fix permissions problem preventing mining from working
---
background-script.js | 10 +++++++---
livemining.html | 4 ----
livemining.js | 9 ++++-----
manifest.json | 4 ++--
texthook.js | 12 ++++++------
5 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/background-script.js b/background-script.js
index 922bb0f..981eb17 100644
--- a/background-script.js
+++ b/background-script.js
@@ -1967,7 +1967,7 @@ function send_error(tab, error)
try
{
browser.tabs.sendMessage(tab, {type:"error",error:error});
- } catch (err) {}
+ } catch (err) {console.log("failed to send error to origin tab")}
}
browser.runtime.onMessage.addListener((req, sender) =>
@@ -2011,6 +2011,7 @@ browser.runtime.onMessage.addListener((req, sender) =>
console.log("got request");
let xhr = new XMLHttpRequest();
xhr.open("POST", req.host, true);
+ xhr.overrideMimeType('application/json');
//xhr.setRequestHeader('Content-type','application/json; charset=utf-8');
console.log(req.command);
xhr.addEventListener('load', () =>
@@ -2030,11 +2031,14 @@ browser.runtime.onMessage.addListener((req, sender) =>
newxhr.send('{"action": "sync","version": 6}');
}
}
- } catch (e) { }
+ } catch (e) {
+ console.log(e);
+ }
});
- xhr.addEventListener('error', () =>
+ xhr.addEventListener('error', (e) =>
{
send_error(sender.tab.id, "AnkiConnect mining failed: unspecified error (Anki is probably not open)");
+ console.log(e);
});
xhr.addEventListener('timeout', () =>
{
diff --git a/livemining.html b/livemining.html
index 7b0580b..138c233 100644
--- a/livemining.html
+++ b/livemining.html
@@ -87,9 +87,5 @@ time_local - Time when card was mined (localized date, depends on browser and OS
readings_raw - The unfiltered list of readings associated with the given word. Tags and restriction information, like さくや not being a reading of 夕べ, are stripped.
spellings_raw - The unfiltered list of spellings associated with the given word. Tags and restriction information are stripped.
-
-Advanced
-
-