Skip to content

Commit

Permalink
For single servers, use description as server Name
Browse files Browse the repository at this point in the history
  • Loading branch information
softins committed Sep 30, 2024
1 parent 11ae06a commit 760c687
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<option v-for="(c, index) in options.extra" :value="c.server" :key="index">{{ c.desc }}</option>
</optgroup>
<optgroup v-if="options.single.length" label="Custom single servers">
<option v-for="(c, index) in options.single" :value="'='+c.server" :key="index">{{ c.desc }}</option>
<option v-for="(c, index) in options.single" :value="'='+c.server+'='+c.desc" :key="index">{{ c.desc }}</option>
</optgroup>
</select>

Expand Down Expand Up @@ -292,11 +292,27 @@ export default {
return this.backends[this.usebackend].warn;
},
chosenServer() {
return this.server[0] == '=' ? this.server.substring(1) : this.server;
if (this.server[0] != '=') return this.server;
let i = this.server.substring(1).indexOf('=');
if (i < 0) return this.server.substring(1);
return this.server.substring(1, 1+i);
},
chosenDesc() {
if (this.server[0] != '=') return null;
let i = this.server.substring(1).indexOf('=');
if (i < 0) return null;
return this.server.substring(2+i);
},
chosenType() {
return this.server[0] == '=' ? 'server' : 'directory';
},
chosenURL() {
let url = this.backendURL + '?' + this.chosenType + '=' + this.chosenServer;
if (this.chosenDesc) {
url += '&name=' + encodeURIComponent(this.chosenDesc);
}
return url;
},
servertxt() {
return this.servers.length == 1 ? 'server' : 'servers';
},
Expand Down Expand Up @@ -412,7 +428,7 @@ export default {
queriedServer = this.chosenServer
this.loading = true
this.$http
.get(this.backendURL + '?' + this.chosenType + '=' + this.chosenServer)
.get(this.chosenURL)
.then(response => {
if (queriedServer == this.chosenServer) {
this.fetched = new Date()
Expand Down Expand Up @@ -442,7 +458,7 @@ export default {
if (this.chosenServer != '') {
queriedServer = this.chosenServer
this.$http
.get(this.backendURL + '?' + this.chosenType + '=' + this.chosenServer)
.get(this.chosenURL)
.then(response => {
if (queriedServer == this.chosenServer) {
this.fetched = new Date()
Expand Down

0 comments on commit 760c687

Please sign in to comment.