|
|
@@ -5,12 +5,11 @@ const path = require('path');
|
|
|
const fs = require('fs');
|
|
|
const is = require('electron-is');
|
|
|
const { exec } = require('child_process');
|
|
|
-const unzip = require("unzip-crx-3");
|
|
|
const Controller = require('ee-core').Controller;
|
|
|
const Utils = require('ee-core').Utils;
|
|
|
const electronApp = require('electron').app;
|
|
|
-const {dialog, webContents, shell, BrowserWindow, BrowserView, Notification, powerMonitor, screen, nativeTheme} = require('electron');
|
|
|
-const chromeExtension = require('../library/chromeExtension');
|
|
|
+const {dialog, webContents, shell, BrowserWindow, BrowserView,
|
|
|
+ Notification, powerMonitor, screen, nativeTheme} = require('electron');
|
|
|
const autoLaunchManager = require('../library/autoLaunch');
|
|
|
|
|
|
let myTimer = null;
|
|
|
@@ -23,16 +22,16 @@ let notificationObj = null;
|
|
|
*/
|
|
|
class ExampleController extends Controller {
|
|
|
|
|
|
+ constructor(ctx) {
|
|
|
+ super(ctx);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 所有方法接收两个参数
|
|
|
- * @param args 前端 或 egg,传的参数(单个参数,或参数数组)
|
|
|
+ * @param args 前端传的参数
|
|
|
* @param event - IpcMainEvent 文档:https://www.electronjs.org/docs/latest/api/structures/ipc-main-event
|
|
|
*/
|
|
|
|
|
|
- constructor(ctx) {
|
|
|
- super(ctx);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* test
|
|
|
*/
|
|
|
@@ -236,23 +235,23 @@ class ExampleController extends Controller {
|
|
|
/**
|
|
|
* 加载扩展程序
|
|
|
*/
|
|
|
- async loadExtension (args) {
|
|
|
- const crxFile = args[0];
|
|
|
- if (_.isEmpty(crxFile)) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- const extensionId = path.basename(crxFile, '.crx');
|
|
|
- const chromeExtensionDir = chromeExtension.getDirectory();
|
|
|
- const extensionDir = path.join(chromeExtensionDir, extensionId);
|
|
|
-
|
|
|
- console.log("[api] [example] [loadExtension] extension id:", extensionId);
|
|
|
- unzip(crxFile, extensionDir).then(() => {
|
|
|
- console.log("[api] [example] [loadExtension] unzip success!");
|
|
|
- chromeExtension.load(extensionId);
|
|
|
- });
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
+ // async loadExtension (args) {
|
|
|
+ // const crxFile = args[0];
|
|
|
+ // if (_.isEmpty(crxFile)) {
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // const extensionId = path.basename(crxFile, '.crx');
|
|
|
+ // const chromeExtensionDir = chromeExtension.getDirectory();
|
|
|
+ // const extensionDir = path.join(chromeExtensionDir, extensionId);
|
|
|
+
|
|
|
+ // console.log("[api] [example] [loadExtension] extension id:", extensionId);
|
|
|
+ // unzip(crxFile, extensionDir).then(() => {
|
|
|
+ // console.log("[api] [example] [loadExtension] unzip success!");
|
|
|
+ // chromeExtension.load(extensionId);
|
|
|
+ // });
|
|
|
+
|
|
|
+ // return true;
|
|
|
+ // }
|
|
|
|
|
|
/**
|
|
|
* 创建系统通知
|