From aff35d2a663b2022fd566b6d0811be460548c958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BF=83=E5=AE=87?= Date: Wed, 18 Oct 2023 14:28:06 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E6=BC=8F=E6=B4=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/jsFromMiddleLayer/main.js | 5 +++-- src/modules/tpm/jupyter/index.js | 6 +++--- src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/public/js/jsFromMiddleLayer/main.js b/public/js/jsFromMiddleLayer/main.js index f77f99266..ee0aabb00 100755 --- a/public/js/jsFromMiddleLayer/main.js +++ b/public/js/jsFromMiddleLayer/main.js @@ -32,7 +32,7 @@ function openTerminal(options) { console.log(data); client.sendClientData(data); - window.parent.postMessage({ tp: 'sshWorking' }, "*"); + window.parent.postMessage({ tp: 'sshWorking' }, window.location.origin); }); term.open(); $('body>.terminal').detach().appendTo(parentDomId + ' #term'); @@ -66,6 +66,7 @@ function openTerminal(options) { }; window.addEventListener("message", function (event) { + if (event.origin !== window.location.origin) return console.log("post message: "); console.log(event.data); if (event.data.tp === 'resize') { @@ -106,7 +107,7 @@ function openTerminal(options) { } if (force_close_socket === false) { // $(window).trigger('setSSHConnectStatus'); - window.parent.postMessage({ tp: 'setSSHConnectStatus', tab: options.tab }, "*"); + window.parent.postMessage({ tp: 'setSSHConnectStatus', tab: options.tab }, window.location.origin); } else { // 主动关闭连接时,不自动重连 force_close_socket = false; diff --git a/src/modules/tpm/jupyter/index.js b/src/modules/tpm/jupyter/index.js index 6883aa72f..47c97627a 100644 --- a/src/modules/tpm/jupyter/index.js +++ b/src/modules/tpm/jupyter/index.js @@ -111,7 +111,7 @@ function JupyterTPI (props) { const addEventListeners = () => { window.addEventListener('message', (e) => { // console.log("触发了jupytermessage"); - if(e){ + if(e && e.origin === window.location.origin){ if(e.data){ if(e.data==="jupytermessage"){ newHandle() @@ -127,9 +127,9 @@ function JupyterTPI (props) { return; } if(sum===1){ - _iframe.contentWindow.postMessage("stopParent", "*"); + _iframe.contentWindow.postMessage("stopParent", window.location.origin); }else{ - _iframe.contentWindow.postMessage("clonsParent", "*"); + _iframe.contentWindow.postMessage("clonsParent", window.location.origin); } } diff --git a/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index 391d9aa39..97f42f770 100644 --- a/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -197,7 +197,7 @@ class Challengesjupyter extends Component { window.addEventListener('message', (e) => { - if(e){ + if(e && e.origin === window.location.origin){ if(e.data){ if(e.data==="jupytermessage"){ if(this.state.showtime===false){ From 086bd5fd16565e17eddecbce50cc356246a12e37 Mon Sep 17 00:00:00 2001 From: unknown <2569982966@qq.com> Date: Thu, 16 Nov 2023 13:16:19 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=88=90=E6=9E=9C?= =?UTF-8?q?=E5=BA=93overview=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 458 ++----------------- src/App.js | 15 +- src/military/achievement.js | 17 +- src/military/achievement/overview/index.jsx | 227 +++++++++ src/military/achievement/overview/index.scss | 215 +++++++++ 5 files changed, 495 insertions(+), 437 deletions(-) create mode 100644 src/military/achievement/overview/index.jsx create mode 100644 src/military/achievement/overview/index.scss diff --git a/.idea/workspace.xml b/.idea/workspace.xml index b6bb1a5df..0b803d869 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,293 +2,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + -