Skip to content

Commit

Permalink
Moved plugin directory to userData folder (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsarfati authored Nov 22, 2019
1 parent e28914d commit e726685
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/desktop-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "salad",
"version": "0.3.4",
"version": "0.3.5",
"description": "Salad Technologies Desktop Application",
"author": "Salad Technologies <[email protected]>",
"homepage": "https://www.salad.io/",
Expand Down
33 changes: 27 additions & 6 deletions packages/desktop-app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ import { PluginManager } from './salad-bowl/PluginManager'
import { PluginDefinition } from './salad-bowl/models/PluginDefinition'
import { SaladBridgeNotificationService } from './salad-bowl/SaladBridgeNotificationService'
import * as Sentry from '@sentry/electron'
import { Profile } from './models/Profile'

Sentry.init({ dsn: 'https://[email protected]/1804227' })
const appVersion = app.getVersion()

Sentry.init({
dsn: 'https://[email protected]/1804227',
release: appVersion,
})

/** Path to the /static folder. Provided via electron-webpack */
declare const __static: string
Expand Down Expand Up @@ -149,10 +155,9 @@ const createMainWindow = () => {
//Create the bridge to listen to messages from the web-app
let bridge = new SaladBridge(mainWindow)
let notificationService = new SaladBridgeNotificationService(bridge)
let exePath = app.getPath('exe')
let appPath = path.dirname(exePath)
console.log(`Path to Salad:${appPath}`)
pluginManager = new PluginManager(appPath, notificationService)
let dataFolder = app.getPath('userData')
console.log(`Path to Salad plugins:${dataFolder}`)
pluginManager = new PluginManager(dataFolder, notificationService)

ipcMain.on('js-dispatch', bridge.receiveMessage)

Expand Down Expand Up @@ -225,6 +230,22 @@ const createMainWindow = () => {
saladAutoLauncher.disable()
})

bridge.on('login', (profile: Profile) => {
Sentry.configureScope(scope => {
scope.setUser({
id: profile.id,
email: profile.email,
username: profile.username,
})
})
})

bridge.on('logout', () => {
Sentry.configureScope(scope => {
scope.setUser({})
})
})

mainWindow.webContents.on('new-window', (e: Electron.Event, url: string) => {
console.log(`opening new window at ${url}`)
e.preventDefault()
Expand Down Expand Up @@ -344,4 +365,4 @@ const cleanExit = () => {

process.on('SIGINT', cleanExit) // catch ctrl-c
process.on('SIGTERM', cleanExit) // catch kill
console.log(`Running ${app.name} ${app.getVersion()}`)
console.log(`Running ${app.name} ${appVersion}`)
5 changes: 5 additions & 0 deletions packages/desktop-app/src/models/Profile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface Profile {
id: string
username: string
email: string
}

0 comments on commit e726685

Please sign in to comment.