Skip to content

Commit

Permalink
Merge branch 'master' into gh-3102
Browse files Browse the repository at this point in the history
  • Loading branch information
retorquere committed Jan 7, 2025
2 parents f8a2945 + 51c37e8 commit df7fe7d
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 37 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Better BibTeX (BBT) is an extension for [Zotero](https://www.zotero.org) and [Ju

## Zotero 7 support

Better BibTeX is mostly compatible with the Zotero 7 beta; I am awaiting a change by the Zotero team to get to complete support. You can find the status of Zotero 7 support in the first post of [#2522](https://github.com/retorquere/zotero-better-bibtex/issues/2522); if you find new problems (which are not still marked as unresolved in that top post), please report them as *new* issues, not by commenting on #2522.
I have begun the process of deprecating Zotero 6 support. I'm still putting the infrastructure for than in place, but as of now, only Zotero7 and Zotero7 beta get new functionality, and Zotero 6 support (available at https://github.com/retorquere/zotero-better-bibtex/releases/tag/v6.7.267) is in maintenance mode.

## Juris-M support

Expand Down
22 changes: 15 additions & 7 deletions content/ErrorReport.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
Components.utils.import('resource://gre/modules/Services.jsm')
/*
declare var Services: any
if (typeof Services == 'undefined') {
var { Services } = ChromeUtils.import('resource://gre/modules/Services.jsm') // eslint-disable-line no-var
}
*/

import * as client from './client'

Expand Down Expand Up @@ -28,8 +33,6 @@ import { alert } from './prompt'

import * as s3 from './s3.json'

import * as PACKAGE from '../package.json'

const kB = 1024

type WizardButton = HTMLElement & { disabled: boolean }
Expand Down Expand Up @@ -139,11 +142,11 @@ export class ErrorReport {
if (index === 0) Zotero.Utilities.Internal.quit(true)
}

private async latest() {
private async latest(): Promise<string> {
try {
const latest = PACKAGE.xpi.releaseURL.replace('https://github.com/', 'https://api.github.com/repos/').replace(/\/releases\/.*/, '/releases/latest')
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return JSON.parse((await Zotero.HTTP.request('GET', latest, { noCache: true })).response).tag_name.replace('v', '')
const latest = JSON.parse((await Zotero.HTTP.request('GET', 'https://github.com/retorquere/zotero-better-bibtex/releases/download/release/updates.json', { noCache: true })).response)
return latest.addons['[email protected]'].updates[0].version as string
}
catch (err) {
log.error('errorreport.latest:', err)
Expand Down Expand Up @@ -434,7 +437,12 @@ export class ErrorReport {
context += 'Settings:\n'
const settings = { default: '', set: '' }
for (const [ key, value ] of Object.entries(Preference.all)) {
settings[value === defaults[key] ? 'default' : 'set'] += ` ${ key } = ${ JSON.stringify(value) }\n`
if (value === defaults[key]) {
settings.default += ` ${key} = ${ JSON.stringify(value) }\n`
}
else {
settings.set += ` ${key} = ${JSON.stringify(value)} (default: ${JSON.stringify(defaults[key])})\n`
}
}
if (settings.default) settings.default = `Settings at default:\n${ settings.default }`
context += settings.set + settings.default
Expand Down
7 changes: 6 additions & 1 deletion content/Preferences.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
Components.utils.import('resource://gre/modules/Services.jsm')
/*
declare var Services: any
if (typeof Services == 'undefined') {
var { Services } = ChromeUtils.import('resource://gre/modules/Services.jsm') // eslint-disable-line no-var
}
*/

import { Shim } from './os'
import * as client from './client'
Expand Down
7 changes: 6 additions & 1 deletion content/key-manager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
Components.utils.import('resource://gre/modules/Services.jsm')
/*
declare var Services: any
if (typeof Services == 'undefined') {
var { Services } = ChromeUtils.import('resource://gre/modules/Services.jsm') // eslint-disable-line no-var
}
*/

import { orchestrator } from './orchestrator'

Expand Down
13 changes: 7 additions & 6 deletions content/key-manager/chinese.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/*
declare var Services: any
if (typeof Services == 'undefined') {
var { Services } = ChromeUtils.import('resource://gre/modules/Services.jsm') // eslint-disable-line no-var
}
*/

import { Preference } from '../prefs'
import { Events } from '../events'
// import { CJK } from '../text'
import { discard } from '../logger'

declare const ChromeUtils: any

if (typeof Services == 'undefined') {
var { Services } = ChromeUtils.import('resource://gre/modules/Services.jsm') // eslint-disable-line no-var
}

import type { jieba as jiebaFunc, pinyin as pinyinFunc } from './chinese-optional'

// Replace the console object with the empty shim
Expand Down
9 changes: 7 additions & 2 deletions content/translators.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
/* eslint-disable no-case-declarations, @typescript-eslint/no-unsafe-return */

/*
declare var Services: any
if (typeof Services == 'undefined') {
var { Services } = ChromeUtils.import('resource://gre/modules/Services.jsm') // eslint-disable-line no-var
}
*/

import { Shim } from './os'
import * as client from './client'
const $OS = client.is7 ? Shim : OS
Expand Down Expand Up @@ -33,8 +40,6 @@ async function guard(run: Promise<void>): Promise<boolean> {
}
*/

Components.utils.import('resource://gre/modules/Services.jsm')

declare class ChromeWorker extends Worker { }

Components.utils.import('resource://zotero/config.js')
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zotero-better-bibtex",
"version": "7.0.0",
"version": "7.0.2",
"description": "Make Zotero useful for us LaTeX holdouts.",
"homepage": "https://retorque.re/zotero-better-bibtex",
"license": "ISC",
Expand All @@ -15,9 +15,7 @@
"updateLink": "https://github.com/retorquere/zotero-better-bibtex/releases/download/v{version}/zotero-better-bibtex-{version}.xpi",
"updateInfoURL": "https://github.com/retorquere/zotero-better-bibtex/releases/latest",
"releaseURL": "https://github.com/retorquere/zotero-better-bibtex/releases/download/release/",
"update": {
"updates.json": true
}
"minVersion": "7.*"
},
"scripts": {
"changelog": "auto-changelog",
Expand Down Expand Up @@ -125,7 +123,7 @@
"uzip": "^0.20201231.0",
"words-to-numbers": "^1.5.1",
"xregexp": "^5.1.1",
"zotero-plugin": "4.0.2"
"zotero-plugin": "5.0.1"
},
"devDependencies": {
"@retorquere/bibtex-parser": "^9.0.17",
Expand Down
2 changes: 2 additions & 0 deletions setup/release-message.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
This release is compatible with Zotero 7 and Zotero 7 beta. The last version of BBT that is compatible with Zotero 6 can be found at https://github.com/retorquere/zotero-better-bibtex/releases/tag/v6.7.267. Zotero 6 support is in maintenance mode.

If you use Firefox, make sure to right-click and save the XPI file, not just clicking it.

You can verify you are on the latest version by going into 'Tools' -> 'Addons' in Zotero/Juris-M, clicking the gear icon, and selecting 'Check for updates'
2 changes: 1 addition & 1 deletion submodules/zotero
6 changes: 0 additions & 6 deletions test/fixtures/debug-bridge/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ async function waitForZotero() {
return
}

var { Services } = ChromeUtils.import('resource://gre/modules/Services.jsm')
var windows = Services.wm.getEnumerator('navigator:browser')
var found = false
while (windows.hasMoreElements()) {
Expand Down Expand Up @@ -149,11 +148,6 @@ async function startup({ resourceURI, rootURI = resourceURI.spec }, reason) {
log(`async:startup:start, Zotero: ${typeof Zotero !== 'undefined'}`)
await waitForZotero()

// 'Services' may not be available in Zotero 6
if (typeof Services == 'undefined') {
var { Services } = ChromeUtils.import('resource://gre/modules/Services.jsm')
}

// Read prefs from prefs.js when the plugin in Zotero 6
if (Zotero.platformMajorVersion < 102) {
setDefaultPrefs(rootURI)
Expand Down
3 changes: 2 additions & 1 deletion typings/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@ type ZoteroObject = GlobalBBT & Omit<Record<string, any>, keyof GlobalBBT>
declare const Zotero: ZoteroObject

declare const Components: any
declare const Services: any
declare const rootURI: string
declare const ChromeUtils: any
declare const Services: any

0 comments on commit df7fe7d

Please sign in to comment.