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.pagetitle = channel.opts.pagetitle;
|
||||||
data.media = channel.playlist.current ?
|
data.mediatitle = channel.playlist.current ?
|
||||||
channel.playlist.current.media.pack() :
|
channel.playlist.current.media.title :
|
||||||
{};
|
"-";
|
||||||
data.usercount = channel.users.length;
|
data.usercount = channel.users.length;
|
||||||
data.voteskip_eligible = channel.calcVoteskipMax();
|
data.voteskip_eligible = channel.calcVoteskipMax();
|
||||||
data.users = [];
|
data.users = [];
|
||||||
for(var i in channel.users)
|
for(var i in channel.users) {
|
||||||
if(channel.users[i].name !== "")
|
if(channel.users[i].name !== "") {
|
||||||
data.users.push(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 = [];
|
data.chat = [];
|
||||||
for(var i in channel.chatbuffer)
|
for(var i in channel.chatbuffer)
|
||||||
|
@ -96,7 +109,7 @@ module.exports = function (Server) {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan !== null) {
|
if (chan !== null) {
|
||||||
chan.getRank(uname, function (err, rank) {
|
chan.getRank(uname, function (err, rank) {
|
||||||
if (err || rank < 2) {
|
if (err || rank < 2) {
|
||||||
|
|
|
@ -94,36 +94,6 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
setInterval(refresh, 10000);
|
setInterval(refresh, 10000);
|
||||||
refresh();
|
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() {
|
function refresh() {
|
||||||
$.getJSON(WEB_URL+"/api/allchannels/public?callback=?",
|
$.getJSON(WEB_URL+"/api/allchannels/public?callback=?",
|
||||||
function(data) {
|
function(data) {
|
||||||
|
@ -147,15 +117,7 @@
|
||||||
.appendTo(name);
|
.appendTo(name);
|
||||||
$("<td/>").text(d.usercount || 0).appendTo(tr);
|
$("<td/>").text(d.usercount || 0).appendTo(tr);
|
||||||
var title = $("<td/>").appendTo(tr);
|
var title = $("<td/>").appendTo(tr);
|
||||||
if(d.media.id) {
|
title.text(d.mediatitle);
|
||||||
$("<a/>").appendTo(title)
|
|
||||||
.text(d.media.title)
|
|
||||||
.attr("href", idToURL(d.media))
|
|
||||||
.attr("target", "_blank");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
title.text("-");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue