zotero-plugin 6.3.2 → 6.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -0
- package/bin/fetch-log.mjs +2 -2
- package/debug-log.js +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -124,3 +124,50 @@ then when you execute `npm start`, zotero will start up with the latest build of
|
|
|
124
124
|
**DO CREATE A BACKUP OF YOUR ZOTERO DATA *AND* YOUR ZOTERO PROFILE BEFORE USING THIS THE FIRST TIME**
|
|
125
125
|
|
|
126
126
|
`zotero-start` will **blindly** trust you've set it up right and will **alter data** in the profile
|
|
127
|
+
|
|
128
|
+
# Getting logging from your users
|
|
129
|
+
|
|
130
|
+
In your startup, you can call
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
import { DebugLog } from 'zotero-plugin/debug-log'
|
|
134
|
+
DebugLog.register('<your plugin name>', ['your-plugin.', 'fileHandler.pdf'])
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
and you will get an entry in the Help menu that will allow your users to upload their debug log for diagnosis. You can fetch the log by
|
|
138
|
+
running
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
zp-fetch-log <the ID that the user was presented with>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
If you want to be extra secure, you can encrypt the logs before they are sent; first, run
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
zp-keypair
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
which will generate a keypair. Remember the passphrase, it cannot be recovered, but if you do forget, you can generate a new keypair. Logs
|
|
151
|
+
sent with the old keypair cannot be decrypted, so if you forget your passphrase, you will have to put out a new release of your plugin.
|
|
152
|
+
|
|
153
|
+
add this to your esbuild script:
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
const { pem } = require('zotero-plugin/esbuild')
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
and add `pem` to your plugins in the esbuild config:
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
...
|
|
163
|
+
plugins: [pem],
|
|
164
|
+
...
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
and in your code, register using
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
DebugLog.register('<your plugin name>', ['your-plugin.', 'fileHandler.pdf'], require('./public.pem'))
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Logs are sent to/retrieved from 0x0.st
|
package/bin/fetch-log.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { Entry as KeyRingEntry } from "@napi-rs/keyring";
|
|
|
11
11
|
import prompts from "prompts";
|
|
12
12
|
|
|
13
13
|
// package.json
|
|
14
|
-
var version = "6.3.
|
|
14
|
+
var version = "6.3.3";
|
|
15
15
|
|
|
16
16
|
// bin/crypto.ts
|
|
17
17
|
import crypto from "crypto";
|
|
@@ -92,7 +92,7 @@ async function main() {
|
|
|
92
92
|
if (entry.isDirectory) continue;
|
|
93
93
|
const m2 = entry.name.match(/(?<filename>.+)\.(?<type>key|enc|iv)$/i);
|
|
94
94
|
let filename = m2?.groups.filename || entry.name;
|
|
95
|
-
const type = (m2?.groups.
|
|
95
|
+
const type = (m2?.groups.type || "").toLowerCase();
|
|
96
96
|
if (type && !options.encrypted) oops("unexpected", type, "file in non-encrypted log");
|
|
97
97
|
if (type === "key") {
|
|
98
98
|
decryptionKey = crypto2.privateDecrypt({
|
package/debug-log.js
CHANGED
|
@@ -57,6 +57,7 @@ class Bundler {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
exports.Bundler = Bundler;
|
|
60
|
+
const zotero_prefs_root = 'extensions.zotero.';
|
|
60
61
|
class DebugLogSender {
|
|
61
62
|
id = {
|
|
62
63
|
menu: 'debug-log-sender-menu',
|
|
@@ -154,7 +155,12 @@ class DebugLogSender {
|
|
|
154
155
|
const prefs = {};
|
|
155
156
|
const names = [];
|
|
156
157
|
for (let pref of preferences) {
|
|
157
|
-
pref
|
|
158
|
+
if (pref[0] === ':') {
|
|
159
|
+
pref = pref.substring(1);
|
|
160
|
+
}
|
|
161
|
+
else if (!pref.startsWith(zotero_prefs_root)) {
|
|
162
|
+
pref = zotero_prefs_root + pref;
|
|
163
|
+
}
|
|
158
164
|
if (pref.endsWith('.')) {
|
|
159
165
|
const childkeys = Services.prefs.getBranch(pref).getChildList('', {});
|
|
160
166
|
for (const key of childkeys) {
|