Include domain in insecure-connection error

This commit is contained in:
Dan Stillman 2024-04-02 05:50:42 -04:00 committed by Dan Stillman
parent 35aaa013ed
commit 423393c78b
2 changed files with 11 additions and 10 deletions

View file

@ -1269,16 +1269,19 @@ Zotero.HTTP = new function() {
let dialogButtonCallback; let dialogButtonCallback;
if (state !== 'secure') { if (state !== 'secure') {
if (state === 'broken' || state === 'insecure') { if (state === 'broken' || state === 'insecure') {
msg = errorMessage ?? channel.securityInfo?.errorCodeString ?? ''; let domain = channel.originalURI?.host ?? '';
msg = Zotero.getString('networkError.insecureConnectionTo', [Zotero.appName, domain])
+ "\n\n";
if (channel.originalURI?.spec.includes(ZOTERO_CONFIG.DOMAIN_NAME) if (channel.originalURI?.spec.includes(ZOTERO_CONFIG.DOMAIN_NAME)
|| channel.originalURI?.spec.includes(ZOTERO_CONFIG.PROXY_AUTH_URL.match(/^https:\/\/([^\/]+)\//)[1])) { || channel.originalURI?.spec.includes(ZOTERO_CONFIG.PROXY_AUTH_URL.match(/^https:\/\/([^\/]+)\//)[1])) {
msg = Zotero.getString('networkError.connectionMonitored', Zotero.appName) msg += Zotero.getString('networkError.connectionMonitored', Zotero.appName)
+ "\n\n" + "\n\n"
+ (isProxyAuthRequest + (isProxyAuthRequest
? Zotero.getString('startupError.internetFunctionalityMayNotWork') + "\n\n" ? Zotero.getString('startupError.internetFunctionalityMayNotWork') + "\n\n"
: "") : "");
+ msg;
} }
msg += errorMessage ?? channel.securityInfo?.errorCodeString ?? '';
msg = msg.trim();
dialogButtonText = Zotero.getString('general.moreInformation'); dialogButtonText = Zotero.getString('general.moreInformation');
dialogButtonCallback = function () { dialogButtonCallback = function () {
Zotero.launchURL('https://www.zotero.org/support/kb/ssl_certificate_error'); Zotero.launchURL('https://www.zotero.org/support/kb/ssl_certificate_error');
@ -1288,10 +1291,7 @@ Zotero.HTTP = new function() {
throw new Zotero.HTTP.SecurityException( throw new Zotero.HTTP.SecurityException(
msg, msg,
{ {
dialogHeader: Zotero.getString( dialogHeader: Zotero.getString('networkError.connectionNotSecure'),
'networkError.connectionNotSecure',
Zotero.clientName
),
dialogButtonText, dialogButtonText,
dialogButtonCallback dialogButtonCallback
} }

View file

@ -115,7 +115,8 @@ general.operationInProgress = A Zotero operation is currently in progress.
general.operationInProgress.waitUntilFinished = Please wait until it has finished. general.operationInProgress.waitUntilFinished = Please wait until it has finished.
general.operationInProgress.waitUntilFinishedAndTryAgain = Please wait until it has finished and try again. general.operationInProgress.waitUntilFinishedAndTryAgain = Please wait until it has finished and try again.
networkError.connectionNotSecure = %S could not make a secure connection. networkError.connectionNotSecure = Insecure Connection
networkError.insecureConnectionTo = %S could not make a secure connection to %S.
networkError.errorViaProxy = Error connecting via proxy server networkError.errorViaProxy = Error connecting via proxy server
networkError.connectionMonitored = Your connection is likely being monitored, and %S has not been configured to trust the intermediate server. networkError.connectionMonitored = Your connection is likely being monitored, and %S has not been configured to trust the intermediate server.