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 817ca999e3
commit 47c939561c
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.icon = "chrome://zotero/skin/locate-library-lookup.png";
this.canHandleItem = function (item) { return Zotero.Promise.resolve(item.isRegularItem()); }; this.canHandleItem = function (item) { return Zotero.Promise.resolve(item.isRegularItem()); };
this.handleItems = Zotero.Promise.method(function (items, event) { 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')) { 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 = []; var urls = [];
for (let item of items) { for (let item of items) {

View file

@ -30,8 +30,6 @@ Components.utils.import("resource://gre/modules/osfile.jsm");
import FilePicker from 'zotero/modules/filePicker'; import FilePicker from 'zotero/modules/filePicker';
Zotero_Preferences.General = { Zotero_Preferences.General = {
DEFAULT_OPENURL_RESOLVER: 'https://www.worldcat.org/registry/gateway',
_openURLResolvers: null, _openURLResolvers: null,
init: function () { init: function () {
@ -255,12 +253,6 @@ Zotero_Preferences.General = {
var menupopup = openURLMenu.firstChild; var menupopup = openURLMenu.firstChild;
menupopup.innerHTML = ''; menupopup.innerHTML = '';
var defaultMenuItem = document.createXULElement('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.createXULElement('menuitem'); var customMenuItem = document.createXULElement('menuitem');
customMenuItem.setAttribute('label', Zotero.getString('general.custom')); customMenuItem.setAttribute('label', Zotero.getString('general.custom'));
customMenuItem.setAttribute('value', 'custom'); customMenuItem.setAttribute('value', 'custom');
@ -314,13 +306,8 @@ Zotero_Preferences.General = {
} }
} }
// Default // From directory
if (currentResolver == this.DEFAULT_OPENURL_RESOLVER) { if (selectedName) {
openURLMenu.setAttribute('label', Zotero.getString('general.default'));
defaultMenuItem.setAttribute('checked', true);
Zotero.Prefs.clear('openURL.name');
}
else if (selectedName) {
openURLMenu.setAttribute('label', selectedName); openURLMenu.setAttribute('label', selectedName);
// If we found a match, update stored name // If we found a match, update stored name
Zotero.Prefs.set('openURL.name', selectedName); Zotero.Prefs.set('openURL.name', selectedName);
@ -348,15 +335,8 @@ Zotero_Preferences.General = {
var openURLServerField = document.getElementById('openURLServerField'); var openURLServerField = document.getElementById('openURLServerField');
var openURLVersionMenu = document.getElementById('openURLVersionMenu'); 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 // If "Custom" selected, clear URL field
else if (event.target.value == "custom") { if (event.target.value == "custom") {
Zotero.Prefs.clear('openURL.name'); Zotero.Prefs.clear('openURL.name');
Zotero.Prefs.set('openURL.resolver', ''); Zotero.Prefs.set('openURL.resolver', '');
Zotero.Prefs.clear('openURL.version'); Zotero.Prefs.clear('openURL.version');

View file

@ -1208,6 +1208,8 @@ locate.externalViewer.label = Open in External Viewer
locate.internalViewer.label = Open in Internal Viewer locate.internalViewer.label = Open in Internal Viewer
locate.showFile.label = Show File locate.showFile.label = Show File
locate.libraryLookup.label = Library Lookup 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.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. 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

@ -22,7 +22,7 @@ pref("extensions.zotero.automaticScraperUpdates",true);
pref("extensions.zotero.triggerProxyAuthentication", 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) // 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.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.openURL.version","1.0");
pref("extensions.zotero.automaticSnapshots",true); pref("extensions.zotero.automaticSnapshots",true);
pref("extensions.zotero.downloadAssociatedFiles",true); pref("extensions.zotero.downloadAssociatedFiles",true);