From 16adc01f842e140635034b5f5fb05402ba0edfe9 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 10 Jan 2022 17:34:53 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/home.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/home/home.js b/public/home/home.js index 92eb86c1d3..7f8aa070dc 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -33,6 +33,11 @@ var swiperRepo = new Swiper(".homepro-list", { }); var output = document.getElementById("newmessage"); +var url = "ws://" + document.location.host + "/action/notification" +if(document.location.host == "git.openi.org.cn"){ + url = "wss://" + document.location.host + "/action/notification" +} + var socket = new WebSocket("ws://" + document.location.host + "/action/notification"); socket.onopen = function () { -- 2.34.1 From 96ebfbdf27912c05c5c6bff957455f22dab04635 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 10 Jan 2022 17:36:31 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/home.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/home/home.js b/public/home/home.js index 7f8aa070dc..2f9ee90fd5 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -37,8 +37,7 @@ var url = "ws://" + document.location.host + "/action/notification" if(document.location.host == "git.openi.org.cn"){ url = "wss://" + document.location.host + "/action/notification" } - -var socket = new WebSocket("ws://" + document.location.host + "/action/notification"); +var socket = new WebSocket(url); socket.onopen = function () { console.log("message has connected."); -- 2.34.1 From 4ac3b4759c000ad520838bc74b2a98266a06e44f Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 10 Jan 2022 17:41:25 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/home.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/home/home.js b/public/home/home.js index 2f9ee90fd5..6859e85b72 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -34,7 +34,7 @@ var swiperRepo = new Swiper(".homepro-list", { var output = document.getElementById("newmessage"); var url = "ws://" + document.location.host + "/action/notification" -if(document.location.host == "git.openi.org.cn"){ +if(document.location.host == "git.openi.org.cn" || document.URL.startsWith("https")){ url = "wss://" + document.location.host + "/action/notification" } var socket = new WebSocket(url); -- 2.34.1 From d026c5d413dc9b77d0e0dabe26eeff3695e0e83e Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 10 Jan 2022 17:43:29 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- public/home/home.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/home/home.js b/public/home/home.js index 6859e85b72..f38e6f18e4 100644 --- a/public/home/home.js +++ b/public/home/home.js @@ -33,7 +33,9 @@ var swiperRepo = new Swiper(".homepro-list", { }); var output = document.getElementById("newmessage"); -var url = "ws://" + document.location.host + "/action/notification" +console.log("document.location.host="+document.location.host); +console.log("document.URL="+document.URL); +var url = "ws://" + document.location.host + "/action/notification"; if(document.location.host == "git.openi.org.cn" || document.URL.startsWith("https")){ url = "wss://" + document.location.host + "/action/notification" } -- 2.34.1