From 788f3f3566bea46a164ed8ed68b39f69344fc65e Mon Sep 17 00:00:00 2001
From: Alexandr Ilenko <AIlenko@IBS.RU>
Date: Mon, 22 Aug 2022 18:33:14 +0300
Subject: [SILABMC-280] Fix: use wsS only when httpS

---
 src/views/_sila/Operations/Kvm/KvmConsole.vue | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

(limited to 'src/views/_sila/Operations/Kvm/KvmConsole.vue')

diff --git a/src/views/_sila/Operations/Kvm/KvmConsole.vue b/src/views/_sila/Operations/Kvm/KvmConsole.vue
index 603aa115..b4fddb9d 100644
--- a/src/views/_sila/Operations/Kvm/KvmConsole.vue
+++ b/src/views/_sila/Operations/Kvm/KvmConsole.vue
@@ -111,12 +111,10 @@ export default {
       this.rfb = null;
     },
     openTerminal() {
+      const url = new URL('/kvm/0', window.location.href);
+      url.protocol = url.protocol.replace('http', 'ws');
       const token = this.$store.getters['authentication/token'];
-      this.rfb = new RFB(
-        this.$refs.panel,
-        `wss://${window.location.host}/kvm/0`,
-        { wsProtocols: [token] }
-      );
+      this.rfb = new RFB(this.$refs.panel, url, { wsProtocols: [token] });
 
       this.rfb.scaleViewport = true;
       this.rfb.clipViewport = true;
-- 
cgit v1.2.3

