added node-notifier; showing plugin notifications.
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
"mkdirp": "^0.5.1",
|
"mkdirp": "^0.5.1",
|
||||||
"musicmetadata": "^2.0.2",
|
"musicmetadata": "^2.0.2",
|
||||||
"network-address": "^1.1.0",
|
"network-address": "^1.1.0",
|
||||||
|
"node-notifier": "^5.0.2",
|
||||||
"parse-torrent": "^5.7.3",
|
"parse-torrent": "^5.7.3",
|
||||||
"prettier-bytes": "^1.0.1",
|
"prettier-bytes": "^1.0.1",
|
||||||
"react": "^15.2.1",
|
"react": "^15.2.1",
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ const {exec} = require('child_process')
|
|||||||
const {resolve, basename} = require('path')
|
const {resolve, basename} = require('path')
|
||||||
const {writeFileSync} = require('fs')
|
const {writeFileSync} = require('fs')
|
||||||
const State = require('./renderer/lib/state')
|
const State = require('./renderer/lib/state')
|
||||||
|
const notifier = require('node-notifier')
|
||||||
|
|
||||||
const {app, dialog} = require('electron')
|
|
||||||
const {sync: mkdirpSync} = require('mkdirp')
|
const {sync: mkdirpSync} = require('mkdirp')
|
||||||
const ms = require('ms')
|
const ms = require('ms')
|
||||||
const shellEnv = require('shell-env')
|
const shellEnv = require('shell-env')
|
||||||
@@ -55,6 +55,7 @@ module.exports = class Plugins {
|
|||||||
if (plugins !== this.plugins) {
|
if (plugins !== this.plugins) {
|
||||||
const id = this.getId(plugins)
|
const id = this.getId(plugins)
|
||||||
if (this.id !== id) {
|
if (this.id !== id) {
|
||||||
|
this.alert('Installing plugins...')
|
||||||
log('UPDATING...')
|
log('UPDATING...')
|
||||||
this.id = id
|
this.id = id
|
||||||
this.plugins = plugins
|
this.plugins = plugins
|
||||||
@@ -156,7 +157,8 @@ module.exports = class Plugins {
|
|||||||
// notify watchers
|
// notify watchers
|
||||||
if (this.forceUpdate || changed) {
|
if (this.forceUpdate || changed) {
|
||||||
this.watchers.forEach(fn => fn(err, {forceUpdate: this.forceUpdate}))
|
this.watchers.forEach(fn => fn(err, {forceUpdate: this.forceUpdate}))
|
||||||
log('instalation completed')
|
this.alert('Installation completed')
|
||||||
|
log('installation completed')
|
||||||
}
|
}
|
||||||
|
|
||||||
// save state
|
// save state
|
||||||
@@ -221,12 +223,11 @@ module.exports = class Plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
alert (message) {
|
alert (message) {
|
||||||
log(message)
|
notifier.notify({
|
||||||
// TODO: display notifications
|
title: 'WebTorrent Plugins',
|
||||||
// dialog.showMessageBox({
|
// icon: config.icon, // TODO: save icon in webtorrent local folder and set config.icon
|
||||||
// message,
|
message: message
|
||||||
// buttons: ['Ok']
|
})
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isLocalPath (string) {
|
isLocalPath (string) {
|
||||||
@@ -333,9 +334,7 @@ module.exports = class Plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (installNeeded) this.updatePlugins()
|
if (installNeeded) this.updatePlugins()
|
||||||
|
return plugins.map(load).filter(v => Boolean(v))
|
||||||
return plugins.map(load)
|
|
||||||
.filter(v => Boolean(v))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onApp (app) {
|
onApp (app) {
|
||||||
|
|||||||
Reference in New Issue
Block a user