feat: 开关房功能开发
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
|
||||
import { ipcMain } from 'electron';
|
||||
import { ipcMain, app } from 'electron';
|
||||
import { IPC_EVENTS } from '@common/constants';
|
||||
import { launchLocalChrome } from '@main/utils/chrome/launchLocalChrome'
|
||||
import { executeScriptService } from '@main/service/execute-script-service';
|
||||
import path from 'path'
|
||||
import log from 'electron-log';
|
||||
|
||||
export function runTaskOperationService() {
|
||||
const executeScriptServiceInstance = new executeScriptService();
|
||||
@@ -19,7 +20,17 @@ export function runTaskOperationService() {
|
||||
*/
|
||||
|
||||
await launchLocalChrome(options)
|
||||
const result = await executeScriptServiceInstance.executeScript(path.join(__dirname, '../../scripts/fg_trace.js'), options)
|
||||
|
||||
// 脚本路径处理
|
||||
let scriptPath = ''
|
||||
if (app.isPackaged) {
|
||||
scriptPath = path.join(process.resourcesPath, 'scripts/fg_trace.js')
|
||||
} else {
|
||||
scriptPath = path.join(process.cwd(), 'src/main/scripts/fg_trace.js')
|
||||
}
|
||||
|
||||
log.info(`Launching script with path: ${scriptPath}`);
|
||||
const result = await executeScriptServiceInstance.executeScript(scriptPath, options)
|
||||
|
||||
return { success: true, result };
|
||||
} catch (error: any) {
|
||||
|
||||
Reference in New Issue
Block a user