Make appcache actually work
This commit is contained in:
parent
d3d6df5d99
commit
00ee3e5c67
|
@ -1,6 +1,6 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html manifest="/manifest.cache">
|
||||||
<head manifest="/manifest.cache">
|
<head>
|
||||||
<title>Otalk</title>
|
<title>Otalk</title>
|
||||||
<link rel="stylesheet" type="text/css" href="#{cssFileName}" />
|
<link rel="stylesheet" type="text/css" href="#{cssFileName}" />
|
||||||
<script src="#{jsFileName}"></script>
|
<script src="#{jsFileName}"></script>
|
||||||
|
|
|
@ -5,12 +5,12 @@ CACHE:
|
||||||
#{jsFileName}
|
#{jsFileName}
|
||||||
#{cssFileName}
|
#{cssFileName}
|
||||||
|
|
||||||
images/logo.png
|
/images/logo.png
|
||||||
images/icon_128x128.png
|
/images/icon_128x128.png
|
||||||
|
|
||||||
js/zepto.js
|
/js/zepto.js
|
||||||
js/login.js
|
js/login.js
|
||||||
js/logout.js
|
/js/logout.js
|
||||||
|
|
||||||
NETWORK:
|
NETWORK:
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "otalk.im",
|
"name": "otalk.im",
|
||||||
"version": "0.0.5",
|
"version": "0.0.6",
|
||||||
"description": "Otalk: WebRTC Enabled XMPP Client, in the Browser",
|
"description": "Otalk: WebRTC Enabled XMPP Client, in the Browser",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
38
server.js
38
server.js
|
@ -45,18 +45,21 @@ if (config.isDev) {
|
||||||
clientApp.config.beforeBuildJS = function () {
|
clientApp.config.beforeBuildJS = function () {
|
||||||
var clientFolder = __dirname + '/clientapp';
|
var clientFolder = __dirname + '/clientapp';
|
||||||
templatizer(clientFolder + '/templates', clientFolder + '/templates.js');
|
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.set('view engine', 'jade');
|
||||||
|
|
||||||
app.get('/login', function (req, res) {
|
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) {
|
app.get('/manifest.webapp', function (req, res, next) {
|
||||||
fs.readFile('./public/x-manifest.webapp', function doneReadingManifest(err, manifestContents) {
|
res.set('Content-Type', 'application/x-web-app-manifest+json');
|
||||||
if (err) return next(err);
|
res.send(webappManifest);
|
||||||
|
|
||||||
res.set('Content-Type', 'application/x-web-app-manifest+json');
|
|
||||||
res.send(manifestContents);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/manifest.cache', function (req, res, next) {
|
app.get('/manifest.cache', function (req, res, next) {
|
||||||
fs.readFile('./public/x-manifest.cache', function doneReadingManifestCache(err, manifestCacheContents) {
|
res.set('Content-Type', 'text/cache-manifest');
|
||||||
if (err) return next(err);
|
res.set('Cache-Control', 'public, max-age=0');
|
||||||
|
res.send(cacheManifest);
|
||||||
res.set('Content-Type', 'text/cache-manifest');
|
|
||||||
res.send(manifestCacheContents);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/oembed', function (req, res) {
|
app.get('/oembed', function (req, res) {
|
||||||
|
|
Loading…
Reference in New Issue