Fixed issue with embedded player, and trying to get better error-logs

This commit is contained in:
Kasper Rynning-Tønnesen
2018-06-22 18:56:03 +02:00
parent 3ef8a43c3c
commit ef92068ea6
3 changed files with 33 additions and 22 deletions

View File

@@ -73,27 +73,39 @@ app.get('/robots.txt', function (req, res) {
app.use(function (req, res, next) { app.use(function (req, res, next) {
var cookie = req.cookies._uI; var cookie = req.cookies._uI;
if (cookie === undefined) { if(req.originalUrl.split("/").length > 3) {
console.error((new Date), "couldn't fetch cookie for some reason, maybe no cookie exists?", req, "couldn't fetch cookie for some reason, maybe no cookie exists?"); res.header("Access-Control-Allow-Origin", "*");
var user_name = Functions.hash_pass(Functions.rndName(uniqid.time(), 15)); res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
res.cookie('_uI', user_name, { next();
maxAge: 365 * 10000 * 3600000,
httpOnly: true,
secure: secure,
sameSite: true,
});
} else { } else {
//process.stderr.write((new Date), "couldn't fetch cookie for some reason, maybe no cookie exists?", req, "couldn't fetch cookie for some reason, maybe no cookie exists?"); if (cookie === undefined) {
res.cookie('_uI', cookie, { try {
maxAge: 365 * 10000 * 3600000, console.error((new Date), "originalUrl", req.originalUrl);
httpOnly: true, console.error((new Date), "couldn't fetch cookie for some reason, maybe no cookie exists?", req.get('origin'), "couldn't fetch cookie for some reason, maybe no cookie exists?");
secure: secure,
sameSite: true, } catch(e) {
}); console.error((new Date), "couldn't fetch origin");
}
var user_name = Functions.hash_pass(Functions.rndName(uniqid.time(), 15));
res.cookie('_uI', user_name, {
maxAge: 365 * 10000 * 3600000,
httpOnly: true,
secure: secure,
sameSite: true,
});
} else {
//process.stderr.write((new Date), "couldn't fetch cookie for some reason, maybe no cookie exists?", req, "couldn't fetch cookie for some reason, maybe no cookie exists?");
res.cookie('_uI', cookie, {
maxAge: 365 * 10000 * 3600000,
httpOnly: true,
secure: secure,
sameSite: true,
});
}
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
} }
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
}); });
app.use('/service-worker.js', function(req, res) { app.use('/service-worker.js', function(req, res) {

View File

@@ -3432,10 +3432,9 @@ nav ul li:hover, nav ul li.active {
.title-container{ .title-container{
background-color: rgba(0,0,0,0.1); background-color: rgba(0,0,0,0.1);
display: inline-block; display: block;
top:56px !important; top:56px !important;
width: 100vw; width: 100vw;
background: #2d2d2d; background: #2d2d2d;
} }
.title-container li { .title-container li {

View File

@@ -566,7 +566,7 @@ var Player = {
//var elem = document.getElementById('song-title'); //var elem = document.getElementById('song-title');
//var getTitleViews = document.getElementById('viewers'); //var getTitleViews = document.getElementById('viewers');
if(!client) { if(!client && !embed) {
document.getElementById("host-title").innerText = title; document.getElementById("host-title").innerText = title;
} }
document.getElementById("song-title").innerText = title; document.getElementById("song-title").innerText = title;