Remove legacy /sioconfig and user agreement link

- `/sioconfig` has been deprecated for ages in favor of
    `/socketconfig/${channel}.json`
  - Each website administrator should be responsible for determining the
    appropriate terms of service for their website instead of CyTube
    providing a default one.
This commit is contained in:
Calvin Montgomery 2017-08-21 23:19:19 -07:00
parent 7c897d91db
commit a48cab81b9
5 changed files with 1 additions and 148 deletions

View file

@ -375,20 +375,6 @@ function preprocessConfig(cfg) {
cfg.io["ipv4-default"] = cfg.io["ipv4-ssl"] || cfg.io["ipv4-nossl"];
cfg.io["ipv6-default"] = cfg.io["ipv6-ssl"] || cfg.io["ipv6-nossl"];
// sioconfig
// TODO this whole thing is messy, need to redo how the socket address is sent
var sioconfigjson = {
"ipv4-nossl": cfg.io["ipv4-nossl"],
"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;
// Generate RegExps for reserved names
var reserved = cfg["reserved-names"];
for (var key in reserved) {

View file

@ -76,43 +76,6 @@ function redirectHttps(req, res) {
return false;
}
/**
* Legacy socket.io configuration endpoint. This is being migrated to
* /socketconfig/<channel name>.json (see ./routes/socketconfig.js)
*/
function handleLegacySocketConfig(req, res) {
if (/\.json$/.test(req.path)) {
res.json(Config.get('sioconfigjson'));
return;
}
res.type('application/javascript');
var sioconfig = Config.get('sioconfig');
var iourl;
var ip = req.realIP;
var ipv6 = false;
if (net.isIPv6(ip)) {
iourl = Config.get('io.ipv6-default');
ipv6 = true;
}
if (!iourl) {
iourl = Config.get('io.ipv4-default');
}
sioconfig += 'var IO_URL=\'' + iourl + '\';';
sioconfig += 'var IO_V6=' + ipv6 + ';';
res.send(sioconfig);
}
function handleUserAgreement(req, res) {
sendPug(res, 'tos', {
domain: Config.get('http.domain')
});
}
function initializeErrorHandlers(app) {
app.use((req, res, next) => {
return next(new HTTPError(`No route for ${req.path}`, {
@ -220,9 +183,7 @@ module.exports = {
require('./routes/channel')(app, ioConfig, chanPath);
require('./routes/index')(app, channelIndex, webConfig.getMaxIndexEntries());
app.get('/sioconfig(.json)?', handleLegacySocketConfig);
require('./routes/socketconfig')(app, clusterClient);
app.get('/useragreement', handleUserAgreement);
require('./routes/contact')(app, webConfig);
require('./auth').init(app);
require('./account').init(app, globalMessageBus);