mirror of https://github.com/calzoneman/sync.git
Static content caching
This commit is contained in:
parent
0f9c3b2dd1
commit
cc241da5cf
|
@ -17,6 +17,8 @@ http:
|
|||
domain: 'http://localhost'
|
||||
# Use express-minify to minify CSS and Javascript
|
||||
minify: false
|
||||
# Static content cache (in seconds)
|
||||
cache-ttl: 0
|
||||
|
||||
# HTTPS server details
|
||||
https:
|
||||
|
|
|
@ -26,7 +26,8 @@ var defaults = {
|
|||
host: "",
|
||||
port: 8080,
|
||||
domain: "http://localhost",
|
||||
minify: false
|
||||
minify: false,
|
||||
"cache-ttl": 0
|
||||
},
|
||||
https: {
|
||||
enabled: false,
|
||||
|
|
|
@ -32,7 +32,7 @@ function sendJade(res, view, locals) {
|
|||
var file = path.join(templates, view + ".jade");
|
||||
var fn = jade.compile(fs.readFileSync(file), {
|
||||
filename: file,
|
||||
pretty: true
|
||||
pretty: !Config.get("http.minify")
|
||||
});
|
||||
cache[view] = fn;
|
||||
}
|
||||
|
|
|
@ -229,6 +229,16 @@ function handleContactPage(req, res) {
|
|||
});
|
||||
}
|
||||
|
||||
function static(dir) {
|
||||
dir = path.join(__dirname, dir);
|
||||
return function (req, res) {
|
||||
res.sendfile(req.path.replace(/^\//, ""), {
|
||||
maxAge: Config.get("http.cache-ttl") * 1000,
|
||||
root: dir
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* Initializes webserver callbacks
|
||||
|
@ -273,7 +283,8 @@ module.exports = {
|
|||
logRequest(req);
|
||||
next();
|
||||
});
|
||||
app.use(express.static("www"));
|
||||
//app.use(express.static("www"));
|
||||
app.use(static(path.join("..", "..", "www")));
|
||||
},
|
||||
|
||||
logRequest: logRequest,
|
||||
|
|
|
@ -62,7 +62,7 @@ var LASTCHAT = {
|
|||
var FOCUSED = true;
|
||||
var PAGETITLE = "CyTube";
|
||||
var TITLE_BLINK;
|
||||
var CHATSOUND = new Audio("boop.wav");
|
||||
var CHATSOUND = new Audio("/boop.wav");
|
||||
var KICKED = false;
|
||||
var NAME = readCookie("cytube_uname");
|
||||
var SESSION = readCookie("cytube_session");
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
var Froogaloop=function(){function e(a){return new e.fn.init(a)}function h(a,c,b){if(!b.contentWindow.postMessage)return!1;var f=b.getAttribute("src").split("?")[0],a=JSON.stringify({method:a,value:c});"//"===f.substr(0,2)&&(f=window.location.protocol+f);b.contentWindow.postMessage(a,f)}function j(a){var c,b;try{c=JSON.parse(a.data),b=c.event||c.method}catch(f){}"ready"==b&&!i&&(i=!0);if(a.origin!=k)return!1;var a=c.value,e=c.data,g=""===g?null:c.player_id;c=g?d[g][b]:d[b];b=[];if(!c)return!1;void 0!==
|
||||
a&&b.push(a);e&&b.push(e);g&&b.push(g);return 0<b.length?c.apply(null,b):c.call()}function l(a,c,b){b?(d[b]||(d[b]={}),d[b][a]=c):d[a]=c}var d={},i=!1,k="";e.fn=e.prototype={element:null,init:function(a){"string"===typeof a&&(a=document.getElementById(a));this.element=a;a=this.element.getAttribute("src");"//"===a.substr(0,2)&&(a=window.location.protocol+a);for(var a=a.split("/"),c="",b=0,f=a.length;b<f;b++){if(3>b)c+=a[b];else break;2>b&&(c+="/")}k=c;return this},api:function(a,c){if(!this.element||
|
||||
!a)return!1;var b=this.element,f=""!==b.id?b.id:null,d=!c||!c.constructor||!c.call||!c.apply?c:null,e=c&&c.constructor&&c.call&&c.apply?c:null;e&&l(a,e,f);h(a,d,b);return this},addEvent:function(a,c){if(!this.element)return!1;var b=this.element,d=""!==b.id?b.id:null;l(a,c,d);"ready"!=a?h("addEventListener",a,b):"ready"==a&&i&&c.call(null,d);return this},removeEvent:function(a){if(!this.element)return!1;var c=this.element,b;a:{if((b=""!==c.id?c.id:null)&&d[b]){if(!d[b][a]){b=!1;break a}d[b][a]=null}else{if(!d[a]){b=
|
||||
!1;break a}d[a]=null}b=!0}"ready"!=a&&b&&h("removeEventListener",a,c)}};e.fn.init.prototype=e.fn;window.addEventListener?window.addEventListener("message",j,!1):window.attachEvent("onmessage",j);return window.Froogaloop=window.$f=e}();
|
|
@ -569,7 +569,9 @@ var LivestreamPlayer = function (data) {
|
|||
|
||||
self.setVolume = function () { };
|
||||
|
||||
self.init();
|
||||
waitUntilDefined(window, "swfobject", function () {
|
||||
self.init();
|
||||
});
|
||||
};
|
||||
|
||||
var TwitchTVPlayer = function (data) {
|
||||
|
|
Loading…
Reference in New Issue