Fix regression of avoiding duplicated servers.

This commit is contained in:
Zhongyi Tong
2017-08-16 12:48:31 -04:00
parent 48b829b771
commit 965b55ba5f
2 changed files with 7 additions and 6 deletions

View File

@@ -90,8 +90,9 @@ class DomainUtil {
}
checkDomain(domain, silent = false) {
if (silent && this.duplicateDomain(domain)) {
alert('This Server Address already exists.');
if (!silent && this.duplicateDomain(domain)) {
// Do not check duplicate in silent mode
alert('This server has been added.');
return;
}
@@ -200,7 +201,7 @@ class DomainUtil {
updateSavedServer(url, index) {
// Does not promise successful update
this.checkDomain(url, false).then(newServerConf => {
this.checkDomain(url, true).then(newServerConf => {
this.saveServerIcon(newServerConf.icon).then(localIconUrl => {
newServerConf.icon = localIconUrl;
this.updateDomain(index, newServerConf);
@@ -221,7 +222,7 @@ class DomainUtil {
let len = url.length;
while (len) {
hash = (hash * 33) ^ url.charCodeAt(--len)
hash = (hash * 33) ^ url.charCodeAt(--len);
}
// Create 'server-icons' directory if not existed