Files
OctoPrint/src/octoprint/plugins/errortracking/templates/errortracking_javascripts.jinja2
T

29 lines
1.1 KiB
Django/Jinja

<script type="text/javascript">
var ERRORTRACKING_ENABLED = {% if plugin_errortracking_enabled -%} true; {% else %} false; {%- endif %}
var ERRORTRACKING_ENABLE = function() {
var errortracking_url_coreui = "{{ plugin_errortracking_url_coreui }}";
var errortracking_unique_id = "{{ plugin_errortracking_unique_id }}";
Sentry.init({
dsn: errortracking_url_coreui,
release: VERSION,
allowUrls: [
// only include errors raise in HTML, packed core & client
{% assets "js_client" %}"{{ ASSET_URL }}",{% endassets %}
{% assets "js_core" %}"{{ ASSET_URL }}",{% endassets %}
{% if g.locale %}"{{ url_for('localeJs', locale=g.locale, domain='messages') }}"{% endif %}
]
});
Sentry.setUser({"id": errortracking_unique_id});
ERRORTRACKING_ENABLED = true;
log.info("Initialized error tracking");
};
$(function() {
if (ERRORTRACKING_ENABLED) {
ERRORTRACKING_ENABLE();
}
});
</script>