Add /sioconfig.json
This commit is contained in:
parent
7875dbdf4a
commit
27b501e655
|
|
@ -317,10 +317,17 @@ function preprocessConfig(cfg) {
|
||||||
cfg.io["ipv6-default"] = cfg.io["ipv6-ssl"] || cfg.io["ipv6-nossl"];
|
cfg.io["ipv6-default"] = cfg.io["ipv6-ssl"] || cfg.io["ipv6-nossl"];
|
||||||
|
|
||||||
// sioconfig
|
// sioconfig
|
||||||
var sioconfig = "var IO_URLS={'ipv4-nossl':'" + cfg.io["ipv4-nossl"] + "'," +
|
// TODO this whole thing is messy, need to redo how the socket address is sent
|
||||||
"'ipv4-ssl':'" + cfg.io["ipv4-ssl"] + "'," +
|
var sioconfigjson = {
|
||||||
"'ipv6-nossl':'" + cfg.io["ipv6-nossl"] + "'," +
|
"ipv4-nossl": cfg.io["ipv4-nossl"],
|
||||||
"'ipv6-ssl':'" + cfg.io["ipv6-ssl"] + "'};";
|
"ipv4-ssl": cfg.io["ipv4-ssl"],
|
||||||
|
"ipv6-nossl": cfg.io["ipv6-nossl"],
|
||||||
|
"ipv6-ssl": cfg.io["ipv6-ssl"]
|
||||||
|
};
|
||||||
|
|
||||||
|
var sioconfig = JSON.stringify(sioconfigjson);
|
||||||
|
sioconfig = "var IO_URLS=" + sioconfig + ";";
|
||||||
|
cfg.sioconfigjson = sioconfigjson;
|
||||||
cfg.sioconfig = sioconfig;
|
cfg.sioconfig = sioconfig;
|
||||||
|
|
||||||
// Generate RegExps for reserved names
|
// Generate RegExps for reserved names
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,11 @@ function handleIndex(req, res) {
|
||||||
* Handles a request for the socket.io information
|
* Handles a request for the socket.io information
|
||||||
*/
|
*/
|
||||||
function handleSocketConfig(req, res) {
|
function handleSocketConfig(req, res) {
|
||||||
|
if (/\.json$/.test(req.path)) {
|
||||||
|
res.json(Config.get("sioconfigjson"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
res.type("application/javascript");
|
res.type("application/javascript");
|
||||||
|
|
||||||
var sioconfig = Config.get("sioconfig");
|
var sioconfig = Config.get("sioconfig");
|
||||||
|
|
@ -237,7 +242,7 @@ module.exports = {
|
||||||
|
|
||||||
app.get("/r/:channel", handleChannel);
|
app.get("/r/:channel", handleChannel);
|
||||||
app.get("/", handleIndex);
|
app.get("/", handleIndex);
|
||||||
app.get("/sioconfig", handleSocketConfig);
|
app.get("/sioconfig(.json)?", handleSocketConfig);
|
||||||
app.get("/useragreement", handleUserAgreement);
|
app.get("/useragreement", handleUserAgreement);
|
||||||
app.get("/contact", handleContactPage);
|
app.get("/contact", handleContactPage);
|
||||||
require("./auth").init(app);
|
require("./auth").init(app);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue