mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-23 10:32:29 +03:00
Fix: sentry will use userData before redirect it, ahead of the time
This commit is contained in:
parent
d89abde860
commit
1027fbfb60
@ -1,11 +1,10 @@
|
|||||||
|
import './portable'
|
||||||
import './sentry'
|
import './sentry'
|
||||||
import './lru'
|
import './lru'
|
||||||
import { app, ipcMain, Menu } from 'electron'
|
import { app, ipcMain, Menu } from 'electron'
|
||||||
import { parseArgs } from './cli'
|
import { parseArgs } from './cli'
|
||||||
import { Application } from './app'
|
import { Application } from './app'
|
||||||
import electronDebug = require('electron-debug')
|
import electronDebug = require('electron-debug')
|
||||||
import * as path from 'path'
|
|
||||||
import * as fs from 'fs'
|
|
||||||
|
|
||||||
if (!process.env.TERMINUS_PLUGINS) {
|
if (!process.env.TERMINUS_PLUGINS) {
|
||||||
process.env.TERMINUS_PLUGINS = ''
|
process.env.TERMINUS_PLUGINS = ''
|
||||||
@ -13,14 +12,6 @@ if (!process.env.TERMINUS_PLUGINS) {
|
|||||||
|
|
||||||
const application = new Application()
|
const application = new Application()
|
||||||
|
|
||||||
if (process.env.PORTABLE_EXECUTABLE_DIR) {
|
|
||||||
const portableData = path.join(process.env.PORTABLE_EXECUTABLE_DIR, 'terminus-data')
|
|
||||||
if (!fs.existsSync(portableData)) {
|
|
||||||
fs.mkdirSync(portableData)
|
|
||||||
}
|
|
||||||
app.setPath('userData', portableData)
|
|
||||||
}
|
|
||||||
|
|
||||||
ipcMain.on('app:new-window', () => {
|
ipcMain.on('app:new-window', () => {
|
||||||
application.newWindow()
|
application.newWindow()
|
||||||
})
|
})
|
||||||
|
15
app/lib/portable.ts
Executable file
15
app/lib/portable.ts
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
import * as path from 'path'
|
||||||
|
import * as fs from 'fs'
|
||||||
|
|
||||||
|
if (process.env.PORTABLE_EXECUTABLE_DIR) {
|
||||||
|
const portableData = path.join(process.env.PORTABLE_EXECUTABLE_DIR, 'terminus-data')
|
||||||
|
if (!fs.existsSync(portableData)) {
|
||||||
|
fs.mkdirSync(portableData)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
require('electron').app.setPath('userData', portableData)
|
||||||
|
} catch {
|
||||||
|
require('electron').remote.app.setPath('userData', portableData)
|
||||||
|
}
|
||||||
|
}
|
42
app/lib/sentry.ts
Normal file → Executable file
42
app/lib/sentry.ts
Normal file → Executable file
@ -1,21 +1,21 @@
|
|||||||
const { init } = process.type === 'main' ? require('@sentry/electron/dist/main') : require('@sentry/electron/dist/renderer')
|
const { init } = process.type === 'main' ? require('@sentry/electron/dist/main') : require('@sentry/electron/dist/renderer')
|
||||||
import * as isDev from 'electron-is-dev'
|
import * as isDev from 'electron-is-dev'
|
||||||
|
|
||||||
|
|
||||||
const SENTRY_DSN = 'https://4717a0a7ee0b4429bd3a0f06c3d7eec3@sentry.io/181876'
|
const SENTRY_DSN = 'https://4717a0a7ee0b4429bd3a0f06c3d7eec3@sentry.io/181876'
|
||||||
let release
|
let release
|
||||||
try {
|
try {
|
||||||
release = require('electron').app.getVersion()
|
release = require('electron').app.getVersion()
|
||||||
} catch {
|
} catch {
|
||||||
release = require('electron').remote.app.getVersion()
|
release = require('electron').remote.app.getVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isDev) {
|
if (!isDev) {
|
||||||
init({
|
init({
|
||||||
dsn: SENTRY_DSN,
|
dsn: SENTRY_DSN,
|
||||||
release,
|
release,
|
||||||
integrations (integrations) {
|
integrations (integrations) {
|
||||||
return integrations.filter(integration => integration.name !== 'Breadcrumbs')
|
return integrations.filter(integration => integration.name !== 'Breadcrumbs')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user