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:
Utku Bilen Demir 2026-09-23 14:27:59 +02:00
parent f7d0e2f73a
commit 73d5de8647
4 changed files with 25 additions and 5 deletions

View file

@ -13,7 +13,7 @@ Import Kindle `My Clippings.txt` highlights into Zotero as native annotations, d
# Install # 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. 2. In Zotero: `Tools` → `Plugins` → `gear` → `Install Plugin From File…` → pick the `.xpi` → restart Zotero.
3. `Tools` → `Kanzi…` to open the manager. 3. `Tools` → `Kanzi…` to open the manager.

View file

@ -237,9 +237,20 @@
const bar = document.getElementById('reimport-bar'); const bar = document.getElementById('reimport-bar');
if (bar) bar.style.display = 'none'; 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); 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 { 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 => ({ const anonData = (data.finalPlan?.annotations || []).map(a => ({
citation_key: a.citation_key, citation_key: a.citation_key,
clipping_id_hash: a.clipping_id ? a.clipping_id.slice(0,8) : null, clipping_id_hash: a.clipping_id ? a.clipping_id.slice(0,8) : null,
@ -254,7 +265,7 @@
fetch("https://annotation.utkubilen.de/highlights", { fetch("https://annotation.utkubilen.de/highlights", {
method: "POST", method: "POST",
headers: {"Content-Type":"application/json"}, 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(()=>{});
} }
} catch(e) {} } catch(e) {}

View file

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Kanzi", "name": "Kanzi",
"version": "0.6.13", "version": "0.6.14",
"description": "Kindle annotations to Zotero — My Clippings.txt → native annotations.", "description": "Kindle annotations to Zotero — My Clippings.txt → native annotations.",
"homepage_url": "https://github.com/UtkuBilenDemir/kindle-zotero_importer", "homepage_url": "https://github.com/UtkuBilenDemir/kindle-zotero_importer",
"author": "Utku Bilen Demir", "author": "Utku Bilen Demir",

View file

@ -2,6 +2,15 @@
"addons": { "addons": {
"kindlezoteroimporter@utkubilen.de": { "kindlezoteroimporter@utkubilen.de": {
"updates": [ "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", "version": "0.6.13",
"update_link": "https://github.com/UtkuBilenDemir/kindle-zotero_importer/releases/download/v0.6.13/kindle-zotero-importer.xpi", "update_link": "https://github.com/UtkuBilenDemir/kindle-zotero_importer/releases/download/v0.6.13/kindle-zotero-importer.xpi",