zotero-plugin 5.0.21 → 5.0.23
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/bin/branches.js +80 -14
- package/bin/fetch-zotero-log.py +3 -2
- package/bin/keypair +20 -0
- package/bin/release.js +95 -29
- package/debug-log.d.ts +1 -3
- package/debug-log.js +16 -27
- package/manifest.js +104 -0
- package/package.json +14 -13
- package/install.rdf.pug +0 -29
- package/rdf.js +0 -117
- package/update.rdf.pug +0 -24
- /package/{rdf.d.ts → manifest.d.ts} +0 -0
package/bin/branches.js
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"node_modules/dotenv/package.json"(exports, module) {
|
|
38
38
|
module.exports = {
|
|
39
39
|
name: "dotenv",
|
|
40
|
-
version: "
|
|
40
|
+
version: "17.2.1",
|
|
41
41
|
description: "Loads environment variables from .env file",
|
|
42
42
|
main: "lib/main.js",
|
|
43
43
|
types: "lib/main.d.ts",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
lint: "standard",
|
|
61
61
|
pretest: "npm run lint && npm run dts-check",
|
|
62
62
|
test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
|
|
63
|
-
"test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",
|
|
63
|
+
"test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
|
|
64
64
|
prerelease: "npm test",
|
|
65
65
|
release: "standard-version"
|
|
66
66
|
},
|
|
@@ -109,6 +109,36 @@
|
|
|
109
109
|
var crypto = __require("crypto");
|
|
110
110
|
var packageJson = require_package();
|
|
111
111
|
var version = packageJson.version;
|
|
112
|
+
var TIPS = [
|
|
113
|
+
"\u{1F510} encrypt with Dotenvx: https://dotenvx.com",
|
|
114
|
+
"\u{1F510} prevent committing .env to code: https://dotenvx.com/precommit",
|
|
115
|
+
"\u{1F510} prevent building .env in docker: https://dotenvx.com/prebuild",
|
|
116
|
+
"\u{1F4E1} observe env with Radar: https://dotenvx.com/radar",
|
|
117
|
+
"\u{1F4E1} auto-backup env with Radar: https://dotenvx.com/radar",
|
|
118
|
+
"\u{1F4E1} version env with Radar: https://dotenvx.com/radar",
|
|
119
|
+
"\u{1F6E0}\uFE0F run anywhere with `dotenvx run -- yourcommand`",
|
|
120
|
+
"\u2699\uFE0F specify custom .env file path with { path: '/custom/path/.env' }",
|
|
121
|
+
"\u2699\uFE0F enable debug logging with { debug: true }",
|
|
122
|
+
"\u2699\uFE0F override existing env vars with { override: true }",
|
|
123
|
+
"\u2699\uFE0F suppress all logs with { quiet: true }",
|
|
124
|
+
"\u2699\uFE0F write to custom object with { processEnv: myObject }",
|
|
125
|
+
"\u2699\uFE0F load multiple .env files with { path: ['.env.local', '.env'] }"
|
|
126
|
+
];
|
|
127
|
+
function _getRandomTip() {
|
|
128
|
+
return TIPS[Math.floor(Math.random() * TIPS.length)];
|
|
129
|
+
}
|
|
130
|
+
function parseBoolean(value) {
|
|
131
|
+
if (typeof value === "string") {
|
|
132
|
+
return !["false", "0", "no", "off", ""].includes(value.toLowerCase());
|
|
133
|
+
}
|
|
134
|
+
return Boolean(value);
|
|
135
|
+
}
|
|
136
|
+
function supportsAnsi() {
|
|
137
|
+
return process.stdout.isTTY;
|
|
138
|
+
}
|
|
139
|
+
function dim(text) {
|
|
140
|
+
return supportsAnsi() ? `\x1B[2m${text}\x1B[0m` : text;
|
|
141
|
+
}
|
|
112
142
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
113
143
|
function parse2(src) {
|
|
114
144
|
const obj = {};
|
|
@@ -130,8 +160,10 @@
|
|
|
130
160
|
return obj;
|
|
131
161
|
}
|
|
132
162
|
function _parseVault(options) {
|
|
163
|
+
options = options || {};
|
|
133
164
|
const vaultPath = _vaultPath(options);
|
|
134
|
-
|
|
165
|
+
options.path = vaultPath;
|
|
166
|
+
const result = DotenvModule.configDotenv(options);
|
|
135
167
|
if (!result.parsed) {
|
|
136
168
|
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
137
169
|
err.code = "MISSING_DATA";
|
|
@@ -155,11 +187,14 @@
|
|
|
155
187
|
return DotenvModule.parse(decrypted);
|
|
156
188
|
}
|
|
157
189
|
function _warn(message) {
|
|
158
|
-
console.
|
|
190
|
+
console.error(`[dotenv@${version}][WARN] ${message}`);
|
|
159
191
|
}
|
|
160
192
|
function _debug(message) {
|
|
161
193
|
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
162
194
|
}
|
|
195
|
+
function _log(message) {
|
|
196
|
+
console.log(`[dotenv@${version}] ${message}`);
|
|
197
|
+
}
|
|
163
198
|
function _dotenvKey(options) {
|
|
164
199
|
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
165
200
|
return options.DOTENV_KEY;
|
|
@@ -226,9 +261,10 @@
|
|
|
226
261
|
return envPath[0] === "~" ? path2.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
227
262
|
}
|
|
228
263
|
function _configVault(options) {
|
|
229
|
-
const debug =
|
|
230
|
-
|
|
231
|
-
|
|
264
|
+
const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
265
|
+
const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options && options.quiet);
|
|
266
|
+
if (debug || !quiet) {
|
|
267
|
+
_log("Loading env from encrypted .env.vault");
|
|
232
268
|
}
|
|
233
269
|
const parsed = DotenvModule._parseVault(options);
|
|
234
270
|
let processEnv = process.env;
|
|
@@ -241,7 +277,12 @@
|
|
|
241
277
|
function configDotenv(options) {
|
|
242
278
|
const dotenvPath = path2.resolve(process.cwd(), ".env");
|
|
243
279
|
let encoding = "utf8";
|
|
244
|
-
|
|
280
|
+
let processEnv = process.env;
|
|
281
|
+
if (options && options.processEnv != null) {
|
|
282
|
+
processEnv = options.processEnv;
|
|
283
|
+
}
|
|
284
|
+
let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
|
|
285
|
+
let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options && options.quiet);
|
|
245
286
|
if (options && options.encoding) {
|
|
246
287
|
encoding = options.encoding;
|
|
247
288
|
} else {
|
|
@@ -273,11 +314,25 @@
|
|
|
273
314
|
lastError = e;
|
|
274
315
|
}
|
|
275
316
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
317
|
+
const populated = DotenvModule.populate(processEnv, parsedAll, options);
|
|
318
|
+
debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
|
|
319
|
+
quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
|
|
320
|
+
if (debug || !quiet) {
|
|
321
|
+
const keysCount = Object.keys(populated).length;
|
|
322
|
+
const shortPaths = [];
|
|
323
|
+
for (const filePath of optionPaths) {
|
|
324
|
+
try {
|
|
325
|
+
const relative = path2.relative(process.cwd(), filePath);
|
|
326
|
+
shortPaths.push(relative);
|
|
327
|
+
} catch (e) {
|
|
328
|
+
if (debug) {
|
|
329
|
+
_debug(`Failed to load ${filePath} ${e.message}`);
|
|
330
|
+
}
|
|
331
|
+
lastError = e;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
_log(`injecting env (${keysCount}) from ${shortPaths.join(",")} ${dim(`-- tip: ${_getRandomTip()}`)}`);
|
|
279
335
|
}
|
|
280
|
-
DotenvModule.populate(processEnv, parsedAll, options);
|
|
281
336
|
if (lastError) {
|
|
282
337
|
return { parsed: parsedAll, error: lastError };
|
|
283
338
|
} else {
|
|
@@ -325,6 +380,7 @@
|
|
|
325
380
|
function populate(processEnv, parsed, options = {}) {
|
|
326
381
|
const debug = Boolean(options && options.debug);
|
|
327
382
|
const override = Boolean(options && options.override);
|
|
383
|
+
const populated = {};
|
|
328
384
|
if (typeof parsed !== "object") {
|
|
329
385
|
const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
330
386
|
err.code = "OBJECT_REQUIRED";
|
|
@@ -334,6 +390,7 @@
|
|
|
334
390
|
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
335
391
|
if (override === true) {
|
|
336
392
|
processEnv[key] = parsed[key];
|
|
393
|
+
populated[key] = parsed[key];
|
|
337
394
|
}
|
|
338
395
|
if (debug) {
|
|
339
396
|
if (override === true) {
|
|
@@ -344,8 +401,10 @@
|
|
|
344
401
|
}
|
|
345
402
|
} else {
|
|
346
403
|
processEnv[key] = parsed[key];
|
|
404
|
+
populated[key] = parsed[key];
|
|
347
405
|
}
|
|
348
406
|
}
|
|
407
|
+
return populated;
|
|
349
408
|
}
|
|
350
409
|
var DotenvModule = {
|
|
351
410
|
configDotenv,
|
|
@@ -377,6 +436,9 @@
|
|
|
377
436
|
if (process.env.DOTENV_CONFIG_PATH != null) {
|
|
378
437
|
options.path = process.env.DOTENV_CONFIG_PATH;
|
|
379
438
|
}
|
|
439
|
+
if (process.env.DOTENV_CONFIG_QUIET != null) {
|
|
440
|
+
options.quiet = process.env.DOTENV_CONFIG_QUIET;
|
|
441
|
+
}
|
|
380
442
|
if (process.env.DOTENV_CONFIG_DEBUG != null) {
|
|
381
443
|
options.debug = process.env.DOTENV_CONFIG_DEBUG;
|
|
382
444
|
}
|
|
@@ -393,15 +455,19 @@
|
|
|
393
455
|
// node_modules/dotenv/lib/cli-options.js
|
|
394
456
|
var require_cli_options = __commonJS({
|
|
395
457
|
"node_modules/dotenv/lib/cli-options.js"(exports, module) {
|
|
396
|
-
var re = /^dotenv_config_(encoding|path|debug|override|DOTENV_KEY)=(.+)$/;
|
|
458
|
+
var re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;
|
|
397
459
|
module.exports = function optionMatcher(args) {
|
|
398
|
-
|
|
460
|
+
const options = args.reduce(function(acc, cur) {
|
|
399
461
|
const matches = cur.match(re);
|
|
400
462
|
if (matches) {
|
|
401
463
|
acc[matches[1]] = matches[2];
|
|
402
464
|
}
|
|
403
465
|
return acc;
|
|
404
466
|
}, {});
|
|
467
|
+
if (!("quiet" in options)) {
|
|
468
|
+
options.quiet = "true";
|
|
469
|
+
}
|
|
470
|
+
return options;
|
|
405
471
|
};
|
|
406
472
|
}
|
|
407
473
|
});
|
package/bin/fetch-zotero-log.py
CHANGED
|
@@ -4,8 +4,9 @@ import sys, os
|
|
|
4
4
|
import urllib.request
|
|
5
5
|
from zipfile import ZipFile
|
|
6
6
|
|
|
7
|
-
local,
|
|
8
|
-
|
|
7
|
+
local, host, remote = sys.argv[1].split('-')
|
|
8
|
+
assert host == '0x0', sys.argv[1]
|
|
9
|
+
url = f'https://0x0.com/{remote}.zip'
|
|
9
10
|
log = 'logs/' + local + '.zip'
|
|
10
11
|
print(url, '=>', log)
|
|
11
12
|
logs = os.path.dirname(log)
|
package/bin/keypair
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
from cryptography.hazmat.primitives.asymmetric import rsa
|
|
4
|
+
from cryptography.hazmat.primitives import serialization
|
|
5
|
+
|
|
6
|
+
private_key = rsa.generate_private_key(public_exponent=65537, key_size=2048)
|
|
7
|
+
private_pem = private_key.private_bytes(
|
|
8
|
+
encoding=serialization.Encoding.PEM,
|
|
9
|
+
format=serialization.PrivateFormat.PKCS8,
|
|
10
|
+
encryption_algorithm=serialization.NoEncryption()
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
public_key = private_key.public_key()
|
|
14
|
+
public_pem = public_key.public_bytes(
|
|
15
|
+
encoding=serialization.Encoding.PEM,
|
|
16
|
+
format=serialization.PublicFormat.SubjectPublicKeyInfo
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
print(private_pem.decode('utf-8'))
|
|
20
|
+
print(public_pem.decode('utf-8'))
|
package/bin/release.js
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"node_modules/dotenv/package.json"(exports, module) {
|
|
38
38
|
module.exports = {
|
|
39
39
|
name: "dotenv",
|
|
40
|
-
version: "
|
|
40
|
+
version: "17.2.1",
|
|
41
41
|
description: "Loads environment variables from .env file",
|
|
42
42
|
main: "lib/main.js",
|
|
43
43
|
types: "lib/main.d.ts",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
lint: "standard",
|
|
61
61
|
pretest: "npm run lint && npm run dts-check",
|
|
62
62
|
test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
|
|
63
|
-
"test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",
|
|
63
|
+
"test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
|
|
64
64
|
prerelease: "npm test",
|
|
65
65
|
release: "standard-version"
|
|
66
66
|
},
|
|
@@ -109,6 +109,36 @@
|
|
|
109
109
|
var crypto = __require("crypto");
|
|
110
110
|
var packageJson = require_package();
|
|
111
111
|
var version2 = packageJson.version;
|
|
112
|
+
var TIPS = [
|
|
113
|
+
"\u{1F510} encrypt with Dotenvx: https://dotenvx.com",
|
|
114
|
+
"\u{1F510} prevent committing .env to code: https://dotenvx.com/precommit",
|
|
115
|
+
"\u{1F510} prevent building .env in docker: https://dotenvx.com/prebuild",
|
|
116
|
+
"\u{1F4E1} observe env with Radar: https://dotenvx.com/radar",
|
|
117
|
+
"\u{1F4E1} auto-backup env with Radar: https://dotenvx.com/radar",
|
|
118
|
+
"\u{1F4E1} version env with Radar: https://dotenvx.com/radar",
|
|
119
|
+
"\u{1F6E0}\uFE0F run anywhere with `dotenvx run -- yourcommand`",
|
|
120
|
+
"\u2699\uFE0F specify custom .env file path with { path: '/custom/path/.env' }",
|
|
121
|
+
"\u2699\uFE0F enable debug logging with { debug: true }",
|
|
122
|
+
"\u2699\uFE0F override existing env vars with { override: true }",
|
|
123
|
+
"\u2699\uFE0F suppress all logs with { quiet: true }",
|
|
124
|
+
"\u2699\uFE0F write to custom object with { processEnv: myObject }",
|
|
125
|
+
"\u2699\uFE0F load multiple .env files with { path: ['.env.local', '.env'] }"
|
|
126
|
+
];
|
|
127
|
+
function _getRandomTip() {
|
|
128
|
+
return TIPS[Math.floor(Math.random() * TIPS.length)];
|
|
129
|
+
}
|
|
130
|
+
function parseBoolean(value) {
|
|
131
|
+
if (typeof value === "string") {
|
|
132
|
+
return !["false", "0", "no", "off", ""].includes(value.toLowerCase());
|
|
133
|
+
}
|
|
134
|
+
return Boolean(value);
|
|
135
|
+
}
|
|
136
|
+
function supportsAnsi() {
|
|
137
|
+
return process.stdout.isTTY;
|
|
138
|
+
}
|
|
139
|
+
function dim(text) {
|
|
140
|
+
return supportsAnsi() ? `\x1B[2m${text}\x1B[0m` : text;
|
|
141
|
+
}
|
|
112
142
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
113
143
|
function parse2(src) {
|
|
114
144
|
const obj = {};
|
|
@@ -130,8 +160,10 @@
|
|
|
130
160
|
return obj;
|
|
131
161
|
}
|
|
132
162
|
function _parseVault(options2) {
|
|
163
|
+
options2 = options2 || {};
|
|
133
164
|
const vaultPath = _vaultPath(options2);
|
|
134
|
-
|
|
165
|
+
options2.path = vaultPath;
|
|
166
|
+
const result = DotenvModule.configDotenv(options2);
|
|
135
167
|
if (!result.parsed) {
|
|
136
168
|
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
137
169
|
err.code = "MISSING_DATA";
|
|
@@ -155,11 +187,14 @@
|
|
|
155
187
|
return DotenvModule.parse(decrypted);
|
|
156
188
|
}
|
|
157
189
|
function _warn(message) {
|
|
158
|
-
console.
|
|
190
|
+
console.error(`[dotenv@${version2}][WARN] ${message}`);
|
|
159
191
|
}
|
|
160
192
|
function _debug(message) {
|
|
161
193
|
console.log(`[dotenv@${version2}][DEBUG] ${message}`);
|
|
162
194
|
}
|
|
195
|
+
function _log(message) {
|
|
196
|
+
console.log(`[dotenv@${version2}] ${message}`);
|
|
197
|
+
}
|
|
163
198
|
function _dotenvKey(options2) {
|
|
164
199
|
if (options2 && options2.DOTENV_KEY && options2.DOTENV_KEY.length > 0) {
|
|
165
200
|
return options2.DOTENV_KEY;
|
|
@@ -226,9 +261,10 @@
|
|
|
226
261
|
return envPath[0] === "~" ? path3.join(os2.homedir(), envPath.slice(1)) : envPath;
|
|
227
262
|
}
|
|
228
263
|
function _configVault(options2) {
|
|
229
|
-
const debug =
|
|
230
|
-
|
|
231
|
-
|
|
264
|
+
const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options2 && options2.debug);
|
|
265
|
+
const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options2 && options2.quiet);
|
|
266
|
+
if (debug || !quiet) {
|
|
267
|
+
_log("Loading env from encrypted .env.vault");
|
|
232
268
|
}
|
|
233
269
|
const parsed = DotenvModule._parseVault(options2);
|
|
234
270
|
let processEnv = process.env;
|
|
@@ -241,7 +277,12 @@
|
|
|
241
277
|
function configDotenv(options2) {
|
|
242
278
|
const dotenvPath = path3.resolve(process.cwd(), ".env");
|
|
243
279
|
let encoding = "utf8";
|
|
244
|
-
|
|
280
|
+
let processEnv = process.env;
|
|
281
|
+
if (options2 && options2.processEnv != null) {
|
|
282
|
+
processEnv = options2.processEnv;
|
|
283
|
+
}
|
|
284
|
+
let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options2 && options2.debug);
|
|
285
|
+
let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options2 && options2.quiet);
|
|
245
286
|
if (options2 && options2.encoding) {
|
|
246
287
|
encoding = options2.encoding;
|
|
247
288
|
} else {
|
|
@@ -273,11 +314,25 @@
|
|
|
273
314
|
lastError = e;
|
|
274
315
|
}
|
|
275
316
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
317
|
+
const populated = DotenvModule.populate(processEnv, parsedAll, options2);
|
|
318
|
+
debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
|
|
319
|
+
quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
|
|
320
|
+
if (debug || !quiet) {
|
|
321
|
+
const keysCount = Object.keys(populated).length;
|
|
322
|
+
const shortPaths = [];
|
|
323
|
+
for (const filePath of optionPaths) {
|
|
324
|
+
try {
|
|
325
|
+
const relative = path3.relative(process.cwd(), filePath);
|
|
326
|
+
shortPaths.push(relative);
|
|
327
|
+
} catch (e) {
|
|
328
|
+
if (debug) {
|
|
329
|
+
_debug(`Failed to load ${filePath} ${e.message}`);
|
|
330
|
+
}
|
|
331
|
+
lastError = e;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
_log(`injecting env (${keysCount}) from ${shortPaths.join(",")} ${dim(`-- tip: ${_getRandomTip()}`)}`);
|
|
279
335
|
}
|
|
280
|
-
DotenvModule.populate(processEnv, parsedAll, options2);
|
|
281
336
|
if (lastError) {
|
|
282
337
|
return { parsed: parsedAll, error: lastError };
|
|
283
338
|
} else {
|
|
@@ -325,6 +380,7 @@
|
|
|
325
380
|
function populate(processEnv, parsed, options2 = {}) {
|
|
326
381
|
const debug = Boolean(options2 && options2.debug);
|
|
327
382
|
const override = Boolean(options2 && options2.override);
|
|
383
|
+
const populated = {};
|
|
328
384
|
if (typeof parsed !== "object") {
|
|
329
385
|
const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
330
386
|
err.code = "OBJECT_REQUIRED";
|
|
@@ -334,6 +390,7 @@
|
|
|
334
390
|
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
335
391
|
if (override === true) {
|
|
336
392
|
processEnv[key] = parsed[key];
|
|
393
|
+
populated[key] = parsed[key];
|
|
337
394
|
}
|
|
338
395
|
if (debug) {
|
|
339
396
|
if (override === true) {
|
|
@@ -344,8 +401,10 @@
|
|
|
344
401
|
}
|
|
345
402
|
} else {
|
|
346
403
|
processEnv[key] = parsed[key];
|
|
404
|
+
populated[key] = parsed[key];
|
|
347
405
|
}
|
|
348
406
|
}
|
|
407
|
+
return populated;
|
|
349
408
|
}
|
|
350
409
|
var DotenvModule = {
|
|
351
410
|
configDotenv,
|
|
@@ -377,6 +436,9 @@
|
|
|
377
436
|
if (process.env.DOTENV_CONFIG_PATH != null) {
|
|
378
437
|
options2.path = process.env.DOTENV_CONFIG_PATH;
|
|
379
438
|
}
|
|
439
|
+
if (process.env.DOTENV_CONFIG_QUIET != null) {
|
|
440
|
+
options2.quiet = process.env.DOTENV_CONFIG_QUIET;
|
|
441
|
+
}
|
|
380
442
|
if (process.env.DOTENV_CONFIG_DEBUG != null) {
|
|
381
443
|
options2.debug = process.env.DOTENV_CONFIG_DEBUG;
|
|
382
444
|
}
|
|
@@ -393,15 +455,19 @@
|
|
|
393
455
|
// node_modules/dotenv/lib/cli-options.js
|
|
394
456
|
var require_cli_options = __commonJS({
|
|
395
457
|
"node_modules/dotenv/lib/cli-options.js"(exports, module) {
|
|
396
|
-
var re = /^dotenv_config_(encoding|path|debug|override|DOTENV_KEY)=(.+)$/;
|
|
458
|
+
var re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;
|
|
397
459
|
module.exports = function optionMatcher(args) {
|
|
398
|
-
|
|
460
|
+
const options2 = args.reduce(function(acc, cur) {
|
|
399
461
|
const matches = cur.match(re);
|
|
400
462
|
if (matches) {
|
|
401
463
|
acc[matches[1]] = matches[2];
|
|
402
464
|
}
|
|
403
465
|
return acc;
|
|
404
466
|
}, {});
|
|
467
|
+
if (!("quiet" in options2)) {
|
|
468
|
+
options2.quiet = "true";
|
|
469
|
+
}
|
|
470
|
+
return options2;
|
|
405
471
|
};
|
|
406
472
|
}
|
|
407
473
|
});
|
|
@@ -8382,7 +8448,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
8382
8448
|
"package.json"(exports, module) {
|
|
8383
8449
|
module.exports = {
|
|
8384
8450
|
name: "zotero-plugin",
|
|
8385
|
-
version: "5.0.
|
|
8451
|
+
version: "5.0.23",
|
|
8386
8452
|
description: "Zotero plugin builder",
|
|
8387
8453
|
homepage: "https://github.com/retorquere/zotero-plugin/wiki",
|
|
8388
8454
|
bin: {
|
|
@@ -8391,7 +8457,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
8391
8457
|
"zotero-plugin-link": "bin/link.js",
|
|
8392
8458
|
"issue-branches": "bin/branches.js",
|
|
8393
8459
|
"zotero-start": "bin/start.py",
|
|
8394
|
-
"fetch-zotero-log": "bin/fetch-zotero-log.py"
|
|
8460
|
+
"fetch-zotero-log": "bin/fetch-zotero-log.py",
|
|
8461
|
+
"zotero-keypair": "bin/keypair"
|
|
8395
8462
|
},
|
|
8396
8463
|
author: {
|
|
8397
8464
|
name: "Emiliano Heyns",
|
|
@@ -8412,21 +8479,22 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
8412
8479
|
dependencies: {
|
|
8413
8480
|
"@octokit/rest": "^22.0.0",
|
|
8414
8481
|
"@rgrove/parse-xml": "^4.2.0",
|
|
8415
|
-
"@types/node": "^24.
|
|
8482
|
+
"@types/node": "^24.2.1",
|
|
8416
8483
|
"@xmldom/xmldom": "^0.9.8",
|
|
8417
8484
|
ajv: "^8.17.1",
|
|
8418
8485
|
"ajv-keywords": "^5.1.0",
|
|
8419
8486
|
archiver: "^7.0.1",
|
|
8420
8487
|
clp: "^4.0.13",
|
|
8421
8488
|
commander: "^14.0.0",
|
|
8422
|
-
dotenv: "^
|
|
8489
|
+
dotenv: "^17.2.1",
|
|
8423
8490
|
ejs: "^3.1.10",
|
|
8424
|
-
"fs-extra": "^11.3.
|
|
8491
|
+
"fs-extra": "^11.3.1",
|
|
8425
8492
|
glob: "^11.0.3",
|
|
8426
8493
|
jsesc: "^3.1.0",
|
|
8427
8494
|
lodash: "^4.17.21",
|
|
8428
8495
|
moment: "^2.30.1",
|
|
8429
|
-
|
|
8496
|
+
openpgp: "^6.2.0",
|
|
8497
|
+
peggy: "^5.0.6",
|
|
8430
8498
|
"properties-reader": "^2.3.0",
|
|
8431
8499
|
pug: "^3.0.3",
|
|
8432
8500
|
rimraf: "^6.0.1",
|
|
@@ -8435,7 +8503,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
8435
8503
|
"string-to-arraybuffer": "^1.0.2",
|
|
8436
8504
|
"ts-node": "^10.9.2",
|
|
8437
8505
|
tslib: "^2.8.1",
|
|
8438
|
-
typescript: "^5.
|
|
8506
|
+
typescript: "^5.9.2",
|
|
8439
8507
|
"uri-templates": "^0.2.0",
|
|
8440
8508
|
uzip: "^0.20201231.0",
|
|
8441
8509
|
"xml-parser": "^1.2.1",
|
|
@@ -8462,7 +8530,6 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
8462
8530
|
"copy-assets.d.ts",
|
|
8463
8531
|
"copy-assets.js",
|
|
8464
8532
|
"error-report.pug",
|
|
8465
|
-
"install.rdf.pug",
|
|
8466
8533
|
"loader/json.d.ts",
|
|
8467
8534
|
"loader/json.js",
|
|
8468
8535
|
"loader/peggy.d.ts",
|
|
@@ -8473,11 +8540,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
8473
8540
|
"make-dirs.d.ts",
|
|
8474
8541
|
"make-dirs.js",
|
|
8475
8542
|
"package.json",
|
|
8476
|
-
"
|
|
8477
|
-
"
|
|
8543
|
+
"manifest.d.ts",
|
|
8544
|
+
"manifest.js",
|
|
8478
8545
|
"root.d.ts",
|
|
8479
8546
|
"root.js",
|
|
8480
|
-
"update.rdf.pug",
|
|
8481
8547
|
"version.d.ts",
|
|
8482
8548
|
"version.js",
|
|
8483
8549
|
"debug-log.js",
|
|
@@ -8491,8 +8557,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
8491
8557
|
url: "https://github.com/retorquere/zotero-plugin/issues"
|
|
8492
8558
|
},
|
|
8493
8559
|
devDependencies: {
|
|
8494
|
-
|
|
8495
|
-
|
|
8560
|
+
"@openpgp/web-stream-tools": "^0.1.3",
|
|
8561
|
+
dprint: "^0.50.1",
|
|
8562
|
+
esbuild: "^0.25.8"
|
|
8496
8563
|
}
|
|
8497
8564
|
};
|
|
8498
8565
|
}
|
|
@@ -12047,8 +12114,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
12047
12114
|
const release = await getRelease(releases_tag, false);
|
|
12048
12115
|
const assets = (await octokit.repos.listReleaseAssets({ owner, repo, release_id: release.data.id })).data;
|
|
12049
12116
|
const updates = {
|
|
12050
|
-
"
|
|
12051
|
-
"updates.json": (pkg.xpi?.maxVersion || "7").match(/^7/) ? "application/json" : ""
|
|
12117
|
+
"updates.json": "application/json"
|
|
12052
12118
|
};
|
|
12053
12119
|
for (const asset of assets) {
|
|
12054
12120
|
if (asset.name in updates && updates[asset.name]) {
|
package/debug-log.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ declare class DebugLogSender {
|
|
|
9
9
|
private get zotero();
|
|
10
10
|
convertLegacy(): void;
|
|
11
11
|
private element;
|
|
12
|
-
register(plugin: string, preferences?: string[],
|
|
12
|
+
register(plugin: string, preferences?: string[], pubkey?: string): void;
|
|
13
13
|
unregister(plugin: string): void;
|
|
14
14
|
private alert;
|
|
15
15
|
send(target: EventTarget): void;
|
|
@@ -17,8 +17,6 @@ declare class DebugLogSender {
|
|
|
17
17
|
private preferences;
|
|
18
18
|
private info;
|
|
19
19
|
private rdf;
|
|
20
|
-
private publicKey;
|
|
21
|
-
private encrypt;
|
|
22
20
|
private arrayBufferToBase64;
|
|
23
21
|
private base64ToArrayBuffer;
|
|
24
22
|
}
|
package/debug-log.js
CHANGED
|
@@ -55,7 +55,7 @@ class DebugLogSender {
|
|
|
55
55
|
}
|
|
56
56
|
return elt;
|
|
57
57
|
}
|
|
58
|
-
register(plugin, preferences = [],
|
|
58
|
+
register(plugin, preferences = [], pubkey = '') {
|
|
59
59
|
var _a, _b;
|
|
60
60
|
this.convertLegacy();
|
|
61
61
|
const label = 'Send debug log to bashupload.com';
|
|
@@ -75,7 +75,7 @@ class DebugLogSender {
|
|
|
75
75
|
label: plugin,
|
|
76
76
|
class: this.id.menuitem,
|
|
77
77
|
'data-preferences': JSON.stringify(preferences || []),
|
|
78
|
-
'data-
|
|
78
|
+
'data-pubkey': pubkey,
|
|
79
79
|
}));
|
|
80
80
|
menuitem.addEventListener('command', event => this.send(event.currentTarget));
|
|
81
81
|
}
|
|
@@ -104,30 +104,23 @@ class DebugLogSender {
|
|
|
104
104
|
const elt = target;
|
|
105
105
|
const plugin = elt.getAttribute('label');
|
|
106
106
|
const preferences = JSON.parse(elt.getAttribute('data-preferences'));
|
|
107
|
-
const
|
|
108
|
-
this.sendAsync(plugin, preferences,
|
|
107
|
+
const pubkey = elt.getAttribute('data-pubkey');
|
|
108
|
+
this.sendAsync(plugin, preferences, pubkey).catch((err) => {
|
|
109
109
|
this.alert('Debug log submission error', `${err}`); // eslint-disable-line @typescript-eslint/restrict-template-expressions
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
-
async sendAsync(plugin, preferences,
|
|
112
|
+
async sendAsync(plugin, preferences, pubkey = null) {
|
|
113
113
|
await this.zotero.Schema.schemaUpdatePromise;
|
|
114
114
|
const files = {};
|
|
115
115
|
const enc = new TextEncoder();
|
|
116
116
|
const key = this.zotero.Utilities.generateObjectKey();
|
|
117
|
-
let publicKey = pem ? await this.publicKey(pem) : null;
|
|
118
|
-
if (pem)
|
|
119
|
-
files[`${key}/pem.txt`] = enc.encode(pem);
|
|
120
117
|
let log = [
|
|
121
118
|
await this.info(preferences),
|
|
122
119
|
this.zotero.getErrors(true).join('\n\n'),
|
|
123
120
|
this.zotero.Debug.getConsoleViewerOutput().slice(-250000).join('\n'), // eslint-disable-line no-magic-numbers
|
|
124
121
|
].filter((txt) => txt).join('\n\n').trim();
|
|
125
|
-
if (publicKey)
|
|
126
|
-
log = await this.encrypt(publicKey, log);
|
|
127
122
|
files[`${key}/debug.txt`] = enc.encode(log);
|
|
128
123
|
let rdf = await this.rdf();
|
|
129
|
-
if (publicKey)
|
|
130
|
-
rdf = await this.encrypt(publicKey, rdf);
|
|
131
124
|
if (rdf)
|
|
132
125
|
files[`${key}/items.rdf`] = enc.encode(rdf);
|
|
133
126
|
// do this runtime because Zotero is not defined at start for bootstrapped zoter6 plugins
|
|
@@ -135,7 +128,17 @@ class DebugLogSender {
|
|
|
135
128
|
if (typeof FormData === 'undefined' && this.zotero.platformMajorVersion >= 102)
|
|
136
129
|
Components.utils.importGlobalProperties(['FormData']);
|
|
137
130
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
138
|
-
|
|
131
|
+
let zip = new Uint8Array(UZip.encode(files));
|
|
132
|
+
/*
|
|
133
|
+
if (pubkey) {
|
|
134
|
+
const publicKey = await openpgp.readKey({ armoredKey: pubkey })
|
|
135
|
+
const encrypted = await openpgp.encrypt({
|
|
136
|
+
message: await openpgp.createMessage({ binary: zip }),
|
|
137
|
+
encryptionKeys: publicKey,
|
|
138
|
+
})
|
|
139
|
+
zip = encrypted
|
|
140
|
+
}
|
|
141
|
+
*/
|
|
139
142
|
const blob = new Blob([zip], { type: 'application/zip' });
|
|
140
143
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
141
144
|
const formData = new FormData();
|
|
@@ -219,20 +222,6 @@ class DebugLogSender {
|
|
|
219
222
|
translation.translate(); // eslint-disable-line @typescript-eslint/no-unsafe-call
|
|
220
223
|
});
|
|
221
224
|
}
|
|
222
|
-
async publicKey(pem) {
|
|
223
|
-
const base64Key = pem
|
|
224
|
-
.replace('-----BEGIN PUBLIC KEY-----', '')
|
|
225
|
-
.replace('-----END PUBLIC KEY-----', '')
|
|
226
|
-
.replace(/\n/g, '');
|
|
227
|
-
const keyBuffer = this.base64ToArrayBuffer(base64Key);
|
|
228
|
-
return await crypto.subtle.importKey('spki', keyBuffer, { name: 'RSA-OAEP', hash: 'SHA-256' }, true, ['encrypt']);
|
|
229
|
-
}
|
|
230
|
-
async encrypt(publicKey, plaintext) {
|
|
231
|
-
const textEncoder = new TextEncoder();
|
|
232
|
-
const data = textEncoder.encode(plaintext);
|
|
233
|
-
const encrypted = await crypto.subtle.encrypt({ name: 'RSA-OAEP' }, publicKey, data);
|
|
234
|
-
return this.arrayBufferToBase64(encrypted);
|
|
235
|
-
}
|
|
236
225
|
arrayBufferToBase64(buffer) {
|
|
237
226
|
let binary = '';
|
|
238
227
|
const bytes = new Uint8Array(buffer);
|
package/manifest.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-console, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/restrict-template-expressions, no-magic-numbers */
|
|
3
|
+
var _a, _b;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
7
|
+
const glob_1 = require("glob");
|
|
8
|
+
const path = tslib_1.__importStar(require("path"));
|
|
9
|
+
const properties_reader_1 = tslib_1.__importDefault(require("properties-reader"));
|
|
10
|
+
const uri_templates_1 = tslib_1.__importDefault(require("uri-templates"));
|
|
11
|
+
const root_1 = tslib_1.__importDefault(require("./root"));
|
|
12
|
+
const version_1 = tslib_1.__importDefault(require("./version"));
|
|
13
|
+
const pkg = Object.assign({}, require(path.join(root_1.default, 'package.json')));
|
|
14
|
+
if (!pkg.id)
|
|
15
|
+
pkg.id = `${pkg.name.replace(/^zotero-/, '')}@${pkg.author.email.replace(/.*@/, '')}`.toLowerCase();
|
|
16
|
+
if (pkg.xpi)
|
|
17
|
+
Object.assign(pkg, pkg.xpi);
|
|
18
|
+
pkg.version = version_1.default;
|
|
19
|
+
if (pkg.updateLink)
|
|
20
|
+
pkg.updateLink = (0, uri_templates_1.default)(pkg.updateLink).fill({ version: pkg.version });
|
|
21
|
+
pkg.updateURL = `${pkg.xpi.releaseURL}update.rdf`;
|
|
22
|
+
const translations = (0, glob_1.globSync)(path.join(root_1.default, 'locale/*/*.properties'));
|
|
23
|
+
for (const translation of translations) {
|
|
24
|
+
const locale = path.basename(path.dirname(translation));
|
|
25
|
+
const properties = (0, properties_reader_1.default)(translation);
|
|
26
|
+
const description = properties.get('xpi.description');
|
|
27
|
+
if (!description)
|
|
28
|
+
continue;
|
|
29
|
+
if (locale === 'en-US') {
|
|
30
|
+
pkg.description = description;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
pkg.localizedDescriptions = pkg.localizedDescriptions || {};
|
|
34
|
+
pkg.localizedDescriptions[locale] = description;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const options_and_vars = Object.assign(Object.assign({ minVersion: '7.0.0', maxVersion: '8.*' }, pkg), { pretty: true });
|
|
38
|
+
try {
|
|
39
|
+
Object.assign(options_and_vars, JSON.parse(fs.readFileSync(path.join(root_1.default, 'schema', 'supported.json'), 'utf8')));
|
|
40
|
+
}
|
|
41
|
+
catch (err) { // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
42
|
+
// ignore
|
|
43
|
+
}
|
|
44
|
+
console.log('generating updates.json');
|
|
45
|
+
fs.writeFileSync(path.join(root_1.default, 'gen/updates.json'), JSON.stringify({
|
|
46
|
+
addons: {
|
|
47
|
+
[pkg.id]: {
|
|
48
|
+
updates: [
|
|
49
|
+
{
|
|
50
|
+
version: options_and_vars.version,
|
|
51
|
+
update_link: options_and_vars.updateLink,
|
|
52
|
+
applications: {
|
|
53
|
+
zotero: {
|
|
54
|
+
strict_min_version: options_and_vars.minVersion,
|
|
55
|
+
strict_max_version: options_and_vars.maxVersion,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
}, null, 2));
|
|
63
|
+
const icons = [
|
|
64
|
+
{ 48: (_b = (_a = pkg.xpi) === null || _a === void 0 ? void 0 : _a.iconURL) === null || _b === void 0 ? void 0 : _b.replace(/^chrome:\/\/[^/]+\//, '') },
|
|
65
|
+
].filter(i => i[48]);
|
|
66
|
+
const basename = pkg.id.replace(/@.*/, '');
|
|
67
|
+
for (const i of [`content/skin/${basename}.png`, `skin/${basename}.png`, `${basename}.png`, 'icon.png']) {
|
|
68
|
+
icons.push({ 48: i });
|
|
69
|
+
icons.push({ 48: i.replace('/zotero-', '/') });
|
|
70
|
+
}
|
|
71
|
+
for (const i of [...icons]) {
|
|
72
|
+
icons.push({ 48: i[48].replace(/[.](svg|png)$/, ext => ({ '.svg': '.png', '.png': '.svg' }[ext])) });
|
|
73
|
+
}
|
|
74
|
+
for (const i of [...icons]) {
|
|
75
|
+
if (i[48].endsWith('.svg')) {
|
|
76
|
+
i[96] = i[48];
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
i[96] = i[48].replace(/([.][^.]+)$/, '@2x$1');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const icon = icons.find(i => fs.existsSync(path.join(root_1.default, ...i[48].split('/'))));
|
|
83
|
+
if (icon) {
|
|
84
|
+
options_and_vars.icons = {
|
|
85
|
+
48: icon[48],
|
|
86
|
+
96: fs.existsSync(path.join(root_1.default, ...icon[96].split('/'))) ? icon[96] : icon[48],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
console.log('generating manifest.json');
|
|
90
|
+
fs.writeFileSync(path.join(root_1.default, 'build/manifest.json'), JSON.stringify({
|
|
91
|
+
manifest_version: 2,
|
|
92
|
+
name: options_and_vars.name,
|
|
93
|
+
version: options_and_vars.version,
|
|
94
|
+
description: options_and_vars.description,
|
|
95
|
+
icons: options_and_vars.icons,
|
|
96
|
+
applications: {
|
|
97
|
+
zotero: {
|
|
98
|
+
id: options_and_vars.id,
|
|
99
|
+
update_url: options_and_vars.updateURL.replace('/update.rdf', '/updates.json'),
|
|
100
|
+
strict_min_version: '6.999',
|
|
101
|
+
strict_max_version: '7.*',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
}, null, 2));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zotero-plugin",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.23",
|
|
4
4
|
"description": "Zotero plugin builder",
|
|
5
5
|
"homepage": "https://github.com/retorquere/zotero-plugin/wiki",
|
|
6
6
|
"bin": {
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"zotero-plugin-link": "bin/link.js",
|
|
10
10
|
"issue-branches": "bin/branches.js",
|
|
11
11
|
"zotero-start": "bin/start.py",
|
|
12
|
-
"fetch-zotero-log": "bin/fetch-zotero-log.py"
|
|
12
|
+
"fetch-zotero-log": "bin/fetch-zotero-log.py",
|
|
13
|
+
"zotero-keypair": "bin/keypair"
|
|
13
14
|
},
|
|
14
15
|
"author": {
|
|
15
16
|
"name": "Emiliano Heyns",
|
|
@@ -30,21 +31,22 @@
|
|
|
30
31
|
"dependencies": {
|
|
31
32
|
"@octokit/rest": "^22.0.0",
|
|
32
33
|
"@rgrove/parse-xml": "^4.2.0",
|
|
33
|
-
"@types/node": "^24.
|
|
34
|
+
"@types/node": "^24.2.1",
|
|
34
35
|
"@xmldom/xmldom": "^0.9.8",
|
|
35
36
|
"ajv": "^8.17.1",
|
|
36
37
|
"ajv-keywords": "^5.1.0",
|
|
37
38
|
"archiver": "^7.0.1",
|
|
38
39
|
"clp": "^4.0.13",
|
|
39
40
|
"commander": "^14.0.0",
|
|
40
|
-
"dotenv": "^
|
|
41
|
+
"dotenv": "^17.2.1",
|
|
41
42
|
"ejs": "^3.1.10",
|
|
42
|
-
"fs-extra": "^11.3.
|
|
43
|
+
"fs-extra": "^11.3.1",
|
|
43
44
|
"glob": "^11.0.3",
|
|
44
45
|
"jsesc": "^3.1.0",
|
|
45
46
|
"lodash": "^4.17.21",
|
|
46
47
|
"moment": "^2.30.1",
|
|
47
|
-
"
|
|
48
|
+
"openpgp": "^6.2.0",
|
|
49
|
+
"peggy": "^5.0.6",
|
|
48
50
|
"properties-reader": "^2.3.0",
|
|
49
51
|
"pug": "^3.0.3",
|
|
50
52
|
"rimraf": "^6.0.1",
|
|
@@ -53,7 +55,7 @@
|
|
|
53
55
|
"string-to-arraybuffer": "^1.0.2",
|
|
54
56
|
"ts-node": "^10.9.2",
|
|
55
57
|
"tslib": "^2.8.1",
|
|
56
|
-
"typescript": "^5.
|
|
58
|
+
"typescript": "^5.9.2",
|
|
57
59
|
"uri-templates": "^0.2.0",
|
|
58
60
|
"uzip": "^0.20201231.0",
|
|
59
61
|
"xml-parser": "^1.2.1",
|
|
@@ -80,7 +82,6 @@
|
|
|
80
82
|
"copy-assets.d.ts",
|
|
81
83
|
"copy-assets.js",
|
|
82
84
|
"error-report.pug",
|
|
83
|
-
"install.rdf.pug",
|
|
84
85
|
"loader/json.d.ts",
|
|
85
86
|
"loader/json.js",
|
|
86
87
|
"loader/peggy.d.ts",
|
|
@@ -91,11 +92,10 @@
|
|
|
91
92
|
"make-dirs.d.ts",
|
|
92
93
|
"make-dirs.js",
|
|
93
94
|
"package.json",
|
|
94
|
-
"
|
|
95
|
-
"
|
|
95
|
+
"manifest.d.ts",
|
|
96
|
+
"manifest.js",
|
|
96
97
|
"root.d.ts",
|
|
97
98
|
"root.js",
|
|
98
|
-
"update.rdf.pug",
|
|
99
99
|
"version.d.ts",
|
|
100
100
|
"version.js",
|
|
101
101
|
"debug-log.js",
|
|
@@ -109,7 +109,8 @@
|
|
|
109
109
|
"url": "https://github.com/retorquere/zotero-plugin/issues"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
|
-
"
|
|
113
|
-
"
|
|
112
|
+
"@openpgp/web-stream-tools": "^0.1.3",
|
|
113
|
+
"dprint": "^0.50.1",
|
|
114
|
+
"esbuild": "^0.25.8"
|
|
114
115
|
}
|
|
115
116
|
}
|
package/install.rdf.pug
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
doctype xml
|
|
2
|
-
RDF(xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#")
|
|
3
|
-
Description(about="urn:mozilla:install-manifest")
|
|
4
|
-
em:name= name
|
|
5
|
-
em:description= description
|
|
6
|
-
if bootstrapped
|
|
7
|
-
em:bootstrap true
|
|
8
|
-
if localizedDescriptions
|
|
9
|
-
each localizedDescription, locale in localizedDescriptions
|
|
10
|
-
Description
|
|
11
|
-
em:locale= locale
|
|
12
|
-
em:name= name
|
|
13
|
-
em:description= localizedDescription
|
|
14
|
-
em:id= id
|
|
15
|
-
em:version= version
|
|
16
|
-
em:homepageURL= homepage
|
|
17
|
-
em:creator= author.name
|
|
18
|
-
if iconURL
|
|
19
|
-
em:iconURL= iconURL
|
|
20
|
-
if updateURL
|
|
21
|
-
em:updateURL= updateURL
|
|
22
|
-
em:type 2
|
|
23
|
-
if optionsURL
|
|
24
|
-
em:optionsURL= optionsURL
|
|
25
|
-
em:targetApplication
|
|
26
|
-
Description
|
|
27
|
-
em:id zotero@chnm.gmu.edu
|
|
28
|
-
em:minVersion= minVersion
|
|
29
|
-
em:maxVersion= maxVersion
|
package/rdf.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable no-console, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/restrict-template-expressions, no-magic-numbers */
|
|
3
|
-
var _a, _b;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const fs = tslib_1.__importStar(require("fs"));
|
|
7
|
-
const glob_1 = require("glob");
|
|
8
|
-
const path = tslib_1.__importStar(require("path"));
|
|
9
|
-
const pug = tslib_1.__importStar(require("pug"));
|
|
10
|
-
const properties_reader_1 = tslib_1.__importDefault(require("properties-reader"));
|
|
11
|
-
const uri_templates_1 = tslib_1.__importDefault(require("uri-templates"));
|
|
12
|
-
const root_1 = tslib_1.__importDefault(require("./root"));
|
|
13
|
-
const version_1 = tslib_1.__importDefault(require("./version"));
|
|
14
|
-
const pkg = Object.assign({}, require(path.join(root_1.default, 'package.json')));
|
|
15
|
-
if (!pkg.id)
|
|
16
|
-
pkg.id = `${pkg.name.replace(/^zotero-/, '')}@${pkg.author.email.replace(/.*@/, '')}`.toLowerCase();
|
|
17
|
-
if (pkg.xpi)
|
|
18
|
-
Object.assign(pkg, pkg.xpi);
|
|
19
|
-
pkg.version = version_1.default;
|
|
20
|
-
if (pkg.updateLink)
|
|
21
|
-
pkg.updateLink = (0, uri_templates_1.default)(pkg.updateLink).fill({ version: pkg.version });
|
|
22
|
-
pkg.updateURL = `${pkg.xpi.releaseURL}update.rdf`;
|
|
23
|
-
const translations = (0, glob_1.globSync)(path.join(root_1.default, 'locale/*/*.properties'));
|
|
24
|
-
for (const translation of translations) {
|
|
25
|
-
const locale = path.basename(path.dirname(translation));
|
|
26
|
-
const properties = (0, properties_reader_1.default)(translation);
|
|
27
|
-
const description = properties.get('xpi.description');
|
|
28
|
-
if (!description)
|
|
29
|
-
continue;
|
|
30
|
-
if (locale === 'en-US') {
|
|
31
|
-
pkg.description = description;
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
pkg.localizedDescriptions = pkg.localizedDescriptions || {};
|
|
35
|
-
pkg.localizedDescriptions[locale] = description;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const options_and_vars = Object.assign(Object.assign({ minVersion: '6.0.9', maxVersion: '7.*' }, pkg), { pretty: true });
|
|
39
|
-
try {
|
|
40
|
-
Object.assign(options_and_vars, JSON.parse(fs.readFileSync(path.join(root_1.default, 'schema', 'supported.json'), 'utf8')));
|
|
41
|
-
}
|
|
42
|
-
catch (err) { // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
43
|
-
// ignore
|
|
44
|
-
}
|
|
45
|
-
if (options_and_vars.minVersion.match(/^6/)) {
|
|
46
|
-
let template;
|
|
47
|
-
console.log('generating install.rdf');
|
|
48
|
-
template = fs.readFileSync(path.join(__dirname, 'install.rdf.pug'), 'utf8');
|
|
49
|
-
template = pug.render(template, options_and_vars);
|
|
50
|
-
fs.writeFileSync(path.join(root_1.default, 'build/install.rdf'), template, { encoding: 'utf8' });
|
|
51
|
-
console.log('generating update.rdf');
|
|
52
|
-
template = fs.readFileSync(path.join(__dirname, 'update.rdf.pug'), 'utf8');
|
|
53
|
-
template = pug.render(template, options_and_vars);
|
|
54
|
-
fs.writeFileSync(path.join(root_1.default, 'gen/update.rdf'), template, { encoding: 'utf8' });
|
|
55
|
-
}
|
|
56
|
-
if (options_and_vars.maxVersion.match(/^7/)) {
|
|
57
|
-
console.log('generating updates.json');
|
|
58
|
-
fs.writeFileSync(path.join(root_1.default, 'gen/updates.json'), JSON.stringify({
|
|
59
|
-
addons: {
|
|
60
|
-
[pkg.id]: {
|
|
61
|
-
updates: [
|
|
62
|
-
{
|
|
63
|
-
version: options_and_vars.version,
|
|
64
|
-
update_link: options_and_vars.updateLink,
|
|
65
|
-
applications: {
|
|
66
|
-
zotero: {
|
|
67
|
-
strict_min_version: options_and_vars.minVersion.match(/^7/) ? options_and_vars.minVersion : '6.999',
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
}, null, 2));
|
|
75
|
-
const icons = [
|
|
76
|
-
{ 48: (_b = (_a = pkg.xpi) === null || _a === void 0 ? void 0 : _a.iconURL) === null || _b === void 0 ? void 0 : _b.replace(/^chrome:\/\/[^/]+\//, '') },
|
|
77
|
-
].filter(i => i[48]);
|
|
78
|
-
const basename = pkg.id.replace(/@.*/, '');
|
|
79
|
-
for (const i of [`content/skin/${basename}.png`, `skin/${basename}.png`, `${basename}.png`, 'icon.png']) {
|
|
80
|
-
icons.push({ 48: i });
|
|
81
|
-
icons.push({ 48: i.replace('/zotero-', '/') });
|
|
82
|
-
}
|
|
83
|
-
for (const i of [...icons]) {
|
|
84
|
-
icons.push({ 48: i[48].replace(/[.](svg|png)$/, ext => ({ '.svg': '.png', '.png': '.svg' }[ext])) });
|
|
85
|
-
}
|
|
86
|
-
for (const i of [...icons]) {
|
|
87
|
-
if (i[48].endsWith('.svg')) {
|
|
88
|
-
i[96] = i[48];
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
i[96] = i[48].replace(/([.][^.]+)$/, '@2x$1');
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
const icon = icons.find(i => fs.existsSync(path.join(root_1.default, ...i[48].split('/'))));
|
|
95
|
-
if (icon) {
|
|
96
|
-
options_and_vars.icons = {
|
|
97
|
-
48: icon[48],
|
|
98
|
-
96: fs.existsSync(path.join(root_1.default, ...icon[96].split('/'))) ? icon[96] : icon[48],
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
console.log('generating manifest.json');
|
|
102
|
-
fs.writeFileSync(path.join(root_1.default, 'build/manifest.json'), JSON.stringify({
|
|
103
|
-
manifest_version: 2,
|
|
104
|
-
name: options_and_vars.name,
|
|
105
|
-
version: options_and_vars.version,
|
|
106
|
-
description: options_and_vars.description,
|
|
107
|
-
icons: options_and_vars.icons,
|
|
108
|
-
applications: {
|
|
109
|
-
zotero: {
|
|
110
|
-
id: options_and_vars.id,
|
|
111
|
-
update_url: options_and_vars.updateURL.replace('/update.rdf', '/updates.json'),
|
|
112
|
-
strict_min_version: '6.999',
|
|
113
|
-
strict_max_version: '7.*',
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
}, null, 2));
|
|
117
|
-
}
|
package/update.rdf.pug
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
doctype xml
|
|
2
|
-
RDF:RDF(xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#")
|
|
3
|
-
RDF:Description(about=`urn:mozilla:extension:${id}`)
|
|
4
|
-
em:updates
|
|
5
|
-
RDF:Seq
|
|
6
|
-
RDF:li
|
|
7
|
-
RDF:Description
|
|
8
|
-
em:version= version
|
|
9
|
-
em:targetApplication
|
|
10
|
-
RDF:Description
|
|
11
|
-
em:id zotero@chnm.gmu.edu
|
|
12
|
-
em:minVersion= minVersion
|
|
13
|
-
em:maxVersion= maxVersion
|
|
14
|
-
em:updateLink= updateLink
|
|
15
|
-
if updateInfoURL
|
|
16
|
-
em:updateInfoURL= updateInfoURL
|
|
17
|
-
em:targetApplication
|
|
18
|
-
RDF:Description
|
|
19
|
-
em:id juris-m@juris-m.github.io
|
|
20
|
-
em:minVersion= minVersion
|
|
21
|
-
em:maxVersion= maxVersion
|
|
22
|
-
em:updateLink= updateLink
|
|
23
|
-
if updateInfoURL
|
|
24
|
-
em:updateInfoURL= updateInfoURL
|
|
File without changes
|