mirror of
https://github.com/louislam/dockge.git
synced 2024-11-27 13:14:03 +00:00
Merge branch 'master' into urls
# Conflicts: # frontend/src/lang/en.json
This commit is contained in:
commit
f339ef525e
4 changed files with 24 additions and 2 deletions
|
@ -195,6 +195,7 @@ export class DockgeServer {
|
||||||
// Create Socket.io
|
// Create Socket.io
|
||||||
this.io = new socketIO.Server(this.httpServer, {
|
this.io = new socketIO.Server(this.httpServer, {
|
||||||
cors,
|
cors,
|
||||||
|
transports: [ "websocket" ],
|
||||||
});
|
});
|
||||||
|
|
||||||
this.io.on("connection", async (socket: Socket) => {
|
this.io.on("connection", async (socket: Socket) => {
|
||||||
|
|
|
@ -92,5 +92,10 @@
|
||||||
"Internal Networks": "Internal Networks",
|
"Internal Networks": "Internal Networks",
|
||||||
"External Networks": "External Networks",
|
"External Networks": "External Networks",
|
||||||
"No External Networks": "No External Networks",
|
"No External Networks": "No External Networks",
|
||||||
|
"reverseProxyMsg1": "Using a Reverse Proxy?",
|
||||||
|
"reverseProxyMsg2": "Check how to config it for WebSocket",
|
||||||
|
"Cannot connect to the socket server.": "Cannot connect to the socket server.",
|
||||||
|
"reconnecting...": "Reconnecting...",
|
||||||
|
"connecting...": "Connecting to the socket server...",
|
||||||
"url": "URL | URLs"
|
"url": "URL | URLs"
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
<div v-if="! $root.socketIO.connected && ! $root.socketIO.firstConnect" class="lost-connection">
|
<div v-if="! $root.socketIO.connected && ! $root.socketIO.firstConnect" class="lost-connection">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
{{ $root.socketIO.connectionErrorMsg }}
|
{{ $root.socketIO.connectionErrorMsg }}
|
||||||
|
<div v-if="$root.socketIO.showReverseProxyGuide">
|
||||||
|
{{ $t("reverseProxyMsg1") }} <a href="https://github.com/louislam/uptime-kuma/wiki/Reverse-Proxy" target="_blank">{{ $t("reverseProxyMsg2") }}</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -82,6 +85,10 @@
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
<div v-if="$root.socketIO.connecting" class="container mt-5">
|
||||||
|
<h4>{{ $t("connecting...") }}</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
<router-view v-if="$root.loggedIn" />
|
<router-view v-if="$root.loggedIn" />
|
||||||
<Login v-if="! $root.loggedIn && $root.allowLoginDialog" />
|
<Login v-if="! $root.loggedIn && $root.allowLoginDialog" />
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -19,6 +19,7 @@ export default defineComponent({
|
||||||
initedSocketIO: false,
|
initedSocketIO: false,
|
||||||
connectionErrorMsg: `${this.$t("Cannot connect to the socket server.")} ${this.$t("Reconnecting...")}`,
|
connectionErrorMsg: `${this.$t("Cannot connect to the socket server.")} ${this.$t("Reconnecting...")}`,
|
||||||
showReverseProxyGuide: true,
|
showReverseProxyGuide: true,
|
||||||
|
connecting: false,
|
||||||
},
|
},
|
||||||
info: {
|
info: {
|
||||||
|
|
||||||
|
@ -103,13 +104,20 @@ export default defineComponent({
|
||||||
url = location.protocol + "//" + location.host;
|
url = location.protocol + "//" + location.host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let connectingMsgTimeout = setTimeout(() => {
|
||||||
|
this.socketIO.connecting = true;
|
||||||
|
}, 1500);
|
||||||
|
|
||||||
socket = io(url, {
|
socket = io(url, {
|
||||||
transports: [ "websocket", "polling" ]
|
transports: [ "websocket" ]
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("connect", () => {
|
socket.on("connect", () => {
|
||||||
console.log("Connected to the socket server");
|
console.log("Connected to the socket server");
|
||||||
|
|
||||||
|
clearTimeout(connectingMsgTimeout);
|
||||||
|
this.socketIO.connecting = false;
|
||||||
|
|
||||||
this.socketIO.connectCount++;
|
this.socketIO.connectCount++;
|
||||||
this.socketIO.connected = true;
|
this.socketIO.connected = true;
|
||||||
this.socketIO.showReverseProxyGuide = false;
|
this.socketIO.showReverseProxyGuide = false;
|
||||||
|
@ -143,10 +151,11 @@ export default defineComponent({
|
||||||
|
|
||||||
socket.on("connect_error", (err) => {
|
socket.on("connect_error", (err) => {
|
||||||
console.error(`Failed to connect to the backend. Socket.io connect_error: ${err.message}`);
|
console.error(`Failed to connect to the backend. Socket.io connect_error: ${err.message}`);
|
||||||
this.socketIO.connectionErrorMsg = `${this.$t("Cannot connect to the socket server.")} [${err}] ${this.$t("Reconnecting...")}`;
|
this.socketIO.connectionErrorMsg = `${this.$t("Cannot connect to the socket server.")} [${err}] ${this.$t("reconnecting...")}`;
|
||||||
this.socketIO.showReverseProxyGuide = true;
|
this.socketIO.showReverseProxyGuide = true;
|
||||||
this.socketIO.connected = false;
|
this.socketIO.connected = false;
|
||||||
this.socketIO.firstConnect = false;
|
this.socketIO.firstConnect = false;
|
||||||
|
this.socketIO.connecting = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Custom Events
|
// Custom Events
|
||||||
|
|
Loading…
Reference in a new issue