mirror of https://github.com/calzoneman/sync.git
Various fixes
This commit is contained in:
parent
87f44b69e0
commit
b1e6f696e8
|
@ -11,6 +11,7 @@ var ChatCommand = require("./chatcommand");
|
||||||
|
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
|
var url = require("url");
|
||||||
|
|
||||||
var DEFAULT_FILTERS = [
|
var DEFAULT_FILTERS = [
|
||||||
new Filter("monospace", "`(.+?)`", "g", "<code>$1</code>"),
|
new Filter("monospace", "`(.+?)`", "g", "<code>$1</code>"),
|
||||||
|
@ -889,8 +890,6 @@ Channel.prototype.sendBanlist = function (users) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(banlist);
|
|
||||||
|
|
||||||
for (var i = 0; i < banlist.length; i++) {
|
for (var i = 0; i < banlist.length; i++) {
|
||||||
bans.push({
|
bans.push({
|
||||||
id: banlist[i].id,
|
id: banlist[i].id,
|
||||||
|
@ -1496,6 +1495,10 @@ Channel.prototype.addMedia = function (data, callback) {
|
||||||
media.pos = data.pos;
|
media.pos = data.pos;
|
||||||
media.queueby = data.queueby;
|
media.queueby = data.queueby;
|
||||||
media.temp = data.temp;
|
media.temp = data.temp;
|
||||||
|
if (data.title && media.type === "cu") {
|
||||||
|
media.title = data.title;
|
||||||
|
}
|
||||||
|
|
||||||
var res = self.playlist.addMedia(media);
|
var res = self.playlist.addMedia(media);
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
callback(res.error, null);
|
callback(res.error, null);
|
||||||
|
@ -1701,7 +1704,9 @@ Channel.prototype.handleQueuePlaylist = function (user, data) {
|
||||||
* Handles a user message to delete a playlist item
|
* Handles a user message to delete a playlist item
|
||||||
*/
|
*/
|
||||||
Channel.prototype.handleDelete = function (user, data) {
|
Channel.prototype.handleDelete = function (user, data) {
|
||||||
if (!this.hasPermission(user, "playlistdelete")) {
|
var self = this;
|
||||||
|
|
||||||
|
if (!self.hasPermission(user, "playlistdelete")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1709,9 +1714,11 @@ Channel.prototype.handleDelete = function (user, data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.deleteMedia(data, function (err) {
|
var plitem = self.playlist.items.find(data);
|
||||||
if (!err) {
|
|
||||||
this.logger.log("### " + user.name + " deleted " + plitem.media.title);
|
self.deleteMedia(data, function (err) {
|
||||||
|
if (!err && plitem && plitem.media) {
|
||||||
|
self.logger.log("### " + user.name + " deleted " + plitem.media.title);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -265,6 +265,7 @@ User.prototype.initChannelCallbacks = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
wrapTypecheck("queue", function (data) {
|
wrapTypecheck("queue", function (data) {
|
||||||
|
console.log("queue", data);
|
||||||
self.channel.handleQueue(self, data);
|
self.channel.handleQueue(self, data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -276,7 +277,7 @@ User.prototype.initChannelCallbacks = function () {
|
||||||
self.channel.handleMove(self, data);
|
self.channel.handleMove(self, data);
|
||||||
});
|
});
|
||||||
|
|
||||||
wrapTypecheck("delete", function (data) {
|
wrap("delete", function (data) {
|
||||||
self.channel.handleDelete(self, data);
|
self.channel.handleDelete(self, data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -284,8 +285,8 @@ User.prototype.initChannelCallbacks = function () {
|
||||||
self.channel.handleUncache(self, data);
|
self.channel.handleUncache(self, data);
|
||||||
});
|
});
|
||||||
|
|
||||||
wrapTypecheck("jumpto", function (data) {
|
wrap("jumpTo", function (data) {
|
||||||
self.channel.handleJump(self, data);
|
self.channel.handleJumpTo(self, data);
|
||||||
});
|
});
|
||||||
|
|
||||||
wrap("playNext", function () {
|
wrap("playNext", function () {
|
||||||
|
|
|
@ -119,14 +119,16 @@ html(lang="en")
|
||||||
#customembed.collapse.plcontrol-collapse.col-lg-12.col-md-12
|
#customembed.collapse.plcontrol-collapse.col-lg-12.col-md-12
|
||||||
.vertical-spacer
|
.vertical-spacer
|
||||||
.input-group
|
.input-group
|
||||||
input#customembed_title.form-control(type="text", placeholder="Title (optional)")
|
input#customembed-title.form-control(type="text", placeholder="Title (optional)")
|
||||||
span.input-group-btn
|
span.input-group-btn
|
||||||
button#ce_queue_next.btn.btn-default Next
|
button#ce_queue_next.btn.btn-default Next
|
||||||
span.input-group-btn
|
span.input-group-btn
|
||||||
button#ce_queue_end.btn.btn-default At End
|
button#ce_queue_end.btn.btn-default At End
|
||||||
| Paste the embed code below and click Next or At End.
|
| Paste the embed code below and click Next or At End.
|
||||||
| Acceptable embed codes are <code><iframe></code> and <code><object></code> tags.
|
| Acceptable embed codes are <code><iframe></code> and <code><object></code> tags.
|
||||||
textarea#customembed_code.input-block-level.form-control(rows="3")
|
textarea#customembed-content.input-block-level.form-control(rows="3")
|
||||||
|
#queuefail.col-lg-12.col-md-12
|
||||||
|
.vertical-spacer
|
||||||
.col-lg-12.col-md-12
|
.col-lg-12.col-md-12
|
||||||
#queue.videolist
|
#queue.videolist
|
||||||
#plmeta
|
#plmeta
|
||||||
|
|
|
@ -796,12 +796,12 @@ Callbacks = {
|
||||||
: "Added by: Unknown");
|
: "Added by: Unknown");
|
||||||
if (data.after === "prepend") {
|
if (data.after === "prepend") {
|
||||||
li.prependTo(q);
|
li.prependTo(q);
|
||||||
li.show("blind", function () {
|
li.show("fade", function () {
|
||||||
plq.release();
|
plq.release();
|
||||||
});
|
});
|
||||||
} else if (data.after === "append") {
|
} else if (data.after === "append") {
|
||||||
li.appendTo(q);
|
li.appendTo(q);
|
||||||
li.show("blind", function () {
|
li.show("fade", function () {
|
||||||
plq.release();
|
plq.release();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -811,7 +811,7 @@ Callbacks = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
li.insertAfter(liafter);
|
li.insertAfter(liafter);
|
||||||
li.show("blind", function () {
|
li.show("fade", function () {
|
||||||
plq.release();
|
plq.release();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -854,7 +854,7 @@ Callbacks = {
|
||||||
PL_ACTION_QUEUE.queue(function (plq) {
|
PL_ACTION_QUEUE.queue(function (plq) {
|
||||||
PL_WAIT_SCROLL = true;
|
PL_WAIT_SCROLL = true;
|
||||||
var li = $(".pluid-" + data.uid);
|
var li = $(".pluid-" + data.uid);
|
||||||
li.hide("blind", function() {
|
li.hide("fade", function() {
|
||||||
li.remove();
|
li.remove();
|
||||||
plq.release();
|
plq.release();
|
||||||
PL_WAIT_SCROLL = false;
|
PL_WAIT_SCROLL = false;
|
||||||
|
|
|
@ -270,65 +270,56 @@ $("#queue").sortable({
|
||||||
});
|
});
|
||||||
$("#queue").disableSelection();
|
$("#queue").disableSelection();
|
||||||
|
|
||||||
// TODO no more comma separated queueing.
|
function queue(pos, src) {
|
||||||
function queue(pos) {
|
if (!src) {
|
||||||
if($("#customembed_code").val()) {
|
src = "url";
|
||||||
var title = false;
|
|
||||||
if($("#customembed_title").val()) {
|
|
||||||
title = $("#customembed_title").val();
|
|
||||||
}
|
|
||||||
socket.emit("queue", {
|
|
||||||
id: $("#customembed_code").val(),
|
|
||||||
title: title,
|
|
||||||
type: "cu",
|
|
||||||
pos: pos
|
|
||||||
});
|
|
||||||
$("#customembed_code").val("");
|
|
||||||
$("#customembed_title").val("");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
var links = $("#mediaurl").val().split(",");
|
|
||||||
var parsed = [];
|
|
||||||
links.forEach(function(link) {
|
|
||||||
var data = parseMediaLink(link);
|
|
||||||
if(data.id === null || data.type === null) {
|
|
||||||
makeAlert("Error", "Invalid link. Please double check it and remove extraneous information", "alert-danger")
|
|
||||||
.insertBefore($("#extended_controls"));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$("#mediaurl").val("");
|
|
||||||
}
|
|
||||||
parsed.push({
|
|
||||||
id: data.id,
|
|
||||||
type: data.type
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
if(parsed.length > 1) {
|
if (src === "customembed") {
|
||||||
|
var title = $("#customembed-title").val();
|
||||||
|
if (!title) {
|
||||||
|
title = false;
|
||||||
|
}
|
||||||
|
var content = $("#customembed-content").val();
|
||||||
|
|
||||||
socket.emit("queue", {
|
socket.emit("queue", {
|
||||||
id: false,
|
id: content,
|
||||||
list: parsed,
|
title: title,
|
||||||
type: "list",
|
pos: pos,
|
||||||
pos: pos
|
type: "cu"
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
var link = $("#mediaurl").val();
|
||||||
parsed[0].pos = pos;
|
var data = parseMediaLink(link);
|
||||||
socket.emit("queue", parsed[0]);
|
if (data.id == null || data.type == null) {
|
||||||
|
makeAlert("Error", "Failed to parse link. Please check that it is correct",
|
||||||
|
"alert-danger")
|
||||||
|
.insertAfter($("#addfromurl"));
|
||||||
|
} else {
|
||||||
|
$("#mediaurl").val("");
|
||||||
|
socket.emit("queue", {
|
||||||
|
id: data.id,
|
||||||
|
type: data.type,
|
||||||
|
pos: pos
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#queue_next").click(function() {
|
$("#queue_next").click(queue.bind(this, "next", "url"));
|
||||||
queue("next");
|
$("#queue_end").click(queue.bind(this, "end", "url"));
|
||||||
});
|
$("#ce_queue_next").click(queue.bind(this, "next", "customembed"));
|
||||||
|
$("#ce_queue_end").click(queue.bind(this, "end", "customembed"));
|
||||||
$("#queue_end").click(function() {
|
|
||||||
queue("end");
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#mediaurl").keydown(function(ev) {
|
$("#mediaurl").keydown(function(ev) {
|
||||||
if(ev.keyCode == 13) {
|
if (ev.keyCode === 13) {
|
||||||
queue("end");
|
queue("end", "url");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#customembed-content").keydown(function(ev) {
|
||||||
|
if (ev.keyCode === 13) {
|
||||||
|
queue("end", "customembed");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -341,13 +332,6 @@ $("#voteskip").click(function() {
|
||||||
$("#voteskip").attr("disabled", true);
|
$("#voteskip").attr("disabled", true);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#customembed_btn").click(function () {
|
|
||||||
if($("#customembed_entry").css("display") == "none")
|
|
||||||
$("#customembed_entry").show("blind");
|
|
||||||
else
|
|
||||||
$("#customembed_entry").hide("blind");
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#getplaylist").click(function() {
|
$("#getplaylist").click(function() {
|
||||||
var callback = function(data) {
|
var callback = function(data) {
|
||||||
hidePlayer();
|
hidePlayer();
|
||||||
|
|
|
@ -21,7 +21,7 @@ function makeAlert(title, text, klass) {
|
||||||
$("<strong/>").text(title).prependTo(al);
|
$("<strong/>").text(title).prependTo(al);
|
||||||
$("<button/>").addClass("close pull-right").html("×")
|
$("<button/>").addClass("close pull-right").html("×")
|
||||||
.click(function() {
|
.click(function() {
|
||||||
al.hide("blind", function() {
|
al.hide("fade", function() {
|
||||||
al.remove();
|
al.remove();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -817,7 +817,7 @@ function handlePermissionChange() {
|
||||||
.click(function() {
|
.click(function() {
|
||||||
USEROPTS.first_visit = false;
|
USEROPTS.first_visit = false;
|
||||||
storeOpts();
|
storeOpts();
|
||||||
al.hide("blind", function() {
|
al.hide("fade", function() {
|
||||||
al.remove();
|
al.remove();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -881,7 +881,7 @@ function addLibraryButtons(li, id, source) {
|
||||||
.addClass("pull-left")
|
.addClass("pull-left")
|
||||||
.prependTo(li);
|
.prependTo(li);
|
||||||
|
|
||||||
var type = (source === "library") ? undefined : source;
|
var type = (source === "library") ? "lib" : source;
|
||||||
|
|
||||||
if(hasPermission("playlistadd")) {
|
if(hasPermission("playlistadd")) {
|
||||||
if(hasPermission("playlistnext")) {
|
if(hasPermission("playlistnext")) {
|
||||||
|
@ -914,7 +914,7 @@ function addLibraryButtons(li, id, source) {
|
||||||
socket.emit("uncache", {
|
socket.emit("uncache", {
|
||||||
id: id
|
id: id
|
||||||
});
|
});
|
||||||
li.hide("blind", function() {
|
li.hide("fade", function() {
|
||||||
li.remove();
|
li.remove();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
@ -999,17 +999,17 @@ function playlistMove(from, after, cb) {
|
||||||
var q = $("#queue");
|
var q = $("#queue");
|
||||||
|
|
||||||
if(after === "prepend") {
|
if(after === "prepend") {
|
||||||
lifrom.hide("blind", function() {
|
lifrom.hide("fade", function() {
|
||||||
lifrom.detach();
|
lifrom.detach();
|
||||||
lifrom.prependTo(q);
|
lifrom.prependTo(q);
|
||||||
lifrom.show("blind", cb);
|
lifrom.show("fade", cb);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if(after === "append") {
|
else if(after === "append") {
|
||||||
lifrom.hide("blind", function() {
|
lifrom.hide("fade", function() {
|
||||||
lifrom.detach();
|
lifrom.detach();
|
||||||
lifrom.appendTo(q);
|
lifrom.appendTo(q);
|
||||||
lifrom.show("blind", cb);
|
lifrom.show("fade", cb);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1018,10 +1018,10 @@ function playlistMove(from, after, cb) {
|
||||||
cb(false);
|
cb(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lifrom.hide("blind", function() {
|
lifrom.hide("fade", function() {
|
||||||
lifrom.detach();
|
lifrom.detach();
|
||||||
lifrom.insertAfter(liafter);
|
lifrom.insertAfter(liafter);
|
||||||
lifrom.show("blind", cb);
|
lifrom.show("fade", cb);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,11 +245,7 @@
|
||||||
border-color: #bce8f1;
|
border-color: #bce8f1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#queue {
|
#queue > li:last-child {
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#queue li:last-child {
|
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
@ -479,3 +475,11 @@
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.qfalert {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#customembed-content {
|
||||||
|
font-family: Monospace;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue