mirror of
https://github.com/moparisthebest/kaiwa
synced 2025-02-16 07:00:09 -05:00
Make appcache actually work
This commit is contained in:
parent
d3d6df5d99
commit
00ee3e5c67
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head manifest="/manifest.cache">
|
||||
<html manifest="/manifest.cache">
|
||||
<head>
|
||||
<title>Otalk</title>
|
||||
<link rel="stylesheet" type="text/css" href="#{cssFileName}" />
|
||||
<script src="#{jsFileName}"></script>
|
||||
|
@ -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:
|
||||
*
|
||||
|
@ -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",
|
||||
|
38
server.js
38
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user