Remove default OpenURL gateway

https://www.worldcat.org/registry/gateway is no longer supported -- see
https://forums.zotero.org/discussion/comment/418373/#Comment_418373 for
details

If no resolver is selected, show an error on "Library Lookup" with a
button to open the prefs.
This commit is contained in:
Dan Stillman 2022-09-30 15:52:56 -04:00
parent 64047f181a
commit 99084084d4
4 changed files with 22 additions and 26 deletions

View file

@ -589,9 +589,23 @@ var Zotero_LocateMenu = new function() {
this.icon = "chrome://zotero/skin/locate-library-lookup.png";
this.canHandleItem = function (item) { return Zotero.Promise.resolve(item.isRegularItem()); };
this.handleItems = Zotero.Promise.method(function (items, event) {
// If no resolver configured, just switch to the default
// If no resolver configured, show error
if (!Zotero.Prefs.get('openURL.resolver')) {
Zotero.Prefs.clear('openURL.resolver')
let ps = Services.prompt;
let buttonFlags = (ps.BUTTON_POS_0) * (ps.BUTTON_TITLE_IS_STRING)
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_CANCEL);
let index = ps.confirmEx(
null,
Zotero.getString('locate.libraryLookup.noResolver.title'),
Zotero.getString('locate.libraryLookup.noResolver.text', Zotero.appName),
buttonFlags,
Zotero.getString('general.openPreferences'),
null, null, null, {}
);
if (index == 0) {
Zotero.Utilities.Internal.openPreferences('zotero-prefpane-advanced');
}
return;
}
var urls = [];
for (let item of items) {

View file

@ -27,8 +27,6 @@ Components.utils.import("resource://gre/modules/Services.jsm");
import FilePicker from 'zotero/modules/filePicker';
Zotero_Preferences.Advanced = {
DEFAULT_OPENURL_RESOLVER: 'https://www.worldcat.org/registry/gateway',
_openURLResolvers: null,
init: function () {
@ -462,12 +460,6 @@ Zotero_Preferences.Advanced = {
var menupopup = openURLMenu.firstChild;
menupopup.innerHTML = '';
var defaultMenuItem = document.createElement('menuitem');
defaultMenuItem.setAttribute('label', Zotero.getString('general.default'));
defaultMenuItem.setAttribute('value', this.DEFAULT_OPENURL_RESOLVER);
defaultMenuItem.setAttribute('type', 'checkbox');
menupopup.appendChild(defaultMenuItem);
var customMenuItem = document.createElement('menuitem');
customMenuItem.setAttribute('label', Zotero.getString('general.custom'));
customMenuItem.setAttribute('value', 'custom');
@ -521,13 +513,8 @@ Zotero_Preferences.Advanced = {
}
}
// Default
if (currentResolver == this.DEFAULT_OPENURL_RESOLVER) {
openURLMenu.setAttribute('label', Zotero.getString('general.default'));
defaultMenuItem.setAttribute('checked', true);
Zotero.Prefs.clear('openURL.name');
}
else if (selectedName) {
// From directory
if (selectedName) {
openURLMenu.setAttribute('label', selectedName);
// If we found a match, update stored name
Zotero.Prefs.set('openURL.name', selectedName);
@ -555,15 +542,8 @@ Zotero_Preferences.Advanced = {
var openURLServerField = document.getElementById('openURLServerField');
var openURLVersionMenu = document.getElementById('openURLVersionMenu');
// Default
if (event.target.value == this.DEFAULT_OPENURL_RESOLVER) {
Zotero.Prefs.clear('openURL.name');
Zotero.Prefs.clear('openURL.resolver');
Zotero.Prefs.clear('openURL.version');
openURLServerField.value = this.DEFAULT_OPENURL_RESOLVER;
}
// If "Custom" selected, clear URL field
else if (event.target.value == "custom") {
if (event.target.value == "custom") {
Zotero.Prefs.clear('openURL.name');
Zotero.Prefs.set('openURL.resolver', '');
Zotero.Prefs.clear('openURL.version');

View file

@ -1212,6 +1212,8 @@ locate.externalViewer.label = Open in External Viewer
locate.internalViewer.label = Open in Internal Viewer
locate.showFile.label = Show File
locate.libraryLookup.label = Library Lookup
locate.libraryLookup.noResolver.title = No OpenURL Resolver
locate.libraryLookup.noResolver.text = You must choose an OpenURL resolver from the Advanced pane of the %S preferences.
locate.manageLocateEngines = Manage Lookup Engines…
locate.locateEngineDescription = Lookup engines help you find resources in your %S library on the web. Engines enabled in this list appear in the Locate drop-down in the toolbar.

View file

@ -23,7 +23,7 @@ pref("extensions.zotero.automaticScraperUpdates",true);
pref("extensions.zotero.triggerProxyAuthentication", true);
// Proxy auth URLs should respond successfully to HEAD requests over HTTP and HTTPS (in case of forced HTTPS requests)
pref("extensions.zotero.proxyAuthenticationURLs", "https://www.acm.org,https://www.ebscohost.com,https://www.sciencedirect.com,https://ieeexplore.ieee.org,https://www.jstor.org,http://www.ovid.com,https://link.springer.com,https://www.tandfonline.com");
pref("extensions.zotero.openURL.resolver","https://www.worldcat.org/registry/gateway");
pref("extensions.zotero.openURL.resolver","");
pref("extensions.zotero.openURL.version","1.0");
pref("extensions.zotero.automaticSnapshots",true);
pref("extensions.zotero.downloadAssociatedFiles",true);