diff --git a/clientapp/templates/main.html b/clientapp/templates/main.html index aa3b8a5..f029f26 100644 --- a/clientapp/templates/main.html +++ b/clientapp/templates/main.html @@ -1,6 +1,6 @@ - - + + Otalk diff --git a/clientapp/templates/misc/manifest.cache b/clientapp/templates/misc/manifest.cache index 15574b3..943c58a 100644 --- a/clientapp/templates/misc/manifest.cache +++ b/clientapp/templates/misc/manifest.cache @@ -5,12 +5,12 @@ CACHE: #{jsFileName} #{cssFileName} -images/logo.png -images/icon_128x128.png +/images/logo.png +/images/icon_128x128.png -js/zepto.js +/js/zepto.js js/login.js -js/logout.js +/js/logout.js NETWORK: * diff --git a/package.json b/package.json index 45c1406..6f122ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "otalk.im", - "version": "0.0.5", + "version": "0.0.6", "description": "Otalk: WebRTC Enabled XMPP Client, in the Browser", "repository": { "type": "git", diff --git a/server.js b/server.js index 4d22750..787a149 100644 --- a/server.js +++ b/server.js @@ -45,18 +45,21 @@ if (config.isDev) { clientApp.config.beforeBuildJS = function () { var clientFolder = __dirname + '/clientapp'; templatizer(clientFolder + '/templates', clientFolder + '/templates.js'); - - var pkginfo = JSON.parse(fs.readFileSync('./package.json')); - var cacheManifest = fs.readFileSync('clientapp/templates/misc/manifest.cache', 'utf-8'); - cacheManifest = cacheManifest - .replace('#{version}', pkginfo.version + ' ' + Date.now()) - .replace('#{jsFileName}', '/' + clientApp.jsFileName()) - .replace('#{cssFileName}', '/' + clientApp.cssFileName()); - - fs.writeFileSync('./public/x-manifest.cache', cacheManifest); }; } + +var pkginfo = JSON.parse(fs.readFileSync('./package.json')); + +var manifestTemplate = fs.readFileSync('./clientapp/templates/misc/manifest.cache', 'utf-8'); +var cacheManifest = manifestTemplate + .replace('#{version}', pkginfo.version) + .replace('#{jsFileName}', '/' + clientApp.jsFileName()) + .replace('#{cssFileName}', '/' + clientApp.cssFileName()); + +var webappManifest = fs.readFileSync('./public/x-manifest.webapp'); + + app.set('view engine', 'jade'); app.get('/login', function (req, res) { @@ -73,21 +76,14 @@ app.get('/oauth/callback', function (req, res) { }); app.get('/manifest.webapp', function (req, res, next) { - fs.readFile('./public/x-manifest.webapp', function doneReadingManifest(err, manifestContents) { - if (err) return next(err); - - res.set('Content-Type', 'application/x-web-app-manifest+json'); - res.send(manifestContents); - }); + res.set('Content-Type', 'application/x-web-app-manifest+json'); + res.send(webappManifest); }); app.get('/manifest.cache', function (req, res, next) { - fs.readFile('./public/x-manifest.cache', function doneReadingManifestCache(err, manifestCacheContents) { - if (err) return next(err); - - res.set('Content-Type', 'text/cache-manifest'); - res.send(manifestCacheContents); - }); + res.set('Content-Type', 'text/cache-manifest'); + res.set('Cache-Control', 'public, max-age=0'); + res.send(cacheManifest); }); app.get('/oembed', function (req, res) {