From f9102d92546e3bb0a6d0f79278853d9a9dbe24e9 Mon Sep 17 00:00:00 2001 From: Emiliano Heyns Date: Sat, 30 Dec 2023 03:03:54 +0100 Subject: [PATCH] starts but too many menu entries --- bootstrap.ts | 26 ++++++++++++++------------ lib.ts | 12 +++++++++++- package.json | 3 ++- zotero-plugin.ini | 6 +++--- 4 files changed, 30 insertions(+), 17 deletions(-) diff --git a/bootstrap.ts b/bootstrap.ts index 282facc..0c9f308 100644 --- a/bootstrap.ts +++ b/bootstrap.ts @@ -99,24 +99,26 @@ export async function install(): Promise { export async function startup({ id, version, resourceURI, rootURI = resourceURI.spec }): Promise { await waitForZotero() - log('Starting') + try { + log('Starting') - // 'Services' may not be available in Zotero 6 - if (typeof Services == 'undefined') { - // eslint-disable-next-line @typescript-eslint/no-shadow - var { Services } = ChromeUtils.import('resource://gre/modules/Services.jsm') - } + // 'Services' may not be available in Zotero 6 + if (typeof Services == 'undefined') { + // eslint-disable-next-line @typescript-eslint/no-shadow + var { Services } = ChromeUtils.import('resource://gre/modules/Services.jsm') + } - // Read prefs from prefs.js when the plugin in Zotero 6 - if (Zotero.platformMajorVersion < 102) { // eslint-disable-line @typescript-eslint/no-magic-numbers - setDefaultPrefs(rootURI) - } + // Read prefs from prefs.js when the plugin in Zotero 6 + /* + if (Zotero.platformMajorVersion < 102) { // eslint-disable-line @typescript-eslint/no-magic-numbers + setDefaultPrefs(rootURI) + } + */ - // Add DOM elements to the main Zotero pane - try { log('loading lib') Services.scriptloader.loadSubScript(`${rootURI}lib.js`, { Zotero }) Zotero.EdTechHub.startup() + log('Started') } catch (err) { log(`EdTechHub: startup error: ${err}`) diff --git a/lib.ts b/lib.ts index dc2e699..165f3cf 100644 --- a/lib.ts +++ b/lib.ts @@ -143,7 +143,6 @@ function debug(msg, err = null) { } else { Zotero.debug(`EdTechHub: ${msg}`) - } } @@ -324,6 +323,17 @@ class EdTechHubMain { } async startup() { + try { + debug('starting...') + await this.start_up() + debug('started') + } + catch (err) { + debug('failed to start', err) + } + } + + async start_up() { const ready = Zotero.Promise.defer() this.ready = ready.promise diff --git a/package.json b/package.json index b14d0f9..4e6d728 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "name": "EdTechHub for Zotero", "updateLink": "https://github.com/edtechhub/zotero-edtechhub/releases/download/v{version}/zotero-edtechhub-{version}.xpi", "releaseURL": "https://github.com/edtechhub/zotero-edtechhub/releases/download/release/", - "iconURL": "chrome://zotero-edtechhub/skin/edtechhub.png" + "iconURL": "chrome://zotero-edtechhub/skin/edtechhub.png", + "bootstrapped": true }, "devDependencies": { "@fluent/syntax": "^0.19.0", diff --git a/zotero-plugin.ini b/zotero-plugin.ini index c36b131..3cac77e 100644 --- a/zotero-plugin.ini +++ b/zotero-plugin.ini @@ -1,9 +1,9 @@ [profile] -name = BBTZ5TEST -path = ~/.BBTZ5TEST +name = BBTTEST +path = ~/.BBTTEST [zotero] -log = ~/.BBTZ5TEST.log +log = ~/.BBTTEST.log # db = zotero.sqlite # [preferences]