mirror of
https://github.com/KevinMidboe/zoff.git
synced 2026-02-10 11:29:37 +00:00
Compare commits
39 Commits
fix/viewco
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fef8ad5215 | ||
|
|
938dac703e | ||
|
|
8ca0b2b4dd | ||
|
|
49fceb761c | ||
|
|
bc3328db2b | ||
|
|
9d9c783244 | ||
|
|
ad96e147b1 | ||
|
|
eb0cd96995 | ||
|
|
41a2964533 | ||
|
|
dcf581bb06 | ||
|
|
5e938e8bb2 | ||
|
|
612a76ebf6 | ||
|
|
d228cf223d | ||
|
|
f5d9272a42 | ||
|
|
50694e32db | ||
|
|
ff37946397 | ||
|
|
df353968a6 | ||
|
|
dc7435b4c1 | ||
|
|
82f6e5ed12 | ||
|
|
29c8d2c84b | ||
|
|
b47e38dce4 | ||
|
|
89c4a59ca4 | ||
|
|
116cb3f68d | ||
|
|
13bc8cb0ba | ||
|
|
9ed72c0cc0 | ||
|
|
ad8bc0c05b | ||
|
|
9993a377b8 | ||
|
|
0213c5fe0a | ||
|
|
d820b2daba | ||
|
|
3739a15049 | ||
|
|
cba874510b | ||
|
|
b3a7b95fd6 | ||
|
|
f9b05c11e0 | ||
|
|
e8d49c77df | ||
|
|
07164153b0 | ||
|
|
206321a46f | ||
|
|
460d0138f0 | ||
|
|
4d96763545 | ||
|
|
d3e72202ce |
2
FUNDING.yml
Normal file
2
FUNDING.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
github: [kasperrt]
|
||||||
|
custom: ["https://www.paypal.me/zoffmusic"]
|
||||||
@@ -83,5 +83,5 @@ Zoff is licensed under a
|
|||||||
<a href="http://creativecommons.org/licenses/by-nc-nd/3.0/no/">Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Norway License.</a>.
|
<a href="http://creativecommons.org/licenses/by-nc-nd/3.0/no/">Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Norway License.</a>.
|
||||||
Do not redistribute without permission from the developers.
|
Do not redistribute without permission from the developers.
|
||||||
|
|
||||||
Copyright © 2018
|
Copyright © 2019
|
||||||
Kasper Rynning-Tønnesen and Nicolas Almagro Tonne
|
Kasper Rynning-Tønnesen and Nicolas Almagro Tonne
|
||||||
|
|||||||
636
package-lock.json
generated
636
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -38,16 +38,17 @@
|
|||||||
"express-handlebars": "^3.0.2",
|
"express-handlebars": "^3.0.2",
|
||||||
"express-recaptcha": "^3.0.1",
|
"express-recaptcha": "^3.0.1",
|
||||||
"express-session": "^1.15.6",
|
"express-session": "^1.15.6",
|
||||||
|
"farmhash": "^3.0.0",
|
||||||
"feature-policy": "^0.2.0",
|
"feature-policy": "^0.2.0",
|
||||||
"gulp-clean-css": "^4.2.0",
|
"gulp-clean-css": "^4.2.0",
|
||||||
"gulp-sourcemaps": "^2.6.5",
|
"gulp-sourcemaps": "^2.6.5",
|
||||||
"gulp-uglify-es": "^1.0.4",
|
"gulp-uglify-es": "^1.0.4",
|
||||||
"helmet": "^3.16.0",
|
"helmet": "^3.21.1",
|
||||||
"jimp": "^0.2.28",
|
"jimp": "^0.2.28",
|
||||||
"mongodb": "^2.2.36",
|
"mongodb": "^2.2.36",
|
||||||
"mongojs": "^2.6.0",
|
"mongojs": "^2.6.0",
|
||||||
"mongojs-paginate": "^1.2.0",
|
"mongojs-paginate": "^1.2.0",
|
||||||
"mongoose": "^5.4.18",
|
"mongoose": "^5.7.5",
|
||||||
"mpromise": "^0.5.5",
|
"mpromise": "^0.5.5",
|
||||||
"nodemailer": "^4.7.0",
|
"nodemailer": "^4.7.0",
|
||||||
"passport": "^0.4.0",
|
"passport": "^0.4.0",
|
||||||
|
|||||||
10
pm2.json
10
pm2.json
@@ -2,18 +2,14 @@
|
|||||||
"apps": [
|
"apps": [
|
||||||
{
|
{
|
||||||
"name": "zoff",
|
"name": "zoff",
|
||||||
"script": "./server/app.js",
|
"script": "./server/pm2.js",
|
||||||
"watch": true,
|
"watch": true,
|
||||||
|
"instances": "max",
|
||||||
|
"exec_mode": "cluster",
|
||||||
"ignore_watch": [
|
"ignore_watch": [
|
||||||
"./node_modules",
|
"./node_modules",
|
||||||
"./server/public/assets/images/thumbnails"
|
"./server/public/assets/images/thumbnails"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "gulp",
|
|
||||||
"script": "./gulpfile.js",
|
|
||||||
"watch": true,
|
|
||||||
"ignore_watch": ["./node_modules", "./server/"]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ var cluster = require("cluster"),
|
|||||||
//publicPath = path.join(__dirname, 'public'),
|
//publicPath = path.join(__dirname, 'public'),
|
||||||
http = require("http"),
|
http = require("http"),
|
||||||
port = 8080,
|
port = 8080,
|
||||||
//farmhash = require('farmhash'),
|
farmhash = require("farmhash"),
|
||||||
uniqid = require("uniqid"),
|
uniqid = require("uniqid"),
|
||||||
num_processes = require("os").cpus().length;
|
num_processes = require("os").cpus().length;
|
||||||
|
|
||||||
@@ -53,20 +53,22 @@ function startClustered(redis_enabled) {
|
|||||||
var worker_index = function(ip, len) {
|
var worker_index = function(ip, len) {
|
||||||
//console.log(ip);
|
//console.log(ip);
|
||||||
var s = "";
|
var s = "";
|
||||||
if (ip == undefined) ip = uniqid.time();
|
if (ip !== undefined) {
|
||||||
|
return farmhash.fingerprint32(ip) % len;
|
||||||
|
}
|
||||||
|
ip = uniqid.time();
|
||||||
for (var i = 0, _len = ip.length; i < _len; i++) {
|
for (var i = 0, _len = ip.length; i < _len; i++) {
|
||||||
if (!isNaN(ip[i])) {
|
if (!isNaN(ip[i])) {
|
||||||
s += ip[i];
|
s += ip[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Number(s) % len;
|
return Number(s) % len;
|
||||||
//eturn farmhash.fingerprint32(ip) % len;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var server = net
|
var server = net
|
||||||
.createServer({ pauseOnConnect: true }, function(connection, a) {
|
.createServer({ pauseOnConnect: true }, function(connection, a) {
|
||||||
var worker =
|
var worker =
|
||||||
workers[worker_index(connection.remoteAddress, num_processes)];
|
workers[worker_index(connection.address().address, num_processes)];
|
||||||
worker.send("sticky-session:connection", connection);
|
worker.send("sticky-session:connection", connection);
|
||||||
})
|
})
|
||||||
.listen(port);
|
.listen(port);
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ var project_object = {
|
|||||||
duration: 1,
|
duration: 1,
|
||||||
end: 1,
|
end: 1,
|
||||||
type: 1,
|
type: 1,
|
||||||
|
added_by: { $ifNull: ["$added_by", "Anonymous"] },
|
||||||
source: { $ifNull: ["$source", "youtube"] },
|
source: { $ifNull: ["$source", "youtube"] },
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
$ifNull: [
|
$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) {
|
function chat(msg, guid, offline, socket) {
|
||||||
if (
|
if (
|
||||||
typeof msg !== "object" ||
|
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.get_history = get_history;
|
||||||
module.exports.chat = chat;
|
module.exports.chat = chat;
|
||||||
module.exports.all_chat = all_chat;
|
module.exports.all_chat = all_chat;
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ module.exports = function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var status = msg.status;
|
var status = msg.status;
|
||||||
var channel = Functions.encodeChannelName(msg.channel); //.replace(/ /g,'');
|
var channel = msg.channel; //.replace(/ /g,'');
|
||||||
if (status) {
|
if (status) {
|
||||||
in_list = false;
|
in_list = false;
|
||||||
offline = true;
|
offline = true;
|
||||||
@@ -504,6 +504,19 @@ module.exports = function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on("join_silent", function(msg) {
|
||||||
|
if (msg.hasOwnProperty("channel") && msg.channel.indexOf("?") > -1) {
|
||||||
|
var _list = msg.channel.substring(0, msg.channel.indexOf("?"));
|
||||||
|
msg.channel = _list;
|
||||||
|
}
|
||||||
|
if (msg.hasOwnProperty("channel")) {
|
||||||
|
msg.channel = Functions.encodeChannelName(msg.channel);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List.join_silent(msg, socket);
|
||||||
|
});
|
||||||
|
|
||||||
socket.on("list", function(msg) {
|
socket.on("list", function(msg) {
|
||||||
if (msg.hasOwnProperty("channel") && msg.channel.indexOf("?") > -1) {
|
if (msg.hasOwnProperty("channel") && msg.channel.indexOf("?") > -1) {
|
||||||
var _list = msg.channel.substring(0, msg.channel.indexOf("?"));
|
var _list = msg.channel.substring(0, msg.channel.indexOf("?"));
|
||||||
|
|||||||
@@ -31,6 +31,41 @@ function now_playing(list, fn, socket) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function join_silent(msg, socket) {
|
||||||
|
if (typeof msg === "object" && msg !== undefined && msg !== null) {
|
||||||
|
var channelName = msg.channel;
|
||||||
|
var tryingPassword = false;
|
||||||
|
var password = "";
|
||||||
|
if(msg.password != "") {
|
||||||
|
tryingPassword = true;
|
||||||
|
password = Functions.decrypt_string(msg.password);
|
||||||
|
password = crypto
|
||||||
|
.createHash("sha256")
|
||||||
|
.update(password)
|
||||||
|
.digest("base64");
|
||||||
|
}
|
||||||
|
|
||||||
|
channelName = channelName.toLowerCase(); //.replace(/ /g,'');
|
||||||
|
channelName = Functions.removeEmojis(channelName).toLowerCase();
|
||||||
|
db.collection(channelName + "_settings").find(function(err, docs) {
|
||||||
|
if(docs.length == 0) {
|
||||||
|
socket.emit("join_silent_declined", "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(docs[0].userpass == "" || docs[0].userpass == undefined || docs[0].userpass == password) {
|
||||||
|
socket.join(channelName);
|
||||||
|
socket.emit("join_silent_accepted", "");
|
||||||
|
|
||||||
|
send_play(channelName, socket);
|
||||||
|
} else {
|
||||||
|
socket.emit("join_silent_declined", "");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function list(msg, guid, coll, offline, socket) {
|
function list(msg, guid, coll, offline, socket) {
|
||||||
var socketid = socket.zoff_id;
|
var socketid = socket.zoff_id;
|
||||||
if (typeof msg === "object" && msg !== undefined && msg !== null) {
|
if (typeof msg === "object" && msg !== undefined && msg !== null) {
|
||||||
@@ -1245,6 +1280,7 @@ function getNextSong(coll, socket, callback) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.join_silent = join_silent;
|
||||||
module.exports.sendColor = sendColor;
|
module.exports.sendColor = sendColor;
|
||||||
module.exports.now_playing = now_playing;
|
module.exports.now_playing = now_playing;
|
||||||
module.exports.list = list;
|
module.exports.list = list;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ var Functions = require(pathThumbnails + "/handlers/functions.js");
|
|||||||
var List = require(pathThumbnails + "/handlers/list.js");
|
var List = require(pathThumbnails + "/handlers/list.js");
|
||||||
var Frontpage = require(pathThumbnails + "/handlers/frontpage.js");
|
var Frontpage = require(pathThumbnails + "/handlers/frontpage.js");
|
||||||
var Search = require(pathThumbnails + "/handlers/search.js");
|
var Search = require(pathThumbnails + "/handlers/search.js");
|
||||||
|
var Chat = require(pathThumbnails + "/handlers/chat.js");
|
||||||
var crypto = require("crypto");
|
var crypto = require("crypto");
|
||||||
var Filter = require("bad-words");
|
var Filter = require("bad-words");
|
||||||
var filter = new Filter({ placeHolder: "x" });
|
var filter = new Filter({ placeHolder: "x" });
|
||||||
@@ -201,7 +202,7 @@ function addFromOtherList(arr, guid, offline, socket) {
|
|||||||
accessed: Functions.get_time()
|
accessed: Functions.get_time()
|
||||||
};
|
};
|
||||||
db.collection(
|
db.collection(
|
||||||
channel
|
new_channel
|
||||||
).find(
|
).find(
|
||||||
{
|
{
|
||||||
now_playing: true
|
now_playing: true
|
||||||
@@ -819,159 +820,167 @@ function add_function(arr, coll, guid, offline, socket) {
|
|||||||
var source = arr.source;
|
var source = arr.source;
|
||||||
var tags = arr.tags;
|
var tags = arr.tags;
|
||||||
conf = docs;
|
conf = docs;
|
||||||
if (
|
Chat.getUserNameByGuid(guid, function(username) {
|
||||||
docs !== null &&
|
if (
|
||||||
docs.length !== 0 &&
|
docs !== null &&
|
||||||
((docs[0].addsongs === true &&
|
docs.length !== 0 &&
|
||||||
(hash == docs[0].adminpass || docs[0].adminpass === "")) ||
|
((docs[0].addsongs === true &&
|
||||||
docs[0].addsongs === false)
|
(hash == docs[0].adminpass || docs[0].adminpass === "")) ||
|
||||||
) {
|
docs[0].addsongs === false)
|
||||||
db.collection(coll).find(
|
) {
|
||||||
{ id: id, type: { $ne: "suggested" } },
|
db.collection(coll).find(
|
||||||
function(err, docs) {
|
{ id: id, type: { $ne: "suggested" } },
|
||||||
if (docs !== null && docs.length === 0) {
|
function(err, docs) {
|
||||||
var guids = [guid];
|
if (docs !== null && docs.length === 0) {
|
||||||
var added = Functions.get_time();
|
var guids = [guid];
|
||||||
var votes = 1;
|
var added = Functions.get_time();
|
||||||
db.collection(coll).find({ now_playing: true }, function(
|
var votes = 1;
|
||||||
err,
|
db.collection(coll).find({ now_playing: true }, function(
|
||||||
docs
|
err,
|
||||||
) {
|
docs
|
||||||
if (docs !== null && docs.length === 0) {
|
) {
|
||||||
np = true;
|
if (docs !== null && docs.length === 0) {
|
||||||
} else {
|
np = true;
|
||||||
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;
|
|
||||||
} else {
|
} else {
|
||||||
new_song.thumbnail =
|
np = false;
|
||||||
"https://img.youtube.com/vi/404_notfound/mqdefault.jpg";
|
|
||||||
}
|
}
|
||||||
} else if (source == "youtube")
|
var new_song = {
|
||||||
new_song.thumbnail =
|
added: added,
|
||||||
"https://img.youtube.com/vi/" +
|
guids: guids,
|
||||||
new_song.id +
|
id: id,
|
||||||
"/mqdefault.jpg";
|
now_playing: np,
|
||||||
db.collection(coll).update(
|
title: title,
|
||||||
{ id: id },
|
tags: tags,
|
||||||
new_song,
|
votes: votes,
|
||||||
{ upsert: true },
|
duration: duration,
|
||||||
function(err, docs) {
|
start: parseInt(start),
|
||||||
new_song._id = "asd";
|
end: parseInt(end),
|
||||||
if (np) {
|
type: "video",
|
||||||
List.send_list(coll, undefined, false, true, false);
|
source: source,
|
||||||
db.collection(coll + "_settings").update(
|
added_by: username
|
||||||
{ id: "config" },
|
};
|
||||||
{ $set: { startTime: Functions.get_time() } }
|
if (source == "soundcloud") {
|
||||||
);
|
if (
|
||||||
List.send_play(coll, undefined);
|
arr.thumbnail.indexOf("https://i1.sndcdn.com") > -1 ||
|
||||||
var thumbnail =
|
arr.thumbnail.indexOf("https://w1.sndcdn.com") > -1
|
||||||
arr.thumbnail != undefined
|
) {
|
||||||
? arr.thumbnail
|
new_song.thumbnail = 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 {
|
} else {
|
||||||
io.to(coll).emit("channel", {
|
new_song.thumbnail =
|
||||||
type: "added",
|
"https://img.youtube.com/vi/404_notfound/mqdefault.jpg";
|
||||||
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(
|
} else if (source == "youtube")
|
||||||
{ _id: coll },
|
new_song.thumbnail =
|
||||||
{
|
"https://img.youtube.com/vi/" +
|
||||||
$inc: { count: 1 },
|
new_song.id +
|
||||||
$set: { accessed: Functions.get_time() }
|
"/mqdefault.jpg";
|
||||||
},
|
db.collection(coll).update(
|
||||||
{ upsert: true },
|
{ id: id },
|
||||||
function(err, docs) {}
|
new_song,
|
||||||
);
|
{ upsert: true },
|
||||||
List.getNextSong(coll, undefined);
|
function(err, docs) {
|
||||||
}
|
new_song._id = "asd";
|
||||||
);
|
if (np) {
|
||||||
socket.emit("toast", "addedsong");
|
List.send_list(coll, undefined, false, true, false);
|
||||||
});
|
db.collection(coll + "_settings").update(
|
||||||
} else {
|
{ id: "config" },
|
||||||
vote(coll, id, guid, socket);
|
{ $set: { startTime: Functions.get_time() } }
|
||||||
}
|
);
|
||||||
}
|
List.send_play(coll, undefined);
|
||||||
);
|
var thumbnail =
|
||||||
} else {
|
arr.thumbnail != undefined
|
||||||
db.collection(coll).find({ id: id }, function(err, docs) {
|
? arr.thumbnail
|
||||||
if (docs.length === 0) {
|
: undefined;
|
||||||
var suggestedAdd = {
|
Frontpage.update_frontpage(
|
||||||
added: Functions.get_time(),
|
coll,
|
||||||
guids: [guid],
|
id,
|
||||||
id: id,
|
title,
|
||||||
now_playing: false,
|
thumbnail,
|
||||||
title: title,
|
arr.source
|
||||||
votes: 1,
|
);
|
||||||
duration: duration,
|
if (source != "soundcloud")
|
||||||
start: start,
|
Search.get_correct_info(new_song, coll, false);
|
||||||
end: end,
|
else if (source == "soundcloud")
|
||||||
type: "suggested",
|
Search.get_genres_soundcloud(new_song, coll);
|
||||||
tags: tags
|
} else {
|
||||||
};
|
io.to(coll).emit("channel", {
|
||||||
var source = arr.source;
|
type: "added",
|
||||||
if (source == "soundcloud") {
|
value: new_song
|
||||||
suggestedAdd.thumbnail = arr.thumbnail;
|
});
|
||||||
suggestedAdd.source = source;
|
if (source != "soundcloud")
|
||||||
} else {
|
Search.get_correct_info(new_song, coll, true);
|
||||||
suggestedAdd.source = "youtube";
|
else if (source == "soundcloud")
|
||||||
}
|
Search.get_genres_soundcloud(new_song, coll);
|
||||||
db.collection(coll).update(
|
}
|
||||||
{ id: id },
|
db.collection("frontpage_lists").update(
|
||||||
{ $set: suggestedAdd },
|
{ _id: coll },
|
||||||
{ upsert: true },
|
{
|
||||||
function(err, docs) {
|
$inc: { count: 1 },
|
||||||
socket.emit("toast", "suggested");
|
$set: { accessed: Functions.get_time() }
|
||||||
var toSend = suggestedAdd;
|
},
|
||||||
toSend.guids = [];
|
{ upsert: true },
|
||||||
if (source == "soundcloud")
|
function(err, docs) {}
|
||||||
toSend.thumbnail = arr.thumbnail;
|
);
|
||||||
io.to(coll).emit("suggested", toSend);
|
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 {
|
||||||
} else {
|
db.collection(coll).find({ id: id }, function(err, docs) {
|
||||||
if (conf[0].vote === false) vote(coll, id, guid, socket);
|
if (docs.length === 0) {
|
||||||
else socket.emit("toast", "listhaspass");
|
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 {
|
} else {
|
||||||
if (
|
if (
|
||||||
(arr.hasOwnProperty("offsiteAdd") && !arr.offsiteAdd) ||
|
(arr.hasOwnProperty("offsiteAdd") && !arr.offsiteAdd) ||
|
||||||
|
|||||||
@@ -244,9 +244,7 @@ function conf_function(params, coll, guid, offline, socket) {
|
|||||||
var adminpass = params.adminpass;
|
var adminpass = params.adminpass;
|
||||||
var skipping = params.skipping;
|
var skipping = params.skipping;
|
||||||
var shuffling = params.shuffling;
|
var shuffling = params.shuffling;
|
||||||
|
|
||||||
var userpass = Functions.decrypt_string(params.userpass);
|
var userpass = Functions.decrypt_string(params.userpass);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(!params.userpass_changed && frontpage) ||
|
(!params.userpass_changed && frontpage) ||
|
||||||
(params.userpass_changed && userpass == "")
|
(params.userpass_changed && userpass == "")
|
||||||
|
|||||||
82
server/pm2.js
Normal file
82
server/pm2.js
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
var cluster = require("cluster"),
|
||||||
|
net = require("net"),
|
||||||
|
path = require("path"),
|
||||||
|
//publicPath = path.join(__dirname, 'public'),
|
||||||
|
http = require("http"),
|
||||||
|
port = 8080,
|
||||||
|
//farmhash = require('farmhash'),
|
||||||
|
uniqid = require("uniqid"),
|
||||||
|
num_processes = require("os").cpus().length;
|
||||||
|
|
||||||
|
publicPath = path.join(__dirname, "public");
|
||||||
|
pathThumbnails = __dirname;
|
||||||
|
|
||||||
|
var redis = require("redis");
|
||||||
|
var client = redis.createClient({ host: "localhost", port: 6379 });
|
||||||
|
|
||||||
|
startSingle(true, true);
|
||||||
|
|
||||||
|
function startSingle(clustered, redis_enabled) {
|
||||||
|
var server;
|
||||||
|
var client = require("./apps/client.js");
|
||||||
|
try {
|
||||||
|
var cert_config = require(path.join(
|
||||||
|
path.join(__dirname, "config"),
|
||||||
|
"cert_config.js"
|
||||||
|
));
|
||||||
|
var fs = require("fs");
|
||||||
|
var privateKey = fs.readFileSync(cert_config.privateKey).toString();
|
||||||
|
var certificate = fs.readFileSync(cert_config.certificate).toString();
|
||||||
|
var ca = fs.readFileSync(cert_config.ca).toString();
|
||||||
|
var credentials = {
|
||||||
|
key: privateKey,
|
||||||
|
cert: certificate,
|
||||||
|
ca: ca
|
||||||
|
};
|
||||||
|
var https = require("https");
|
||||||
|
server = https.Server(credentials, routingFunction);
|
||||||
|
} catch (err) {
|
||||||
|
console.log("Starting without https (probably on localhost)");
|
||||||
|
server = http.createServer(routingFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
server.listen(port, onListen);
|
||||||
|
|
||||||
|
var socketIO = client.socketIO;
|
||||||
|
|
||||||
|
var redis = require("socket.io-redis");
|
||||||
|
try {
|
||||||
|
socketIO.adapter(redis({ host: "localhost", port: 6379 }));
|
||||||
|
} catch (e) {
|
||||||
|
console.log("No redis-server to connect to..");
|
||||||
|
}
|
||||||
|
socketIO.listen(server);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onListen() {
|
||||||
|
console.log("Started with pid [" + process.pid + "]");
|
||||||
|
}
|
||||||
|
|
||||||
|
function routingFunction(req, res, next) {
|
||||||
|
var client = require("./apps/client.js");
|
||||||
|
var admin = require("./apps/admin.js");
|
||||||
|
try {
|
||||||
|
var url = req.headers["x-forwarded-host"]
|
||||||
|
? req.headers["x-forwarded-host"]
|
||||||
|
: req.headers.host.split(":")[0];
|
||||||
|
var subdomain = req.headers["x-forwarded-host"]
|
||||||
|
? req.headers["x-forwarded-host"].split(".")
|
||||||
|
: req.headers.host.split(":")[0].split(".");
|
||||||
|
|
||||||
|
if (subdomain.length > 1 && subdomain[0] == "admin") {
|
||||||
|
admin(req, res, next);
|
||||||
|
} else {
|
||||||
|
client(req, res, next);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log("Bad request for " + req.headers.host + req.url, e);
|
||||||
|
res.statusCode = 500;
|
||||||
|
res.write("Bad request"); //write a response to the client
|
||||||
|
res.end(); //end the response
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -48,6 +48,10 @@ nav ul li.active {
|
|||||||
background-color: rgba(0, 0, 0, 0.1);
|
background-color: rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.full-height {
|
||||||
|
height:100vh;
|
||||||
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||||
-moz-tap-highlight-color: rgba(0, 0, 0, 0);
|
-moz-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||||
|
|||||||
@@ -1273,7 +1273,7 @@ margin:-1px;
|
|||||||
cursor: default;
|
cursor: default;
|
||||||
display: inline;
|
display: inline;
|
||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
font-weight: 100;
|
/*font-weight: 100;*/
|
||||||
height: auto;
|
height: auto;
|
||||||
line-height: 90.069229px;
|
line-height: 90.069229px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -1384,7 +1384,7 @@ margin:-1px;
|
|||||||
display: inline;
|
display: inline;
|
||||||
/* font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; */
|
/* font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; */
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: 300;
|
/*font-weight: 300;*/
|
||||||
height: auto;
|
height: auto;
|
||||||
/*line-height: 24.2857151031494px;*/
|
/*line-height: 24.2857151031494px;*/
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -1539,6 +1539,8 @@ margin:-1px;
|
|||||||
|
|
||||||
.channel-finder .input-field {
|
.channel-finder .input-field {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
margin-left: 0px !important;
|
margin-left: 0px !important;
|
||||||
width: max-content !important;
|
width: max-content !important;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -1552,7 +1554,9 @@ margin:-1px;
|
|||||||
.channel-finder .input-field .prefix {
|
.channel-finder .input-field .prefix {
|
||||||
color: white;
|
color: white;
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
/*margin-left: -215px;*/
|
position: initial;
|
||||||
|
margin-right: -45px;
|
||||||
|
margin-bottom: 9px;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ var Channel = {
|
|||||||
if (window.location.hash == "#small" || inIframe()) {
|
if (window.location.hash == "#small" || inIframe()) {
|
||||||
small_player = true;
|
small_player = true;
|
||||||
document.querySelector("footer").style.display = "none";
|
document.querySelector("footer").style.display = "none";
|
||||||
//addJoinBox();
|
|
||||||
//hideAllExtra();
|
|
||||||
//document.querySelectorAll(".tab.col.s3")[1].remove();
|
|
||||||
//document.querySelectorAll(".tab.col.s3")[1].remove();
|
|
||||||
}
|
}
|
||||||
if (client) {
|
if (client) {
|
||||||
Helper.addClass(".tabs", "hide");
|
Helper.addClass(".tabs", "hide");
|
||||||
@@ -25,12 +21,7 @@ var Channel = {
|
|||||||
Helper.addClass(".control-list", "client-control-list");
|
Helper.addClass(".control-list", "client-control-list");
|
||||||
} else {
|
} else {
|
||||||
if (!api_key.hasOwnProperty("soundcloud")) soundcloud_enabled = false;
|
if (!api_key.hasOwnProperty("soundcloud")) soundcloud_enabled = false;
|
||||||
else {
|
|
||||||
/*SC.initialize({
|
|
||||||
client_id: api_key.soundcloud
|
|
||||||
}, function() {
|
|
||||||
});*/
|
|
||||||
}
|
|
||||||
if (cast_ready_connect || chromecastAvailable || chromecastReady) {
|
if (cast_ready_connect || chromecastAvailable || chromecastReady) {
|
||||||
Helper.addClass(".volume-container", "volume-container-cast");
|
Helper.addClass(".volume-container", "volume-container-cast");
|
||||||
}
|
}
|
||||||
@@ -295,10 +286,13 @@ var Channel = {
|
|||||||
|
|
||||||
if (!client) {
|
if (!client) {
|
||||||
if (!Helper.mobilecheck()) {
|
if (!Helper.mobilecheck()) {
|
||||||
|
var port = window.location.port;
|
||||||
|
if (port != "") port = ":" + port;
|
||||||
var shareCodeUrl =
|
var shareCodeUrl =
|
||||||
window.location.protocol +
|
window.location.protocol +
|
||||||
"//client." +
|
"//client." +
|
||||||
window.location.hostname +
|
window.location.hostname +
|
||||||
|
port +
|
||||||
"/r/" +
|
"/r/" +
|
||||||
btoa(encodeURIComponent(chan.toLowerCase()));
|
btoa(encodeURIComponent(chan.toLowerCase()));
|
||||||
document
|
document
|
||||||
@@ -312,18 +306,11 @@ var Channel = {
|
|||||||
"#channel-name-join",
|
"#channel-name-join",
|
||||||
"client." +
|
"client." +
|
||||||
window.location.hostname +
|
window.location.hostname +
|
||||||
|
port +
|
||||||
"/" +
|
"/" +
|
||||||
encodeURIComponent(chan.toLowerCase())
|
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 {
|
} else {
|
||||||
Helper.removeElement(".video-container");
|
Helper.removeElement(".video-container");
|
||||||
Helper.removeElement(".offline-panel");
|
Helper.removeElement(".offline-panel");
|
||||||
@@ -435,24 +422,6 @@ var Channel = {
|
|||||||
position: "top",
|
position: "top",
|
||||||
html: "Cast Zoff to TV"
|
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) {
|
addListener("click", ".sp-choose-link", function(e) {
|
||||||
@@ -708,10 +677,6 @@ var Channel = {
|
|||||||
channel: add + chan.toLowerCase()
|
channel: add + chan.toLowerCase()
|
||||||
});
|
});
|
||||||
} else if (url_split[3] === "") {
|
} else if (url_split[3] === "") {
|
||||||
/*if(client) {
|
|
||||||
var host = window.location.hostname.split(".");
|
|
||||||
window.location.hostname = host[host.length -1];
|
|
||||||
}*/
|
|
||||||
Admin.display_logged_out();
|
Admin.display_logged_out();
|
||||||
if (hostMode) {
|
if (hostMode) {
|
||||||
Helper.removeClass("#main-row", "fullscreened");
|
Helper.removeClass("#main-row", "fullscreened");
|
||||||
|
|||||||
@@ -299,6 +299,9 @@ var Helper = {
|
|||||||
var this_element = M.Tooltip.getInstance(elem);
|
var this_element = M.Tooltip.getInstance(elem);
|
||||||
if (this_element != undefined) this_element.destroy();
|
if (this_element != undefined) this_element.destroy();
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
|
elem.removeAttribute("title");
|
||||||
|
} catch (e) {}
|
||||||
M.Tooltip.init(elem, options);
|
M.Tooltip.init(elem, options);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -308,6 +311,9 @@ var Helper = {
|
|||||||
var this_element = M.Tooltip.getInstance(elem);
|
var this_element = M.Tooltip.getInstance(elem);
|
||||||
if (this_element != undefined) this_element.destroy();
|
if (this_element != undefined) this_element.destroy();
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
|
elements[i].removeAttribute("title");
|
||||||
|
} catch (e) {}
|
||||||
M.Tooltip.init(elements[i], options);
|
M.Tooltip.init(elements[i], options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,11 +13,7 @@ var Hostcontroller = {
|
|||||||
Hostcontroller.old_id = id;
|
Hostcontroller.old_id = id;
|
||||||
}
|
}
|
||||||
var codeURL =
|
var codeURL =
|
||||||
window.location.protocol +
|
window.location.protocol + "//remote." + window.location.host + "/" + id;
|
||||||
"//remote." +
|
|
||||||
window.location.hostname +
|
|
||||||
"/" +
|
|
||||||
id;
|
|
||||||
if (embed) {
|
if (embed) {
|
||||||
if (window.parentWindow && window.parentOrigin) {
|
if (window.parentWindow && window.parentOrigin) {
|
||||||
window.parentWindow.postMessage(
|
window.parentWindow.postMessage(
|
||||||
|
|||||||
@@ -607,7 +607,14 @@ var Player = {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (Player.player.getVideoUrl().indexOf(id) > -1) {
|
if (Player.player.getVideoUrl().indexOf(id) > -1) {
|
||||||
Player.player.seekTo(seekTo);
|
if (
|
||||||
|
!(
|
||||||
|
seekTo - 5 < Player.player.getCurrentTime() &&
|
||||||
|
seekTo + 5 > Player.player.getCurrentTime()
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Player.player.seekTo(seekTo);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Player.player.loadVideoById({
|
Player.player.loadVideoById({
|
||||||
videoId: id,
|
videoId: id,
|
||||||
|
|||||||
@@ -32,11 +32,8 @@ window.addEventListener(
|
|||||||
M.Modal.init(document.getElementById("about"));
|
M.Modal.init(document.getElementById("about"));
|
||||||
M.Modal.init(document.getElementById("contact"));
|
M.Modal.init(document.getElementById("contact"));
|
||||||
M.Modal.init(document.getElementById("help"));
|
M.Modal.init(document.getElementById("help"));
|
||||||
|
|
||||||
if (window.location.hostname == "remote.zoff.me") add = "https://zoff.me";
|
|
||||||
else add = "localhost";
|
|
||||||
socket = io.connect(
|
socket = io.connect(
|
||||||
add,
|
window.location.protocol + "//" + window.location.host,
|
||||||
connection_options
|
connection_options
|
||||||
);
|
);
|
||||||
socket.on("update_required", function() {
|
socket.on("update_required", function() {
|
||||||
|
|||||||
@@ -36,10 +36,6 @@ var Suggestions = {
|
|||||||
var video_title = params.title;
|
var video_title = params.title;
|
||||||
var date = new Date(params.added * 1000);
|
var date = new Date(params.added * 1000);
|
||||||
var addedTime =
|
var addedTime =
|
||||||
Helper.pad(date.getHours()) +
|
|
||||||
":" +
|
|
||||||
Helper.pad(date.getMinutes()) +
|
|
||||||
" - " +
|
|
||||||
Helper.pad(date.getDate()) +
|
Helper.pad(date.getDate()) +
|
||||||
"." +
|
"." +
|
||||||
Helper.pad(date.getMonth()) +
|
Helper.pad(date.getMonth()) +
|
||||||
@@ -53,6 +49,9 @@ var Suggestions = {
|
|||||||
votes: addedTime,
|
votes: addedTime,
|
||||||
extra: "Added"
|
extra: "Added"
|
||||||
};
|
};
|
||||||
|
if (params.added_by != undefined) {
|
||||||
|
toSend.extra += " by " + params.added_by;
|
||||||
|
}
|
||||||
if (params.source) toSend.source = params.source;
|
if (params.source) toSend.source = params.source;
|
||||||
else {
|
else {
|
||||||
toSend.source = "youtube";
|
toSend.source = "youtube";
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<!-- Compiled and minified JavaScript -->
|
<!-- Compiled and minified JavaScript -->
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="https://zoff.me/assets/css/style.css" title="Default" />
|
<link rel="stylesheet" type="text/css" href="https://zoff.me/assets/dist/style.css" title="Default" />
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.1.0/socket.io.slim.js"></script>
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.1.0/socket.io.slim.js"></script>
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<main class="container valign-wrapper row">
|
<main class="container valign-wrapper row full-height">
|
||||||
<div class="center-align col m6 offset-m3">
|
<div class="center-align col m6 offset-m3">
|
||||||
<img src="https://zoff.me/assets/images/favicon.png" width="100" height="100" alt="image" />
|
<img src="https://zoff.me/assets/images/favicon.png" width="100" height="100" alt="image" />
|
||||||
<form action="/login" id="login_form" method="POST">
|
<form action="/login" id="login_form" method="POST">
|
||||||
|
|||||||
@@ -43,20 +43,20 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a title="Like what we made? Help us by donating (a) beer!" class="waves-effect waves-light btn orange light-blue share donate-button">
|
<a class="waves-effect waves-light btn orange share donate-button">
|
||||||
<i class="material-icons left footer-button-icon">payment</i>Donate
|
<i class="material-icons left footer-button-icon">payment</i>Donate
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/users/kasperrt/sponsorship" target="_blank" class="waves-effect waves-light btn pink accent-1 share">
|
||||||
|
<i class="material-icons left footer-button-icon">favorite</i>Sponsor
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li class="google-play-image-list">
|
<li class="google-play-image-list">
|
||||||
<a class="android-image-link" href="https://play.google.com/store/apps/details?id=zoff.me.zoff&hl=no&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1">
|
<a class="android-image-link" href="https://play.google.com/store/apps/details?id=zoff.me.zoff&hl=no&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1">
|
||||||
<img alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png"/>
|
<img alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png"/>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="apple-appstore-image-list">
|
|
||||||
<a class="apple-image-link" href="https://itunes.apple.com/us/app/zoff/id1402037061?ls=1&mt=8">
|
|
||||||
<img alt="Get it on the AppStore" src="/assets/images/appstore.svg"/>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ var Functions = require(pathThumbnails + "/handlers/functions.js");
|
|||||||
var Frontpage = require(pathThumbnails + "/handlers/frontpage.js");
|
var Frontpage = require(pathThumbnails + "/handlers/frontpage.js");
|
||||||
|
|
||||||
var db = require(pathThumbnails + "/handlers/db.js");
|
var db = require(pathThumbnails + "/handlers/db.js");
|
||||||
//var db = require(pathThumbnails + '/handlers/db.js');
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
google = require(path.join(
|
google = require(path.join(
|
||||||
@@ -168,10 +167,6 @@ function root(req, res, next) {
|
|||||||
var subdomain = req.headers["x-forwarded-host"]
|
var subdomain = req.headers["x-forwarded-host"]
|
||||||
? req.headers["x-forwarded-host"].split(".")
|
? req.headers["x-forwarded-host"].split(".")
|
||||||
: req.headers.host.split(":")[0].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") {
|
if (subdomain[0] == "remote") {
|
||||||
var data = {
|
var data = {
|
||||||
year: year,
|
year: year,
|
||||||
@@ -228,7 +223,6 @@ function root(req, res, next) {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(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"]
|
var subdomain = req.headers["x-forwarded-host"]
|
||||||
? req.headers["x-forwarded-host"].split(".")
|
? req.headers["x-forwarded-host"].split(".")
|
||||||
: req.headers.host.split(":")[0].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") {
|
if (subdomain[0] == "remote") {
|
||||||
var data = {
|
var data = {
|
||||||
year: year,
|
year: year,
|
||||||
@@ -264,22 +254,9 @@ function channel(req, res, next) {
|
|||||||
} else {
|
} else {
|
||||||
if (req.params.channel_name == "o_callback") {
|
if (req.params.channel_name == "o_callback") {
|
||||||
res.redirect("/api/oauth");
|
res.redirect("/api/oauth");
|
||||||
//res.sendFile(path.join(pathThumbnails, '/public/assets/html/callback.html'));
|
|
||||||
} else {
|
} 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 = {
|
var data = {
|
||||||
title: "404: File Not Found",
|
title: "404: File Not Found",
|
||||||
//list_name: capitalizeFirstLetter(Functions.decodeChannelName(req.params.channel_name)),
|
|
||||||
list_name: capitalizeFirstLetter(req.params.channel_name),
|
list_name: capitalizeFirstLetter(req.params.channel_name),
|
||||||
year: year,
|
year: year,
|
||||||
javascript_file: "main.min.js",
|
javascript_file: "main.min.js",
|
||||||
@@ -296,11 +273,7 @@ function channel(req, res, next) {
|
|||||||
if (subdomain[0] == "client") {
|
if (subdomain[0] == "client") {
|
||||||
data.client = true;
|
data.client = true;
|
||||||
}
|
}
|
||||||
if (req.params.channel_name == "404") {
|
|
||||||
res.status(404);
|
|
||||||
}
|
|
||||||
res.render("layouts/client/channel", data);
|
res.render("layouts/client/channel", data);
|
||||||
//});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user