mirror of
https://github.com/KevinMidboe/zoff.git
synced 2026-01-11 20:15:35 +00:00
Compare commits
16 Commits
refactor/p
...
feat/added
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ed72c0cc0 | ||
|
|
ad8bc0c05b | ||
|
|
9993a377b8 | ||
|
|
0213c5fe0a | ||
|
|
d820b2daba | ||
|
|
3739a15049 | ||
|
|
cba874510b | ||
|
|
b3a7b95fd6 | ||
|
|
f9b05c11e0 | ||
|
|
e8d49c77df | ||
|
|
bd9815927b | ||
|
|
07164153b0 | ||
|
|
206321a46f | ||
|
|
460d0138f0 | ||
|
|
4d96763545 | ||
|
|
d3e72202ce |
@@ -30,6 +30,7 @@ var project_object = {
|
||||
duration: 1,
|
||||
end: 1,
|
||||
type: 1,
|
||||
added_by: { $ifNull: ["$added_by", "Anonymous"] },
|
||||
source: { $ifNull: ["$source", "youtube"] },
|
||||
thumbnail: {
|
||||
$ifNull: [
|
||||
|
||||
@@ -71,6 +71,16 @@ function getAndSendLogs(channel, all, socket, pass, query) {
|
||||
});
|
||||
}
|
||||
|
||||
function getUserNameByGuid(guid, callback) {
|
||||
db.collection("user_names").find({ guid: guid }, function(err, usernames) {
|
||||
if (usernames.length == 1) {
|
||||
callback(usernames[0].name);
|
||||
return;
|
||||
}
|
||||
callback("Anonymous");
|
||||
});
|
||||
}
|
||||
|
||||
function chat(msg, guid, offline, socket) {
|
||||
if (
|
||||
typeof msg !== "object" ||
|
||||
@@ -909,6 +919,7 @@ function get_name_generate(guid, announce_payload, first, channel) {
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.getUserNameByGuid = getUserNameByGuid;
|
||||
module.exports.get_history = get_history;
|
||||
module.exports.chat = chat;
|
||||
module.exports.all_chat = all_chat;
|
||||
|
||||
@@ -2,6 +2,7 @@ var Functions = require(pathThumbnails + "/handlers/functions.js");
|
||||
var List = require(pathThumbnails + "/handlers/list.js");
|
||||
var Frontpage = require(pathThumbnails + "/handlers/frontpage.js");
|
||||
var Search = require(pathThumbnails + "/handlers/search.js");
|
||||
var Chat = require(pathThumbnails + "/handlers/chat.js");
|
||||
var crypto = require("crypto");
|
||||
var Filter = require("bad-words");
|
||||
var filter = new Filter({ placeHolder: "x" });
|
||||
@@ -201,7 +202,7 @@ function addFromOtherList(arr, guid, offline, socket) {
|
||||
accessed: Functions.get_time()
|
||||
};
|
||||
db.collection(
|
||||
channel
|
||||
new_channel
|
||||
).find(
|
||||
{
|
||||
now_playing: true
|
||||
@@ -819,159 +820,167 @@ function add_function(arr, coll, guid, offline, socket) {
|
||||
var source = arr.source;
|
||||
var tags = arr.tags;
|
||||
conf = docs;
|
||||
if (
|
||||
docs !== null &&
|
||||
docs.length !== 0 &&
|
||||
((docs[0].addsongs === true &&
|
||||
(hash == docs[0].adminpass || docs[0].adminpass === "")) ||
|
||||
docs[0].addsongs === false)
|
||||
) {
|
||||
db.collection(coll).find(
|
||||
{ id: id, type: { $ne: "suggested" } },
|
||||
function(err, docs) {
|
||||
if (docs !== null && docs.length === 0) {
|
||||
var guids = [guid];
|
||||
var added = Functions.get_time();
|
||||
var votes = 1;
|
||||
db.collection(coll).find({ now_playing: true }, function(
|
||||
err,
|
||||
docs
|
||||
) {
|
||||
if (docs !== null && docs.length === 0) {
|
||||
np = true;
|
||||
} else {
|
||||
np = false;
|
||||
}
|
||||
var new_song = {
|
||||
added: added,
|
||||
guids: guids,
|
||||
id: id,
|
||||
now_playing: np,
|
||||
title: title,
|
||||
tags: tags,
|
||||
votes: votes,
|
||||
duration: duration,
|
||||
start: parseInt(start),
|
||||
end: parseInt(end),
|
||||
type: "video",
|
||||
source: source
|
||||
};
|
||||
if (source == "soundcloud") {
|
||||
if (
|
||||
arr.thumbnail.indexOf("https://i1.sndcdn.com") > -1 ||
|
||||
arr.thumbnail.indexOf("https://w1.sndcdn.com") > -1
|
||||
) {
|
||||
new_song.thumbnail = arr.thumbnail;
|
||||
Chat.getUserNameByGuid(guid, function(username) {
|
||||
if (
|
||||
docs !== null &&
|
||||
docs.length !== 0 &&
|
||||
((docs[0].addsongs === true &&
|
||||
(hash == docs[0].adminpass || docs[0].adminpass === "")) ||
|
||||
docs[0].addsongs === false)
|
||||
) {
|
||||
db.collection(coll).find(
|
||||
{ id: id, type: { $ne: "suggested" } },
|
||||
function(err, docs) {
|
||||
if (docs !== null && docs.length === 0) {
|
||||
var guids = [guid];
|
||||
var added = Functions.get_time();
|
||||
var votes = 1;
|
||||
db.collection(coll).find({ now_playing: true }, function(
|
||||
err,
|
||||
docs
|
||||
) {
|
||||
if (docs !== null && docs.length === 0) {
|
||||
np = true;
|
||||
} else {
|
||||
new_song.thumbnail =
|
||||
"https://img.youtube.com/vi/404_notfound/mqdefault.jpg";
|
||||
np = false;
|
||||
}
|
||||
} else if (source == "youtube")
|
||||
new_song.thumbnail =
|
||||
"https://img.youtube.com/vi/" +
|
||||
new_song.id +
|
||||
"/mqdefault.jpg";
|
||||
db.collection(coll).update(
|
||||
{ id: id },
|
||||
new_song,
|
||||
{ upsert: true },
|
||||
function(err, docs) {
|
||||
new_song._id = "asd";
|
||||
if (np) {
|
||||
List.send_list(coll, undefined, false, true, false);
|
||||
db.collection(coll + "_settings").update(
|
||||
{ id: "config" },
|
||||
{ $set: { startTime: Functions.get_time() } }
|
||||
);
|
||||
List.send_play(coll, undefined);
|
||||
var thumbnail =
|
||||
arr.thumbnail != undefined
|
||||
? arr.thumbnail
|
||||
: undefined;
|
||||
Frontpage.update_frontpage(
|
||||
coll,
|
||||
id,
|
||||
title,
|
||||
thumbnail,
|
||||
arr.source
|
||||
);
|
||||
if (source != "soundcloud")
|
||||
Search.get_correct_info(new_song, coll, false);
|
||||
else if (source == "soundcloud")
|
||||
Search.get_genres_soundcloud(new_song, coll);
|
||||
var new_song = {
|
||||
added: added,
|
||||
guids: guids,
|
||||
id: id,
|
||||
now_playing: np,
|
||||
title: title,
|
||||
tags: tags,
|
||||
votes: votes,
|
||||
duration: duration,
|
||||
start: parseInt(start),
|
||||
end: parseInt(end),
|
||||
type: "video",
|
||||
source: source,
|
||||
added_by: username
|
||||
};
|
||||
if (source == "soundcloud") {
|
||||
if (
|
||||
arr.thumbnail.indexOf("https://i1.sndcdn.com") > -1 ||
|
||||
arr.thumbnail.indexOf("https://w1.sndcdn.com") > -1
|
||||
) {
|
||||
new_song.thumbnail = arr.thumbnail;
|
||||
} else {
|
||||
io.to(coll).emit("channel", {
|
||||
type: "added",
|
||||
value: new_song
|
||||
});
|
||||
if (source != "soundcloud")
|
||||
Search.get_correct_info(new_song, coll, true);
|
||||
else if (source == "soundcloud")
|
||||
Search.get_genres_soundcloud(new_song, coll);
|
||||
new_song.thumbnail =
|
||||
"https://img.youtube.com/vi/404_notfound/mqdefault.jpg";
|
||||
}
|
||||
db.collection("frontpage_lists").update(
|
||||
{ _id: coll },
|
||||
{
|
||||
$inc: { count: 1 },
|
||||
$set: { accessed: Functions.get_time() }
|
||||
},
|
||||
{ upsert: true },
|
||||
function(err, docs) {}
|
||||
);
|
||||
List.getNextSong(coll, undefined);
|
||||
}
|
||||
);
|
||||
socket.emit("toast", "addedsong");
|
||||
});
|
||||
} else {
|
||||
vote(coll, id, guid, socket);
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
db.collection(coll).find({ id: id }, function(err, docs) {
|
||||
if (docs.length === 0) {
|
||||
var suggestedAdd = {
|
||||
added: Functions.get_time(),
|
||||
guids: [guid],
|
||||
id: id,
|
||||
now_playing: false,
|
||||
title: title,
|
||||
votes: 1,
|
||||
duration: duration,
|
||||
start: start,
|
||||
end: end,
|
||||
type: "suggested",
|
||||
tags: tags
|
||||
};
|
||||
var source = arr.source;
|
||||
if (source == "soundcloud") {
|
||||
suggestedAdd.thumbnail = arr.thumbnail;
|
||||
suggestedAdd.source = source;
|
||||
} else {
|
||||
suggestedAdd.source = "youtube";
|
||||
}
|
||||
db.collection(coll).update(
|
||||
{ id: id },
|
||||
{ $set: suggestedAdd },
|
||||
{ upsert: true },
|
||||
function(err, docs) {
|
||||
socket.emit("toast", "suggested");
|
||||
var toSend = suggestedAdd;
|
||||
toSend.guids = [];
|
||||
if (source == "soundcloud")
|
||||
toSend.thumbnail = arr.thumbnail;
|
||||
io.to(coll).emit("suggested", toSend);
|
||||
} else if (source == "youtube")
|
||||
new_song.thumbnail =
|
||||
"https://img.youtube.com/vi/" +
|
||||
new_song.id +
|
||||
"/mqdefault.jpg";
|
||||
db.collection(coll).update(
|
||||
{ id: id },
|
||||
new_song,
|
||||
{ upsert: true },
|
||||
function(err, docs) {
|
||||
new_song._id = "asd";
|
||||
if (np) {
|
||||
List.send_list(coll, undefined, false, true, false);
|
||||
db.collection(coll + "_settings").update(
|
||||
{ id: "config" },
|
||||
{ $set: { startTime: Functions.get_time() } }
|
||||
);
|
||||
List.send_play(coll, undefined);
|
||||
var thumbnail =
|
||||
arr.thumbnail != undefined
|
||||
? arr.thumbnail
|
||||
: undefined;
|
||||
Frontpage.update_frontpage(
|
||||
coll,
|
||||
id,
|
||||
title,
|
||||
thumbnail,
|
||||
arr.source
|
||||
);
|
||||
if (source != "soundcloud")
|
||||
Search.get_correct_info(new_song, coll, false);
|
||||
else if (source == "soundcloud")
|
||||
Search.get_genres_soundcloud(new_song, coll);
|
||||
} else {
|
||||
io.to(coll).emit("channel", {
|
||||
type: "added",
|
||||
value: new_song
|
||||
});
|
||||
if (source != "soundcloud")
|
||||
Search.get_correct_info(new_song, coll, true);
|
||||
else if (source == "soundcloud")
|
||||
Search.get_genres_soundcloud(new_song, coll);
|
||||
}
|
||||
db.collection("frontpage_lists").update(
|
||||
{ _id: coll },
|
||||
{
|
||||
$inc: { count: 1 },
|
||||
$set: { accessed: Functions.get_time() }
|
||||
},
|
||||
{ upsert: true },
|
||||
function(err, docs) {}
|
||||
);
|
||||
List.getNextSong(coll, undefined);
|
||||
}
|
||||
);
|
||||
socket.emit("toast", "addedsong");
|
||||
});
|
||||
} else {
|
||||
vote(coll, id, guid, socket);
|
||||
}
|
||||
);
|
||||
} else if (docs[0].now_playing === true) {
|
||||
socket.emit("toast", "alreadyplay");
|
||||
} else {
|
||||
if (conf[0].vote === false) vote(coll, id, guid, socket);
|
||||
else socket.emit("toast", "listhaspass");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
db.collection(coll).find({ id: id }, function(err, docs) {
|
||||
if (docs.length === 0) {
|
||||
var suggestedAdd = {
|
||||
added: Functions.get_time(),
|
||||
guids: [guid],
|
||||
id: id,
|
||||
now_playing: false,
|
||||
title: title,
|
||||
votes: 1,
|
||||
duration: duration,
|
||||
start: start,
|
||||
end: end,
|
||||
type: "suggested",
|
||||
tags: tags,
|
||||
added_by: username
|
||||
};
|
||||
var source = arr.source;
|
||||
if (source == "soundcloud") {
|
||||
suggestedAdd.thumbnail = arr.thumbnail;
|
||||
suggestedAdd.source = source;
|
||||
} else {
|
||||
suggestedAdd.source = "youtube";
|
||||
}
|
||||
db.collection(coll).update(
|
||||
{ id: id },
|
||||
{ $set: suggestedAdd },
|
||||
{ upsert: true },
|
||||
function(err, docs) {
|
||||
socket.emit("toast", "suggested");
|
||||
var toSend = suggestedAdd;
|
||||
toSend.guids = [];
|
||||
if (source == "soundcloud")
|
||||
toSend.thumbnail = arr.thumbnail;
|
||||
io.to(coll).emit("suggested", toSend);
|
||||
if (source != "soundcloud")
|
||||
Search.get_correct_info(suggestedAdd, coll, false);
|
||||
else if (source == "soundcloud")
|
||||
Search.get_genres_soundcloud(suggestedAdd, coll);
|
||||
}
|
||||
);
|
||||
} else if (docs[0].now_playing === true) {
|
||||
socket.emit("toast", "alreadyplay");
|
||||
} else {
|
||||
if (conf[0].vote === false) vote(coll, id, guid, socket);
|
||||
else socket.emit("toast", "listhaspass");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (
|
||||
(arr.hasOwnProperty("offsiteAdd") && !arr.offsiteAdd) ||
|
||||
|
||||
@@ -3,10 +3,6 @@ var Channel = {
|
||||
if (window.location.hash == "#small" || inIframe()) {
|
||||
small_player = true;
|
||||
document.querySelector("footer").style.display = "none";
|
||||
//addJoinBox();
|
||||
//hideAllExtra();
|
||||
//document.querySelectorAll(".tab.col.s3")[1].remove();
|
||||
//document.querySelectorAll(".tab.col.s3")[1].remove();
|
||||
}
|
||||
if (client) {
|
||||
Helper.addClass(".tabs", "hide");
|
||||
@@ -25,12 +21,7 @@ var Channel = {
|
||||
Helper.addClass(".control-list", "client-control-list");
|
||||
} else {
|
||||
if (!api_key.hasOwnProperty("soundcloud")) soundcloud_enabled = false;
|
||||
else {
|
||||
/*SC.initialize({
|
||||
client_id: api_key.soundcloud
|
||||
}, function() {
|
||||
});*/
|
||||
}
|
||||
|
||||
if (cast_ready_connect || chromecastAvailable || chromecastReady) {
|
||||
Helper.addClass(".volume-container", "volume-container-cast");
|
||||
}
|
||||
@@ -295,10 +286,13 @@ var Channel = {
|
||||
|
||||
if (!client) {
|
||||
if (!Helper.mobilecheck()) {
|
||||
var port = window.location.port;
|
||||
if (port != "") port = ":" + port;
|
||||
var shareCodeUrl =
|
||||
window.location.protocol +
|
||||
"//client." +
|
||||
window.location.hostname +
|
||||
port +
|
||||
"/r/" +
|
||||
btoa(encodeURIComponent(chan.toLowerCase()));
|
||||
document
|
||||
@@ -312,18 +306,11 @@ var Channel = {
|
||||
"#channel-name-join",
|
||||
"client." +
|
||||
window.location.hostname +
|
||||
port +
|
||||
"/" +
|
||||
encodeURIComponent(chan.toLowerCase())
|
||||
);
|
||||
} /*else if(small_player) {
|
||||
document.querySelector("#channel-share-modal .modal-content").innerHTML = "<p>To listen to this channel with more features, go to</p><p>https://zoff.me/" + encodeURIComponent(chan.toLowerCase()) + "</p><img src='/assets/images/favicon.png' height='100' width='100' alt='circle-logo-zoff'>";
|
||||
//M.Modal.getInstance(document.getElementById("channel-share-modal")).open();
|
||||
if(!Helper.mobilecheck()) {
|
||||
setTimeout(function() {
|
||||
M.Modal.getInstance(document.getElementById("channel-share-modal")).close();
|
||||
}, 10000);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
} else {
|
||||
Helper.removeElement(".video-container");
|
||||
Helper.removeElement(".offline-panel");
|
||||
@@ -435,24 +422,6 @@ var Channel = {
|
||||
position: "top",
|
||||
html: "Cast Zoff to TV"
|
||||
});
|
||||
|
||||
/*$("#color_embed").spectrum({
|
||||
color: "#808080",
|
||||
change: function(c) {
|
||||
color = c.toHexString().substring(1); // #ff0000
|
||||
document.getElementById("embed-area").value = embed_code(embed_autoplay, embed_width, embed_height, color);
|
||||
},
|
||||
appendTo: "#embed",
|
||||
containerClassName: 'polyfill-color z-depth-4',
|
||||
show: function(color) {
|
||||
},
|
||||
});*/
|
||||
|
||||
/*Helper.addClass(".sp-choose", "hide");
|
||||
Helper.addClass(".sp-cancel", "btn-flat waves-effect waves-red");
|
||||
Helper.removeClass(".sp-cancel", "sp-cancel");
|
||||
document.getElementsByClassName("sp-button-container")[0].insertAdjacentHTML("beforeend", "<a href='#' class='btn-flat waves-effect waves-green sp-choose-link'>CHOOSE</a>");
|
||||
*/
|
||||
}
|
||||
|
||||
addListener("click", ".sp-choose-link", function(e) {
|
||||
@@ -708,10 +677,6 @@ var Channel = {
|
||||
channel: add + chan.toLowerCase()
|
||||
});
|
||||
} else if (url_split[3] === "") {
|
||||
/*if(client) {
|
||||
var host = window.location.hostname.split(".");
|
||||
window.location.hostname = host[host.length -1];
|
||||
}*/
|
||||
Admin.display_logged_out();
|
||||
if (hostMode) {
|
||||
Helper.removeClass("#main-row", "fullscreened");
|
||||
|
||||
@@ -13,11 +13,7 @@ var Hostcontroller = {
|
||||
Hostcontroller.old_id = id;
|
||||
}
|
||||
var codeURL =
|
||||
window.location.protocol +
|
||||
"//remote." +
|
||||
window.location.hostname +
|
||||
"/" +
|
||||
id;
|
||||
window.location.protocol + "//remote." + window.location.host + "/" + id;
|
||||
if (embed) {
|
||||
if (window.parentWindow && window.parentOrigin) {
|
||||
window.parentWindow.postMessage(
|
||||
|
||||
@@ -32,11 +32,8 @@ window.addEventListener(
|
||||
M.Modal.init(document.getElementById("about"));
|
||||
M.Modal.init(document.getElementById("contact"));
|
||||
M.Modal.init(document.getElementById("help"));
|
||||
|
||||
if (window.location.hostname == "remote.zoff.me") add = "https://zoff.me";
|
||||
else add = "localhost";
|
||||
socket = io.connect(
|
||||
add,
|
||||
window.location.protocol + "//" + window.location.host,
|
||||
connection_options
|
||||
);
|
||||
socket.on("update_required", function() {
|
||||
|
||||
@@ -36,10 +36,6 @@ var Suggestions = {
|
||||
var video_title = params.title;
|
||||
var date = new Date(params.added * 1000);
|
||||
var addedTime =
|
||||
Helper.pad(date.getHours()) +
|
||||
":" +
|
||||
Helper.pad(date.getMinutes()) +
|
||||
" - " +
|
||||
Helper.pad(date.getDate()) +
|
||||
"." +
|
||||
Helper.pad(date.getMonth()) +
|
||||
@@ -53,6 +49,9 @@ var Suggestions = {
|
||||
votes: addedTime,
|
||||
extra: "Added"
|
||||
};
|
||||
if (params.added_by != undefined) {
|
||||
toSend.extra += " by " + params.added_by;
|
||||
}
|
||||
if (params.source) toSend.source = params.source;
|
||||
else {
|
||||
toSend.source = "youtube";
|
||||
@@ -89,7 +88,7 @@ var Suggestions = {
|
||||
"&type=video&key=" +
|
||||
api_key.youtube;
|
||||
var video_urls =
|
||||
"https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id,statistics&fields=pageInfo,items(id,contentDetails,snippet(categoryId,channelTitle,publishedAt,title,description,thumbnails))&key=" +
|
||||
"https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id,statistics&fields=pageInfo,items(id,contentDetails,statistics(viewCount),snippet(categoryId,channelTitle,publishedAt,title,description,thumbnails))&key=" +
|
||||
api_key.youtube +
|
||||
"&id=";
|
||||
|
||||
@@ -125,29 +124,27 @@ var Suggestions = {
|
||||
try {
|
||||
viewCount = song.statistics.viewCount
|
||||
.toString()
|
||||
.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
|
||||
} catch (e) {}
|
||||
|
||||
try {
|
||||
document
|
||||
.getElementById("suggest-song-html")
|
||||
.insertAdjacentHTML(
|
||||
"beforeend",
|
||||
List.generateSong(
|
||||
{
|
||||
id: video_id,
|
||||
title: video_title,
|
||||
length: length,
|
||||
duration: duration,
|
||||
votes: viewCount,
|
||||
extra: "Views",
|
||||
source: "youtube"
|
||||
},
|
||||
false,
|
||||
false,
|
||||
false
|
||||
)
|
||||
);
|
||||
document.getElementById("suggest-song-html").insertAdjacentHTML(
|
||||
"beforeend",
|
||||
List.generateSong(
|
||||
{
|
||||
id: video_id,
|
||||
title: video_title,
|
||||
length: length,
|
||||
duration: duration,
|
||||
votes: viewCount,
|
||||
extra: "Views",
|
||||
source: "youtube"
|
||||
},
|
||||
false,
|
||||
false,
|
||||
false
|
||||
)
|
||||
);
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ var Functions = require(pathThumbnails + "/handlers/functions.js");
|
||||
var Frontpage = require(pathThumbnails + "/handlers/frontpage.js");
|
||||
|
||||
var db = require(pathThumbnails + "/handlers/db.js");
|
||||
//var db = require(pathThumbnails + '/handlers/db.js');
|
||||
|
||||
try {
|
||||
google = require(path.join(
|
||||
@@ -168,10 +167,6 @@ function root(req, res, next) {
|
||||
var subdomain = req.headers["x-forwarded-host"]
|
||||
? req.headers["x-forwarded-host"].split(".")
|
||||
: req.headers.host.split(":")[0].split(".");
|
||||
/*if(url != "zoff.me" && url != "admin.localhost" && url != "admin.zoff.me" && url != "remote.zoff.me" && url != "fb.zoff.me" && url != "remote.localhost" && url != "localhost") {
|
||||
res.redirect("https://zoff.me");
|
||||
return;
|
||||
}*/
|
||||
if (subdomain[0] == "remote") {
|
||||
var data = {
|
||||
year: year,
|
||||
@@ -228,7 +223,6 @@ function root(req, res, next) {
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
//res.redirect("https://zoff.me");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,10 +234,6 @@ function channel(req, res, next) {
|
||||
var subdomain = req.headers["x-forwarded-host"]
|
||||
? req.headers["x-forwarded-host"].split(".")
|
||||
: req.headers.host.split(":")[0].split(".");
|
||||
/*if(url != "zoff.me" && url != "admin.localhost" && url != "admin.zoff.me" && url != "remote.zoff.me" && url != "fb.zoff.me" && url != "remote.localhost" && url != "localhost") {
|
||||
res.redirect("https://zoff.me");
|
||||
return;
|
||||
}*/
|
||||
if (subdomain[0] == "remote") {
|
||||
var data = {
|
||||
year: year,
|
||||
@@ -264,22 +254,9 @@ function channel(req, res, next) {
|
||||
} else {
|
||||
if (req.params.channel_name == "o_callback") {
|
||||
res.redirect("/api/oauth");
|
||||
//res.sendFile(path.join(pathThumbnails, '/public/assets/html/callback.html'));
|
||||
} else {
|
||||
/*db.collection("frontpage_lists").find({"_id": Functions.encodeChannelName(req.params.channel_name)}, function(err, docs) {
|
||||
console.log(docs);
|
||||
var og_image = "https://zoff.me/assets/images/small-square.jpg";
|
||||
if(docs.length == 1) {
|
||||
if(docs[0].hasOwnProperty("thumbnail")) {
|
||||
if(docs[0].thumbnail.indexOf("mqdefault.jpg") > -1) docs[0].thumbnail = docs[0].thumbnail.replace("mqdefault", "hqdefault");
|
||||
og_image = docs[0].thumbnail;
|
||||
} else {
|
||||
og_image = "https://img.youtube.com/vi/" + docs[0].id + "/hqdefault.jpg";
|
||||
}
|
||||
}*/
|
||||
var data = {
|
||||
title: "404: File Not Found",
|
||||
//list_name: capitalizeFirstLetter(Functions.decodeChannelName(req.params.channel_name)),
|
||||
list_name: capitalizeFirstLetter(req.params.channel_name),
|
||||
year: year,
|
||||
javascript_file: "main.min.js",
|
||||
@@ -296,11 +273,7 @@ function channel(req, res, next) {
|
||||
if (subdomain[0] == "client") {
|
||||
data.client = true;
|
||||
}
|
||||
if (req.params.channel_name == "404") {
|
||||
res.status(404);
|
||||
}
|
||||
res.render("layouts/client/channel", data);
|
||||
//});
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user