From e7266856f1401e8bfef7d990fb6be10777670c1a Mon Sep 17 00:00:00 2001 From: Daniel Sarfati Date: Fri, 22 Nov 2019 14:51:45 -0700 Subject: [PATCH] Moved plugin directory to `userData` folder (#238) --- packages/desktop-app/package.json | 2 +- packages/desktop-app/src/main.ts | 33 ++++++++++++++++++---- packages/desktop-app/src/models/Profile.ts | 5 ++++ 3 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 packages/desktop-app/src/models/Profile.ts diff --git a/packages/desktop-app/package.json b/packages/desktop-app/package.json index 3140d57d1..9299a73c3 100644 --- a/packages/desktop-app/package.json +++ b/packages/desktop-app/package.json @@ -1,6 +1,6 @@ { "name": "salad", - "version": "0.3.4", + "version": "0.3.5", "description": "Salad Technologies Desktop Application", "author": "Salad Technologies ", "homepage": "https://www.salad.io/", diff --git a/packages/desktop-app/src/main.ts b/packages/desktop-app/src/main.ts index 17a0ae754..0d0945b02 100644 --- a/packages/desktop-app/src/main.ts +++ b/packages/desktop-app/src/main.ts @@ -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://0a70874cde284d838a378e1cc3bbd963@sentry.io/1804227' }) +const appVersion = app.getVersion() + +Sentry.init({ + dsn: 'https://0a70874cde284d838a378e1cc3bbd963@sentry.io/1804227', + release: appVersion, +}) /** Path to the /static folder. Provided via electron-webpack */ declare const __static: string @@ -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) @@ -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() @@ -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}`) diff --git a/packages/desktop-app/src/models/Profile.ts b/packages/desktop-app/src/models/Profile.ts new file mode 100644 index 000000000..f372b84fb --- /dev/null +++ b/packages/desktop-app/src/models/Profile.ts @@ -0,0 +1,5 @@ +export interface Profile { + id: string + username: string + email: string +}