Skip to content

Commit 66df328

Browse files
committed
osfile shim apparently dropped from Zotero 7 release
1 parent 5b3c7d4 commit 66df328

File tree

4 files changed

+433
-15
lines changed

4 files changed

+433
-15
lines changed

.eslintrc.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"default": "array"
3131
}
3232
],
33+
"@typescript-eslint/no-magic-numbers": "off",
3334
"@typescript-eslint/await-thenable": "error",
3435
"@typescript-eslint/ban-ts-comment": "warn",
3536
"@typescript-eslint/ban-types": "off",
@@ -199,10 +200,6 @@
199200
"no-invalid-this": "off",
200201
"no-irregular-whitespace": "error",
201202
"no-magic-numbers": "off",
202-
"@typescript-eslint/no-magic-numbers": [ "error", {
203-
"ignore": [ -1, 0, 1, 2 ],
204-
"ignoreEnums": true
205-
}],
206203
"no-new-wrappers": "error",
207204
"no-redeclare": "error",
208205
"no-throw-literal": "error",

esbuild.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ async function bundle(config) {
8181
}
8282

8383
async function build() {
84+
8485
await bundle({
8586
exportGlobals: true,
8687
entryPoints: [ 'bootstrap.ts' ],

lib.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
declare const Zotero: any
22
declare const Components: any
33
declare const Services: any
4+
declare let OS: any
5+
6+
import { OS as $OS } from './osfile'
7+
if (typeof OS === 'undefined') OS = $OS
48

59
const l10n = require('./locale/en-US/zotero-edtechhub.ftl')
610

@@ -22,9 +26,6 @@ var EdTechHub: EdTechHubMain // eslint-disable-line no-var
2226
import { DebugLog as DebugLogSender } from 'zotero-plugin/debug-log'
2327
import { patch as $patch$, unpatch as $unpatch$ } from './monkey-patch'
2428

25-
Components.utils.import('resource://gre/modules/osfile.jsm')
26-
declare const OS: any
27-
2829
import sanitize_filename = require('sanitize-filename')
2930

3031
function flash(title, body = null, timeout = 8) { // eslint-disable-line @typescript-eslint/no-magic-numbers
@@ -420,16 +421,17 @@ class EdTechHubMain {
420421
return merged // eslint-disable-line @typescript-eslint/no-unsafe-return
421422
})
422423

423-
const addons = await Zotero.getInstalledExtensions()
424-
// if (!addons.find(addon => addon.startsWith('Zotero DOI Manager '))) {
425-
// flash('Zotero-ShortDOI not installed', 'The short-doi plugin is not available, please install it from https://github.com/bwiernik/zotero-shortdoi')
426-
// }
427-
if (!addons.find((addon: string) => addon.startsWith('ZotFile '))) {
428-
flash('ZotFile not installed', 'The ZotFile plugin is not available, please install it from http://zotfile.com/')
424+
/*
425+
const checks = {
426+
'Zotero DOI Manager ': [ 'Zotero-ShortDOI not installed', 'The short-doi plugin is not available, please install it from https://github.com/bwiernik/zotero-shortdoi' ],
427+
'ZotFile ': [ 'ZotFile not installed', 'The ZotFile plugin is not available, please install it from http://zotfile.com/' ],
428+
'Zutilo Utility for Zotero ': [ 'Zutilo not installed', 'The Zutilo plugin is not available, please install it from https://github.com/willsALMANJ/Zutilo' ],
429429
}
430-
if (!addons.find((addon: string) => addon.startsWith('Zutilo Utility for Zotero '))) {
431-
flash('Zutilo not installed', 'The Zutilo plugin is not available, please install it from https://github.com/willsALMANJ/Zutilo')
430+
const addons = await Zotero.getInstalledExtensions()
431+
for (const [ name, [ title, body ] ] of Object.entries(checks)) {
432+
if (!addons.find((addon: string) => addon.startsWith(name))) flash(title, body)
432433
}
434+
*/
433435

434436
try {
435437
debug('installing translators')

0 commit comments

Comments
 (0)