mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2026-02-15 21:09:51 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
115105a2a0 |
37
.gitignore
vendored
37
.gitignore
vendored
@@ -1,4 +1,37 @@
|
||||
.project
|
||||
node_modules
|
||||
# dependencies
|
||||
/node_modules
|
||||
package-lock.json
|
||||
|
||||
# IDEs and editors
|
||||
/.idea
|
||||
*.iml
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# IDE - VSCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
||||
# misc
|
||||
/.sass-cache
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
testem.log
|
||||
/typings
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
.vscode/
|
||||
|
||||
registry-data
|
||||
|
||||
2
dist/index.html
vendored
2
dist/index.html
vendored
@@ -13,4 +13,4 @@
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--><!DOCTYPE html><html><head><meta charset="UTF-8"><link rel="stylesheet" href="vendor.css"><link rel="stylesheet" href="style.css"><link href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en" rel="stylesheet" type="text/css"><title>Docker Registry UI</title></head><body><app></app><script src="scripts/vendor.js"></script><script src="scripts/docker-registry-ui.js"></script></body></html>
|
||||
--><!DOCTYPE html><html><head><meta charset="UTF-8"><link rel="stylesheet" href="vendor.css"><link rel="stylesheet" href="style.css"><link href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en" rel="stylesheet" type="text/css"><title>Docker Registry UI</title></head><body><app></app><script src="scripts/init.js"></script><script src="scripts/vendor.js"></script><script src="scripts/docker-registry-ui.js"></script></body></html>
|
||||
27
dist/scripts/init.js
vendored
Normal file
27
dist/scripts/init.js
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
const REGISTRY_SERVER_KEY = 'registryServer';
|
||||
let registryServersStr = localStorage.getItem(REGISTRY_SERVER_KEY);
|
||||
let registryServers = [];
|
||||
if (registryServersStr !== null){
|
||||
let rs = JSON.parse(registryServersStr);
|
||||
if (rs instanceof Array) {
|
||||
registryServers = rs;
|
||||
}
|
||||
}
|
||||
|
||||
const apiHost = location.protocol+'//'+location.host;
|
||||
if (!registryServers.includes(apiHost)) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', apiHost+"/v2/", true);
|
||||
xhr.onload = function (e) {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status === 200) {
|
||||
const version = xhr.getResponseHeader('Docker-Distribution-Api-Version');
|
||||
if (version.startsWith('registry/2.')) {
|
||||
registryServers.unshift(apiHost);
|
||||
localStorage.setItem(REGISTRY_SERVER_KEY, JSON.stringify(registryServers));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
<body>
|
||||
<app></app>
|
||||
<script src="scripts/init.js"></script>
|
||||
<!-- build:js scripts/vendor.js -->
|
||||
<script src="../node_modules/riot/riot+compiler.min.js"></script>
|
||||
<script src="../node_modules/riot-route/dist/route.js"></script>
|
||||
|
||||
27
src/scripts/init.js
Normal file
27
src/scripts/init.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const REGISTRY_SERVER_KEY = 'registryServer';
|
||||
let registryServersStr = localStorage.getItem(REGISTRY_SERVER_KEY);
|
||||
let registryServers = [];
|
||||
if (registryServersStr !== null){
|
||||
let rs = JSON.parse(registryServersStr);
|
||||
if (rs instanceof Array) {
|
||||
registryServers = rs;
|
||||
}
|
||||
}
|
||||
|
||||
const apiHost = location.protocol+'//'+location.host;
|
||||
if (!registryServers.includes(apiHost)) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', apiHost+"/v2/", true);
|
||||
xhr.onload = function (e) {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status === 200) {
|
||||
const version = xhr.getResponseHeader('Docker-Distribution-Api-Version');
|
||||
if (version.startsWith('registry/2.')) {
|
||||
registryServers.unshift(apiHost);
|
||||
localStorage.setItem(REGISTRY_SERVER_KEY, JSON.stringify(registryServers));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
Reference in New Issue
Block a user