[app] unify error message for blocked access on Docker-Content-Digest

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
This commit is contained in:
Jakob Ackermann 2019-09-20 00:32:16 +02:00
parent a2e81ac12c
commit 48aba129ce
No known key found for this signature in database
GPG key ID: 17FA08AA7E62A231
5 changed files with 12 additions and 7 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -92,6 +92,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
registryUI.errorSnackbar = function(message) {
return registryUI.snackbar(message, true);
};
registryUI.showErrorCanNotReadContentDigest = function() {
registryUI.errorSnackbar(
'Access on registry response was blocked. Try adding the header ' +
'`Access-Control-Expose-Headers: Docker-Content-Digest`' +
' to your proxy or registry: ' +
'https://docs.docker.com/registry/configuration/#http'
);
};
registryUI.cleanName = function() {
const url = registryUI.pullUrl || (registryUI.url() && registryUI.url().length > 0 && registryUI.url()) || window.location.host;
return registryUI.stripHttps(url);

View file

@ -37,10 +37,7 @@
this.copy = function () {
if (!self.dockerCmd) {
registryUI.errorSnackbar(
'Your browser has no SHA256 support. As a workaround your registry ' +
' can set the header `Access-Control-Expose-Headers: Docker-Content-Digest`.'
);
registryUI.showErrorCanNotReadContentDigest();
return;
}
const copyText = this.refs['input'];

View file

@ -38,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
registryUI.taglist.go(name);
if (this.status == 200) {
if (!this.hasHeader('Docker-Content-Digest')) {
registryUI.errorSnackbar('You need to add Access-Control-Expose-Headers: [\'Docker-Content-Digest\'] in your server configuration.');
registryUI.showErrorCanNotReadContentDigest();
return;
}
const digest = this.getResponseHeader('Docker-Content-Digest');