mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
fixed port redirect issue
This commit is contained in:
@@ -10,34 +10,34 @@ router.use(function(req, res, next) {
|
|||||||
|
|
||||||
router.route('/:channel_name').get(function(req, res, next){
|
router.route('/:channel_name').get(function(req, res, next){
|
||||||
try{
|
try{
|
||||||
var url = req.headers['x-forwarded-host'];
|
var url = req.headers['x-forwarded-host'] ? req.headers['x-forwarded-host'] : req.headers.host.split(":")[0];
|
||||||
var subdomain = req.headers['x-forwarded-host'].split(".");
|
var subdomain = req.headers['x-forwarded-host'] ? req.headers['x-forwarded-host'].split(".") : req.headers.host.split(":")[0].split(".");
|
||||||
if(url != "zoff.me" && url != "remote.zoff.me" && url != "remote.localhost" && url != "localhost") {
|
if(url != "zoff.me" && url != "remote.zoff.me" && url != "remote.localhost" && url != "localhost") {
|
||||||
res.redirect("https://zoff.me");
|
res.redirect("https://zoff.me");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(subdomain[0] == "remote") {
|
if(subdomain[0] == "remote") {
|
||||||
var data = {
|
var data = {
|
||||||
year: 2017,
|
year: 2017,
|
||||||
javascript_file: "remote.min.js"
|
javascript_file: "remote.min.js"
|
||||||
}
|
}
|
||||||
res.render('layouts/remote', data);
|
res.render('layouts/remote', data);
|
||||||
} else if(subdomain.length >= 2 && subdomain[0] == "www") {
|
} else if(subdomain.length >= 2 && subdomain[0] == "www") {
|
||||||
res.redirect("https://zoff.me");
|
res.redirect("https://zoff.me");
|
||||||
} else {
|
} else {
|
||||||
if(req.params.channel_name == "_embed") {
|
if(req.params.channel_name == "_embed") {
|
||||||
res.sendFile(path.join(__dirname, '/views/assets/html/embed.html'));
|
res.sendFile(path.join(__dirname, '/views/assets/html/embed.html'));
|
||||||
} else if(req.params.channel_name == "o_callback") {
|
} else if(req.params.channel_name == "o_callback") {
|
||||||
res.sendFile(path.join(__dirname, '/views/assets/html/callback.html'));
|
res.sendFile(path.join(__dirname, '/views/assets/html/callback.html'));
|
||||||
} else {
|
} else {
|
||||||
var data = {
|
var data = {
|
||||||
list_name: capitalizeFirstLetter(req.params.channel_name),
|
list_name: capitalizeFirstLetter(req.params.channel_name),
|
||||||
year: 2017,
|
year: 2017,
|
||||||
javascript_file: "main.min.js"
|
javascript_file: "main.min.js"
|
||||||
}
|
}
|
||||||
res.render('layouts/channel', data);
|
res.render('layouts/channel', data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
res.redirect("https://zoff.me");
|
res.redirect("https://zoff.me");
|
||||||
}
|
}
|
||||||
@@ -126,8 +126,8 @@ router.route('/api/mail').post(function(req, res) {
|
|||||||
|
|
||||||
router.route('/').get(function(req, res, next){
|
router.route('/').get(function(req, res, next){
|
||||||
try{
|
try{
|
||||||
var url = req.headers['x-forwarded-host'];
|
var url = req.headers['x-forwarded-host'] ? req.headers['x-forwarded-host'] : req.headers.host.split(":")[0];
|
||||||
var subdomain = req.headers['x-forwarded-host'].split(".");
|
var subdomain = req.headers['x-forwarded-host'] ? req.headers['x-forwarded-host'].split(".") : req.headers.host.split(":")[0].split(".");
|
||||||
if(url != "zoff.me" && url != "remote.zoff.me" && url != "remote.localhost" && url != "localhost") {
|
if(url != "zoff.me" && url != "remote.zoff.me" && url != "remote.localhost" && url != "localhost") {
|
||||||
res.redirect("https://zoff.me");
|
res.redirect("https://zoff.me");
|
||||||
return;
|
return;
|
||||||
@@ -148,7 +148,8 @@ router.route('/').get(function(req, res, next){
|
|||||||
res.render('layouts/frontpage', data);
|
res.render('layouts/frontpage', data);
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
res.redirect("https://zoff.me");
|
console.log(e);
|
||||||
|
//res.redirect("https://zoff.me");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user