🏗️ refactor IPC listener management and enhance logging response handling

This commit is contained in:
刘嘉伟 2025-02-25 14:15:18 +08:00
parent 20a8208240
commit 3373e30331
5 changed files with 14 additions and 11 deletions

View File

@ -24,5 +24,6 @@ jobs:
- name: Build
run: |
npm install
npx run release
npm i -g pnpm
pnpm install
pnpm build:electron

View File

@ -26,7 +26,7 @@ class LogController extends BaseController {
openFrpcLogFile(req: ControllerParam) {
this._logService.openFrpcLogFile().then(data => {
if (data) {
ResponseUtils.success(null);
ResponseUtils.success();
} else {
ResponseUtils.fail();
}

View File

@ -3,9 +3,9 @@ import VersionRepository from "../repository/VersionRepository";
import PathUtils from "../utils/PathUtils";
import GlobalConstant from "../core/GlobalConstant";
import { app, BrowserWindow, Notification } from "electron";
import { success } from "../utils/ResponseUtils";
import treeKill from "tree-kill";
import BeanFactory from "../core/BeanFactory";
import ResponseUtils from "../utils/ResponseUtils";
class FrpcProcessService {
private readonly _serverService: ServerService;

View File

@ -1,9 +1,9 @@
import fs from "fs";
import { success } from "../utils/ResponseUtils";
import PathUtils from "../utils/PathUtils";
import SystemService from "./SystemService";
import BeanFactory from "../core/BeanFactory";
import { BrowserWindow } from "electron";
import ResponseUtils from "../utils/ResponseUtils";
class LogService {
private readonly _systemService: SystemService;

View File

@ -6,7 +6,7 @@ import Breadcrumb from "@/layout/compoenets/Breadcrumb.vue";
import { ElMessage, ElMessageBox } from "element-plus";
import { useDebounceFn } from "@vueuse/core";
import IconifyIconOffline from "@/components/IconifyIcon/src/iconifyIconOffline";
import { on, send } from "@/utils/ipcUtils";
import { on, removeRouterListeners, removeRouterListeners2, send } from "@/utils/ipcUtils";
import { ipcRouters } from "../../../electron/core/IpcRouter";
defineComponent({
@ -40,6 +40,10 @@ const handleDownload = useDebounceFn((version: FrpcVersion) => {
send(ipcRouters.VERSION.downloadVersion, {
githubReleaseId: version.githubReleaseId
});
downloading.value.set(
version.githubReleaseId,
0
);
}, 300);
/**
@ -144,11 +148,9 @@ const handleImportFrp = () => {
};
onUnmounted(() => {
ipcRenderer.removeAllListeners("Download.frpVersionDownloadOnProgress");
ipcRenderer.removeAllListeners("Download.frpVersionDownloadOnCompleted");
ipcRenderer.removeAllListeners("Download.frpVersionHook");
ipcRenderer.removeAllListeners("Download.deleteVersion.hook");
ipcRenderer.removeAllListeners("Download.importFrpFile.hook");
removeRouterListeners(ipcRouters.VERSION.deleteDownloadedVersion);
removeRouterListeners(ipcRouters.VERSION.downloadVersion);
removeRouterListeners(ipcRouters.VERSION.getVersions);
});
</script>
<template>