diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 73b1044..25866ad 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push Standard Version + - name: Build and push Beta Version uses: docker/build-push-action@v2 with: context: . @@ -31,14 +31,4 @@ jobs: push: true tags: | joxit/docker-registry-ui:master - joxit/docker-registry-ui:main - - name: Build and push Static Version - uses: docker/build-push-action@v2 - with: - context: . - file: ./static.dockerfile - platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x - push: true - tags: | - joxit/docker-registry-ui:master-static - joxit/docker-registry-ui:main-static \ No newline at end of file + joxit/docker-registry-ui:main \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 32d2bb6..9db62ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,7 +42,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push Standard Version + - name: Build and push Latest Version uses: docker/build-push-action@v2 with: context: . @@ -51,14 +51,4 @@ jobs: push: true tags: | joxit/docker-registry-ui:latest - joxit/docker-registry-ui:${{steps.current-tag.outputs.tag}} - - name: Build and push Static version - uses: docker/build-push-action@v2 - with: - context: . - file: ./static.dockerfile - platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x - push: true - tags: | - joxit/docker-registry-ui:static - joxit/docker-registry-ui:${{steps.current-tag.outputs.tag}}-static \ No newline at end of file + joxit/docker-registry-ui:${{steps.current-tag.outputs.tag}} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index b220f5f..0282147 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,5 +18,7 @@ LABEL maintainer="Jones MAGLOIRE @Joxit" WORKDIR /usr/share/nginx/html/ +COPY nginx/default.conf /etc/nginx/conf.d/default.conf +COPY bin/entrypoint /docker-entrypoint.d/90-docker-registry-ui.sh COPY dist/ /usr/share/nginx/html/ COPY favicon.ico /usr/share/nginx/html/ \ No newline at end of file diff --git a/Dockerfile.static b/Dockerfile.static deleted file mode 120000 index ae6a841..0000000 --- a/Dockerfile.static +++ /dev/null @@ -1 +0,0 @@ -static.dockerfile \ No newline at end of file diff --git a/README.md b/README.md index cc44023..85e33c9 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,11 @@ title: Docker Registry User Interface ## Overview -This project aims to provide a simple and complete user interface for your private docker registry. -You have the choice between two versions, the **standard interface** (`joxit/docker-registry-ui:latest`) and the **static interface** (`joxit/docker-registry-ui:static`). +:warning: `joxit/docker-registry-ui:master` and `joxit/docker-registry-ui:main` tags contains unreleased v2.0.0 version! -In the **standard interface**, there is no default registry, you need to add your own within the UI. -With this version, you can manage **more than one** registry server but all the environment variables will be **unavailable**. -All registries will be stored in the [local storage](https://en.wikipedia.org/wiki/Web_storage#Local_and_session_storage) of your browser. No configuration is needed when you launch the UI. +This project aims to provide a simple and complete user interface for your private docker registry. You can customize the interface with various options. The major option is `SINGLE_REGISTRY` which allows you to disable the dynamic selection of docker registeries (same behavior as the old **static** tag). -In the **static interface**, it will connect to a single registry and will not change. The configuration is done at the start of the interface, when you use the docker images whose tags contain the `static` keyword. With this version, you can manage **only one registry** and all environment variables will be **available**. +You may need the [migration guide from 1.x to 2.x](https://github.com/Joxit/docker-registry-ui/wiki/Migrating-from-1.x-to-2.x) or [the 1.x readme](https://github.com/Joxit/docker-registry-ui/blob/8fe3adf12540d1316cb57628ebe86a392a703d90/README.md) This web user interface uses [Riot](https://github.com/Riot/riot) the react-like user interface micro-library and [riot-mui](https://github.com/kysonic/riot-mui) components. @@ -40,20 +37,20 @@ This web user interface uses [Riot](https://github.com/Riot/riot) the react-like - Display image/tag count (see [#56 issue comment](https://github.com/Joxit/docker-registry-ui/issues/56#issuecomment-449246524)). - Select multiple tags to delete (see [#29](https://github.com/Joxit/docker-registry-ui/issues/29)). - Select all tags with ALT + Click to delete (see [#80](https://github.com/Joxit/docker-registry-ui/issues/80)). -- One interface for many registries **standard interface**. -- Share your docker registry with query parameter `url` (e.g. `https://joxit.dev/docker-registry-ui/demo?url=https://registry.example.com`) **standard interface**. -- Use `joxit/docker-registry-ui:static` as reverse proxy (with `REGISTRY_URL` environment variable) to your docker registry (This will avoid CORS) **static interface**. -- Add Title when using `REGISTRY_URL` (see [#28](https://github.com/Joxit/docker-registry-ui/issues/28)) **static interface**. -- Customise docker pull command on static registry UI (see [#71](https://github.com/Joxit/docker-registry-ui/issues/71)) **static interface**. -- Add custom header via environment variable and file via `NGINX_PROXY_HEADER_*` (see [#89](https://github.com/Joxit/docker-registry-ui/pull/89)) **static interface** -- Show/Hide content digest in taglist via `SHOW_CONTENT_DIGEST` (values are: [`true`, `false`], default: `true`) (see [#126](https://github.com/Joxit/docker-registry-ui/issues/126)) **static interface**. -- Limit the number of elements in the image list via `CATALOG_ELEMENTS_LIMIT` (see [#127](https://github.com/Joxit/docker-registry-ui/pull/127)) **static interface**. +- One interface for many registries (when `SINGLE_REGISTRY=false`). +- Share your docker registry with query parameter `url` (e.g. `https://joxit.dev/docker-registry-ui/demo?url=https://registry.example.com`) (when `SINGLE_REGISTRY=false`). +- Use the UI as reverse proxy (with `REGISTRY_URL` environment variable) to your docker registry (This will avoid CORS). +- Add Title when using `REGISTRY_URL` (see [#28](https://github.com/Joxit/docker-registry-ui/issues/28)). +- Customise docker pull command on static registry UI (see [#71](https://github.com/Joxit/docker-registry-ui/issues/71)). +- Add custom header via environment variable and file via `NGINX_PROXY_HEADER_*` (see [#89](https://github.com/Joxit/docker-registry-ui/pull/89)) +- Show/Hide content digest in taglist via `SHOW_CONTENT_DIGEST` (values are: [`true`, `false`], default: `true`) (see [#126](https://github.com/Joxit/docker-registry-ui/issues/126)). +- Limit the number of elements in the image list via `CATALOG_ELEMENTS_LIMIT` (see [#127](https://github.com/Joxit/docker-registry-ui/pull/127)). - Multi arch support in history page (see [#130](https://github.com/Joxit/docker-registry-ui/issues/130) and [#134](https://github.com/Joxit/docker-registry-ui/pull/134)) ## FAQ -- What is the difference between **`joxit/docker-registry-ui:latest`** and **`joxit/docker-registry-ui:static`** tags ? - - The `latest` tag was the first version of the project, one UI for many docker registries. The `static` tag allows you to have an interface for a single registry and also allows you select your features. +- What is the difference between **`SINGLE_REGISTRY=false`** and **`SINGLE_REGISTRY=true`** options ? + - When `SINGLE_REGISTRY` is set to false, a menu appears on the interface allowing you to dynamically change docker registry URLs. - Why, when I delete all tags of an image, the image is still in the UI ? - This is a limitation of docker registry, the garbage collector don't remove empty images. If you want to delete dangling images, you will need to delete the folder in your registry data. (see [#77](https://github.com/Joxit/docker-registry-ui/issues/77)) - Why the image size in the UI is not the same as displayed during `docker images` ? @@ -80,46 +77,19 @@ This web user interface uses [Riot](https://github.com/Riot/riot) the react-like Need more informations ? Try my [examples](https://github.com/Joxit/docker-registry-ui/tree/main/examples) or open an issue. -## Getting Started - -The docker image contains the source code and nginx in order to serve the docker-registry-ui. Please remember the difference between the **standard interface** (`latest` tag) and **static interface** (`static` tags). - -### Run the standard interface - -You can run the standard interface see the website on your 80 port. You will be able to use the interface for **many registry servers**, but all the configuration via environment variables from the static interface will be **unavailable**. - -```sh -docker run -d -p 80:80 joxit/docker-registry-ui:latest -``` - -### Run the static interface +## Available options Some env options are available for use this interface for **only one server**. -- [`URL`](https://github.com/Joxit/docker-registry-ui/tree/main/examples/ui-as-standalone): set the static URL to use (You will need CORS configuration). Example: `http://127.0.0.1:5000`. (`Required`) -- [`REGISTRY_URL`](https://github.com/Joxit/docker-registry-ui/tree/main/examples/ui-as-proxy): your docker registry URL to contact (CORS configuration is not needed). Example: `http://my-docker-container:5000`. (Can't be used with `URL`, since 0.3.2). -- `DELETE_IMAGES`: if this variable is empty or `false`, delete feature is deactivated. It is activated otherwise. -- `REGISTRY_TITLE`: Set a custom title for your user interface when using `REGISTRY_URL` (since 0.3.4). -- `PULL_URL`: Set a custom url for the docker pull command, this is useful when you use `REGISTRY_URL` and your registry is on a different host (since 1.1.0). -- [`NGINX_PROXY_HEADER_*`](https://github.com/Joxit/docker-registry-ui/tree/main/examples/proxy-headers): Set custom headers for your docker registry, usefull when you want to add your credentials. (Can be use only with `REGISTRY_URL`). -- [`SHOW_CONTENT_DIGEST`](https://github.com/Joxit/docker-registry-ui/issues/126): Show content digest in docker tag list. Default: `true`. -- [`CATALOG_ELEMENTS_LIMIT`](https://github.com/Joxit/docker-registry-ui/pull/132): Limit the number of elements in the catalog page. Default: `100000`. - -Example with `URL` option. - -```sh -docker run -d -p 80:80 -e URL=http://127.0.0.1:5000 -e DELETE_IMAGES=true joxit/docker-registry-ui:static -``` - -Example with `REGISTRY_URL`, this will add a proxy to your registry. -Your registry will be accessible here : `http://127.0.0.1/v2`, this will avoid CORS errors (see [#25](https://github.com/Joxit/docker-registry-ui/issues/25#issuecomment-360522487)). -Be careful, `joxit/docker-registry-ui` and `registry:2` will communicate, both containers should be in the same network or use your private IP. - -```sh -docker network create registry-ui-net -docker run -d --net registry-ui-net --name registry-srv registry:2 -docker run -d --net registry-ui-net -p 80:80 -e REGISTRY_URL=http://registry-srv:5000 -e DELETE_IMAGES=true -e REGISTRY_TITLE="My registry" joxit/docker-registry-ui:static -``` +- `REGISTRY_URL`: The default url of your docker registry. You may need CORS configuration on your registry. (default: derived from the hostname of your UI). +- `REGISTRY_TITLE`: Set a custom title for your user interface. (default: value derived from `REGISTRY_URL`). +- `PULL_URL`: Set a custom url when you copy the `docker pull` command. (default: value derived from `REGISTRY_URL`). +- `DELETE_IMAGES`: Set if we can delete images from the UI. (default: `false`) +- `SHOW_CONTENT_DIGEST`: Show content digest in docker tag list. (default: `true`) +- `CATALOG_ELEMENTS_LIMIT`: Limit the number of elements in the catalog page. (default: `100000`). +- `SINGLE_REGISTRY`: Remove the menu that show the dialogs to add, remove and change the endpoint of your docker registry. (default `false`) +- `NGINX_PROXY_PASS_URL`: Update the default Nginx configuration and set the **proxy_pass** to your backend docker registry (this avoid CORS configuration). +- `NGINX_PROXY_HEADER_*`: Update the default Nginx configuration and set **custom headers** for your backend docker registry. Only when `NGINX_PROXY_PASS_URL` is used. There are some examples with [docker-compose](https://docs.docker.com/compose/) and docker-registry-ui as proxy [here](https://github.com/Joxit/docker-registry-ui/tree/main/examples/ui-as-proxy/) or docker-registry-ui as standalone [here](https://github.com/Joxit/docker-registry-ui/tree/main/examples/ui-as-standalone/). @@ -185,7 +155,7 @@ http: addr: :5000 headers: X-Content-Type-Options: [nosniff] - Access-Control-Allow-Origin: ['http://127.0.0.1:8001'] + Access-Control-Allow-Origin: ['http://127.0.0.1:8000'] Access-Control-Allow-Methods: ['HEAD', 'GET', 'OPTIONS', 'DELETE'] Access-Control-Allow-Headers: ['Authorization', 'Accept'] Access-Control-Max-Age: [1728000] diff --git a/arm32v7-static.dockerfile b/arm32v7-static.dockerfile deleted file mode 100644 index c6b52ba..0000000 --- a/arm32v7-static.dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) 2016-2018 Jones Magloire @Joxit -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -FROM arm32v7/nginx - -LABEL maintainer="Jones MAGLOIRE @Joxit" - -WORKDIR /usr/share/nginx/html/ - -ENV NGINX_PROXY_HEADER_Host '$http_host' - -COPY nginx/default.conf /etc/nginx/conf.d/default.conf -COPY dist/ /usr/share/nginx/html/ -COPY dist/scripts/docker-registry-ui-static.js /usr/share/nginx/html/scripts/docker-registry-ui.js -COPY bin/entrypoint /docker-entrypoint.d/90-docker-registry-ui.sh -COPY favicon.ico /usr/share/nginx/html/ diff --git a/arm32v7.dockerfile b/arm32v7.dockerfile index cdde137..ca3ee39 100644 --- a/arm32v7.dockerfile +++ b/arm32v7.dockerfile @@ -18,5 +18,7 @@ LABEL maintainer="Jones MAGLOIRE @Joxit" WORKDIR /usr/share/nginx/html/ +COPY nginx/default.conf /etc/nginx/conf.d/default.conf +COPY bin/entrypoint /docker-entrypoint.d/90-docker-registry-ui.sh COPY dist/ /usr/share/nginx/html/ COPY favicon.ico /usr/share/nginx/html/ diff --git a/arm64v8-static.dockerfile b/arm64v8-static.dockerfile deleted file mode 100644 index 41ef7a4..0000000 --- a/arm64v8-static.dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) 2016-2018 Jones Magloire @Joxit -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -FROM arm64v8/nginx - -LABEL maintainer="Jones MAGLOIRE @Joxit" - -WORKDIR /usr/share/nginx/html/ - -ENV NGINX_PROXY_HEADER_Host '$http_host' - -COPY nginx/default.conf /etc/nginx/conf.d/default.conf -COPY dist/ /usr/share/nginx/html/ -COPY dist/scripts/docker-registry-ui-static.js /usr/share/nginx/html/scripts/docker-registry-ui.js -COPY bin/entrypoint /docker-entrypoint.d/90-docker-registry-ui.sh -COPY favicon.ico /usr/share/nginx/html/ diff --git a/arm64v8.dockerfile b/arm64v8.dockerfile index 31d9b31..8956830 100644 --- a/arm64v8.dockerfile +++ b/arm64v8.dockerfile @@ -18,5 +18,7 @@ LABEL maintainer="Jones MAGLOIRE @Joxit" WORKDIR /usr/share/nginx/html/ +COPY nginx/default.conf /etc/nginx/conf.d/default.conf +COPY bin/entrypoint /docker-entrypoint.d/90-docker-registry-ui.sh COPY dist/ /usr/share/nginx/html/ COPY favicon.ico /usr/share/nginx/html/ diff --git a/bin/entrypoint b/bin/entrypoint index 80377ec..eb34220 100755 --- a/bin/entrypoint +++ b/bin/entrypoint @@ -1,19 +1,20 @@ #!/bin/sh -sed -i "s,\${URL},${URL}," scripts/docker-registry-ui.js -sed -i "s,\${REGISTRY_TITLE},${REGISTRY_TITLE}," scripts/docker-registry-ui.js -sed -i "s,\${PULL_URL},${PULL_URL}," scripts/docker-registry-ui.js +sed -i "s,\${REGISTRY_URL},${REGISTRY_URL}," index.html +sed -i "s,\${REGISTRY_TITLE},${REGISTRY_TITLE}," index.html +sed -i "s,\${PULL_URL},${PULL_URL}," index.html +sed -i "s,\${SINGLE_REGISTRY},${SINGLE_REGISTRY}," index.html if [ -z "${DELETE_IMAGES}" ] || [ "${DELETE_IMAGES}" = false ] ; then - sed -i -r "s/(isImageRemoveActivated[:=])[^,;]*/\1false/" scripts/docker-registry-ui.js + sed -i -r "s/\${DELETE_IMAGES}/false/" index.html fi if [ "${SHOW_CONTENT_DIGEST}" = false ] ; then - sed -i -r "s/(showContentDigest[:=])[^,;]*/\1false/" scripts/docker-registry-ui.js + sed -i -r "s/\${SHOW_CONTENT_DIGEST}/false/" index.html fi if [ -n "${CATALOG_ELEMENTS_LIMIT}" ] ; then - sed -i -r "s/(catalogElementsLimit[:=])[^,;]*/\1${CATALOG_ELEMENTS_LIMIT}/" scripts/docker-registry-ui.js + sed -i -r "s/\${CATALOG_ELEMENTS_LIMIT}/${CATALOG_ELEMENTS_LIMIT}/" index.html fi get_nginx_proxy_headers() { @@ -33,8 +34,8 @@ get_nginx_proxy_headers() { done } -if [ -n "${REGISTRY_URL}" ] ; then - sed -i "s,\${REGISTRY_URL},${REGISTRY_URL}," /etc/nginx/conf.d/default.conf +if [ -n "${NGINX_PROXY_PASS_URL}" ] ; then + sed -i "s,\${NGINX_PROXY_PASS_URL},${NGINX_PROXY_PASS_URL}," /etc/nginx/conf.d/default.conf sed -i "s^\${NGINX_PROXY_HEADERS}^$(get_nginx_proxy_headers)^" /etc/nginx/conf.d/default.conf sed -i "s,#!,," /etc/nginx/conf.d/default.conf fi diff --git a/debian-static.dockerfile b/debian-static.dockerfile deleted file mode 100644 index 8860fb6..0000000 --- a/debian-static.dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) 2016-2018 Jones Magloire @Joxit -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -FROM nginx:latest - -LABEL maintainer="Jones MAGLOIRE @Joxit" - -WORKDIR /usr/share/nginx/html/ - -ENV NGINX_PROXY_HEADER_Host '$http_host' - -COPY nginx/default.conf /etc/nginx/conf.d/default.conf -COPY dist/ /usr/share/nginx/html/ -COPY dist/scripts/docker-registry-ui-static.js /usr/share/nginx/html/scripts/docker-registry-ui.js -COPY bin/entrypoint /docker-entrypoint.d/90-docker-registry-ui.sh -COPY favicon.ico /usr/share/nginx/html/ diff --git a/debian.dockerfile b/debian.dockerfile index ee5d31f..2e67843 100644 --- a/debian.dockerfile +++ b/debian.dockerfile @@ -18,5 +18,7 @@ LABEL maintainer="Jones MAGLOIRE @Joxit" WORKDIR /usr/share/nginx/html/ +COPY nginx/default.conf /etc/nginx/conf.d/default.conf +COPY bin/entrypoint /docker-entrypoint.d/90-docker-registry-ui.sh COPY dist/ /usr/share/nginx/html/ COPY favicon.ico /usr/share/nginx/html/ diff --git a/demo/index.html b/demo/index.html index e3275e7..2b94757 100644 --- a/demo/index.html +++ b/demo/index.html @@ -19,12 +19,13 @@ - - + - - + + @@ -35,26 +36,28 @@ - + - - ` + return ``; + case 'keep': + return opts[output] ? body : ''; } -} +}; -export default function(src) { - let html = fs.readFileSync(src).toString().replace(/>\n+\s*/g, '>'); +export default function (src, opts) { + let html = fs + .readFileSync(src) + .toString() + .replace(/>\n+\s*/g, '>'); while (useref.test(html)) { - const [ raw, type, output ] = useref.exec(html); - html = html.replace(raw, generateBalise(type, output)); + const [raw, type, output, body] = useref.exec(html); + html = html.replace(raw, generateBalise(type, output, body, opts)); } return html; -} \ No newline at end of file +} diff --git a/rollup/license.js b/rollup/license.js new file mode 100644 index 0000000..f8f9728 --- /dev/null +++ b/rollup/license.js @@ -0,0 +1,18 @@ +export default `/* + * Copyright (C) 2016-2021 Jones Magloire @Joxit + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + * @license AGPL + */` \ No newline at end of file diff --git a/src/components/docker-registry-ui.riot b/src/components/docker-registry-ui.riot index 6ae3820..e6692a7 100644 --- a/src/components/docker-registry-ui.riot +++ b/src/components/docker-registry-ui.riot @@ -18,7 +18,8 @@ along with this program. If not, see .
- +
@@ -66,7 +67,8 @@ along with this program. If not, see . import TagHistory from './tag-history/tag-history.riot'; import DialogsMenu from './dialogs/dialogs-menu.riot'; import { - stripHttps + stripHttps, + getRegistryServers } from '../scripts/utils'; import router from '../scripts/router'; @@ -84,8 +86,10 @@ along with this program. If not, see . state.snackbarMessage = undefined; }, onBeforeMount(props) { - this.state.registryUrl = props.registryUrl || (window.location.origin + window.location.pathname.replace(/\/+$/, - '')); + // props.singleRegistry === 'true' means old static version + this.state.registryUrl = props.registryUrl || + (props.singleRegistry === 'true' ? undefined : (router.getUrlQueryParam() || getRegistryServers(0))) || + (window.location.origin + window.location.pathname.replace(/\/+$/, '')); this.state.name = props.name || stripHttps(props.registryUrl); this.state.catalogElementsLimit = props.catalogElementsLimit || 100000; this.state.pullUrl = this.pullUrl(this.state.registryUrl, props.pullUrl); diff --git a/src/index.html b/src/index.html index 7151673..7087846 100644 --- a/src/index.html +++ b/src/index.html @@ -34,57 +34,17 @@ - + + + + + + + + diff --git a/src/index.js b/src/index.js index 1351354..97b5af5 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,5 @@ import { component, register } from 'riot'; + import { MaterialCard, MaterialSpinner, @@ -11,7 +12,7 @@ import { MaterialSnackbar, MaterialDropdownList, MaterialPopup, - MaterialInput + MaterialInput, } from 'riot-mui'; import DockerRegistryUI from './components/docker-registry-ui.riot'; diff --git a/src/scripts/router.js b/src/scripts/router.js index fcd771b..e8fc42e 100644 --- a/src/scripts/router.js +++ b/src/scripts/router.js @@ -15,7 +15,7 @@ * along with this program. If not, see . */ import { router, getCurrentRoute } from '@riotjs/route'; -import { encodeURI } from './utils'; +import { encodeURI, decodeURI } from './utils'; function getQueryParams() { const queries = {}; @@ -44,7 +44,7 @@ function updateQueryParams(qs) { function toSearchString(queries) { let search = []; for (let key in queries) { - if (queries[key] !== undefined) { + if (key && queries[key] !== undefined) { search.push(`${key}=${queries[key]}`); } } @@ -83,6 +83,17 @@ export default { updateUrlQueryParam(url) { this.updateQueryString({ url: encodeURI(url) }); }, + getUrlQueryParam() { + const queries = getQueryParams(); + const url = queries['url']; + if (url) { + try { + return decodeURI(url); + } catch (e) { + console.error(`Can't decode query parameter URL: ${url}`, e); + } + } + }, updatePageQueryParam(page) { this.updateQueryString({ page }); }, diff --git a/static.dockerfile b/static.dockerfile deleted file mode 100644 index 20bf1a6..0000000 --- a/static.dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) 2016-2018 Jones Magloire @Joxit -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -FROM nginx:alpine - -LABEL maintainer="Jones MAGLOIRE @Joxit" - -WORKDIR /usr/share/nginx/html/ - -ENV NGINX_PROXY_HEADER_Host '$http_host' - -COPY nginx/default.conf /etc/nginx/conf.d/default.conf -COPY dist/ /usr/share/nginx/html/ -COPY dist/scripts/docker-registry-ui-static.js /usr/share/nginx/html/scripts/docker-registry-ui.js -COPY bin/entrypoint /docker-entrypoint.d/90-docker-registry-ui.sh -COPY favicon.ico /usr/share/nginx/html/