From 9a78a9bd51f3b0941239709687d7666dcdff74fd Mon Sep 17 00:00:00 2001 From: ZegWe Date: Tue, 25 May 2021 19:31:15 +0800 Subject: [PATCH] fix socketio bug when using https --- src/plugins/socket.ts | 3 ++- src/views/plugins.vue | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/socket.ts b/src/plugins/socket.ts index b81c187..b3750d6 100644 --- a/src/plugins/socket.ts +++ b/src/plugins/socket.ts @@ -11,9 +11,10 @@ import * as io from 'socket.io-client' // transports: ['websocket'], // query: { EIO: '3', transport: 'websocket' } // } +let ws = (location.protocol == "http:") ? "ws://" : "wss://" Vue.use( new VueSocketIO({ - connection: io(`ws://${location.host}`, { + connection: io(`${ws}${location.host}`, { upgrade: true, secure: true, reconnection: true, diff --git a/src/views/plugins.vue b/src/views/plugins.vue index 4d45ca1..cb80921 100644 --- a/src/views/plugins.vue +++ b/src/views/plugins.vue @@ -62,8 +62,8 @@ import 'codemirror/theme/seti.css' export default class Plugins extends Vue { selectedItem = -1 plugin:{ - name: string - }[] = [] + name: string + }[] = [] LuaFileName = '' LuaFileSrc = ''