Eugene Pankov 8 years ago
parent
commit
d9fd78fb42

+ 1 - 0
app/index.pug

@@ -8,6 +8,7 @@ html
             window.nodeRequire = require
         script(src='./preload.js')
         script(src='./bundle.js', defer)
+        style#custom-css
     body(style='background: ; min-height: 100vh; overflow: hidden')
         app-root
             .preload-logo

+ 1 - 1
app/package.json

@@ -6,7 +6,7 @@
     "email": "[email protected]"
   },
   "main": "main.js",
-  "version": "0.0.2",
+  "version": "1.0.0-alpha.1",
   "scripts": {
     "build": "../node_modules/.bin/webpack --progress --color --display-modules",
     "watch": "../node_modules/.bin/webpack --progress --color --watch"

+ 30 - 0
app/src/entry.preload.ts

@@ -1,3 +1,33 @@
 import 'source-sans-pro'
 import 'font-awesome/css/font-awesome.css'
 import './preload.scss'
+
+import * as Raven from 'raven-js'
+
+const SENTRY_DSN = 'https://[email protected]/181876'
+
+Raven.config(
+    SENTRY_DSN,
+    {
+        release: require('electron').remote.app.getVersion(),
+        dataCallback: (data: any) => {
+            const normalize = (filename) => {
+                let splitArray = filename.split('/')
+                return splitArray[splitArray.length - 1]
+            }
+
+            data.exception.values[0].stacktrace.frames.forEach(frame => {
+                frame.filename = normalize(frame.filename)
+            })
+
+            data.culprit = data.exception.values[0].stacktrace.frames[0].filename
+
+            return data
+        }
+    }
+)
+
+process.on('uncaughtException', (err) => {
+    Raven.captureException(err)
+    console.error(err)
+})

+ 50 - 0
package-lock.json

@@ -27,6 +27,18 @@
       "integrity": "sha1-JeTdgEtjDJFq5nEjPm1x9s4YEko=",
       "dev": true
     },
+    "@types/raven": {
+      "version": "1.2.2",
+      "resolved": "https://registry.npmjs.org/@types/raven/-/raven-1.2.2.tgz",
+      "integrity": "sha1-r+Ur2YGHo6PSi4IS42MUO9FvI78=",
+      "dev": true
+    },
+    "@types/raven-js": {
+      "version": "3.10.0",
+      "resolved": "https://registry.npmjs.org/@types/raven-js/-/raven-js-3.10.0.tgz",
+      "integrity": "sha1-0IMhYuvqdnHq//CKMktWrd5b+cM=",
+      "dev": true
+    },
     "@types/webpack-env": {
       "version": "https://registry.npmjs.org/@types/webpack-env/-/webpack-env-1.13.0.tgz",
       "integrity": "sha1-MEQ4FkfhHulzxa8uklMjkw9pHYA=",
@@ -641,6 +653,12 @@
       "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=",
       "dev": true
     },
+    "cookie": {
+      "version": "0.3.1",
+      "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
+      "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=",
+      "dev": true
+    },
     "core-js": {
       "version": "2.4.1",
       "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz",
@@ -1985,6 +2003,12 @@
       "integrity": "sha1-HRdnnAac2l0ECZGgnbwsDbN35V4=",
       "dev": true
     },
+    "lsmod": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/lsmod/-/lsmod-1.0.0.tgz",
+      "integrity": "sha1-mgD3bco26yP6BTUK/htYXUKZ5ks=",
+      "dev": true
+    },
     "macaddress": {
       "version": "https://registry.npmjs.org/macaddress/-/macaddress-0.2.8.tgz",
       "integrity": "sha1-WQTcU3w57G2+/q6QIycTX6hRHxI=",
@@ -2756,6 +2780,26 @@
       "integrity": "sha1-Z0yZdgkBw8QRJ3GjHlIdw0nMCew=",
       "dev": true
     },
+    "raven": {
+      "version": "2.0.2",
+      "resolved": "https://registry.npmjs.org/raven/-/raven-2.0.2.tgz",
+      "integrity": "sha1-pD07hwKubbLpGYdii+jyiVAIEK4=",
+      "dev": true,
+      "dependencies": {
+        "uuid": {
+          "version": "3.0.0",
+          "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.0.tgz",
+          "integrity": "sha1-Zyj8BFnEUNeWqZwxg3VpvfZy1yg=",
+          "dev": true
+        }
+      }
+    },
+    "raven-js": {
+      "version": "3.16.0",
+      "resolved": "https://registry.npmjs.org/raven-js/-/raven-js-3.16.0.tgz",
+      "integrity": "sha1-p5naT90ExjlD9n3rk9qg7P4QHqs=",
+      "dev": true
+    },
     "raw-loader": {
       "version": "https://registry.npmjs.org/raw-loader/-/raw-loader-0.5.1.tgz",
       "integrity": "sha1-DD0L6u2KAclm2Xh793goElKpeao=",
@@ -3131,6 +3175,12 @@
         }
       }
     },
+    "stack-trace": {
+      "version": "0.0.9",
+      "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz",
+      "integrity": "sha1-qPbq7KkGdMMz58Q5U/J1tFFRBpU=",
+      "dev": true
+    },
     "stat-mode": {
       "version": "https://registry.npmjs.org/stat-mode/-/stat-mode-0.2.2.tgz",
       "integrity": "sha1-5sgLYjEj19gM8TLOU480YokHJQI=",

+ 4 - 0
package.json

@@ -5,6 +5,8 @@
     "@types/electron": "1.4.34",
     "@types/fs-promise": "^1.0.1",
     "@types/node": "^7.0.5",
+    "@types/raven": "^1.2.2",
+    "@types/raven-js": "^3.10.0",
     "@types/webpack-env": "^1.13.0",
     "apply-loader": "^0.1.0",
     "awesome-typescript-loader": "3.1.2",
@@ -28,6 +30,8 @@
     "pug-html-loader": "^1.0.9",
     "pug-loader": "^2.3.0",
     "pug-static-loader": "0.0.1",
+    "raven": "^2.0.2",
+    "raven-js": "^3.16.0",
     "raw-loader": "^0.5.1",
     "sass-loader": "^6.0.3",
     "shelljs": "^0.7.7",

+ 1 - 0
terminus-core/src/configDefaults.yaml

@@ -5,3 +5,4 @@ appearance:
   tabsLocation: top
   theme: Standard
   frame: thin
+  css: '/* * { color: blue !important; } */'

+ 4 - 3
terminus-core/src/services/config.service.ts

@@ -1,7 +1,8 @@
+import { Subject } from 'rxjs'
 import * as yaml from 'js-yaml'
 import * as path from 'path'
 import * as fs from 'fs'
-import { EventEmitter, Injectable, Inject } from '@angular/core'
+import { Injectable, Inject } from '@angular/core'
 import { ConfigProvider } from '../api/configProvider'
 import { ElectronService } from './electron.service'
 import { HostAppService } from './hostApp.service'
@@ -51,7 +52,7 @@ export class ConfigProxy {
 @Injectable()
 export class ConfigService {
     store: any
-    change = new EventEmitter()
+    changed$ = new Subject<void>()
     restartRequested: boolean
     private _store: any
     private path: string
@@ -91,7 +92,7 @@ export class ConfigService {
     }
 
     emitChange (): void {
-        this.change.emit()
+        this.changed$.next()
     }
 
     requestRestart (): void {

+ 4 - 4
terminus-core/src/services/electron.service.ts

@@ -15,13 +15,13 @@ export class ElectronService {
     constructor () {
         this.electron = require('electron')
         this.remoteElectron = this.remoteRequire('electron')
-        this.app = this.remoteElectron.app
-        this.screen = this.remoteElectron.screen
-        this.dialog = this.remoteElectron.dialog
+        this.app = this.electron.remote.app
+        this.screen = this.electron.remote.screen
+        this.dialog = this.electron.remote.dialog
         this.shell = this.electron.shell
         this.clipboard = this.electron.clipboard
         this.ipcRenderer = this.electron.ipcRenderer
-        this.globalShortcut = this.remoteElectron.globalShortcut
+        this.globalShortcut = this.electron.remote.globalShortcut
     }
 
     remoteRequire (name: string): any {

+ 1 - 1
terminus-core/src/services/hotkeys.service.ts

@@ -43,7 +43,7 @@ export class HotkeysService {
             })
         })
         this.hotkeyDescriptions = hotkeyProviders.map(x => x.hotkeys).reduce((a, b) => a.concat(b))
-        this.config.change.subscribe(() => {
+        this.config.changed$.subscribe(() => {
             this.registerGlobalHotkey()
         })
         this.registerGlobalHotkey()

+ 2 - 1
terminus-core/src/services/themes.service.ts

@@ -11,8 +11,9 @@ export class ThemesService {
         @Inject(Theme) private themes: Theme[],
     ) {
         this.applyCurrentTheme()
-        config.change.subscribe(() => {
+        config.changed$.subscribe(() => {
             this.applyCurrentTheme()
+            document.querySelector('style#custom-css').innerHTML = config.store.appearance.css
         })
     }
 

+ 7 - 0
terminus-settings/src/components/settingsTab.component.pug

@@ -145,6 +145,13 @@ ngb-tabset.vertical(type='tabs')
                                 i.fa.fa-bug
                                 span Open DevTools
 
+            .form-group
+                label Custom CSS
+                textarea.form-control(
+                    [(ngModel)]='config.store.appearance.css',
+                    '(ngModelChange)'='config.save()',
+                )
+                    
     ngb-tab
         template(ngbTabTitle)
             | Hotkeys

+ 10 - 5
terminus-settings/src/components/settingsTab.component.scss

@@ -8,12 +8,17 @@
         width: auto;
         flex: none;
     }
+}
 
-    .hotkeys-table {
-        margin-top: 30px;
+.hotkeys-table {
+    margin-top: 30px;
 
-        td, th {
-            padding: 5px 10px;
-        }
+    td, th {
+        padding: 5px 10px;
     }
 }
+
+textarea {
+    font-family: 'Source Sans Mono', monospace;
+    height: 120px;
+}

+ 1 - 1
terminus-terminal/src/components/terminalTab.component.ts

@@ -44,7 +44,7 @@ export class TerminalTabComponent extends BaseTabComponent {
         super()
         this.decorators = this.decorators || []
         this.title$.next('Terminal')
-        this.configSubscription = config.change.subscribe(() => {
+        this.configSubscription = config.changed$.subscribe(() => {
             this.configure()
         })
         this.resize$.first().subscribe(async (resizeEvent) => {

+ 1 - 1
terminus-terminal/src/persistenceProviders.ts

@@ -7,7 +7,7 @@ import { Injectable } from '@angular/core'
 import { Logger, LogService } from 'terminus-core'
 import { SessionOptions, SessionPersistenceProvider } from './api'
 
-declare function delay(ms: number): Promise<void>
+declare function delay (ms: number): Promise<void>
 
 interface IChildProcess {
     pid: number