Kanzi 0.6.14: fix anonymised sharing NS_ERROR (anonId missing)
- plugin/manager.html: shareAnonymized fetch now robust to missing prefs (getBoolPref/getCharPref NS_ERROR) — defaults to share=true, anonId=anon with auto-generation, British spelling - Fixes 'no annotations added' when anonId pref missing (thrown 0x8000ffff, caught silently, no POST) - Bump to 0.6.14
This commit is contained in:
parent
f7d0e2f73a
commit
73d5de8647
4 changed files with 25 additions and 5 deletions
|
|
@ -13,7 +13,7 @@ Import Kindle `My Clippings.txt` highlights into Zotero as native annotations, d
|
|||
|
||||
# Install
|
||||
|
||||
1. Download `kindle-zotero-importer.xpi` from [Releases](../../releases) (latest `0.6.13`, or `0.6.12-beta` for preview).
|
||||
1. Download `kindle-zotero-importer.xpi` from [Releases](../../releases) (latest `0.6.14`, or `0.6.13-beta` for preview).
|
||||
2. In Zotero: `Tools` → `Plugins` → `gear` → `Install Plugin From File…` → pick the `.xpi` → restart Zotero.
|
||||
3. `Tools` → `Kanzi…` to open the manager.
|
||||
|
||||
|
|
|
|||
|
|
@ -237,9 +237,20 @@
|
|||
const bar = document.getElementById('reimport-bar');
|
||||
if (bar) bar.style.display = 'none';
|
||||
this.status(`${summary.counts.final_annotations || 0} positioned annotations processed; ${this.rows.length} review rows remain.`, results.failed.length > 0);
|
||||
// Anonymized sharing if opted in
|
||||
// Anonymised sharing if opted in — robust to missing prefs (British spelling)
|
||||
try {
|
||||
if (Services.prefs.getBoolPref("extensions.kindleZoteroImporter.shareAnonymized")) {
|
||||
let share = true;
|
||||
try { share = Services.prefs.getBoolPref("extensions.kindleZoteroImporter.shareAnonymized"); } catch(e) { share = true; }
|
||||
if (share) {
|
||||
let anonId = "anon";
|
||||
try { anonId = Services.prefs.getCharPref("extensions.kindleZoteroImporter.anonId") || "anon"; } catch(e) { anonId = "anon"; }
|
||||
// ensure anonId exists for next time
|
||||
if (anonId === "anon") {
|
||||
try {
|
||||
anonId = Math.random().toString(36).slice(2,10) + Date.now().toString(36);
|
||||
Services.prefs.setCharPref("extensions.kindleZoteroImporter.anonId", anonId);
|
||||
} catch(e) {}
|
||||
}
|
||||
const anonData = (data.finalPlan?.annotations || []).map(a => ({
|
||||
citation_key: a.citation_key,
|
||||
clipping_id_hash: a.clipping_id ? a.clipping_id.slice(0,8) : null,
|
||||
|
|
@ -254,7 +265,7 @@
|
|||
fetch("https://annotation.utkubilen.de/highlights", {
|
||||
method: "POST",
|
||||
headers: {"Content-Type":"application/json"},
|
||||
body: JSON.stringify({anonId: Services.prefs.getCharPref("extensions.kindleZoteroImporter.anonId") || "anon", data: anonData})
|
||||
body: JSON.stringify({anonId, data: anonData})
|
||||
}).catch(()=>{});
|
||||
}
|
||||
} catch(e) {}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Kanzi",
|
||||
"version": "0.6.13",
|
||||
"version": "0.6.14",
|
||||
"description": "Kindle annotations to Zotero — My Clippings.txt → native annotations.",
|
||||
"homepage_url": "https://github.com/UtkuBilenDemir/kindle-zotero_importer",
|
||||
"author": "Utku Bilen Demir",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,15 @@
|
|||
"addons": {
|
||||
"kindlezoteroimporter@utkubilen.de": {
|
||||
"updates": [
|
||||
{
|
||||
"version": "0.6.14",
|
||||
"update_link": "https://github.com/UtkuBilenDemir/kindle-zotero_importer/releases/download/v0.6.14/kindle-zotero-importer.xpi",
|
||||
"applications": {
|
||||
"zotero": {
|
||||
"strict_min_version": "6.999"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"version": "0.6.13",
|
||||
"update_link": "https://github.com/UtkuBilenDemir/kindle-zotero_importer/releases/download/v0.6.13/kindle-zotero-importer.xpi",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue