Compare commits
35 commits
postgreSQL
...
master
Author | SHA1 | Date | |
---|---|---|---|
7ab1202617 | |||
0abc71c8e9 | |||
2558a87e96 | |||
f7932166b2 | |||
ed12dd76fd | |||
22a6a4617c | |||
97fd06f7a6 | |||
00dd092fef | |||
73235e5fbb | |||
1efcca6be9 | |||
c6d214b981 | |||
090ae06b69 | |||
d14ee4f0db | |||
eaf01f4d8a | |||
6d6bf69828 | |||
4131b227e9 | |||
234b15831e | |||
8b383e0bdb | |||
2c66de146e | |||
38f144f5f9 | |||
22e1253422 | |||
3460b0544c | |||
b243f8bc7e | |||
afe14c2128 | |||
c136d566fe | |||
d7011029b8 | |||
7ecbddfca1 | |||
df16458f98 | |||
10de5df3c6 | |||
31368cfe7f | |||
c0431eb3e7 | |||
57fe5eea4d | |||
46baa5532f | |||
dd5c0e5b82 | |||
5610b6f0b4 |
30
lib/api.js
30
lib/api.js
|
@ -22,6 +22,9 @@ module.exports = function (Server) {
|
|||
if((Server.cfg["trust-x-forward"] || raw === "127.0.0.1") && forward) {
|
||||
var ip = forward.split(",")[0];
|
||||
Logger.syslog.log("REVPROXY " + raw + " => " + ip);
|
||||
if (ip === undefined) {
|
||||
Logger.errlog.log("WTF: ip is undefined from getIP, forward=" + forward);
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
return raw;
|
||||
|
@ -34,15 +37,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 +112,7 @@ module.exports = function (Server) {
|
|||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (chan !== null) {
|
||||
chan.getRank(uname, function (err, rank) {
|
||||
if (err || rank < 2) {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2013 Calvin Montgomery
|
||||
|
@ -819,6 +818,10 @@ Channel.prototype.addPendingJoin = function (user, password) {
|
|||
|
||||
Channel.prototype.handlePendingJoins = function () {
|
||||
var self = this;
|
||||
if (self.dead) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.pendingJoins.forEach(function (u) {
|
||||
self.userJoin(u.user, u.pw);
|
||||
});
|
||||
|
@ -872,15 +875,27 @@ Channel.prototype.userJoin = function(user, password) {
|
|||
|
||||
// Prevent duplicate login
|
||||
if(user.name != "") {
|
||||
for(var i = 0; i < this.users.length; i++) {
|
||||
if(this.users[i].name.toLowerCase() == user.name.toLowerCase()) {
|
||||
if (this.users[i] == user) {
|
||||
if (this.users === undefined) {
|
||||
Logger.errlog.log("Wat: this.users is undefined");
|
||||
Logger.errlog.log("chan: " + this.name + ", dead: " + this.dead);
|
||||
Logger.errlog.log("keys: " + Object.keys(this).join(","));
|
||||
return;
|
||||
}
|
||||
this.users.forEach(function (u) {
|
||||
if(u.name.toLowerCase() == user.name.toLowerCase()) {
|
||||
if (u == user) {
|
||||
Logger.errlog.log("Wat: userJoin() called on user "+
|
||||
"already in the channel");
|
||||
break;
|
||||
return;
|
||||
}
|
||||
this.kick(this.users[i], "Duplicate login");
|
||||
self.kick(u, "Duplicate login");
|
||||
}
|
||||
});
|
||||
|
||||
// It's possible that by kicking the user above, the channel usercount became
|
||||
// 0 and it unloaded from memory
|
||||
if (this.dead) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1505,6 +1520,9 @@ Channel.prototype.addMedia = function(data, user) {
|
|||
m.pos = data.pos;
|
||||
m.queueby = data.queueby;
|
||||
m.temp = data.temp;
|
||||
if (data.type === "cu" && data.title) {
|
||||
m.title = data.title;
|
||||
}
|
||||
var res = self.playlist.addMedia(m);
|
||||
if (res.error) {
|
||||
user.socket.emit("queueFail", {
|
||||
|
@ -2170,7 +2188,7 @@ Channel.prototype.tryUpdateOptions = function(user, data) {
|
|||
|
||||
if ("allow_voteskip" in data) {
|
||||
var vs = Boolean(data.allow_voteskip);
|
||||
this.opts.voteskip = vs;
|
||||
this.opts.allow_voteskip = vs;
|
||||
}
|
||||
|
||||
if ("voteskip_ratio" in data) {
|
||||
|
|
|
@ -45,6 +45,7 @@ var defaults = {
|
|||
"ytv3apikey" : "",
|
||||
"enable-ytv3" : false,
|
||||
"ytv2devkey" : "",
|
||||
"vimeo-workaround" : false,
|
||||
"stat-interval" : 3600000,
|
||||
"stat-max-age" : 86400000,
|
||||
"alias-purge-interval" : 3600000,
|
||||
|
|
111
lib/get-info.js
111
lib/get-info.js
|
@ -23,7 +23,9 @@ var urlRetrieve = function (transport, options, callback) {
|
|||
// This should cut down on needing to restart the server
|
||||
var d = domain.create();
|
||||
d.on("error", function (err) {
|
||||
Logger.errlog.log(err.trace());
|
||||
if (typeof err.trace === "function") {
|
||||
Logger.errlog.log(err.trace());
|
||||
}
|
||||
Logger.errlog.log("urlRetrieve failed: " + err);
|
||||
Logger.errlog.log("Request was: " + options.host + options.path);
|
||||
callback(503, err);
|
||||
|
@ -159,7 +161,7 @@ var Getters = {
|
|||
var params = [
|
||||
"part=" + encodeURIComponent("id,snippet,contentDetails"),
|
||||
"id=" + id,
|
||||
"key=" + sv.cfg["ytapikey"]
|
||||
"key=" + sv.cfg["ytv3apikey"]
|
||||
].join("&");
|
||||
var options = {
|
||||
host: "www.googleapis.com",
|
||||
|
@ -355,7 +357,7 @@ var Getters = {
|
|||
callback("API failure", null);
|
||||
return;
|
||||
} else if(status !== 200) {
|
||||
callback("YTv2 HTTP " + status, null);
|
||||
callback("Vimeo HTTP " + status, null);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -646,6 +648,9 @@ var Getters = {
|
|||
var data = m[1];
|
||||
data = data.substring(data.indexOf(",") + 1);
|
||||
data = data.replace(/'(.*?)'([:\,\}\]])/g, "\"$1\"$2");
|
||||
data = data.replace(/\\x(\d*)/g, function (sub, s1) {
|
||||
return String.fromCharCode(parseInt(s1, 16));
|
||||
});
|
||||
data = "[" + data + "]";
|
||||
var js = JSON.parse(data);
|
||||
var title = js[0].title;
|
||||
|
@ -700,6 +705,103 @@ var Getters = {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A function name like this deserves an explanation.
|
||||
*
|
||||
* Vimeo blocked my domain from using their embed API, citing "volume of abuse" as the
|
||||
* reason. After attempts to reach a compromise, Vimeo refused to unblock my domain.
|
||||
*
|
||||
* This function downloads the HTML for the embedded player and extracts direct links
|
||||
* to the h264 encoded MP4 video files (with a session hash required for downloading it).
|
||||
*
|
||||
* This rivals the Google Drive playback functionality as quite possibly the hackiest code
|
||||
* in CyTube. Thanks Vimeo, and may you never see a dime in advertising revenue from a
|
||||
* CyTube client again.
|
||||
*/
|
||||
function VimeoIsADoucheCopter(id, cb) {
|
||||
var failcount = 0;
|
||||
|
||||
var inner = function () {
|
||||
var options = {
|
||||
host: "player.vimeo.com",
|
||||
path: "/video/" + id,
|
||||
headers: {
|
||||
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0",
|
||||
"Referrer": "player.vimeo.com"
|
||||
}
|
||||
};
|
||||
|
||||
var parse = function (data) {
|
||||
var i = data.indexOf("a={");
|
||||
if (i === -1) i = data.indexOf("b={");
|
||||
if (i === -1) i = data.indexOf("c={");
|
||||
if (i === -1) {
|
||||
Logger.errlog.log("Bad embed response for http://vimeo.com/" + id);
|
||||
setImmediate(function () {
|
||||
cb({});
|
||||
});
|
||||
return;
|
||||
}
|
||||
var j = data.indexOf("};", i);
|
||||
var json = data.substring(i+2, j+1);
|
||||
try {
|
||||
json = JSON.parse(json);
|
||||
var codec = json.request.files.codecs[0];
|
||||
var files = json.request.files[codec];
|
||||
setImmediate(function () {
|
||||
cb(files);
|
||||
});
|
||||
} catch (e) {
|
||||
// Not sure why the response sometimes differs. Trying to weed out
|
||||
// search engines perhaps?
|
||||
// Maybe adding the User-Agent above will fix this, I dunno
|
||||
if (data.indexOf("crawler") !== -1) {
|
||||
Logger.syslog.log("Warning: VimeoIsADoucheCopter got crawler response");
|
||||
failcount++;
|
||||
if (failcount > 4) {
|
||||
Logger.errlog.log("VimeoIsADoucheCopter got bad response 5 times!"+
|
||||
" Giving up.");
|
||||
setImmediate(function () {
|
||||
cb({});
|
||||
});
|
||||
} else {
|
||||
setImmediate(function () {
|
||||
inner();
|
||||
});
|
||||
}
|
||||
return;
|
||||
} else if (data.indexOf("This video does not exist.") !== -1) {
|
||||
cb({});
|
||||
return;
|
||||
} else if (data.indexOf("Because of its privacy settings, this video cannot be played here.") !== -1) {
|
||||
cb({});
|
||||
}
|
||||
Logger.errlog.log("Vimeo workaround error: ");
|
||||
Logger.errlog.log(e);
|
||||
Logger.errlog.log("http://vimeo.com/" + id);
|
||||
setImmediate(function () {
|
||||
cb({});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
http.get(options, function (res) {
|
||||
res.setEncoding("utf-8");
|
||||
var buffer = "";
|
||||
|
||||
res.on("data", function (data) {
|
||||
buffer += data;
|
||||
});
|
||||
|
||||
res.on("end", function () {
|
||||
parse(buffer);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
inner();
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
Getters: Getters,
|
||||
getMedia: function (id, type, callback) {
|
||||
|
@ -708,5 +810,6 @@ module.exports = {
|
|||
} else {
|
||||
callback("Unknown media type '" + type + "'", null);
|
||||
}
|
||||
}
|
||||
},
|
||||
VimeoIsADoucheCopter: VimeoIsADoucheCopter
|
||||
};
|
||||
|
|
16
lib/media.js
16
lib/media.js
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2013 Calvin Montgomery
|
||||
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
@ -40,7 +40,7 @@ Media.prototype.pack = function() {
|
|||
duration: this.duration,
|
||||
type: this.type,
|
||||
};
|
||||
|
||||
|
||||
if (this.object) {
|
||||
x.object = this.object;
|
||||
}
|
||||
|
@ -68,6 +68,9 @@ Media.prototype.fullupdate = function() {
|
|||
if (this.params) {
|
||||
x.params = this.params;
|
||||
}
|
||||
if (this.direct) {
|
||||
x.direct = this.direct;
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
|
@ -79,4 +82,9 @@ Media.prototype.timeupdate = function() {
|
|||
};
|
||||
}
|
||||
|
||||
Media.prototype.reset = function () {
|
||||
delete this.currentTime;
|
||||
delete this.direct;
|
||||
};
|
||||
|
||||
exports.Media = Media;
|
||||
|
|
|
@ -13,6 +13,8 @@ ULList = require("./ullist").ULList;
|
|||
var AsyncQueue = require("./asyncqueue");
|
||||
var Media = require("./media").Media;
|
||||
var AllPlaylists = {};
|
||||
var Server = require("./server");
|
||||
var VimeoIsADoucheCopter = require("./get-info").VimeoIsADoucheCopter;
|
||||
|
||||
function PlaylistItem(media, uid) {
|
||||
this.media = media;
|
||||
|
@ -212,6 +214,7 @@ Playlist.prototype.addMedia = function (data) {
|
|||
var m = new Media(data.id, data.title, data.seconds, data.type);
|
||||
m.object = data.object;
|
||||
m.params = data.params;
|
||||
m.direct = data.direct;
|
||||
var item = this.makeItem(m);
|
||||
item.queueby = data.queueby;
|
||||
item.temp = data.temp;
|
||||
|
@ -257,6 +260,7 @@ Playlist.prototype.next = function() {
|
|||
return;
|
||||
|
||||
var it = this.current;
|
||||
it.media.reset();
|
||||
|
||||
if (it.temp) {
|
||||
if (this.remove(it.uid)) {
|
||||
|
@ -290,6 +294,7 @@ Playlist.prototype.jump = function(uid) {
|
|||
return false;
|
||||
|
||||
var it = this.current;
|
||||
it.media.reset();
|
||||
|
||||
this.current = jmp;
|
||||
|
||||
|
@ -338,29 +343,43 @@ Playlist.prototype.lead = function(lead) {
|
|||
}
|
||||
|
||||
Playlist.prototype.startPlayback = function (time) {
|
||||
if(!this.current || !this.current.media)
|
||||
var self = this;
|
||||
if (!self.current || !self.current.media) {
|
||||
return false;
|
||||
if (!this.leading) {
|
||||
this.current.media.paused = false;
|
||||
this.current.media.currentTime = time || 0;
|
||||
this.on("changeMedia")(this.current.media);
|
||||
}
|
||||
|
||||
if (self.current.media.type === "vi" &&
|
||||
!self.current.media.direct &&
|
||||
Server.getServer().cfg["vimeo-workaround"]) {
|
||||
VimeoIsADoucheCopter(self.current.media.id, function (direct) {
|
||||
if (self.current != null && self.current.media != null) {
|
||||
self.current.media.direct = direct;
|
||||
self.startPlayback(time);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!self.leading) {
|
||||
self.current.media.paused = false;
|
||||
self.current.media.currentTime = time || 0;
|
||||
self.on("changeMedia")(self.current.media);
|
||||
return;
|
||||
}
|
||||
|
||||
time = time || -3;
|
||||
this.current.media.paused = time < 0;
|
||||
this.current.media.currentTime = time;
|
||||
self.current.media.paused = time < 0;
|
||||
self.current.media.currentTime = time;
|
||||
|
||||
var pl = this;
|
||||
if(this._leadInterval) {
|
||||
clearInterval(this._leadInterval);
|
||||
this._leadInterval = false;
|
||||
if(self._leadInterval) {
|
||||
clearInterval(self._leadInterval);
|
||||
self._leadInterval = false;
|
||||
}
|
||||
this.on("changeMedia")(this.current.media);
|
||||
if(!isLive(this.current.media.type)) {
|
||||
this._lastUpdate = Date.now();
|
||||
this._leadInterval = setInterval(function() {
|
||||
pl._leadLoop();
|
||||
self.on("changeMedia")(self.current.media);
|
||||
if(!isLive(self.current.media.type)) {
|
||||
self._lastUpdate = Date.now();
|
||||
self._leadInterval = setInterval(function() {
|
||||
self._leadLoop();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ The above copyright notice and this permission notice shall be included in all c
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
const VERSION = "2.4.5";
|
||||
const VERSION = "2.4.6";
|
||||
var singleton = null;
|
||||
|
||||
module.exports = {
|
||||
|
@ -121,7 +121,7 @@ var Server = function (cfg) {
|
|||
"path-traversal",
|
||||
req.url);
|
||||
} else if (e.status >= 500) {
|
||||
Logger.errlog.log(err);
|
||||
Logger.errlog.log(e);
|
||||
}
|
||||
res.send(e.status);
|
||||
} else {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"author": "Calvin Montgomery",
|
||||
"name": "CyTube",
|
||||
"description": "Online media synchronizer and chat",
|
||||
"version": "2.4.5",
|
||||
"version": "2.4.6",
|
||||
"repository": {
|
||||
"url": "http://github.com/calzoneman/sync"
|
||||
},
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/*
|
||||
return null;
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2013 Calvin Montgomery
|
||||
|
||||
|
@ -1010,6 +1009,15 @@ Callbacks = {
|
|||
},
|
||||
|
||||
changeMedia: function(data) {
|
||||
if (PLAYER) {
|
||||
PLAYER.getVolume(function (v) {
|
||||
if (typeof v === "number") {
|
||||
VOLUME = v;
|
||||
setOpt("volume", VOLUME);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(CHANNEL.opts.allow_voteskip)
|
||||
$("#voteskip").attr("disabled", false);
|
||||
|
||||
|
@ -1026,7 +1034,32 @@ Callbacks = {
|
|||
$("#ytapiplayer_wrapper").remove();
|
||||
}
|
||||
|
||||
if(data.type != PLAYER.type) {
|
||||
/*
|
||||
VIMEO SIMULATOR 2014
|
||||
|
||||
Vimeo decided to block my domain. After repeated emails, they refused to
|
||||
unblock it. Rather than give in to their demands, there is a serverside
|
||||
option which extracts direct links to the h264 encoded MP4 video files.
|
||||
These files can be loaded in a custom player to allow Vimeo playback without
|
||||
triggering their dumb API domain block.
|
||||
|
||||
It's a little bit hacky, but my only other option is to keep buying new
|
||||
domains every time one gets blocked. No thanks to Vimeo, who were of no help
|
||||
and unwilling to compromise on the issue.
|
||||
*/
|
||||
if (NO_VIMEO && data.type === "vi" && data.direct && data.direct.sd) {
|
||||
// For browsers that don't support native h264 playback
|
||||
if (USEROPTS.no_h264) {
|
||||
data.type = "jw";
|
||||
} else {
|
||||
data.type = "rv";
|
||||
}
|
||||
// Right now only plays standard definition.
|
||||
// In the future, I may add a quality selector for mobile/standard/HD
|
||||
data.url = data.direct.sd.url;
|
||||
}
|
||||
|
||||
if (data.type != PLAYER.type) {
|
||||
loadMediaPlayer(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2013 Calvin Montgomery
|
||||
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
@ -97,6 +97,15 @@ function getOrDefault(k, def) {
|
|||
return v;
|
||||
}
|
||||
|
||||
function default_noh264() {
|
||||
var ua = navigator.userAgent + "";
|
||||
if (ua.match(/Firefox\/29.0|Chrome|Chromium/)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
var USEROPTS = {
|
||||
theme : getOrDefault("theme", "default"),
|
||||
css : getOrDefault("css", ""),
|
||||
|
@ -120,10 +129,15 @@ var USEROPTS = {
|
|||
sort_afk : getOrDefault("sort_afk", false),
|
||||
default_quality : getOrDefault("default_quality", "#quality_auto"),
|
||||
boop : getOrDefault("boop", false),
|
||||
secure_connection : getOrDefault("secure_connection", false)
|
||||
secure_connection : getOrDefault("secure_connection", false),
|
||||
no_h264 : getOrDefault("no_h264", default_noh264())
|
||||
};
|
||||
|
||||
var VOLUME = parseFloat(getOrDefault("volume", 1));
|
||||
|
||||
var NO_WEBSOCKETS = USEROPTS.altsocket;
|
||||
// Change this to include your own domain if you enable Vimeo fallback
|
||||
var NO_VIMEO = Boolean(location.host.match("cytu.be"));
|
||||
|
||||
var Rank = {
|
||||
Guest: 0,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*}
|
||||
The MIT License (MIT)
|
||||
Copyright (c) 2013 Calvin Montgomery
|
||||
|
||||
|
@ -43,6 +43,7 @@ var YouTubePlayer = function (data) {
|
|||
},
|
||||
events: {
|
||||
onReady: function () {
|
||||
PLAYER.setVolume(VOLUME);
|
||||
},
|
||||
onStateChange: function (ev) {
|
||||
if(PLAYER.paused && ev.data != YT.PlayerState.PAUSED ||
|
||||
|
@ -105,6 +106,27 @@ var YouTubePlayer = function (data) {
|
|||
if(self.player && self.player.seekTo)
|
||||
self.player.seekTo(time, true);
|
||||
};
|
||||
|
||||
self.getVolume = function (cb) {
|
||||
if (!self.player || !self.player.getVolume || !self.player.isMuted) {
|
||||
return;
|
||||
}
|
||||
|
||||
// YouTube's API is strange in the sense that getVolume() returns
|
||||
// the regular (unmuted) volume even if it is muted...
|
||||
// YouTube's volume is 0..100, normalize it to 0..1
|
||||
var vol = self.player.isMuted() ? 0 : (self.player.getVolume() / 100);
|
||||
cb(vol);
|
||||
};
|
||||
|
||||
self.setVolume = function (vol) {
|
||||
if (self.player && self.player.setVolume) {
|
||||
if (vol > 0) {
|
||||
self.player.unMute();
|
||||
}
|
||||
self.player.setVolume(vol * 100);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var VimeoPlayer = function (data) {
|
||||
|
@ -147,11 +169,11 @@ var VimeoPlayer = function (data) {
|
|||
if(CLIENT.leader)
|
||||
sendVideoUpdate();
|
||||
});
|
||||
|
||||
self.setVolume(VOLUME);
|
||||
}.bind(self));
|
||||
};
|
||||
|
||||
self.init();
|
||||
|
||||
self.load = function (data) {
|
||||
self.videoId = data.id;
|
||||
self.videoLength = data.seconds;
|
||||
|
@ -185,6 +207,18 @@ var VimeoPlayer = function (data) {
|
|||
if(self.player && self.player.api)
|
||||
self.player.api("seekTo", time);
|
||||
};
|
||||
|
||||
self.getVolume = function (cb) {
|
||||
if (self.player && self.player.api) {
|
||||
self.player.api("getVolume", cb);
|
||||
}
|
||||
};
|
||||
|
||||
self.setVolume = function (vol) {
|
||||
self.player.api("setVolume", vol);
|
||||
};
|
||||
|
||||
self.init();
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -244,12 +278,12 @@ var VimeoFlashPlayer = function (data) {
|
|||
if(CLIENT.leader)
|
||||
sendVideoUpdate();
|
||||
});
|
||||
|
||||
self.setVolume(VOLUME);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
self.init();
|
||||
|
||||
self.load = function (data) {
|
||||
self.videoId = data.id;
|
||||
self.videoLength = data.seconds;
|
||||
|
@ -281,6 +315,18 @@ var VimeoFlashPlayer = function (data) {
|
|||
if(self.player.api_seekTo);
|
||||
self.player.api_seekTo(time);
|
||||
};
|
||||
|
||||
self.getVolume = function (cb) {
|
||||
if (self.player && self.player.api_getVolume) {
|
||||
cb(self.player.api_getVolume());
|
||||
}
|
||||
};
|
||||
|
||||
self.setVolume = function (vol) {
|
||||
self.player.api_setVolume(vol);
|
||||
};
|
||||
|
||||
self.init();
|
||||
};
|
||||
|
||||
var DailymotionPlayer = function (data) {
|
||||
|
@ -314,14 +360,17 @@ var DailymotionPlayer = function (data) {
|
|||
if(CLIENT.leader)
|
||||
sendVideoUpdate();
|
||||
});
|
||||
|
||||
self.setVolume(VOLUME);
|
||||
});
|
||||
});
|
||||
|
||||
self.load = function (data) {
|
||||
self.videoId = data.id;
|
||||
self.videoLength = data.seconds;
|
||||
if(self.player && self.player.api)
|
||||
if (self.player && self.player.api) {
|
||||
self.player.api("load", data.id);
|
||||
}
|
||||
};
|
||||
|
||||
self.pause = function () {
|
||||
|
@ -347,10 +396,25 @@ var DailymotionPlayer = function (data) {
|
|||
if(self.player && self.player.api)
|
||||
self.player.api("seek", seconds);
|
||||
};
|
||||
|
||||
self.getVolume = function (cb) {
|
||||
if (self.player) {
|
||||
cb(self.player.volume);
|
||||
}
|
||||
};
|
||||
|
||||
self.setVolume = function (vol) {
|
||||
if (self.player && self.player.api) {
|
||||
self.player.api("volume", vol);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var SoundcloudPlayer = function (data) {
|
||||
var self = this;
|
||||
// The getVolume function on their widget throws TypeErrors
|
||||
// Go figure
|
||||
self.soundcloudIsSeriouslyFuckingBroken = VOLUME;
|
||||
self.videoId = data.id;
|
||||
self.videoLength = data.seconds;
|
||||
waitUntilDefined(window, "SC", function () {
|
||||
|
@ -368,9 +432,10 @@ var SoundcloudPlayer = function (data) {
|
|||
|
||||
volslider.slider({
|
||||
range: "min",
|
||||
value: 100,
|
||||
value: VOLUME * 100,
|
||||
stop: function (event, ui) {
|
||||
self.player.setVolume(ui.value);
|
||||
self.soundcloudIsSeriouslyFuckingBroken = ui.value / 100;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -385,25 +450,38 @@ var SoundcloudPlayer = function (data) {
|
|||
sendVideoUpdate();
|
||||
});
|
||||
|
||||
self.player.bind(SC.Widget.Events.FINISH, function () {
|
||||
if(CLIENT.leader) {
|
||||
socket.emit("playNext");
|
||||
}
|
||||
});
|
||||
|
||||
self.player.bind(SC.Widget.Events.PLAY, function () {
|
||||
PLAYER.paused = false;
|
||||
if(CLIENT.leader)
|
||||
sendVideoUpdate();
|
||||
});
|
||||
|
||||
self.player.bind(SC.Widget.Events.FINISH, function () {
|
||||
if(CLIENT.leader) {
|
||||
socket.emit("playNext");
|
||||
}
|
||||
});
|
||||
// THAT'S RIGHT, YOU CAN'T SET THE VOLUME BEFORE IT STARTS PLAYING
|
||||
var soundcloudNeedsToFuckingFixTheirPlayer = function () {
|
||||
self.setVolume(VOLUME);
|
||||
self.player.unbind(SC.Widget.Events.PLAY_PROGRESS);
|
||||
};
|
||||
self.player.bind(SC.Widget.Events.PLAY_PROGRESS, soundcloudNeedsToFuckingFixTheirPlayer);
|
||||
}.bind(self));
|
||||
});
|
||||
|
||||
self.load = function (data) {
|
||||
self.videoId = data.id;
|
||||
self.videoLength = data.seconds;
|
||||
if(self.player && self.player.load)
|
||||
if(self.player && self.player.load) {
|
||||
self.player.load(data.id, { auto_play: true });
|
||||
var soundcloudNeedsToFuckingFixTheirPlayer = function () {
|
||||
self.setVolume(VOLUME);
|
||||
self.player.unbind(SC.Widget.Events.PLAY_PROGRESS);
|
||||
};
|
||||
self.player.bind(SC.Widget.Events.PLAY_PROGRESS, soundcloudNeedsToFuckingFixTheirPlayer);
|
||||
}
|
||||
};
|
||||
|
||||
self.pause = function () {
|
||||
|
@ -435,6 +513,14 @@ var SoundcloudPlayer = function (data) {
|
|||
if(self.player && self.player.seekTo)
|
||||
self.player.seekTo(seconds * 1000);
|
||||
};
|
||||
|
||||
self.getVolume = function (cb) {
|
||||
cb(self.soundcloudIsSeriouslyFuckingBroken);
|
||||
};
|
||||
|
||||
self.setVolume = function (vol) {
|
||||
self.player.setVolume(vol * 100);
|
||||
};
|
||||
};
|
||||
|
||||
var LivestreamPlayer = function (data) {
|
||||
|
@ -457,8 +543,6 @@ var LivestreamPlayer = function (data) {
|
|||
);
|
||||
};
|
||||
|
||||
self.init();
|
||||
|
||||
self.load = function(data) {
|
||||
self.videoId = data.id;
|
||||
self.videoLength = data.seconds;
|
||||
|
@ -474,6 +558,12 @@ var LivestreamPlayer = function (data) {
|
|||
self.getTime = function () { };
|
||||
|
||||
self.seek = function () { };
|
||||
|
||||
self.getVolume = function () { };
|
||||
|
||||
self.setVolume = function () { };
|
||||
|
||||
self.init();
|
||||
};
|
||||
|
||||
var TwitchTVPlayer = function (data) {
|
||||
|
@ -489,22 +579,18 @@ var TwitchTVPlayer = function (data) {
|
|||
allowNetworking: "all",
|
||||
movie: "http://www.twitch.tv/widgets/live_embed_player.swf",
|
||||
id: "live_embed_player_flash",
|
||||
flashvars: "hostname=www.twitch.tv&channel="+self.videoId+"&auto_play=true&start_volume=100"
|
||||
flashvars: "hostname=www.twitch.tv&channel="+self.videoId+"&auto_play=true&start_volume=" + VOLUME
|
||||
};
|
||||
swfobject.embedSWF(url,
|
||||
"ytapiplayer",
|
||||
VWIDTH, VHEIGHT,
|
||||
"8",
|
||||
"8",
|
||||
null, null,
|
||||
params,
|
||||
{}
|
||||
);
|
||||
};
|
||||
|
||||
waitUntilDefined(window, "swfobject", function () {
|
||||
self.init();
|
||||
});
|
||||
|
||||
self.load = function (data) {
|
||||
self.videoId = data.id;
|
||||
self.videoLength = data.seconds;
|
||||
|
@ -520,6 +606,14 @@ var TwitchTVPlayer = function (data) {
|
|||
self.getTime = function () { };
|
||||
|
||||
self.seek = function () { };
|
||||
|
||||
self.getVolume = function () { };
|
||||
|
||||
self.setVolume = function () { };
|
||||
|
||||
waitUntilDefined(window, "swfobject", function () {
|
||||
self.init();
|
||||
});
|
||||
};
|
||||
|
||||
var JustinTVPlayer = function (data) {
|
||||
|
@ -536,22 +630,18 @@ var JustinTVPlayer = function (data) {
|
|||
allowNetworking: "all",
|
||||
movie: "http://www.justin.tv/widgets/live_embed_player.swf",
|
||||
id: "live_embed_player_flash",
|
||||
flashvars: "hostname=www.justin.tv&channel="+self.videoId+"&auto_play=true&start_volume=100"
|
||||
flashvars: "hostname=www.justin.tv&channel="+self.videoId+"&auto_play=true&start_volume=" + VOLUME
|
||||
};
|
||||
swfobject.embedSWF(url,
|
||||
"ytapiplayer",
|
||||
VWIDTH, VHEIGHT,
|
||||
"8",
|
||||
"8",
|
||||
null, null,
|
||||
params,
|
||||
{}
|
||||
);
|
||||
};
|
||||
|
||||
waitUntilDefined(window, "swfobject", function () {
|
||||
self.init();
|
||||
});
|
||||
|
||||
self.load = function (data) {
|
||||
self.videoId = data.id;
|
||||
self.videoLength = data.seconds;
|
||||
|
@ -567,11 +657,26 @@ var JustinTVPlayer = function (data) {
|
|||
self.getTime = function () { };
|
||||
|
||||
self.seek = function () { };
|
||||
|
||||
self.getVolume = function () { };
|
||||
|
||||
self.setVolume = function () { };
|
||||
|
||||
waitUntilDefined(window, "swfobject", function () {
|
||||
self.init();
|
||||
});
|
||||
};
|
||||
|
||||
function rtmpEventHandler(id, ev, data) {
|
||||
if (ev === "volumechange") {
|
||||
PLAYER.volume = (data.muted ? 0 : data.volume);
|
||||
}
|
||||
}
|
||||
|
||||
var RTMPPlayer = function (data) {
|
||||
removeOld();
|
||||
var self = this;
|
||||
var self =this;
|
||||
self.volume = VOLUME;
|
||||
self.videoId = data.id;
|
||||
self.videoLength = data.seconds;
|
||||
self.init = function () {
|
||||
|
@ -584,7 +689,7 @@ var RTMPPlayer = function (data) {
|
|||
allowNetworking: "all",
|
||||
wMode: "direct",
|
||||
movie: prto+"//fpdownload.adobe.com/strobe/FlashMediaPlayback_101.swf",
|
||||
flashvars: "src="+src+"&streamType=live&autoPlay=true"
|
||||
flashvars: "src="+src+"&streamType=live&javascriptCallbackFunction=rtmpEventHandler&autoPlay=true&volume=" + VOLUME
|
||||
};
|
||||
swfobject.embedSWF(url,
|
||||
"ytapiplayer",
|
||||
|
@ -596,10 +701,6 @@ var RTMPPlayer = function (data) {
|
|||
);
|
||||
};
|
||||
|
||||
waitUntilDefined(window, "swfobject", function () {
|
||||
self.init();
|
||||
});
|
||||
|
||||
self.load = function (data) {
|
||||
self.videoId = data.id;
|
||||
self.videoLength = data.seconds;
|
||||
|
@ -615,22 +716,36 @@ var RTMPPlayer = function (data) {
|
|||
self.getTime = function () { };
|
||||
|
||||
self.seek = function () { };
|
||||
|
||||
self.getVolume = function (cb) {
|
||||
cb(self.volume);
|
||||
};
|
||||
|
||||
self.setVolume = function () { };
|
||||
|
||||
waitUntilDefined(window, "swfobject", function () {
|
||||
self.init();
|
||||
});
|
||||
};
|
||||
|
||||
var JWPlayer = function (data) {
|
||||
var self = this;
|
||||
self.videoId = data.id;
|
||||
if (data.url) {
|
||||
self.videoURL = data.url;
|
||||
} else {
|
||||
self.videoURL = data.id;
|
||||
}
|
||||
self.videoLength = data.seconds;
|
||||
self.init = function () {
|
||||
removeOld();
|
||||
|
||||
jwplayer("ytapiplayer").setup({
|
||||
file: self.videoId,
|
||||
file: self.videoURL,
|
||||
width: VWIDTH,
|
||||
height: VHEIGHT,
|
||||
autostart: true
|
||||
});
|
||||
|
||||
jwplayer().onPlay(function() {
|
||||
self.paused = false;
|
||||
if(CLIENT.leader)
|
||||
|
@ -644,10 +759,9 @@ var JWPlayer = function (data) {
|
|||
jwplayer().onComplete(function() {
|
||||
socket.emit("playNext");
|
||||
});
|
||||
self.setVolume(VOLUME);
|
||||
};
|
||||
|
||||
waitUntilDefined(window, "jwplayer", function () { self.init(); });
|
||||
|
||||
self.load = function (data) {
|
||||
self.videoId = data.id;
|
||||
self.videoLength = data.seconds;
|
||||
|
@ -680,6 +794,16 @@ var JWPlayer = function (data) {
|
|||
if(jwplayer)
|
||||
jwplayer().seek(time);
|
||||
};
|
||||
|
||||
self.getVolume = function (cb) {
|
||||
cb(jwplayer().getVolume() / 100);
|
||||
};
|
||||
|
||||
self.setVolume = function (vol) {
|
||||
jwplayer().setVolume(vol * 100);
|
||||
};
|
||||
|
||||
waitUntilDefined(window, "jwplayer", function () { self.init(); });
|
||||
};
|
||||
|
||||
var UstreamPlayer = function (data) {
|
||||
|
@ -697,8 +821,6 @@ var UstreamPlayer = function (data) {
|
|||
iframe.attr("scrolling", "no");
|
||||
iframe.css("border", "none");
|
||||
};
|
||||
|
||||
self.init();
|
||||
|
||||
self.load = function (data) {
|
||||
self.videoId = data.id;
|
||||
|
@ -715,6 +837,12 @@ var UstreamPlayer = function (data) {
|
|||
self.getTime = function () { };
|
||||
|
||||
self.seek = function () { };
|
||||
|
||||
self.getVolume = function () { };
|
||||
|
||||
self.setVolume = function () { };
|
||||
|
||||
self.init();
|
||||
};
|
||||
|
||||
var ImgurPlayer = function (data) {
|
||||
|
@ -731,8 +859,6 @@ var ImgurPlayer = function (data) {
|
|||
iframe.css("border", "none");
|
||||
};
|
||||
|
||||
self.init();
|
||||
|
||||
self.load = function (data) {
|
||||
self.videoId = data.id;
|
||||
self.videoLength = data.seconds;
|
||||
|
@ -748,6 +874,12 @@ var ImgurPlayer = function (data) {
|
|||
self.getTime = function () { };
|
||||
|
||||
self.seek = function () { };
|
||||
|
||||
self.getVolume = function () { };
|
||||
|
||||
self.setVolume = function () { };
|
||||
|
||||
self.init();
|
||||
};
|
||||
|
||||
var CustomPlayer = function (data) {
|
||||
|
@ -768,8 +900,6 @@ var CustomPlayer = function (data) {
|
|||
self.player.attr("height", VHEIGHT);
|
||||
};
|
||||
|
||||
self.init();
|
||||
|
||||
self.load = function (data) {
|
||||
self.videoId = data.id;
|
||||
self.videoLength = data.seconds;
|
||||
|
@ -785,6 +915,12 @@ var CustomPlayer = function (data) {
|
|||
self.getTime = function () { };
|
||||
|
||||
self.seek = function () { };
|
||||
|
||||
self.getVolume = function () { };
|
||||
|
||||
self.setVolume = function () { };
|
||||
|
||||
self.init();
|
||||
};
|
||||
|
||||
var GoogleDocsPlayer = function (data) {
|
||||
|
@ -802,10 +938,9 @@ var GoogleDocsPlayer = function (data) {
|
|||
$("<param/>", p).appendTo(self.player);
|
||||
});
|
||||
removeOld($(self.player));
|
||||
self.setVolume(VOLUME);
|
||||
};
|
||||
|
||||
self.init(data);
|
||||
|
||||
self.load = function (data) {
|
||||
self.init(data);
|
||||
};
|
||||
|
@ -838,13 +973,104 @@ var GoogleDocsPlayer = function (data) {
|
|||
if(self.player && self.player.seekTo)
|
||||
self.player.seekTo(time, true);
|
||||
};
|
||||
|
||||
self.getVolume = function (cb) {
|
||||
if (!self.player || !self.player.getVolume || !self.player.isMuted) {
|
||||
return;
|
||||
}
|
||||
|
||||
// YouTube's API is strange in the sense that getVolume() returns
|
||||
// the regular (unmuted) volume even if it is muted...
|
||||
// YouTube's volume is 0..100, normalize it to 0..1
|
||||
var vol = self.player.isMuted() ? 0 : (self.player.getVolume() / 100);
|
||||
cb(vol);
|
||||
};
|
||||
|
||||
self.setVolume = function (vol) {
|
||||
if (self.player && self.player.setVolume) {
|
||||
self.player.setVolume(vol * 100);
|
||||
}
|
||||
};
|
||||
|
||||
self.init(data);
|
||||
};
|
||||
|
||||
function RawVideoPlayer(data) {
|
||||
var self = this;
|
||||
self.init = function (data) {
|
||||
self.videoId = data.id;
|
||||
self.videoURL = data.url;
|
||||
var video = $("<video/>")
|
||||
.attr("src", self.videoURL)
|
||||
.attr("controls", "controls")
|
||||
.attr("id", "#ytapiplayer")
|
||||
.attr("width", VWIDTH)
|
||||
.attr("height", VHEIGHT)
|
||||
.html("Your browser does not support HTML5 <code><video></code> tags :(");
|
||||
removeOld(video);
|
||||
self.player = video[0];
|
||||
self.setVolume(VOLUME);
|
||||
};
|
||||
|
||||
self.load = function (data) {
|
||||
self.init(data);
|
||||
};
|
||||
|
||||
self.pause = function () {
|
||||
if (self.player) {
|
||||
self.player.pause();
|
||||
}
|
||||
};
|
||||
|
||||
self.play = function () {
|
||||
if (self.player) {
|
||||
self.player.play();
|
||||
}
|
||||
};
|
||||
|
||||
self.isPaused = function (callback) {
|
||||
if (self.player) {
|
||||
callback(self.player.paused);
|
||||
}
|
||||
};
|
||||
|
||||
self.getTime = function (callback) {
|
||||
if (self.player) {
|
||||
callback(self.player.currentTime);
|
||||
}
|
||||
};
|
||||
|
||||
self.seek = function (time) {
|
||||
if (self.player) {
|
||||
self.player.currentTime = time;
|
||||
}
|
||||
};
|
||||
|
||||
self.getVolume = function (cb) {
|
||||
if (self.player) {
|
||||
if (self.player.muted) {
|
||||
cb(0);
|
||||
} else {
|
||||
cb(self.player.volume);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
self.setVolume = function (vol) {
|
||||
if (self.player) {
|
||||
self.player.volume = vol;
|
||||
}
|
||||
};
|
||||
|
||||
self.init(data);
|
||||
};
|
||||
|
||||
|
||||
function handleMediaUpdate(data) {
|
||||
// Don't update if the position is past the video length, but
|
||||
// make an exception when the video length is 0 seconds
|
||||
if (typeof PLAYER.videoLength === "number") {
|
||||
if (PLAYER.videoLength > 0 &&
|
||||
if (PLAYER.videoLength > 0 &&
|
||||
data.currentTime > PLAYER.videoLength) {
|
||||
return;
|
||||
}
|
||||
|
@ -875,7 +1101,7 @@ function handleMediaUpdate(data) {
|
|||
}, tm);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Don't synch if leader or synch disabled
|
||||
if(CLIENT.leader || !USEROPTS.synch)
|
||||
return;
|
||||
|
@ -936,7 +1162,8 @@ var constructors = {
|
|||
"jw": JWPlayer,
|
||||
"im": ImgurPlayer,
|
||||
"cu": CustomPlayer,
|
||||
"gd": GoogleDocsPlayer
|
||||
"gd": GoogleDocsPlayer,
|
||||
"rv": RawVideoPlayer
|
||||
};
|
||||
|
||||
function loadMediaPlayer(data) {
|
||||
|
|
|
@ -662,6 +662,9 @@ function showOptionsMenu() {
|
|||
"issues on some systems");
|
||||
addOption(playback, "", pl_wmodewarn);
|
||||
|
||||
var pl_noh264 = addCheckbox(playback, "h.264", "Use JWPlayer for h.264 playback");
|
||||
pl_noh264.prop("checked", USEROPTS.no_h264);
|
||||
|
||||
var pl_hide = addCheckbox(playback, "Hide Video",
|
||||
"Remove the video player");
|
||||
pl_hide.prop("checked", USEROPTS.hidevid);
|
||||
|
@ -731,6 +734,7 @@ function showOptionsMenu() {
|
|||
USEROPTS.hidevid = pl_hide.prop("checked");
|
||||
USEROPTS.qbtn_hide = pl_hidebtn.prop("checked");
|
||||
USEROPTS.qbtn_idontlikechange = pl_oldbtn.prop("checked");
|
||||
USEROPTS.no_h264 = pl_noh264.prop("checked");
|
||||
USEROPTS.show_timestamps = chat_time.prop("checked");
|
||||
USEROPTS.sort_rank = chat_sort_rank.prop("checked");
|
||||
USEROPTS.sort_afk = chat_sort_afk.prop("checked");
|
||||
|
@ -1607,6 +1611,7 @@ function chatOnly() {
|
|||
$("#toprow").remove()
|
||||
$("#announcements").remove();
|
||||
$("#playlistrow").remove();
|
||||
PLAYER.player = null;
|
||||
$("#videowrap").remove();
|
||||
$("#chatwrap").removeClass("span5").addClass("span12");
|
||||
}
|
||||
|
|
|
@ -92,39 +92,8 @@
|
|||
<script src="./assets/js/data.js"></script>
|
||||
<script src="./assets/js/iourl.js"></script>
|
||||
<script type="text/javascript">
|
||||
var host = location.protocol + "//" + location.host + "/";
|
||||
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) {
|
||||
|
@ -143,20 +112,12 @@
|
|||
var d = data[i];
|
||||
var tr = $("<tr/>").appendTo($("#channeldata"));
|
||||
var name = $("<td/>").appendTo(tr);
|
||||
$("<a/>").attr("href", host + "r/" + d.name)
|
||||
$("<a/>").attr("href", "r/" + d.name)
|
||||
.text(d.pagetitle + " (" + d.name + ")")
|
||||
.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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -166,7 +127,7 @@
|
|||
alert("Invalid channel names. Channel names may contain alphanumeric characters, underscores, and hyphens");
|
||||
return;
|
||||
}
|
||||
document.location = host + "r/" + $("#channel").val();
|
||||
document.location = "r/" + $("#channel").val();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -182,8 +143,7 @@
|
|||
}
|
||||
}
|
||||
if(params["channel"] && params["channel"].match(/^[a-zA-Z0-9]+$/)) {
|
||||
var host = location.protocol + "//" + location.host + "/";
|
||||
document.location = host + "r/" + params["channel"];
|
||||
document.location = "r/" + params["channel"];
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
|
77
www/tos.html
Normal file
77
www/tos.html
Normal file
|
@ -0,0 +1,77 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CyTube</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Calvin 'calzoneman' Montgomery">
|
||||
|
||||
<link href="./assets/css/bootstrap.css" rel="stylesheet">
|
||||
<link href="./assets/css/ytsync.css" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
|
||||
}
|
||||
#channeldata td, #channeldata th {
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<link href="./assets/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="wrapper">
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<a class="brand" href="index.html">CyTube</a>
|
||||
<div class="">
|
||||
<ul class="nav">
|
||||
<li class="active"><a href="index.html">Home</a></li>
|
||||
<li><a href="https://github.com/calzoneman/sync/wiki/Beginner%27s-Guide-and-FAQ" target="_blank">Help</a></li>
|
||||
<li><a href="account.html">Account</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span8 offset2">
|
||||
<h3>Terms of Service</h3>
|
||||
<p>By visiting or otherwise using this service ("CyTube"), you agree to comply with the following terms of use. You agree further to abide by United States law, and by local laws where applicable with regard to your use of this service.</p>
|
||||
<strong>Disclaimer of Warranty</strong>
|
||||
<p>The content present on CyTube is provided "as-is". CyTube makes no warranties, express or implied, and hereby disclaims and negates all other warranties, including without limitation, implied warranties or conditions of merchantability, fitness for a particular purpose, or non-infringement of intellectual property or other violation of rights. Furthermore, CyTube does not make any representations concerning the accuracy or reliability of content present on CyTube.</p>
|
||||
<strong>Disclaimer of Endorsement</strong>
|
||||
<p>CyTube permits users to share links, embedded content, or other content insofar as the shared content complies with these terms of use and is legal under United States and local law. CyTube is not responsible for the content shared, or any consequences of sharing such content. CyTube does not endorse any user-provided content. Viewing shared content is done at the user's own risk.</p>
|
||||
<strong>Prohibited Content</strong>
|
||||
<p>CyTube may not be used in any way to promote activity which is considered harmful or is illegal under United States or local law, including but not limited to:
|
||||
<ul>
|
||||
<li>Sharing of illegal content (Child Pornography, warez, etc.)</li>
|
||||
<li>Sharing of copyrighted content without the content owner's permission</li>
|
||||
<li>Blackmail, slander, or other defamatory action towards any person</li>
|
||||
<li>Harassment</li>
|
||||
<li>Phishing</li>
|
||||
</ul>
|
||||
This list is not exhaustive.</p>
|
||||
<strong>Revocation of Access</strong>
|
||||
<p>CyTube and its administrators reserve the right to temporarily or permanently prohibit any user account or IP address from connecting for violations of these terms of use or for any other reason. Use of a proxy to escape such a ban is not permitted.
|
||||
</div>
|
||||
</div> <!-- /container -->
|
||||
<div class="push"></div>
|
||||
<div id="sitefooter">
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer">
|
||||
<p class="muted">
|
||||
CyTube Software Copyright © 2013 Calvin Montgomery · Available for free on <a href="http://github.com/calzoneman/sync">GitHub</a> ·
|
||||
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5Y7PUVVGVSEWG&lc=US&item_name=CyTube¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted">Donate</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue