mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
Move all html files to views folder, update to use the rendered cache buster
This commit is contained in:
@@ -14,14 +14,14 @@ function create(env, ctx) {
|
||||
var appInfo = env.name + ' ' + env.version;
|
||||
app.set('title', appInfo);
|
||||
app.enable('trust proxy'); // Allows req.secure test on heroku https connections.
|
||||
|
||||
app.set('view engine', 'ejs');
|
||||
// this allows you to render .html files as templates in addition to .ejs
|
||||
app.engine('html', require('ejs').renderFile);
|
||||
app.engine('appcache', require('ejs').renderFile);
|
||||
app.set("views", path.join(__dirname, "views/"));
|
||||
|
||||
app.locals.cachebuster = fs.readFileSync(process.cwd() + '/tmp/cacheBusterToken').toString().trim();
|
||||
app.set('view engine', 'ejs');
|
||||
// this allows you to render .html files as templates in addition to .ejs
|
||||
app.engine('html', require('ejs').renderFile);
|
||||
app.engine('appcache', require('ejs').renderFile);
|
||||
app.set("views", path.join(__dirname, "views/"));
|
||||
|
||||
app.locals.cachebuster = fs.readFileSync(process.cwd() + '/tmp/cacheBusterToken').toString().trim();
|
||||
|
||||
if (ctx.bootErrors && ctx.bootErrors.length > 0) {
|
||||
app.get('*', require('./lib/booterror')(ctx));
|
||||
@@ -58,20 +58,38 @@ function create(env, ctx) {
|
||||
return compression.filter(req, res);
|
||||
}
|
||||
}));
|
||||
// app.use(bodyParser({limit: 1048576 * 50, extended: true }));
|
||||
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.render("index.html", {locals: app.locals});
|
||||
res.render("index.html", {
|
||||
locals: app.locals
|
||||
});
|
||||
});
|
||||
|
||||
var appPages = {
|
||||
"/clock-color.html":"clock-color.html",
|
||||
"/admin":"adminindex.html",
|
||||
"/profile":"profileindex.html",
|
||||
"/food":"foodindex.html",
|
||||
"/bgclock.html":"bgclock.html",
|
||||
"/report":"reportindex.html",
|
||||
"/translations":"translationsindex.html",
|
||||
"/clock.html":"clock.html"
|
||||
};
|
||||
|
||||
Object.keys(appPages).forEach(function(page) {
|
||||
app.get(page, (req, res) => {
|
||||
res.render(appPages[page], {
|
||||
locals: app.locals
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
app.get("/nightscout.appcache", (req, res) => {
|
||||
res.render("nightscout.appcache", {locals: app.locals});
|
||||
});
|
||||
res.render("nightscout.appcache", {
|
||||
locals: app.locals
|
||||
});
|
||||
});
|
||||
|
||||
//if (env.api_secret) {
|
||||
// console.log("API_SECRET", env.api_secret);
|
||||
//}
|
||||
app.use('/api/v1', bodyParser({
|
||||
limit: 1048576 * 50
|
||||
}), api);
|
||||
|
||||
Generated
+849
-57
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Nightscout",
|
||||
"version": "0.10.0-dev-20170823",
|
||||
"version": "0.11.0-dev-20170911",
|
||||
"description": "Nightscout acts as a web-based CGM (Continuous Glucose Montinor) to allow multiple caregivers to remotely view a patients glucose data in realtime.",
|
||||
"license": "AGPL-3.0",
|
||||
"author": "Nightscout Team",
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<meta name="msapplication-config" content="/browserconfig.xml">
|
||||
<meta name="theme-color" content="#333333">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/css/main.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/main.css?v=<%= locals.cachebuster %>" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/drawer.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/admin.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/ui-darkness/jquery-ui.min.css">
|
||||
@@ -45,8 +45,8 @@
|
||||
<b><span class="translate">Authentication status</span>: </b>
|
||||
<span id="authentication_placeholder"></span>
|
||||
|
||||
<script src="/js/bundle.js?v=8.1.4-dev-2017082601"></script>
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script src="/admin/js/admin.js?v=8.1.4-dev-2017082601"></script>
|
||||
<script src="/js/bundle.js?v=<%= locals.cachebuster %>"></script>
|
||||
<script src="/socket.io/socket.io.js?v=<%= locals.cachebuster %>"></script>
|
||||
<script src="/admin/js/admin.js?v=<%= locals.cachebuster %>"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -41,7 +41,7 @@
|
||||
<h1 class="clock"></h1>
|
||||
</div>
|
||||
<script src="/api/v1/status.js"></script>
|
||||
<script src="/js/bundle.js?v=8.1.4-dev-2017082601"></script>
|
||||
<script src="/js/bundle.js?v=<%= locals.cachebuster %>"></script>
|
||||
<script type="text/javascript">
|
||||
function query ( ) {
|
||||
console.log('query');
|
||||
@@ -86,7 +86,7 @@
|
||||
</main>
|
||||
|
||||
<script src="/api/v1/status.js"></script>
|
||||
<script src="/js/bundle.js?v=8.1.4-dev-2017082601"></script>
|
||||
<script src="/js/bundle.js?v=<%= locals.cachebuster %>"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</div>
|
||||
</main>
|
||||
<script src="/api/v1/status.js"></script>
|
||||
<script src="/js/bundle.js?v=8.1.4-dev-2017082601"></script>
|
||||
<script src="/js/bundle.js?v=<%= locals.cachebuster %>"></script>
|
||||
<script type="text/javascript">
|
||||
function query ( ) {
|
||||
console.log('query');
|
||||
@@ -24,7 +24,7 @@
|
||||
<meta name="msapplication-config" content="/browserconfig.xml">
|
||||
<meta name="theme-color" content="#333333">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/css/main.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/main.css?v=<%= locals.cachebuster %>" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/dropdown.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/drawer.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/food.css" />
|
||||
@@ -110,8 +110,8 @@
|
||||
<span id="authentication_placeholder"></span>
|
||||
</div>
|
||||
|
||||
<script src="/js/bundle.js?v=8.1.4-dev-2017082601"></script>
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script src="/food/js/food.js?v=8.1.4-dev-2017082601"></script>
|
||||
<script src="/js/bundle.js?v=<%= locals.cachebuster %>"></script>
|
||||
<script src="/socket.io/socket.io.js?v=<%= locals.cachebuster %>"></script>
|
||||
<script src="/food/js/food.js?v=<%= locals.cachebuster %>"></script>
|
||||
</body>
|
||||
</html>
|
||||
+4
-4
@@ -164,10 +164,10 @@
|
||||
<div id="drawer">
|
||||
<form id="settings-form" role="form" >
|
||||
<ul class="navigation" role="navigation" aria-label="Settings">
|
||||
<li><a href="/report/index.html" target="reports" class="translate">Reports</a></li>
|
||||
<li class="profilecontrol"><a id="editprofilelink" href="/profile/index.html" target="profileeditor" class="translate">Profile Editor</a></li>
|
||||
<li class="foodcontrol"><a id="editfoodlink" href="/food/index.html" target="foodeditor" class="translate">Food Editor</a></li>
|
||||
<li><a id="admintoolslink" href="/admin/index.html" target="admintools" class="translate">Admin Tools</a></li>
|
||||
<li><a href="/report" target="reports" class="translate">Reports</a></li>
|
||||
<li class="profilecontrol"><a id="editprofilelink" href="/profile" target="profileeditor" class="translate">Profile Editor</a></li>
|
||||
<li class="foodcontrol"><a id="editfoodlink" href="/food" target="foodeditor" class="translate">Food Editor</a></li>
|
||||
<li><a id="admintoolslink" href="/admin" target="admintools" class="translate">Admin Tools</a></li>
|
||||
</ul>
|
||||
<fieldset class="browserSettings">
|
||||
<legend class="translate icon-cog">Settings</legend>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<meta name="msapplication-config" content="/browserconfig.xml">
|
||||
<meta name="theme-color" content="#333333">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/css/main.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/main.css?v=<%= locals.cachebuster %>" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/drawer.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/profile.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/ui-darkness/jquery-ui.min.css">
|
||||
@@ -173,8 +173,8 @@
|
||||
</form>
|
||||
|
||||
<script src="/api/v1/status.js"></script>
|
||||
<script src="/js/bundle.js?v=8.1.4-dev-2017082601"></script>
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script src="/profile/js/profileeditor.js?v=8.1.4-dev-2017082601"></script>
|
||||
<script src="/js/bundle.js?v=<%= locals.cachebuster %>"></script>
|
||||
<script src="/socket.io/socket.io.js?v=<%= locals.cachebuster %>"></script>
|
||||
<script src="/profile/js/profileeditor.js?v=<%= locals.cachebuster %>"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -23,7 +23,7 @@
|
||||
<meta name="msapplication-config" content="/browserconfig.xml">
|
||||
<meta name="theme-color" content="#333333">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/css/report.css?v=8.1.4-dev-2017082601" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/report.css?v=<%= locals.cachebuster %>" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/ui-lightness/jquery-ui.min.css">
|
||||
|
||||
</head>
|
||||
@@ -117,9 +117,9 @@
|
||||
<hr>
|
||||
<b><span class="translate">Authentication status</span>: </b><span id="authentication_placeholder"></span>
|
||||
|
||||
<script src="/js/bundle.js?v=8.1.4-dev-2017082601"></script>
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script src="/report/js/report.js?v=8.1.4-dev-2017082601"></script>
|
||||
<script src="/report/js/flotcandle.js?v=8.1.4-dev-2017082601"></script>
|
||||
<script src="/js/bundle.js?v=<%= locals.cachebuster %>"></script>
|
||||
<script src="/socket.io/socket.io.js?v=<%= locals.cachebuster %>"></script>
|
||||
<script src="/report/js/report.js?v=<%= locals.cachebuster %>"></script>
|
||||
<script src="/report/js/flotcandle.js?v=<%= locals.cachebuster %>"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -36,7 +36,7 @@
|
||||
<script src="/js/bundle.js?v=8.1.4-dev-2017082601"></script>
|
||||
|
||||
<script src="/api/v1/status.js"></script>
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script src="/translations/js/translations.js"></script>
|
||||
<script src="/socket.io/socket.io.js?v=<%= locals.cachebuster %>"></script>
|
||||
<script src="/translations/js/translations.js?v=<%= locals.cachebuster %>"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user