fix: Get social token from environments instead of json-storage

This commit is contained in:
AkiraFukushima 2018-03-13 15:09:54 +09:00
parent 2ef6a65aae
commit 770fb20058
3 changed files with 9 additions and 28 deletions

18
package-lock.json generated
View File

@ -414,6 +414,7 @@
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz",
"integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==",
"dev": true,
"requires": {
"lodash": "4.17.5"
}
@ -4305,18 +4306,6 @@
"integrity": "sha1-FOb9pcaOnk7L7/nM8DfL18BcWv4=",
"dev": true
},
"electron-json-storage": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/electron-json-storage/-/electron-json-storage-4.0.2.tgz",
"integrity": "sha1-wNZizNAbxlZ9YHjxemhCrHQyjOQ=",
"requires": {
"async": "2.6.0",
"lodash": "4.17.5",
"mkdirp": "0.5.1",
"rimraf": "2.6.2",
"rwlock": "5.0.0"
}
},
"electron-localshortcut": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/electron-localshortcut/-/electron-localshortcut-3.1.0.tgz",
@ -12484,11 +12473,6 @@
"aproba": "1.2.0"
}
},
"rwlock": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/rwlock/-/rwlock-5.0.0.tgz",
"integrity": "sha1-iI1qd6M1HMGiCSBO8u4XIgk4Ns8="
},
"rx-lite": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz",

View File

@ -57,7 +57,6 @@
},
"dependencies": {
"axios": "^0.16.1",
"electron-json-storage": "^4.0.2",
"element-ui": "^2.2.1",
"google-fonts-webpack-plugin": "^0.4.4",
"is-empty": "^1.2.0",

View File

@ -2,7 +2,6 @@
import { app, ipcMain, BrowserWindow, shell, Menu } from 'electron'
import Datastore from 'nedb'
import storage from 'electron-json-storage'
import empty from 'is-empty'
import Authentication from './auth'
@ -124,16 +123,13 @@ ipcMain.on('get-access-token', (event, code) => {
})
})
// json storage
// environments
ipcMain.on('get-social-token', (event, _) => {
storage.get('config', (err, data) => {
if (err || empty(data)) {
console.log(err)
event.sender.send('error-get-social-token', err)
} else {
event.sender.send('response-get-social-token', data.token)
}
})
const token = process.env.SOCIAL_TOKEN
if (empty(token)) {
return event.sender.send('error-get-social-token', new EmptyTokenError())
}
event.sender.send('response-get-social-token', token)
})
// nedb
@ -215,3 +211,5 @@ app.on('ready', () => {
if (process.env.NODE_ENV === 'production') autoUpdater.checkForUpdates()
})
*/
class EmptyTokenError {}