mirror of https://github.com/calzoneman/sync.git
Merge branch 'master' into dev
This commit is contained in:
commit
d62931098d
104
channel.js
104
channel.js
|
@ -142,21 +142,38 @@ Channel.prototype.hasPermission = function(user, key) {
|
||||||
|
|
||||||
/* REGION Channel data */
|
/* REGION Channel data */
|
||||||
Channel.prototype.loadDump = function() {
|
Channel.prototype.loadDump = function() {
|
||||||
fs.readFile("chandump/" + this.name, function(err, data) {
|
var self = this;
|
||||||
|
if(self.name === "")
|
||||||
|
return;
|
||||||
|
fs.stat("chandump/" + self.name, function (err, stats) {
|
||||||
|
if(!err) {
|
||||||
|
var mb = stats.size / 1048576;
|
||||||
|
mb = parseInt(mb * 100) / 100;
|
||||||
|
if(mb > 1) {
|
||||||
|
Logger.errlog.log("Large chandump detected: " + self.name +
|
||||||
|
" (" + mb + " MB)");
|
||||||
|
self.updateMotd("Your channel file has exceeded the " +
|
||||||
|
"maximum size of 1MB and cannot be " +
|
||||||
|
"loaded. Please ask an administrator " +
|
||||||
|
"for assistance in restoring it.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fs.readFile("chandump/" + self.name, function(err, data) {
|
||||||
if(err) {
|
if(err) {
|
||||||
if(err.code == "ENOENT") {
|
if(err.code == "ENOENT") {
|
||||||
Logger.errlog.log("WARN: missing dump for " + this.name);
|
Logger.errlog.log("WARN: missing dump for " + self.name);
|
||||||
this.initialized = true;
|
self.initialized = true;
|
||||||
this.saveDump();
|
self.saveDump();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Logger.errlog.log("Failed to open channel dump " + this.name);
|
Logger.errlog.log("Failed to open channel dump " + self.name);
|
||||||
Logger.errlog.log(err);
|
Logger.errlog.log(err);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.logger.log("*** Loading channel dump from disk");
|
self.logger.log("*** Loading channel dump from disk");
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
/* Load the playlist */
|
/* Load the playlist */
|
||||||
|
|
||||||
|
@ -167,22 +184,22 @@ Channel.prototype.loadDump = function() {
|
||||||
for(var i = 0; i < data.queue.length; i++) {
|
for(var i = 0; i < data.queue.length; i++) {
|
||||||
var e = data.queue[i];
|
var e = data.queue[i];
|
||||||
var m = new Media(e.id, e.title, e.seconds, e.type);
|
var m = new Media(e.id, e.title, e.seconds, e.type);
|
||||||
var p = this.playlist.makeItem(m);
|
var p = self.playlist.makeItem(m);
|
||||||
p.queueby = data.queue[i].queueby ? data.queue[i].queueby
|
p.queueby = data.queue[i].queueby ? data.queue[i].queueby
|
||||||
: "";
|
: "";
|
||||||
p.temp = e.temp;
|
p.temp = e.temp;
|
||||||
this.playlist.items.append(p);
|
self.playlist.items.append(p);
|
||||||
if(i == data.position)
|
if(i == data.position)
|
||||||
this.playlist.current = p;
|
self.playlist.current = p;
|
||||||
}
|
}
|
||||||
this.sendAll("playlist", this.playlist.items.toArray());
|
self.sendAll("playlist", self.playlist.items.toArray());
|
||||||
this.broadcastPlaylistMeta();
|
self.broadcastPlaylistMeta();
|
||||||
this.playlist.startPlayback();
|
self.playlist.startPlayback();
|
||||||
}
|
}
|
||||||
// Current
|
// Current
|
||||||
else if(data.playlist) {
|
else if(data.playlist) {
|
||||||
var chan = this;
|
var chan = self;
|
||||||
this.playlist.load(data.playlist, function() {
|
self.playlist.load(data.playlist, function() {
|
||||||
chan.sendAll("playlist", chan.playlist.items.toArray());
|
chan.sendAll("playlist", chan.playlist.items.toArray());
|
||||||
chan.broadcastPlaylistMeta();
|
chan.broadcastPlaylistMeta();
|
||||||
chan.playlist.startPlayback(data.playlist.time);
|
chan.playlist.startPlayback(data.playlist.time);
|
||||||
|
@ -192,18 +209,18 @@ Channel.prototype.loadDump = function() {
|
||||||
// Gotta love backwards compatibility
|
// Gotta love backwards compatibility
|
||||||
if(key == "customcss" || key == "customjs") {
|
if(key == "customcss" || key == "customjs") {
|
||||||
var k = key.substring(6);
|
var k = key.substring(6);
|
||||||
this.opts[k] = data.opts[key];
|
self.opts[k] = data.opts[key];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.opts[key] = data.opts[key];
|
self.opts[key] = data.opts[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(var key in data.permissions) {
|
for(var key in data.permissions) {
|
||||||
this.permissions[key] = data.permissions[key];
|
self.permissions[key] = data.permissions[key];
|
||||||
}
|
}
|
||||||
this.sendAll("setPermissions", this.permissions);
|
self.sendAll("setPermissions", self.permissions);
|
||||||
this.broadcastOpts();
|
self.broadcastOpts();
|
||||||
this.users.forEach(function (u) {
|
self.users.forEach(function (u) {
|
||||||
u.autoAFK();
|
u.autoAFK();
|
||||||
});
|
});
|
||||||
if(data.filters) {
|
if(data.filters) {
|
||||||
|
@ -213,41 +230,42 @@ Channel.prototype.loadDump = function() {
|
||||||
if(f[0] != undefined) {
|
if(f[0] != undefined) {
|
||||||
var filt = new Filter("", f[0], "g", f[1]);
|
var filt = new Filter("", f[0], "g", f[1]);
|
||||||
filt.active = f[2];
|
filt.active = f[2];
|
||||||
this.updateFilter(filt, false);
|
self.updateFilter(filt, false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var filt = new Filter(f.name, f.source, f.flags, f.replace);
|
var filt = new Filter(f.name, f.source, f.flags, f.replace);
|
||||||
filt.active = f.active;
|
filt.active = f.active;
|
||||||
filt.filterlinks = f.filterlinks;
|
filt.filterlinks = f.filterlinks;
|
||||||
this.updateFilter(filt, false);
|
self.updateFilter(filt, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.broadcastChatFilters();
|
self.broadcastChatFilters();
|
||||||
}
|
}
|
||||||
if(data.motd) {
|
if(data.motd) {
|
||||||
this.motd = data.motd;
|
self.motd = data.motd;
|
||||||
this.broadcastMotd();
|
self.broadcastMotd();
|
||||||
}
|
}
|
||||||
this.setLock(!(data.openqueue || false));
|
self.setLock(!(data.openqueue || false));
|
||||||
this.chatbuffer = data.chatbuffer || [];
|
self.chatbuffer = data.chatbuffer || [];
|
||||||
for(var i = 0; i < this.chatbuffer.length; i++) {
|
for(var i = 0; i < self.chatbuffer.length; i++) {
|
||||||
this.sendAll("chatMsg", this.chatbuffer[i]);
|
self.sendAll("chatMsg", self.chatbuffer[i]);
|
||||||
}
|
}
|
||||||
this.css = data.css || "";
|
self.css = data.css || "";
|
||||||
this.js = data.js || "";
|
self.js = data.js || "";
|
||||||
this.sendAll("channelCSSJS", {css: this.css, js: this.js});
|
self.sendAll("channelCSSJS", {css: self.css, js: self.js});
|
||||||
this.initialized = true;
|
self.initialized = true;
|
||||||
setTimeout(function() { incrementalDump(this); }.bind(this), 300000);
|
setTimeout(function() { incrementalDump(self); }.bind(self), 300000);
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
Logger.errlog.log("Channel dump load failed: ");
|
Logger.errlog.log("Channel dump load failed: ");
|
||||||
Logger.errlog.log(e.stack);
|
Logger.errlog.log(e.stack);
|
||||||
}
|
}
|
||||||
}.bind(this));
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Channel.prototype.saveDump = function() {
|
Channel.prototype.saveDump = function() {
|
||||||
if(!this.initialized)
|
if(!this.initialized || this.name === "")
|
||||||
return;
|
return;
|
||||||
var filts = new Array(this.filters.length);
|
var filts = new Array(this.filters.length);
|
||||||
for(var i = 0; i < this.filters.length; i++) {
|
for(var i = 0; i < this.filters.length; i++) {
|
||||||
|
@ -1139,7 +1157,19 @@ Channel.prototype.tryQueue = function(user, data) {
|
||||||
|
|
||||||
if(user.rank < Rank.Moderator
|
if(user.rank < Rank.Moderator
|
||||||
&& this.leader != user
|
&& this.leader != user
|
||||||
&& user.noflood("queue", 1.5)) {
|
&& user.noflood("queue", 3)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var count = this.playlist.count(data.id);
|
||||||
|
|
||||||
|
if(user.rank < Rank.Moderator && count >= 5) {
|
||||||
|
user.socket.emit("queueFail", "That video is already on the " +
|
||||||
|
"playlist 5 times.");
|
||||||
|
return;
|
||||||
|
} else if(user.rank < Rank.Siteadmin && count >= 20) {
|
||||||
|
user.socket.emit("queueFail", "That video is already on the " +
|
||||||
|
"playlist 20 times.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
database.js
16
database.js
|
@ -41,12 +41,22 @@ function getConnection() {
|
||||||
Logger.errlog.log("DB connection failed");
|
Logger.errlog.log("DB connection failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(CONFIG["debug"]) {
|
|
||||||
db._querySync = db.querySync;
|
db._querySync = db.querySync;
|
||||||
db.querySync = function(q) {
|
db.querySync = function(q) {
|
||||||
Logger.syslog.log("DEBUG: " + q);
|
if(!this.connectedSync()) {
|
||||||
return this._querySync(q);
|
db = false;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
var res = this._querySync(q);
|
||||||
|
if(!res) {
|
||||||
|
try {
|
||||||
|
db.closeSync();
|
||||||
|
} catch(e) {
|
||||||
|
// already disconnected
|
||||||
|
}
|
||||||
|
db = false;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
32
get-info.js
32
get-info.js
|
@ -11,13 +11,23 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||||
|
|
||||||
var http = require("http");
|
var http = require("http");
|
||||||
var https = require("https");
|
var https = require("https");
|
||||||
|
var domain = require("domain");
|
||||||
var Logger = require("./logger.js");
|
var Logger = require("./logger.js");
|
||||||
var Media = require("./media.js").Media;
|
var Media = require("./media.js").Media;
|
||||||
var CustomEmbedFilter = require("./customembed").filter;
|
var CustomEmbedFilter = require("./customembed").filter;
|
||||||
|
|
||||||
module.exports = function (Server) {
|
module.exports = function (Server) {
|
||||||
function urlRetrieve(transport, options, callback) {
|
var urlRetrieve = function (transport, options, callback) {
|
||||||
try {
|
// Catch any errors that crop up along the way of the request
|
||||||
|
// in order to prevent them from reaching the global handler.
|
||||||
|
// This should cut down on needing to restart the server
|
||||||
|
var d = domain.create();
|
||||||
|
d.on("error", function (err) {
|
||||||
|
Logger.errlog.log("urlRetrieve failed: " + err);
|
||||||
|
Logger.errlog.log("Request was: " + options.host + options.path);
|
||||||
|
callback(503, err);
|
||||||
|
});
|
||||||
|
d.run(function () {
|
||||||
var req = transport.request(options, function (res) {
|
var req = transport.request(options, function (res) {
|
||||||
var buffer = "";
|
var buffer = "";
|
||||||
res.setEncoding("utf-8");
|
res.setEncoding("utf-8");
|
||||||
|
@ -30,10 +40,8 @@ module.exports = function (Server) {
|
||||||
});
|
});
|
||||||
|
|
||||||
req.end();
|
req.end();
|
||||||
} catch(e) {
|
});
|
||||||
callback(503, "");
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var Getters = {
|
var Getters = {
|
||||||
/* youtube.com */
|
/* youtube.com */
|
||||||
|
@ -65,6 +73,9 @@ module.exports = function (Server) {
|
||||||
} else if(status === 403) {
|
} else if(status === 403) {
|
||||||
callback("Private video", null);
|
callback("Private video", null);
|
||||||
return;
|
return;
|
||||||
|
} else if(status === 503) {
|
||||||
|
callback("API failure", null);
|
||||||
|
return;
|
||||||
} else if(status !== 200) {
|
} else if(status !== 200) {
|
||||||
callback(true, null);
|
callback(true, null);
|
||||||
return;
|
return;
|
||||||
|
@ -177,6 +188,9 @@ module.exports = function (Server) {
|
||||||
} else if(status === 403) {
|
} else if(status === 403) {
|
||||||
callback("Playlist is private", null);
|
callback("Playlist is private", null);
|
||||||
return;
|
return;
|
||||||
|
} else if(status === 503) {
|
||||||
|
callback("API failure", null);
|
||||||
|
return;
|
||||||
} else if(status !== 200) {
|
} else if(status !== 200) {
|
||||||
callback(true, null);
|
callback(true, null);
|
||||||
}
|
}
|
||||||
|
@ -278,6 +292,9 @@ module.exports = function (Server) {
|
||||||
} else if(status === 403) {
|
} else if(status === 403) {
|
||||||
callback("Private video", null);
|
callback("Private video", null);
|
||||||
return;
|
return;
|
||||||
|
} else if(status === 503) {
|
||||||
|
callback("API failure", null);
|
||||||
|
return;
|
||||||
} else if(status !== 200) {
|
} else if(status !== 200) {
|
||||||
callback(true, null);
|
callback(true, null);
|
||||||
return;
|
return;
|
||||||
|
@ -362,6 +379,9 @@ module.exports = function (Server) {
|
||||||
if(status === 404) {
|
if(status === 404) {
|
||||||
callback("Sound not found", null);
|
callback("Sound not found", null);
|
||||||
return;
|
return;
|
||||||
|
} else if(status === 503) {
|
||||||
|
callback("API failure", null);
|
||||||
|
return;
|
||||||
} else if(status !== 302) {
|
} else if(status !== 302) {
|
||||||
callback(true, null);
|
callback(true, null);
|
||||||
return;
|
return;
|
||||||
|
|
2
media.js
2
media.js
|
@ -45,6 +45,8 @@ exports.formatTime = formatTime;
|
||||||
var Media = function(id, title, seconds, type) {
|
var Media = function(id, title, seconds, type) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
|
if(this.title.length > 100)
|
||||||
|
this.title = this.title.substring(0, 97) + "...";
|
||||||
this.seconds = seconds == "--:--" ? "--:--" : parseInt(seconds);
|
this.seconds = seconds == "--:--" ? "--:--" : parseInt(seconds);
|
||||||
this.duration = formatTime(this.seconds);
|
this.duration = formatTime(this.seconds);
|
||||||
if(seconds == "--:--") {
|
if(seconds == "--:--") {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"author": "Calvin Montgomery",
|
"author": "Calvin Montgomery",
|
||||||
"name": "CyTube",
|
"name": "CyTube",
|
||||||
"description": "Online media synchronizer and chat",
|
"description": "Online media synchronizer and chat",
|
||||||
"version": "2.3.2",
|
"version": "2.3.3",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "http://github.com/calzoneman/sync"
|
"url": "http://github.com/calzoneman/sync"
|
||||||
},
|
},
|
||||||
|
|
|
@ -450,6 +450,15 @@ Playlist.prototype.clear = function() {
|
||||||
clearInterval(this._leadInterval);
|
clearInterval(this._leadInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Playlist.prototype.count = function (id) {
|
||||||
|
var count = 0;
|
||||||
|
this.items.forEach(function (i) {
|
||||||
|
if(i.media.id === id)
|
||||||
|
count++;
|
||||||
|
});
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
Playlist.prototype.lead = function(lead) {
|
Playlist.prototype.lead = function(lead) {
|
||||||
this.leading = lead;
|
this.leading = lead;
|
||||||
var pl = this;
|
var pl = this;
|
||||||
|
|
|
@ -6,7 +6,7 @@ var Logger = require("./logger");
|
||||||
var Channel = require("./channel");
|
var Channel = require("./channel");
|
||||||
var User = require("./user");
|
var User = require("./user");
|
||||||
|
|
||||||
const VERSION = "2.3.2";
|
const VERSION = "2.3.3";
|
||||||
|
|
||||||
function getIP(req) {
|
function getIP(req) {
|
||||||
var raw = req.connection.remoteAddress;
|
var raw = req.connection.remoteAddress;
|
||||||
|
@ -63,6 +63,7 @@ var Server = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chan.name = "";
|
chan.name = "";
|
||||||
|
chan.canonical_name = "";
|
||||||
},
|
},
|
||||||
stats: null,
|
stats: null,
|
||||||
app: null,
|
app: null,
|
||||||
|
|
|
@ -161,4 +161,13 @@ ULList.prototype.toArray = function(pack) {
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* iterate across the playlist */
|
||||||
|
ULList.prototype.forEach = function (fn) {
|
||||||
|
var item = this.first;
|
||||||
|
while(item !== null) {
|
||||||
|
fn(item);
|
||||||
|
item = item.next;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
exports.ULList = ULList;
|
exports.ULList = ULList;
|
||||||
|
|
53
update.js
53
update.js
|
@ -1,38 +1,14 @@
|
||||||
var Config = require("./config.js");
|
var Config = require("./config.js");
|
||||||
var Database = require("./database.js");
|
var Database = require("./database.js");
|
||||||
|
|
||||||
//Config.DEBUG = true;
|
var x = {};
|
||||||
Database.setup(Config);
|
Config.load(x, "cfg.json", function () {
|
||||||
|
Database.setup(x.cfg);
|
||||||
Database.init();
|
Database.init();
|
||||||
var query;
|
var query;
|
||||||
var db = Database.getConnection();
|
var db = Database.getConnection();
|
||||||
|
|
||||||
// Check for already existing
|
|
||||||
query = "SELECT owner FROM channels WHERE 1";
|
|
||||||
if(!db.querySync(query)) {
|
|
||||||
query = "ALTER TABLE channels ADD owner VARCHAR(20) NOT NULL";
|
|
||||||
var res = db.querySync(query);
|
|
||||||
if(!res) {
|
|
||||||
console.log(db);
|
|
||||||
console.log("Update failed!");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
populateChannelOwners();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("Fixing user playlist bug");
|
|
||||||
query = "ALTER TABLE user_playlists DROP PRIMARY KEY, ADD PRIMARY KEY (user, name)";
|
|
||||||
if(!db.querySync(query)) {
|
|
||||||
console.log("Something went wrong");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log("fixed");
|
|
||||||
}
|
|
||||||
db.closeSync();
|
|
||||||
process.exit(0);
|
|
||||||
|
|
||||||
function populateChannelOwners() {
|
|
||||||
query = "SELECT * FROM channels WHERE 1";
|
query = "SELECT * FROM channels WHERE 1";
|
||||||
var res = db.querySync(query);
|
var res = db.querySync(query);
|
||||||
if(!res) {
|
if(!res) {
|
||||||
|
@ -44,27 +20,16 @@ function populateChannelOwners() {
|
||||||
var channels = res.fetchAllSync();
|
var channels = res.fetchAllSync();
|
||||||
channels.forEach(function(chan) {
|
channels.forEach(function(chan) {
|
||||||
chan = chan.name;
|
chan = chan.name;
|
||||||
query = "SELECT name FROM `chan_"+chan+"_ranks` WHERE rank>=10 ORDER BY rank";
|
query = "UPDATE `chan_" + chan + "_library` SET title=CONCAT(" +
|
||||||
|
"SUBSTRING(title FROM 0 FOR 97), '...') WHERE " +
|
||||||
|
"LENGTH(title) > 100";
|
||||||
|
console.log(query);
|
||||||
res = db.querySync(query);
|
res = db.querySync(query);
|
||||||
if(!res) {
|
if(!res) {
|
||||||
console.log(db);
|
console.log(db);
|
||||||
console.log("failed to fix "+chan);
|
console.log("failed to fix "+chan);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var results = res.fetchAllSync();
|
|
||||||
if(results.length == 0) {
|
|
||||||
console.log("bad channel: " + chan);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var owner = results[0].name;
|
|
||||||
query = "UPDATE channels SET owner='"+owner+"' WHERE name='"+chan+"'";
|
|
||||||
console.log("setting owner=" + owner + " for /r/" + chan);
|
|
||||||
res = db.querySync(query);
|
|
||||||
if(!res) {
|
|
||||||
console.log(db);
|
|
||||||
console.log("Update failed!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
db.closeSync();
|
||||||
|
});
|
||||||
|
|
|
@ -159,7 +159,7 @@ html, body {
|
||||||
}
|
}
|
||||||
|
|
||||||
#messagebuffer div, #messagebuffer code, #filteredit code,
|
#messagebuffer div, #messagebuffer code, #filteredit code,
|
||||||
#channeldata td, #currenttitle {
|
#channeldata td, #currenttitle, .profile-box {
|
||||||
white-space: pre-wrap; /* css-3 */
|
white-space: pre-wrap; /* css-3 */
|
||||||
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
|
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
|
||||||
white-space: -pre-wrap; /* Opera 4-6 */
|
white-space: -pre-wrap; /* Opera 4-6 */
|
||||||
|
|
|
@ -758,7 +758,7 @@ Callbacks = {
|
||||||
}
|
}
|
||||||
makeAlert("Error", data, "alert-error")
|
makeAlert("Error", data, "alert-error")
|
||||||
.addClass("span12")
|
.addClass("span12")
|
||||||
.insertAfter($("#mediaurl").parent());
|
.insertBefore($("#extended_controls"));
|
||||||
},
|
},
|
||||||
|
|
||||||
setTemp: function(data) {
|
setTemp: function(data) {
|
||||||
|
|
|
@ -117,7 +117,8 @@ var USEROPTS = {
|
||||||
ignore_channelcss : getOrDefault("ignore_channelcss", false),
|
ignore_channelcss : getOrDefault("ignore_channelcss", false),
|
||||||
ignore_channeljs : getOrDefault("ignore_channeljs", false),
|
ignore_channeljs : getOrDefault("ignore_channeljs", false),
|
||||||
sort_rank : getOrDefault("sort_rank", false),
|
sort_rank : getOrDefault("sort_rank", false),
|
||||||
sort_afk : getOrDefault("sort_afk", false)
|
sort_afk : getOrDefault("sort_afk", false),
|
||||||
|
default_quality : getOrDefault("default_quality", "#quality_auto")
|
||||||
};
|
};
|
||||||
|
|
||||||
var NO_WEBSOCKETS = USEROPTS.altsocket;
|
var NO_WEBSOCKETS = USEROPTS.altsocket;
|
||||||
|
|
|
@ -224,10 +224,15 @@ $("#userpl_save").click(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
/* video controls */
|
/* video controls */
|
||||||
|
function selectQuality(select, preset) {
|
||||||
|
|
||||||
|
}
|
||||||
(function() {
|
(function() {
|
||||||
function qualHandler(select, preset) {
|
function qualHandler(select, preset) {
|
||||||
$(select).click(function() {
|
$(select).click(function() {
|
||||||
VIDEOQUALITY = preset;
|
VIDEOQUALITY = preset;
|
||||||
|
USEROPTS.default_quality = select;
|
||||||
|
saveOpts();
|
||||||
var btn = $("#qualitywrap .btn.dropdown-toggle");
|
var btn = $("#qualitywrap .btn.dropdown-toggle");
|
||||||
var caret = btn.find(".caret").detach();
|
var caret = btn.find(".caret").detach();
|
||||||
btn.text($(select).text());
|
btn.text($(select).text());
|
||||||
|
@ -236,11 +241,14 @@ $("#userpl_save").click(function() {
|
||||||
PLAYER.player.setPlaybackQuality(VIDEOQUALITY);
|
PLAYER.player.setPlaybackQuality(VIDEOQUALITY);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
qualHandler("#quality_auto", "");
|
||||||
qualHandler("#quality_240p", "small");
|
qualHandler("#quality_240p", "small");
|
||||||
qualHandler("#quality_360p", "medium");
|
qualHandler("#quality_360p", "medium");
|
||||||
qualHandler("#quality_480p", "large");
|
qualHandler("#quality_480p", "large");
|
||||||
qualHandler("#quality_720p", "hd720");
|
qualHandler("#quality_720p", "hd720");
|
||||||
qualHandler("#quality_1080p", "hd1080");
|
qualHandler("#quality_1080p", "hd1080");
|
||||||
|
if($(USEROPTS.default_quality).length > 0)
|
||||||
|
$(USEROPTS.default_quality).click();
|
||||||
})();
|
})();
|
||||||
|
|
||||||
$("#mediarefresh").click(function() {
|
$("#mediarefresh").click(function() {
|
||||||
|
|
|
@ -149,6 +149,7 @@
|
||||||
Quality <span class="caret"></span>
|
Quality <span class="caret"></span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
|
<li><a id="quality_auto" href="javascript:void(0)">Quality: Auto</a></li>
|
||||||
<li><a id="quality_240p" href="javascript:void(0)">240p</a></li>
|
<li><a id="quality_240p" href="javascript:void(0)">240p</a></li>
|
||||||
<li><a id="quality_360p" href="javascript:void(0)">360p</a></li>
|
<li><a id="quality_360p" href="javascript:void(0)">360p</a></li>
|
||||||
<li><a id="quality_480p" href="javascript:void(0)">480p</a></li>
|
<li><a id="quality_480p" href="javascript:void(0)">480p</a></li>
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span8">
|
<div class="span8">
|
||||||
<h3>Loaded Channels</h3>
|
<h3>Public Channels</h3>
|
||||||
<table id="channeldata" class="table table-striped table-bordered">
|
<table id="channeldata" class="table table-striped table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Reference in New Issue