Skip to content
This repository has been archived by the owner on Aug 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1 from nightscout/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Erin879 authored Aug 5, 2019
2 parents 8c9d51f + 98c22d9 commit 5be345b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
25 changes: 18 additions & 7 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ function create (env, ctx) {
if (!insecureUseHttp) {
console.info('Redirecting http traffic to https because INSECURE_USE_HTTP=', insecureUseHttp);
app.use((req, res, next) => {
if (req.header('x-forwarded-proto') == 'https' || req.secure) {
if (req.header('x-forwarded-proto') === 'https' || req.secure) {
next();
} else {
res.redirect(307, `https://${req.header('host')}${req.url}`);
}
})
});
if (secureHstsHeader) { // Add HSTS (HTTP Strict Transport Security) header
console.info('Enabled SECURE_HSTS_HEADER (HTTP Strict Transport Security)');
const helmet = require('helmet');
Expand Down Expand Up @@ -61,7 +61,7 @@ function create (env, ctx) {
}));
app.use(helmet.referrerPolicy({ policy: 'no-referrer' }));
app.use(helmet.featurePolicy({ features: { payment: ["'none'"], } }));
app.use(bodyParser.json({ type: ['json', 'application/csp-report'] }))
app.use(bodyParser.json({ type: ['json', 'application/csp-report'] }));
app.post('/report-violation', (req, res) => {
if (req.body) {
console.log('CSP Violation: ', req.body)
Expand All @@ -84,7 +84,11 @@ function create (env, ctx) {

let cacheBuster = 'developmentMode';
if (process.env.NODE_ENV !== 'development') {
cacheBuster = fs.readFileSync(process.cwd() + '/tmp/cacheBusterToken').toString().trim();
if (fs.existsSync(process.cwd() + '/tmp/cacheBusterToken')) {
cacheBuster = fs.readFileSync(process.cwd() + '/tmp/cacheBusterToken').toString().trim();
} else {
cacheBuster = fs.readFileSync(__dirname + '/tmp/cacheBusterToken').toString().trim();
}
}
app.locals.cachebuster = cacheBuster;

Expand Down Expand Up @@ -254,9 +258,16 @@ function create (env, ctx) {
}

// Production bundling
var tmpFiles = express.static('tmp', {
maxAge: maxAge
});
var tmpFiles;
if (fs.existsSync(process.cwd() + '/tmp/cacheBusterToken')) {
tmpFiles = express.static('tmp', {
maxAge: maxAge
});
} else {
tmpFiles = express.static(__dirname + '/tmp', {
maxAge: maxAge
});
}

// serve the static content
app.use('/bundle', tmpFiles);
Expand Down
1 change: 0 additions & 1 deletion lib/report_plugins/daytoday.js
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,6 @@ daytoday.report = function report_daytoday (datastorage, sorteddaystoshow, optio
var label = ' ' + treatment.carbs + ' g';
if (treatment.protein) label += ' / ' + treatment.protein + ' g';
if (treatment.fat) label += ' / ' + treatment.fat + ' g';
label += ' (' + client.utils.toFixedMin((treatment.carbs / ic), 2) + 'U)';

context.append('rect')
.attr('y', yCarbsScale(treatment.carbs))
Expand Down
7 changes: 0 additions & 7 deletions static/profile/js/profileeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,13 +671,6 @@
adjustedRecord.defaultProfile = currentprofile;
adjustedRecord.units = client.settings.units;

if (record.convertedOnTheFly) {
var result = window.confirm(translate('Profile is going to be saved in newer format used in Nightscout 0.9.0 and above and will not be usable in older versions anymore.\nAre you sure?'));
if (!result) {
return;
}
}

delete record.convertedOnTheFly;
delete adjustedRecord.convertedOnTheFly;

Expand Down
1 change: 1 addition & 0 deletions views/clockviews/shared.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<div id="arrowDiv"><img id="arrow" src=""/></div>
</div>
<div id="clock"></div>
<div id="staleTime"></div>
</div>
</main>

Expand Down

0 comments on commit 5be345b

Please sign in to comment.