Modify /api/channels and /api/allchannels not to include videourl

This commit is contained in:
calzoneman 2013-12-13 00:35:15 -06:00
parent dd5c0e5b82
commit 46baa5532f
2 changed files with 21 additions and 46 deletions

View File

@ -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) {

View File

@ -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);
}
});
}