Skip to content
This repository was archived by the owner on May 22, 2021. It is now read-only.

Commit

Permalink
Merge pull request #257 from mozilla/jsconfig
Browse files Browse the repository at this point in the history
add a dynamic js script for page config
  • Loading branch information
dannycoates authored Jul 19, 2017
2 parents 64e7182 + 85a7be0 commit 3bb6a6f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 28 deletions.
10 changes: 8 additions & 2 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,15 @@ app.use('/l20n', express.static(L20N));
app.use('/locales', express.static(LOCALES));

app.get('/', (req, res) => {
res.render('index', {
res.render('index');
});

app.get('/jsconfig.js', (req, res) => {
res.set('Content-Type', 'application/javascript');
res.render('jsconfig', {
trackerId: conf.analytics_id,
dsn: conf.sentry_id
dsn: conf.sentry_id,
layout: false
});
});

Expand Down
6 changes: 6 additions & 0 deletions views/jsconfig.handlebars
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{#if dsn}}
window.dsn = '{{{dsn}}}';
{{/if}}
{{#if trackerId}}
window.trackerId = '{{{trackerId}}}';
{{/if}}
7 changes: 1 addition & 6 deletions views/layouts/main.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@
<html>
<head>
<title>Firefox Send</title>
{{#if dsn}}
{{> sentry dsn=dsn}}
{{/if}}
<script src="/jsconfig.js"></script>
<script src="/bundle.js"></script>
<link rel="stylesheet" type="text/css" href="/main.css" />
<link rel="stylesheet" href="https://code.cdn.mozilla.net/fonts/fira.css">
{{#if trackerId}}
{{> analytics trackerId=trackerId}}
{{/if}}

<meta name="defaultLanguage" content="en-US">
<meta name="availableLanguages" content="en-US">
Expand Down
17 changes: 0 additions & 17 deletions views/partials/analytics.handlebars

This file was deleted.

3 changes: 0 additions & 3 deletions views/partials/sentry.handlebars

This file was deleted.

0 comments on commit 3bb6a6f

Please sign in to comment.