mirror of https://github.com/calzoneman/sync.git
Modify /api/channels and /api/allchannels not to include videourl
This commit is contained in:
parent
dd5c0e5b82
commit
46baa5532f
27
lib/api.js
27
lib/api.js
|
@ -34,15 +34,28 @@ module.exports = function (Server) {
|
|||
};
|
||||
|
||||
data.pagetitle = channel.opts.pagetitle;
|
||||
data.media = channel.playlist.current ?
|
||||
channel.playlist.current.media.pack() :
|
||||
{};
|
||||
data.mediatitle = channel.playlist.current ?
|
||||
channel.playlist.current.media.title :
|
||||
"-";
|
||||
data.usercount = channel.users.length;
|
||||
data.voteskip_eligible = channel.calcVoteskipMax();
|
||||
data.users = [];
|
||||
for(var i in channel.users)
|
||||
if(channel.users[i].name !== "")
|
||||
data.users.push(channel.users[i].name);
|
||||
for(var i in channel.users) {
|
||||
if(channel.users[i].name !== "") {
|
||||
var name = channel.users[i].name;
|
||||
var rank = channel.users[i].rank;
|
||||
if (rank >= 255) {
|
||||
name = "!" + name;
|
||||
} else if (rank >= 10) {
|
||||
name = "~" + name;
|
||||
} else if (rank >= 3) {
|
||||
name = "&" + name;
|
||||
} else if (rank === 2) {
|
||||
name = "@" + name;
|
||||
}
|
||||
data.users.push(name);
|
||||
}
|
||||
}
|
||||
|
||||
data.chat = [];
|
||||
for(var i in channel.chatbuffer)
|
||||
|
@ -96,7 +109,7 @@ module.exports = function (Server) {
|
|||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (chan !== null) {
|
||||
chan.getRank(uname, function (err, rank) {
|
||||
if (err || rank < 2) {
|
||||
|
|
|
@ -94,36 +94,6 @@
|
|||
<script type="text/javascript">
|
||||
setInterval(refresh, 10000);
|
||||
refresh();
|
||||
function idToURL(data) {
|
||||
var entry = "";
|
||||
switch(data.type) {
|
||||
case "yt":
|
||||
entry = "http://youtube.com/watch?v="+data.id;
|
||||
break;
|
||||
case "vi":
|
||||
entry = "http://vimeo.com/"+data.id;
|
||||
break;
|
||||
case "dm":
|
||||
entry = "http://dailymotion.com/video/"+data.id;
|
||||
break;
|
||||
case "sc":
|
||||
entry = data.id;
|
||||
break;
|
||||
case "li":
|
||||
entry = "http://livestream.com/"+data.id;
|
||||
break;
|
||||
case "tw":
|
||||
entry = "http://twitch.tv/"+data.id;
|
||||
break;
|
||||
case "rt":
|
||||
case "jw":
|
||||
entry = data.id;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
function refresh() {
|
||||
$.getJSON(WEB_URL+"/api/allchannels/public?callback=?",
|
||||
function(data) {
|
||||
|
@ -147,15 +117,7 @@
|
|||
.appendTo(name);
|
||||
$("<td/>").text(d.usercount || 0).appendTo(tr);
|
||||
var title = $("<td/>").appendTo(tr);
|
||||
if(d.media.id) {
|
||||
$("<a/>").appendTo(title)
|
||||
.text(d.media.title)
|
||||
.attr("href", idToURL(d.media))
|
||||
.attr("target", "_blank");
|
||||
}
|
||||
else {
|
||||
title.text("-");
|
||||
}
|
||||
title.text(d.mediatitle);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue