forked from holtwick/briefing
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
142 additions
and
93 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Bug Tracking | ||
|
||
Knowing which bugs occur is crucial for the maturity of a project. And it is a complex business, where services like | ||
[sentry.io](https://sentry.io/) provide great infrastructure to learn the most out of the bugs and be able to fix them. | ||
Since privacy in general, and in particular for this project, is important, I tried to find a balance between code | ||
quality and privacy concerns. | ||
|
||
### Opt-in | ||
|
||
It would be sad to loose any bug information if the user is willing to help, but not aware of the feature. A solution | ||
to this problem is, to ask the user for permission to track errors in the moment they occur. This will not catch all | ||
possible errors, but hopefuly most of them. The user still has the possibility to opt-out in the settings. | ||
|
||
### Lazy Loading | ||
|
||
To make sure no 3rd party code is doing anything in the background without the permission of the user, the related | ||
code is only loaded when allowed to. It will not be loaded immediatey but "lazily" on demand. | ||
|
||
--- | ||
|
||
If you still have concerns or have ideas for improvement, please write to <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import Vue from 'vue' | ||
import { PRODUCTION } from '../config' | ||
import { messages } from '../lib/emitter' | ||
|
||
const log = require('debug')('app:bugs') | ||
|
||
// Lazy loading of bug tracker | ||
export function setupBugTracker(done) { | ||
if (PRODUCTION && isAllowedBugTracking()) { | ||
console.log('Sentry bug tracking is allowed') | ||
import(/* webpackChunkName: 'sentry' */ './lazy-sentry').then(({ setupSentry }) => { | ||
setupSentry({ | ||
dsn: 'https://[email protected]/5266804', | ||
Vue, | ||
}) | ||
console.log('Did init Sentry bug tracking') | ||
if (done) done() | ||
}) | ||
} | ||
} | ||
|
||
// Send bugs if user allowed to do so | ||
|
||
let collectedErrors = [] | ||
|
||
export function isAllowedBugTracking() { | ||
return localStorage.allowSentry === '1' | ||
} | ||
|
||
export function setAllowedBugTracking(allowed = true, reloadMessage = 'Reload to activate changes') { | ||
if (allowed) { | ||
localStorage.allowSentry = '1' | ||
setupBugTracker(_ => { | ||
for (let e of collectedErrors) { | ||
trackException(e) | ||
} | ||
}) | ||
} else { | ||
localStorage.allowSentry = '0' | ||
if (confirm(reloadMessage)) { | ||
location.reload() | ||
} | ||
} | ||
} | ||
|
||
export function trackException(e, silent = false) { | ||
if (!silent) { | ||
console.error('Exception:', e) | ||
} | ||
if (window.sentry) { | ||
log('sentry exception', e) | ||
window.sentry.captureException(e) | ||
} else { | ||
messages.emit('requestBugTracking') | ||
} | ||
} | ||
|
||
export function trackSilentException(e) { | ||
trackException(e, true) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,25 +5,17 @@ import de from './locales/de' | |
import en from './locales/en' | ||
import App from './pwa-app.vue' | ||
import { state } from './state' | ||
import { PRODUCTION } from './config' | ||
import { setupBugTracker } from './bugs' | ||
|
||
// Electron specific | ||
// Electron specific i.e. Windows App will become a nicer modern window title and some other small features | ||
if (navigator.userAgent.toLowerCase().indexOf(' electron/') > -1 && window.beaker == null) { | ||
console.log('Identified Electron') | ||
import(/* webpackChunkName: 'pwa-electron' */ './pwa-electron').then() | ||
console.log('Handled Electron') | ||
} | ||
|
||
if (PRODUCTION && localStorage.allowSentry !== '0') { | ||
console.log('Sentry bug tracking is allowed') | ||
import(/* webpackChunkName: 'sentry' */ './sentry').then(({ setupSentry }) => { | ||
setupSentry({ | ||
dsn: 'https://[email protected]/5266804', | ||
Vue, | ||
}) | ||
console.log('Did init Sentry bug tracking') | ||
}) | ||
} | ||
// This will be done privacy conform, see bugs/README-BUGTRACKER.md | ||
setupBugTracker() | ||
|
||
Vue.config.productionTip = false | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters