fix userscript...

This commit is contained in:
Gabe Yuan
2023-08-09 18:02:18 +08:00
parent 0cc3f4f356
commit faa4251e6c
3 changed files with 4 additions and 2 deletions

1
.env
View File

@@ -5,3 +5,4 @@ REACT_APP_VERSION=1.3.9
REACT_APP_HOMEPAGE=https://github.com/fishjar/kiss-translator
REACT_APP_OPTIONSPAGE=https://kiss-translator.rayjar.com/options
REACT_APP_OPTIONSPAGE2=https://fishjar.github.io/kiss-translator/options.html
REACT_APP_OPTIONSPAGE_DEV=http://localhost:3000/options.html

View File

@@ -15,7 +15,7 @@ import { Translator } from "./libs/translator";
(async () => {
// 设置页面
if (
document.location.href.includes("http://localhost:3000/options.html") ||
document.location.href.includes(process.env.REACT_APP_OPTIONSPAGE_DEV) ||
document.location.href.includes(process.env.REACT_APP_OPTIONSPAGE) ||
document.location.href.includes(process.env.REACT_APP_OPTIONSPAGE2)
) {
@@ -24,6 +24,7 @@ import { Translator } from "./libs/translator";
window.unsafeWindow.GM_setValue = window.GM_setValue;
window.unsafeWindow.GM_getValue = window.GM_getValue;
window.unsafeWindow.GM_deleteValue = window.GM_deleteValue;
window.unsafeWindow.APP_NAME = process.env.REACT_APP_NAME;
return;
}

View File

@@ -23,7 +23,7 @@ export default function Options() {
let i = 0;
for (;;) {
await sleep(1000);
if (window.GM) {
if (window.APP_NAME === process.env.REACT_APP_NAME) {
setReady(true);
break;
}