mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2025-04-30 17:09:55 +03:00
feat(error-page): add a full page for specific errors
This may help people to save their issues fixes #230
This commit is contained in:
parent
b9a157c943
commit
6314e8b11e
5 changed files with 94 additions and 12 deletions
|
@ -71,7 +71,7 @@ export class Http {
|
|||
req.withCredentials = true;
|
||||
}
|
||||
req.hasHeader = hasHeader;
|
||||
req.getErrorMessage = Http.getErrorMessage;
|
||||
req.getErrorMessage = getErrorMessage;
|
||||
self.oReq = req;
|
||||
req.send();
|
||||
});
|
||||
|
@ -128,15 +128,9 @@ const hasHeader = function (header) {
|
|||
|
||||
const getErrorMessage = function () {
|
||||
if (this._url.match('^http://') && window.location.protocol === 'https:') {
|
||||
return (
|
||||
'Mixed Content: The page at `' +
|
||||
window.location.origin +
|
||||
'` was loaded over HTTPS, but requested an insecure server endpoint `' +
|
||||
new URL(this._url).origin +
|
||||
'`. This request has been blocked; the content must be served over HTTPS.'
|
||||
);
|
||||
return { code: 'MIXED_CONTENT', url: this._url };
|
||||
} else if (!this._url || !this._url.match('^http')) {
|
||||
return 'Incorrect server endpoint.';
|
||||
return { code: 'INCORRECT_URL', url: this._url };
|
||||
} else if (this.withCredentials && !this.hasHeader('Access-Control-Allow-Credentials')) {
|
||||
return (
|
||||
"The `Access-Control-Allow-Credentials` header in the response is missing and must be set to `true` when the request's credentials mode is on. Origin `" +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue