Michael Wang il y a 3 ans
Parent
commit
48c1f6214d

+ 5 - 3
src/features/UserLogin/UserLogin.vue

@@ -35,6 +35,9 @@ import { useVCamChecker } from "./useVCamChecker";
 const { addTimeout, addInterval } = useTimers();
 
 //#region 登录日志处理
+// @ts-expect-error
+// eslint-disable-next-line no-undef
+const portableFile = window.proceess?.env?.PORTABLE_EXECUTABLE_FILE;
 logger({
   cnl: ["console", "local", "server"],
   pgn: "登录页面",
@@ -48,9 +51,8 @@ if (isElectron()) {
     act: "versonstats",
     ext: {
       packageVersion: "ua-" + ua.getBrowser().version,
-      file: eval(`proceess.env.PORTABLE_EXECUTABLE_FILE`),
-      uaGood:
-        "uagood-" + (eval(`proceess.env.PORTABLE_EXECUTABLE_FILE`) ? 1 : 0),
+      file: portableFile,
+      uaGood: "uagood-" + (portableFile ? 1 : 0),
     },
   });
 }

+ 5 - 1
src/features/UserLogin/useAppVersion.ts

@@ -4,8 +4,12 @@ import ua from "@/utils/ua";
 import { onMounted, Ref, watch } from "vue";
 
 export function useAppVersion(newVersionAvailable: Ref<boolean>) {
+  // @ts-expect-error
+  // eslint-disable-next-line no-undef
+  const portableFile = window.proceess?.env?.PORTABLE_EXECUTABLE_FILE;
+
   function checkApp() {
-    if (isElectron() && !eval(`proceess.env.PORTABLE_EXECUTABLE_FILE`)) {
+    if (isElectron() && !portableFile) {
       // FIXME: 在苹果电脑跳过检测
       if (navigator.userAgent.includes("Macintosh")) {
         return;

+ 4 - 1
src/utils/nativeMethods.ts

@@ -207,7 +207,10 @@ export function checkMainExe(): boolean {
       .replace("ExecutablePath=", "")
       .trim()
       .replace(/&amp;/g, "&");
-    if (executablePath === eval(`proceess.env.PORTABLE_EXECUTABLE_FILE`)) {
+    // @ts-expect-error
+    // eslint-disable-next-line no-undef
+    const portableFile = window.proceess?.env?.PORTABLE_EXECUTABLE_FILE;
+    if (executablePath === portableFile) {
       const crypto: typeof import("crypto") = window.nodeRequire("crypto");
       const getHash = crypto
         .createHmac("sha256", "abcdefg")