Skip to content

Commit

Permalink
实现内部插件系统
Browse files Browse the repository at this point in the history
  • Loading branch information
Xmader committed Dec 23, 2019
1 parent fb1fb59 commit 3f2aea3
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/native_node_modules/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion app/notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
const path = require("path")

const { notifier } = require("./native_node_modules")
const { Notification } = require("electron")

let { Notification } = require("electron")
if (typeof Notification == "undefined") {
Notification = require("electron").remote.Notification
}

/**
* @param {string} title
Expand Down
2 changes: 1 addition & 1 deletion app/pages/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions app/pages/index.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ css/aria-ng-44e05b37a3.min.css
css/bootstrap-3.4.1.min.css
css/plugins-9b678dd4f5.min.css
js/angular-packages-1.6.10.min.js
js/aria-ng-b5a358bfeb.min.js
js/aria-ng-2c2cbc4a00.min.js
js/bootstrap-3.4.1.min.js
js/echarts-common-3.8.5.min.js
js/jquery-3.3.1.min.js
Expand All @@ -20,4 +20,4 @@ NETWORK:
SETTINGS:
prefer-online

# hash: 9e7ca3c5f6eebd1051d96b82a0bfa50f18f50c6721c4cd7233909acc7dd20c37
# hash: 46d6c45d0f8c1a13507a203f5ae263ca0047de13a34109b28047622530866301
5 changes: 5 additions & 0 deletions app/pages/js/aria-ng-2c2cbc4a00.min.js

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions app/pages/js/aria-ng-b5a358bfeb.min.js

This file was deleted.

15 changes: 8 additions & 7 deletions app/plugins/show-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

const { resolve } = require("path")
const { shell } = require("electron")
const { existsSync } = require("fs")

/**
* @typedef {import("./index").Plugin} Plugin
Expand All @@ -22,21 +23,21 @@ module.exports = {
activate(context) {

// 打开下载路径
context.addListener("request-open-download-dir", (dir) => {
context.extra.openDir = (dir) => {
shell.openItem(resolve(dir))
shell.beep()
})
}

// 在文件管理器中显示文件
context.addListener("request-show-file", (path) => {
context.extra.showFile = (path) => {
shell.showItemInFolder(resolve(path))
shell.beep()
})
}

// 检测文件或目录是否已被移动或删除
context.addListener("request-if-file-exists", (path) => {
return context.fs.exists(path)
})
context.extra.fileExists = context.extra.fileExistsSync = (path) => {
return existsSync(path)
}

}
}

0 comments on commit 3f2aea3

Please sign in to comment.