add link for backend switching
This commit is contained in:
parent
cbe1945f5d
commit
005ec8dd3c
@ -6,6 +6,12 @@
|
|||||||
<div v-else class="center-stuff">
|
<div v-else class="center-stuff">
|
||||||
<h2>{{$t("warning")}}</h2>
|
<h2>{{$t("warning")}}</h2>
|
||||||
<p>{{$t("connection_error")}}</p>
|
<p>{{$t("connection_error")}}</p>
|
||||||
|
<ul v-if="shouldShowBackendSuggestions">
|
||||||
|
Connect to one of these backends:
|
||||||
|
<li v-for="suggestion in backendSuggestions" :key="suggestion.name" @click="changeBackend(suggestion)">
|
||||||
|
{{suggestion.name}}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<help v-if="showHelp"/>
|
<help v-if="showHelp"/>
|
||||||
<div style="position:fixed;bottom:4pt;right:4pt;display:flex;z-index:10">
|
<div style="position:fixed;bottom:4pt;right:4pt;display:flex;z-index:10">
|
||||||
@ -65,8 +71,16 @@ export default {
|
|||||||
report: '',
|
report: '',
|
||||||
sending_report: false,
|
sending_report: false,
|
||||||
connect_dev: undefined,
|
connect_dev: undefined,
|
||||||
|
backendSuggestions: [
|
||||||
|
{ name: 'Bang Xamin', url: 'https://bang.xamin.it' },
|
||||||
|
{ name: 'Bang Miga', url: 'https://bang.migani.synology.me/' },
|
||||||
|
{ name: 'Localhost', url: 'http://localhost:5001' },
|
||||||
|
],
|
||||||
}),
|
}),
|
||||||
computed: {
|
computed: {
|
||||||
|
shouldShowBackendSuggestions() {
|
||||||
|
return window.location.origin.indexOf('vercel') !== -1 || window.location.origin.indexOf('localhost') !== -1
|
||||||
|
},
|
||||||
},
|
},
|
||||||
sockets: {
|
sockets: {
|
||||||
connect() {
|
connect() {
|
||||||
@ -100,6 +114,11 @@ export default {
|
|||||||
// Send message to SW to skip the waiting and activate the new SW
|
// Send message to SW to skip the waiting and activate the new SW
|
||||||
this.registration.waiting.postMessage({ type: 'SKIP_WAITING' })
|
this.registration.waiting.postMessage({ type: 'SKIP_WAITING' })
|
||||||
},
|
},
|
||||||
|
changeBackend(suggestion) {
|
||||||
|
this.$socket.disconnect();
|
||||||
|
window.localStorage.setItem('connect-dev', suggestion.url);
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
resetConnection() {
|
resetConnection() {
|
||||||
this.$socket.disconnect();
|
this.$socket.disconnect();
|
||||||
window.localStorage.removeItem('connect-dev');
|
window.localStorage.removeItem('connect-dev');
|
||||||
|
Loading…
Reference in New Issue
Block a user