From 7c9d806782ddca486ef49a3c74a096f3d951136e Mon Sep 17 00:00:00 2001 From: nonameShijian <2954700422@qq.com> Date: Fri, 16 Feb 2024 17:33:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8index.html=E6=B7=BB=E5=8A=A0promise?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E6=8D=95=E8=8E=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 2 +- index.html | 92 +++++++++++++++++++++++++++++++++++++++----- noname/init/index.js | 4 +- 3 files changed, 85 insertions(+), 13 deletions(-) diff --git a/game/game.js b/game/game.js index 3101a5c49..66b797c24 100644 --- a/game/game.js +++ b/game/game.js @@ -141,7 +141,7 @@ new Promise(resolve => { module._compile(require('fs').readFileSync(filename, 'utf8'), filename); }; } - if (location.protocol.startsWith('http') && 'serviceWorker' in navigator) { + if (window.isSecureContext && 'serviceWorker' in navigator) { let scope = window.location.protocol + '//' + window.location.host + '/'; navigator.serviceWorker.getRegistrations().then(registrations => { let findServiceWorker = registrations.find(registration => { diff --git a/index.html b/index.html index 6ec89d172..22e37375f 100755 --- a/index.html +++ b/index.html @@ -1,4 +1,5 @@ + @@ -6,19 +7,90 @@ 无名杀