load sentry on the client side as well

This commit is contained in:
codl 2017-08-11 22:20:34 +02:00
parent 51cf43d073
commit ced259d7e8
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
2 changed files with 15 additions and 1 deletions

View File

@ -28,6 +28,15 @@ def load_viewer():
def inject_version():
return dict(version=version.version)
@app.context_processor
def inject_sentry():
if sentry:
client_dsn = app.config.get('SENTRY_DSN').split('@')
client_dsn[:1] = client_dsn[0].split(':')
client_dsn = ':'.join(client_dsn[0:2]) + '@' + client_dsn[3]
return dict(sentry_dsn=client_dsn)
return dict()
@app.after_request
def touch_viewer(resp):
if 'viewer' in g and g.viewer:

View File

@ -12,7 +12,12 @@
<meta name='og:type' content='website' />
<meta name='twitter:card' content='summary' />
<meta name='twitter:site:id' content='808418'/>
<script async src="{{ st('version.js') }}"></script>
{% if sentry_dsn -%}
<script defer src="https://cdn.ravenjs.com/3.17.0/raven.min.js" crossorigin="anonymous"
onload="Raven.config('{{sentry_dsn}}').install()"></script>
{% endif -%}
<script defer src="{{ st('version.js') }}"></script>
</head>
<body>
<header>