Fix generating appcache on server start

This commit is contained in:
Lance Stout 2014-01-06 20:09:39 -08:00
parent cf01bd70a6
commit 51b0f213eb
2 changed files with 18 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{
"name": "otalk.im",
"version": "0.0.7",
"version": "0.0.8",
"description": "Otalk: WebRTC Enabled XMPP Client, in the Browser",
"repository": {
"type": "git",

View File

@ -49,29 +49,39 @@ if (config.isDev) {
};
}
clientApp.on('ready', function () {
var pkginfo = JSON.parse(fs.readFileSync('./package.json'));
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 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());
app.get('/manifest.cache', function (req, res, next) {
res.set('Content-Type', 'text/cache-manifest');
res.set('Cache-Control', 'public, max-age=0');
res.send(cacheManifest);
});
});
var webappManifest = fs.readFileSync('./public/x-manifest.webapp');
app.set('view engine', 'jade');
app.get('/login', function (req, res) {
res.render('login');
});
app.get('/logout', function (req, res) {
res.render('logout');
});
app.get('/oauth/login', function (req, res) {
res.redirect('https://apps.andyet.com/oauth/authorize?client_id=' + config.andyetAuth.id + '&response_type=token');
});
app.get('/oauth/callback', function (req, res) {
res.render('oauthLogin');
});
@ -81,12 +91,6 @@ app.get('/manifest.webapp', function (req, res, next) {
res.send(webappManifest);
});
app.get('/manifest.cache', function (req, res, next) {
res.set('Content-Type', 'text/cache-manifest');
res.set('Cache-Control', 'public, max-age=0');
res.send(cacheManifest);
});
app.get('/oembed', function (req, res) {
var callback = req.query.callback;
if (req.query.url) {