mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2026-02-17 21:19:51 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de6d09c98c | ||
|
|
1f2913248e | ||
|
|
3414d7b517 | ||
|
|
cd99f6e231 | ||
|
|
f015187b14 | ||
|
|
07713f1425 | ||
|
|
f560025e70 |
16
.github/ISSUE_TEMPLATE/bug_report.md
vendored
16
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -42,19 +42,17 @@ If applicable, add screenshots to help explain your problem.
|
||||
|
||||
## System information
|
||||
|
||||
- OS: [e.g. Debian 10, Windows, Android 9...]
|
||||
<!-- Browser is only for UI bugs -->
|
||||
- OS: [e.g. Debian, Windows, Mac OS, Android 9...]
|
||||
- Browser:
|
||||
- Name: [e.g. Chrome, Firefox...]
|
||||
- Version: [e.g. 22]
|
||||
- Name: [e.g. Chrome, Firefox...]
|
||||
- Version: [e.g. 114.0.5735.198, 102.11.0...]
|
||||
- Docker registry UI:
|
||||
- Version: [e.g. 1.4.0]
|
||||
- Version: [e.g. 2.5.0, 2.6.0-84b31f2cfb...]
|
||||
- Server: [docker or dist]
|
||||
<!-- Only for Docker and for where the UI is hosted -->
|
||||
- Docker version: [e.g. 19.03]
|
||||
- Docker registry ui tag: [latest, static, master, 1.4-static...]
|
||||
- Docker version: [e.g. 24.0.4...]
|
||||
- Docker registry ui tag: [latest, main, 2.5.0, 2...]
|
||||
- OS/Arch: [e.g. linux/amd64]
|
||||
- Tools: [e.g. docker-compose, kubernets..]
|
||||
- Tools: [e.g. docker-compose, kubernetes, electron..]
|
||||
|
||||
## Additional context
|
||||
|
||||
|
||||
19
Developing.md
Normal file
19
Developing.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# How to build Docker Registry UI
|
||||
|
||||
This file contains tips to help you take (and understand) your first steps in Docker Registry UI development.
|
||||
|
||||
## Clone and install the repository
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Joxit/docker-registry-ui.git
|
||||
cd docker-registry-ui
|
||||
npm install
|
||||
```
|
||||
|
||||
## Run the local server
|
||||
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
|
||||
Open your browser <http://localhost:8000> you can configure your options by updating the `src/index.html` file.
|
||||
@@ -167,9 +167,9 @@ services:
|
||||
image: registry:2.8.2
|
||||
restart: always
|
||||
environment:
|
||||
REGISTRY_HTTP_HEADERS_Access-Control-Origin: '[http://registry.example.com]'
|
||||
REGISTRY_HTTP_HEADERS_Access-Control-Allow-Origin: '[http://registry.example.com]'
|
||||
REGISTRY_HTTP_HEADERS_Access-Control-Allow-Methods: '[HEAD,GET,OPTIONS,DELETE]'
|
||||
REGISTRY_HTTP_HEADERS_Access-Control-Credentials: '[true]'
|
||||
REGISTRY_HTTP_HEADERS_Access-Control-Allow-Credentials: '[true]'
|
||||
REGISTRY_HTTP_HEADERS_Access-Control-Allow-Headers: '[Authorization,Accept,Cache-Control]'
|
||||
REGISTRY_HTTP_HEADERS_Access-Control-Expose-Headers: '[Docker-Content-Digest]'
|
||||
REGISTRY_STORAGE_DELETE_ENABLED: 'true'
|
||||
|
||||
2
dist/docker-registry-ui.css
vendored
2
dist/docker-registry-ui.css
vendored
File diff suppressed because one or more lines are too long
2
dist/docker-registry-ui.js
vendored
2
dist/docker-registry-ui.js
vendored
File diff suppressed because one or more lines are too long
@@ -31,7 +31,8 @@ server {
|
||||
#! proxy_http_version 1.1;
|
||||
#! ${NGINX_PROXY_HEADERS}
|
||||
#! ${NGINX_PROXY_PASS_HEADERS}
|
||||
#! proxy_pass ${NGINX_PROXY_PASS_URL};
|
||||
#! set $registry_server "${NGINX_PROXY_PASS_URL}";
|
||||
#! proxy_pass $registry_server;
|
||||
#! }
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docker-registry-ui",
|
||||
"version": "2.5.1",
|
||||
"version": "2.5.4",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"format": "npm run format-html && npm run format-js && npm run format-riot",
|
||||
|
||||
@@ -111,7 +111,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
onAuthentication: props.onAuthentication,
|
||||
withCredentials: props.isRegistrySecured,
|
||||
});
|
||||
oReq.addEventListener('load', function () {
|
||||
oReq.addEventListener('loadend', function () {
|
||||
if (this.status === 200) {
|
||||
const nbTags = (JSON.parse(this.responseText).tags || []).length;
|
||||
self.update({ nbTags });
|
||||
|
||||
@@ -266,6 +266,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
:host {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
:host main {
|
||||
flex-grow: 1;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
material-navbar {
|
||||
height: 64px;
|
||||
color: var(--header-text);
|
||||
|
||||
@@ -17,16 +17,20 @@ export const getFromCache = (method, url) => {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
return sessionStorage.getItem(sha256);
|
||||
return {
|
||||
responseText: sessionStorage.getItem(`${sha256}/responseText`),
|
||||
dockerContentdigest: sessionStorage.getItem(`${sha256}/dockerContentdigest`),
|
||||
};
|
||||
} catch (e) {}
|
||||
};
|
||||
|
||||
export const setCache = (method, url, responseText) => {
|
||||
export const setCache = (method, url, { responseText, dockerContentdigest }) => {
|
||||
const sha256 = getSha256(method, url);
|
||||
if (!sha256) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
sessionStorage.setItem(sha256, responseText);
|
||||
sessionStorage.setItem(`${sha256}/responseText`, responseText);
|
||||
sessionStorage.setItem(`${sha256}/dockerContentdigest`, dockerContentdigest);
|
||||
} catch (e) {}
|
||||
};
|
||||
|
||||
@@ -29,19 +29,23 @@ export class Http {
|
||||
}
|
||||
|
||||
getContentDigest(cb) {
|
||||
if (this.oReq.hasHeader('Docker-Content-Digest')) {
|
||||
if (this.cache?.dockerContentdigest) {
|
||||
cb(this.cache.dockerContentdigest);
|
||||
} else if (this.oReq.hasHeader('Docker-Content-Digest')) {
|
||||
// Same origin or advanced CORS headers set:
|
||||
// 'Access-Control-Expose-Headers: Docker-Content-Digest'
|
||||
cb(this.oReq.getResponseHeader('Docker-Content-Digest'));
|
||||
} else if (window.crypto && window.TextEncoder) {
|
||||
crypto.subtle.digest('SHA-256', new TextEncoder().encode(this.oReq.responseText)).then(function (buffer) {
|
||||
cb(
|
||||
'sha256:' +
|
||||
Array.from(new Uint8Array(buffer))
|
||||
.map((byte) => byte.toString(16).padStart(2, '0'))
|
||||
.join('')
|
||||
);
|
||||
});
|
||||
crypto.subtle
|
||||
.digest('SHA-256', new TextEncoder().encode(this.oReq.responseText || this.cache?.responseText))
|
||||
.then(function (buffer) {
|
||||
cb(
|
||||
'sha256:' +
|
||||
Array.from(new Uint8Array(buffer))
|
||||
.map((byte) => byte.toString(16).padStart(2, '0'))
|
||||
.join('')
|
||||
);
|
||||
});
|
||||
} else {
|
||||
// IE and old Edge
|
||||
// simply do not call the callback and skip the setup downstream
|
||||
@@ -54,9 +58,9 @@ export class Http {
|
||||
switch (e) {
|
||||
case 'loadend': {
|
||||
self.oReq.addEventListener('loadend', function () {
|
||||
if (this.status === 401 && !this.withCredentials) {
|
||||
const tokenAuth =
|
||||
this.hasHeader('www-authenticate') && parseAuthenticateHeader(this.getResponseHeader('www-authenticate'));
|
||||
const tokenAuth =
|
||||
this.hasHeader('www-authenticate') && parseAuthenticateHeader(this.getResponseHeader('www-authenticate'));
|
||||
if (this.status === 401 && (!this.withCredentials || tokenAuth)) {
|
||||
self.onAuthentication(tokenAuth, (bearer) => {
|
||||
const req = new XMLHttpRequest();
|
||||
req._url = self._url;
|
||||
@@ -80,7 +84,11 @@ export class Http {
|
||||
req.send();
|
||||
});
|
||||
} else {
|
||||
this.status === 200 && setCache(self._method, self._url, this.responseText);
|
||||
this.status === 200 &&
|
||||
setCache(self._method, self._url, {
|
||||
responseText: this.responseText,
|
||||
dockerContentdigest: this.getResponseHeader('Docker-Content-Digest'),
|
||||
});
|
||||
f.bind(this)();
|
||||
}
|
||||
});
|
||||
@@ -119,9 +127,10 @@ export class Http {
|
||||
}
|
||||
|
||||
send() {
|
||||
const responseText = getFromCache(this._method, this._url);
|
||||
if (responseText) {
|
||||
return this._events['loadend'].bind({ status: 200, responseText })();
|
||||
const cache = getFromCache(this._method, this._url);
|
||||
if (cache && cache.responseText) {
|
||||
this.cache = cache;
|
||||
return this._events['loadend'].bind({ status: 200, responseText: cache.responseText })();
|
||||
}
|
||||
this.oReq.send();
|
||||
}
|
||||
|
||||
@@ -336,10 +336,6 @@ footer {
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
main {
|
||||
min-height: calc(100% - 136px);
|
||||
}
|
||||
|
||||
material-footer {
|
||||
padding: 0.5em 1em;
|
||||
li {
|
||||
|
||||
Reference in New Issue
Block a user