feat: add option for default registries when SINGLE_REGISTRY=false

This commit is contained in:
Joxit 2021-10-31 15:09:37 +01:00
parent f4455703ca
commit 8fcae3cda4
No known key found for this signature in database
GPG key ID: F526592B8E012263
6 changed files with 42 additions and 15 deletions

View file

@ -32,7 +32,7 @@
</material-popup>
<script>
import {
getRegistryServers
addRegistryServers
} from '../../scripts/utils';
import router from '../../scripts/router';
@ -51,9 +51,7 @@
if (!input.value.startsWith('http')) {
return this.props.onNotify('The input field should start with http:// or https://.', true);
}
const url = input.value.trim().replace(/\/*$/, '');
const registryServer = getRegistryServers().filter(e => e !== url);
localStorage.setItem('registryServer', JSON.stringify([url].concat(registryServer)));
const url = addRegistryServers(input.value);
router.home()
this.props.onServerChange(url);
this.props.onClose()