Skip to content

Commit

Permalink
fix: start on login (#1334)
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
  • Loading branch information
hacdias authored Apr 17, 2020
1 parent 6ca8c8c commit c2ebf54
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"clean:webui": "shx rm -rf assets/webui/",
"build": "run-s clean:webui build:*",
"build:webui": "run-s build:webui:*",
"build:webui:download": "npx ipfs-or-gateway -c Qmexhq2sBHnXQbvyP2GfUdbnY7HCagH2Mw5vUNSBn2nxip -p assets/webui/ -t 360000 --verbose",
"build:webui:download": "npx ipfs-or-gateway -c bafybeidatpz2hli6fgu3zul5woi27ujesdf5o5a7bu622qj6ugharciwjq -p assets/webui/ -t 360000 --verbose",
"build:webui:minimize": "shx rm -rf assets/webui/static/js/*.map && shx rm -rf assets/webui/static/css/*.map",
"build:binaries": "electron-builder --publish onTag"
},
Expand Down
2 changes: 2 additions & 0 deletions src/create-toggler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { ipcMain } = require('electron')
const os = require('os')
const store = require('./common/store')
const logger = require('./common/logger')

Expand All @@ -23,6 +24,7 @@ module.exports = function ({ webui }, settingsOption, activate) {
webui.webContents.send('config.changed', {
config: store.store,
changed: settingsOption,
platform: os.platform(),
success
})
})
Expand Down
6 changes: 5 additions & 1 deletion src/webui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { screen, BrowserWindow, ipcMain, app, session } = require('electron')
const { join } = require('path')
const { URL } = require('url')
const serve = require('electron-serve')
const os = require('os')
const openExternal = require('./open-external')
const logger = require('../common/logger')
const store = require('../common/store')
Expand Down Expand Up @@ -101,7 +102,10 @@ module.exports = async function (ctx) {
})

ipcMain.on('config.get', () => {
window.webContents.send('config.changed', { config: store.store })
window.webContents.send('config.changed', {
platform: os.platform(),
config: store.store
})
})

session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
Expand Down
5 changes: 5 additions & 0 deletions test/unit/create-toggler.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const sinon = require('sinon')
const chai = require('chai')
const { expect } = chai
const os = require('os')
const dirtyChai = require('dirty-chai')
const mockElectron = require('./mocks/electron')
const mockStore = require('./mocks/store')
Expand Down Expand Up @@ -43,6 +44,7 @@ describe('Create toggler', () => {
expect(args[0]).to.equal('config.changed')
expect(args[1]).to.deep.equal({
changed: 'OPT',
platform: os.platform(),
config: {
OPT: true
},
Expand All @@ -68,6 +70,7 @@ describe('Create toggler', () => {
expect(args[0]).to.equal('config.changed')
expect(args[1]).to.deep.equal({
changed: 'OPT',
platform: os.platform(),
config: {},
success: false
})
Expand All @@ -93,6 +96,7 @@ describe('Create toggler', () => {
expect(args[0]).to.equal('config.changed')
expect(args[1]).to.deep.equal({
changed: 'OPT',
platform: os.platform(),
config: {
OPT: false
},
Expand Down Expand Up @@ -120,6 +124,7 @@ describe('Create toggler', () => {
expect(args[0]).to.equal('config.changed')
expect(args[1]).to.deep.equal({
changed: 'OPT',
platform: os.platform(),
config: {
OPT: true
},
Expand Down

0 comments on commit c2ebf54

Please sign in to comment.