|
@@ -123,6 +123,52 @@ export function useRemoteAppChecker() {
|
|
|
let disableLoginBtnBecauseRemoteApp = $ref(true);
|
|
|
|
|
|
const QECSConfig = $computed(() => store.QECSConfig);
|
|
|
+
|
|
|
+
|
|
|
+ async function checkBlackAppLoopMethod(){
|
|
|
+ if (import.meta.env.DEV) {
|
|
|
+ disableLoginBtnBecauseRemoteApp = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ !QECSConfig.PREVENT_CHEATING_CONFIG?.includes(
|
|
|
+ "DISABLE_REMOTE_ASSISTANCE"
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ disableLoginBtnBecauseRemoteApp = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ let exe = "Project1.exe";
|
|
|
+ try {
|
|
|
+ if (fileExists("Project2.exe")) {
|
|
|
+ const { remoteApp: remoteAppName } = await getBlackAppConfig();
|
|
|
+ console.log('remoteAppName:',remoteAppName)
|
|
|
+ exe = `Project2.exe "${remoteAppName}" `;
|
|
|
+ }
|
|
|
+
|
|
|
+ const fs: typeof import("fs") = window.nodeRequire("fs");
|
|
|
+ fileExists("remoteApplication.txt") &&
|
|
|
+ fs.unlinkSync("remoteApplication.txt");
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ logger({
|
|
|
+ cnl: ["local", "server"],
|
|
|
+ pgu: "AUTO",
|
|
|
+ key: "checkRemoteAppTxt",
|
|
|
+ dtl: "unlink remoteApplication.txt 失败",
|
|
|
+ possibleError: error,
|
|
|
+ });
|
|
|
+ $message.error("请关闭远程控制程序后重试", {
|
|
|
+ duration: 24 * 60 * 60 * 1000,
|
|
|
+ });
|
|
|
+ throw error;
|
|
|
+ }
|
|
|
+ await execLocal(exe);
|
|
|
+
|
|
|
+ await checkRemoteAppTxt();
|
|
|
+ }
|
|
|
+
|
|
|
watch(
|
|
|
() => QECSConfig.PREVENT_CHEATING_CONFIG,
|
|
|
async (val, oldVal) => {
|
|
@@ -130,47 +176,48 @@ export function useRemoteAppChecker() {
|
|
|
// 同时,还通过网络获取,所以此时的监听会发生两次,两次可能导致 remoteApplication.txt 被删除后读取不到
|
|
|
// 所以此时发现值一样就不要进行后续
|
|
|
if (JSON.stringify(val) === JSON.stringify(oldVal)) return;
|
|
|
- if (import.meta.env.DEV) {
|
|
|
- disableLoginBtnBecauseRemoteApp = false;
|
|
|
- return;
|
|
|
- }
|
|
|
- if (
|
|
|
- !QECSConfig.PREVENT_CHEATING_CONFIG?.includes(
|
|
|
- "DISABLE_REMOTE_ASSISTANCE"
|
|
|
- )
|
|
|
- ) {
|
|
|
- disableLoginBtnBecauseRemoteApp = false;
|
|
|
- return;
|
|
|
- }
|
|
|
+ await checkBlackAppLoopMethod();
|
|
|
+ // if (import.meta.env.DEV) {
|
|
|
+ // disableLoginBtnBecauseRemoteApp = false;
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (
|
|
|
+ // !QECSConfig.PREVENT_CHEATING_CONFIG?.includes(
|
|
|
+ // "DISABLE_REMOTE_ASSISTANCE"
|
|
|
+ // )
|
|
|
+ // ) {
|
|
|
+ // disableLoginBtnBecauseRemoteApp = false;
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
|
|
|
- let exe = "Project1.exe";
|
|
|
- try {
|
|
|
- if (fileExists("Project2.exe")) {
|
|
|
- const { remoteApp: remoteAppName } = await getBlackAppConfig();
|
|
|
- console.log('remoteAppName:',remoteAppName)
|
|
|
- exe = `Project2.exe "${remoteAppName}" `;
|
|
|
- }
|
|
|
+ // let exe = "Project1.exe";
|
|
|
+ // try {
|
|
|
+ // if (fileExists("Project2.exe")) {
|
|
|
+ // const { remoteApp: remoteAppName } = await getBlackAppConfig();
|
|
|
+ // console.log('remoteAppName:',remoteAppName)
|
|
|
+ // exe = `Project2.exe "${remoteAppName}" `;
|
|
|
+ // }
|
|
|
|
|
|
- const fs: typeof import("fs") = window.nodeRequire("fs");
|
|
|
- fileExists("remoteApplication.txt") &&
|
|
|
- fs.unlinkSync("remoteApplication.txt");
|
|
|
- } catch (error) {
|
|
|
- console.log(error);
|
|
|
- logger({
|
|
|
- cnl: ["local", "server"],
|
|
|
- pgu: "AUTO",
|
|
|
- key: "checkRemoteAppTxt",
|
|
|
- dtl: "unlink remoteApplication.txt 失败",
|
|
|
- possibleError: error,
|
|
|
- });
|
|
|
- $message.error("请关闭远程控制程序后重试", {
|
|
|
- duration: 24 * 60 * 60 * 1000,
|
|
|
- });
|
|
|
- throw error;
|
|
|
- }
|
|
|
- await execLocal(exe);
|
|
|
+ // const fs: typeof import("fs") = window.nodeRequire("fs");
|
|
|
+ // fileExists("remoteApplication.txt") &&
|
|
|
+ // fs.unlinkSync("remoteApplication.txt");
|
|
|
+ // } catch (error) {
|
|
|
+ // console.log(error);
|
|
|
+ // logger({
|
|
|
+ // cnl: ["local", "server"],
|
|
|
+ // pgu: "AUTO",
|
|
|
+ // key: "checkRemoteAppTxt",
|
|
|
+ // dtl: "unlink remoteApplication.txt 失败",
|
|
|
+ // possibleError: error,
|
|
|
+ // });
|
|
|
+ // $message.error("请关闭远程控制程序后重试", {
|
|
|
+ // duration: 24 * 60 * 60 * 1000,
|
|
|
+ // });
|
|
|
+ // throw error;
|
|
|
+ // }
|
|
|
+ // await execLocal(exe);
|
|
|
|
|
|
- await checkRemoteAppTxt();
|
|
|
+ // await checkRemoteAppTxt();
|
|
|
},
|
|
|
{ immediate: true }
|
|
|
);
|
|
@@ -178,5 +225,6 @@ export function useRemoteAppChecker() {
|
|
|
return {
|
|
|
disableLoginBtnBecauseRemoteApp: $$(disableLoginBtnBecauseRemoteApp),
|
|
|
checkRemoteAppTxt,
|
|
|
+ checkBlackAppLoopMethod
|
|
|
};
|
|
|
}
|