Better redirect with QRcode

This commit is contained in:
Kasper Rynning-Tønnesen
2018-05-31 17:26:15 +02:00
parent a5c984f2e0
commit f6fd8caa7e
2 changed files with 7 additions and 2 deletions

View File

@@ -28,7 +28,7 @@ var Channel = {
var no_socket = true;
chan = Helper.decodeChannelName(Helper.html("#chan"));
mobile_beginning = Helper.mobilecheck();
var side = Helper.mobilecheck() ? "left" : "right";
@@ -186,7 +186,7 @@ var Channel = {
if(!client) {
var shareCodeUrl = window.location.protocol + "//client."+window.location.hostname+"/"+encodeURIComponent(chan.toLowerCase());
var shareCodeUrl = window.location.protocol + "//client."+window.location.hostname+"/r/"+btoa(encodeURIComponent(chan.toLowerCase()));
document.getElementById("share-join-qr").setAttribute("src", "https://chart.googleapis.com/chart?chs=221x221&cht=qr&choe=UTF-8&chld=L|1&chl="+shareCodeUrl);
Helper.setHtml("#channel-name-join", "client." + window.location.hostname + "/" + encodeURIComponent(chan.toLowerCase()));
} else {

View File

@@ -41,6 +41,11 @@ router.route('/:channel_name').get(function(req, res, next){
channel(req, res, next);
});
router.route('/r/:base64data').get(function(req, res, next){
var channelToRedirect = Buffer.from(req.params.base64data, 'base64');
res.redirect('/' + channelToRedirect);
});
router.route('/').get(function(req, res, next){
root(req, res, next);
});