@@ -2,6 +2,7 @@ const commandLineArgs = require('command-line-args');
22const optionDefinitions = require ( './options.js' ) ;
33const getUsage = require ( 'command-line-usage' ) ;
44const express = require ( 'express' ) ;
5+ const cacheControl = require ( 'express-cache-controller' ) ;
56const moment = require ( 'moment' ) ;
67const path = require ( 'path' ) ;
78const fs = require ( 'fs' ) ;
@@ -72,6 +73,12 @@ function SaveGraph()
7273}
7374setInterval ( SaveGraph , options . graphLogInterval ) ;
7475
76+ // Setup cache
77+ app . use ( cacheControl ( {
78+ public : true ,
79+ maxAge : 60
80+ } ) ) ;
81+
7582//FORCE SSL
7683app . use ( function ( req , res , next ) {
7784 if ( req . headers [ 'x-forwarded-proto' ] === 'http' ) {
@@ -92,6 +99,11 @@ app.get('/networkgraph', function(req, res) {
9299
93100// Create payment invoice
94101app . get ( '/getinvoice' , function ( req , res ) {
102+ // Disable cache
103+ res . cacheControl = {
104+ noCache : true
105+ } ;
106+
95107 var value = parseInt ( req . query . value ) ;
96108
97109 if ( ! value || isNaN ( value ) || value < 1 )
@@ -122,6 +134,11 @@ function isHexString(str)
122134
123135// Reply with invoice status
124136app . get ( '/invoicestatus' , function ( req , res ) {
137+ // Disable cache
138+ res . cacheControl = {
139+ noCache : true
140+ } ;
141+
125142 var rhash = req . query . rhash ;
126143
127144 if ( ! isHexString ( rhash ) || rhash . length != 64 )
0 commit comments