Display "Load WebDAV URL" button in Verify Server error
Allows for easier Standalone cert override (I hope -- not yet tested)
This commit is contained in:
parent
0456e5d3be
commit
fe97d33e38
3 changed files with 90 additions and 15 deletions
|
@ -1095,11 +1095,7 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.checkServerCallback = function (uri
|
||||||
|
|
||||||
// If there's an error, just display that
|
// If there's an error, just display that
|
||||||
if (e) {
|
if (e) {
|
||||||
promptService.alert(
|
Zotero.Utilities.Internal.errorPrompt(Zotero.getString('general.error'), e);
|
||||||
window,
|
|
||||||
Zotero.getString('general.error'),
|
|
||||||
e.toString()
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1645,9 +1641,11 @@ Zotero.Sync.Storage.Session.WebDAV.prototype._checkResponse = function (req, obj
|
||||||
if (!channel instanceof Ci.nsIChannel) {
|
if (!channel instanceof Ci.nsIChannel) {
|
||||||
obj.onError('No HTTPS channel available');
|
obj.onError('No HTTPS channel available');
|
||||||
}
|
}
|
||||||
|
|
||||||
var secInfo = channel.securityInfo;
|
var secInfo = channel.securityInfo;
|
||||||
if (secInfo instanceof Ci.nsITransportSecurityInfo) {
|
if (secInfo instanceof Ci.nsITransportSecurityInfo) {
|
||||||
secInfo.QueryInterface(Ci.nsITransportSecurityInfo);
|
secInfo.QueryInterface(Ci.nsITransportSecurityInfo);
|
||||||
|
|
||||||
if ((secInfo.securityState & Ci.nsIWebProgressListener.STATE_IS_INSECURE) == Ci.nsIWebProgressListener.STATE_IS_INSECURE) {
|
if ((secInfo.securityState & Ci.nsIWebProgressListener.STATE_IS_INSECURE) == Ci.nsIWebProgressListener.STATE_IS_INSECURE) {
|
||||||
var host = 'host';
|
var host = 'host';
|
||||||
try {
|
try {
|
||||||
|
@ -1657,20 +1655,40 @@ Zotero.Sync.Storage.Session.WebDAV.prototype._checkResponse = function (req, obj
|
||||||
Zotero.debug(e);
|
Zotero.debug(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
var msg = Zotero.localeJoin([
|
var msg = Zotero.getString('sync.storage.error.webdav.sslCertificateError', host)
|
||||||
Zotero.getString('sync.storage.error.webdav.sslCertificateError', host),
|
+ " " + Zotero.getString('sync.storage.error.webdav.loadURLForMoreInfo');
|
||||||
Zotero.getString('sync.storage.error.webdav.loadURLForMoreInfo')
|
var e = new Zotero.Error(
|
||||||
]);
|
msg,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
dialogText: msg,
|
||||||
|
dialogButtonText: Zotero.getString('sync.storage.error.webdav.loadURL'),
|
||||||
|
dialogButtonCallback: function () {
|
||||||
|
var zp = Zotero.getActiveZoteroPane();
|
||||||
|
zp.loadURI(channel.URI.spec, { shiftKey: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
obj.onError(msg);
|
obj.onError(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if ((secInfo.securityState & Ci.nsIWebProgressListener.STATE_IS_BROKEN) == Ci.nsIWebProgressListener.STATE_IS_BROKEN) {
|
else if ((secInfo.securityState & Ci.nsIWebProgressListener.STATE_IS_BROKEN) == Ci.nsIWebProgressListener.STATE_IS_BROKEN) {
|
||||||
var msg = Zotero.localeJoin([
|
var msg = Zotero.getString('sync.storage.error.webdav.sslConnectionError', host) +
|
||||||
Zotero.getString('sync.storage.error.webdav.sslConnectionError', host),
|
Zotero.getString('sync.storage.error.webdav.loadURLForMoreInfo');
|
||||||
Zotero.getString('sync.storage.error.webdav.loadURLForMoreInfo')
|
var e = new Zotero.Error(
|
||||||
]);
|
msg,
|
||||||
obj.onError(msg);
|
0,
|
||||||
|
{
|
||||||
|
dialogText: msg,
|
||||||
|
dialogButtonText: Zotero.getString('sync.storage.error.webdav.loadURL'),
|
||||||
|
dialogButtonCallback: function () {
|
||||||
|
var zp = Zotero.getActiveZoteroPane();
|
||||||
|
zp.loadURI(channel.URI.spec, { shiftKey: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
obj.onError(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,62 @@ Zotero.Utilities.Internal = {
|
||||||
ascii.push(String.fromCharCode(tens + (tens > 9 ? 87 : 48)) + String.fromCharCode(ones + (ones > 9 ? 87 : 48)));
|
ascii.push(String.fromCharCode(tens + (tens > 9 ? 87 : 48)) + String.fromCharCode(ones + (ones > 9 ? 87 : 48)));
|
||||||
}
|
}
|
||||||
return ascii.join('');
|
return ascii.join('');
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a prompt from an error with custom buttons and a callback
|
||||||
|
*/
|
||||||
|
"errorPrompt":function(title, e) {
|
||||||
|
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||||
|
.getService(Components.interfaces.nsIPromptService);
|
||||||
|
var message, buttonText, buttonCallback;
|
||||||
|
|
||||||
|
if (e.data) {
|
||||||
|
if (e.data.dialogText) {
|
||||||
|
message = e.data.dialogText;
|
||||||
|
}
|
||||||
|
if (typeof e.data.dialogButtonText != 'undefined') {
|
||||||
|
buttonText = e.data.dialogButtonText;
|
||||||
|
buttonCallback = e.data.dialogButtonCallback;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!message) {
|
||||||
|
if (e.message) {
|
||||||
|
message = e.message;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message = e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof buttonText == 'undefined') {
|
||||||
|
buttonText = Zotero.getString('errorReport.reportError');
|
||||||
|
buttonCallback = function () {
|
||||||
|
win.ZoteroPane.reportErrors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If secondary button is explicitly null, just use an alert
|
||||||
|
else if (buttonText === null) {
|
||||||
|
ps.alert(null, title, message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_OK
|
||||||
|
+ ps.BUTTON_POS_1 * ps.BUTTON_TITLE_IS_STRING;
|
||||||
|
var index = ps.confirmEx(
|
||||||
|
null,
|
||||||
|
title,
|
||||||
|
message,
|
||||||
|
buttonFlags,
|
||||||
|
"",
|
||||||
|
buttonText,
|
||||||
|
"", null, {}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (index == 1) {
|
||||||
|
setTimeout(function () { buttonCallback(); }, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -681,6 +681,7 @@ sync.storage.error.webdav.insufficientSpace = A file upload failed due to insuf
|
||||||
sync.storage.error.webdav.sslCertificateError = SSL certificate error connecting to %S.
|
sync.storage.error.webdav.sslCertificateError = SSL certificate error connecting to %S.
|
||||||
sync.storage.error.webdav.sslConnectionError = SSL connection error connecting to %S.
|
sync.storage.error.webdav.sslConnectionError = SSL connection error connecting to %S.
|
||||||
sync.storage.error.webdav.loadURLForMoreInfo = Load your WebDAV URL in the browser for more information.
|
sync.storage.error.webdav.loadURLForMoreInfo = Load your WebDAV URL in the browser for more information.
|
||||||
|
sync.storage.error.webdav.loadURL = Load WebDAV URL
|
||||||
sync.storage.error.zfs.personalQuotaReached1 = You have reached your Zotero File Storage quota. Some files were not uploaded. Other Zotero data will continue to sync to the server.
|
sync.storage.error.zfs.personalQuotaReached1 = You have reached your Zotero File Storage quota. Some files were not uploaded. Other Zotero data will continue to sync to the server.
|
||||||
sync.storage.error.zfs.personalQuotaReached2 = See your zotero.org account settings for additional storage options.
|
sync.storage.error.zfs.personalQuotaReached2 = See your zotero.org account settings for additional storage options.
|
||||||
sync.storage.error.zfs.groupQuotaReached1 = The group '%S' has reached its Zotero File Storage quota. Some files were not uploaded. Other Zotero data will continue to sync to the server.
|
sync.storage.error.zfs.groupQuotaReached1 = The group '%S' has reached its Zotero File Storage quota. Some files were not uploaded. Other Zotero data will continue to sync to the server.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue