mirror of https://github.com/calzoneman/sync.git
Merge pull request #281 from unbibium/master
[MERGE] Add /clean and /cleantitle commands for moderators
This commit is contained in:
commit
04b9537afc
|
@ -91,6 +91,12 @@ function handle(chan, user, msg, data) {
|
|||
else if(msg.indexOf("/clear") == 0) {
|
||||
handleClear(chan, user);
|
||||
}
|
||||
else if(msg.indexOf("/clean ") == 0) {
|
||||
handleClean(chan, user, msg.substring(7));
|
||||
}
|
||||
else if(msg.indexOf("/cleantitle ") == 0) {
|
||||
handleCleanTitle(chan, user, msg.substring(12));
|
||||
}
|
||||
}
|
||||
|
||||
function handleMute(chan, user, args) {
|
||||
|
@ -243,5 +249,63 @@ function handleClear(chan, user) {
|
|||
chan.sendAll("clearchat");
|
||||
}
|
||||
|
||||
var user_input_re = /^(-[img]+\s+)/i
|
||||
|
||||
function user_input_regexp(target) {
|
||||
var m = target.match(user_input_re);
|
||||
var flags = "";
|
||||
if (m) {
|
||||
flags = m[0].slice(1,-1);
|
||||
target = target.replace(user_input_re, "");
|
||||
}
|
||||
return new RegExp(target, flags);
|
||||
}
|
||||
|
||||
function handleClean(chan, user, target) {
|
||||
// you can use regexps, in case someone tries
|
||||
// to fool you with cyrillic or something.
|
||||
target = user_input_regexp(target);
|
||||
cleanPlaylist(chan, user, function(item) {
|
||||
return target.test(item.queueby);
|
||||
});
|
||||
}
|
||||
|
||||
function handleCleanTitle(chan, user, target) {
|
||||
target = user_input_regexp(target);
|
||||
cleanPlaylist(chan, user, function(item) {
|
||||
return target.exec(item.media.title) !== null;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
Remove all videos by a particular user.
|
||||
*/
|
||||
function cleanPlaylist(chan, user, filter) {
|
||||
if(!chan.hasPermission(user, "playlistdelete")) {
|
||||
return;
|
||||
}
|
||||
// local variables for deleteNext() callback
|
||||
var pl = chan.playlist;
|
||||
var count = 0;
|
||||
var matches = pl.items.findAll(filter);
|
||||
var deleteNext;
|
||||
deleteNext = function() {
|
||||
if (count < matches.length) {
|
||||
var uid=matches[count].uid;
|
||||
count += 1
|
||||
chan.sendAll("delete", {
|
||||
uid: uid
|
||||
});
|
||||
pl.remove(uid, deleteNext);
|
||||
} else {
|
||||
// refresh playlist only once, at the end
|
||||
chan.broadcastPlaylistMeta();
|
||||
}
|
||||
}
|
||||
// start initial callback
|
||||
deleteNext();
|
||||
return;
|
||||
}
|
||||
|
||||
exports.handle = handle;
|
||||
|
||||
|
|
|
@ -181,4 +181,14 @@ ULList.prototype.findVideoId = function (id) {
|
|||
return false;
|
||||
};
|
||||
|
||||
ULList.prototype.findAll = function(fn) {
|
||||
var result = [];
|
||||
this.forEach(function(item) {
|
||||
if( fn(item) ) {
|
||||
result.push(item);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
exports.ULList = ULList;
|
||||
|
|
348
www/help.html
348
www/help.html
|
@ -1,348 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CyTube - Help</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 */
|
||||
}
|
||||
</style>
|
||||
<link href="./assets/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="brand" href="#">CyTube</a>
|
||||
<div class="nav-collapse collapse">
|
||||
<ul class="nav">
|
||||
<li><a href="index.html">Home</a></li>
|
||||
<li class="active"><a href="#">Help</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="span8">
|
||||
<a name="troubleshooting"></a>
|
||||
<a href="#troubleshooting"><h1>Troubleshooting</h1></a>
|
||||
<p>There are many reasons why you might encounter issues with CyTube. Below are some common steps to isolate and identify the problem.</p>
|
||||
<ul>
|
||||
<li>Try a different browser. CyTube is tested in Firefox and Chromium, but you may find a browser-specific issue I don't know about</li>
|
||||
<li>Make sure HTTPS Everywhere (if you have this extension) is disabled for YouTube. This is known not to be compatible</li>
|
||||
<li>Try clearing your cookies and cache</li>
|
||||
<li>Disable all extensions, see if it works, and enable them one by one until you figure out which extension conflicts</li>
|
||||
</ul>
|
||||
<p>If you do encounter issues, please report them. You can open an issue on <a href="http://github.com/calzoneman/sync">GitHub</a> or join the #synchtube channel on <a href="http://webchat.6irc.net/?channels=chat,synchtube">6irc</a>.</p>
|
||||
<br>
|
||||
<a name="chatcommands"></a>
|
||||
<a href="#chatcommands"><h1>Chat Commands</h1></a>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Command</th>
|
||||
<th>Rank</th>
|
||||
<th>Result</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td><pre>/sp Spoiler Alert!</pre></td>
|
||||
<td>Anyone</td>
|
||||
<td><span class="spoiler">Spoiler Alert!</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>/me does something</pre></td>
|
||||
<td>Anyone</td>
|
||||
<td><span class="action">username does something</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>/afk</pre></td>
|
||||
<td>Anyone</td>
|
||||
<td>Toggles your AFK (away from keyboard) status. While AFK, your name will appear in italics with a clock icon.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>/say This is important!</pre></td>
|
||||
<td>Moderators</td>
|
||||
<td><span class="shout">This is important!</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>/kick username</pre></td>
|
||||
<td>Moderators</td>
|
||||
<td>(username is kicked from the room)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>/ban username</pre></td>
|
||||
<td>Moderators</td>
|
||||
<td>(username is banned from the room)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>/ipban username</pre></td>
|
||||
<td>Moderators</td>
|
||||
<td>(username is IP banned from the room)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>/unban name|ip_address</pre></td>
|
||||
<td>Moderators</td>
|
||||
<td>(The user is unbanned from the room)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>/poll Title,Option 1,Option 2,etc</pre></td>
|
||||
<td>Moderators</td>
|
||||
<td>
|
||||
<div class="well active">
|
||||
<button class="close pull-right">×</button>
|
||||
<button class="btn btn-danger pull-right">End Poll</button>
|
||||
<h3>Title</h3>
|
||||
<div class="option">
|
||||
<button class="btn">0</button>
|
||||
Option 1
|
||||
</div>
|
||||
<div class="option">
|
||||
<button class="btn">0</button>
|
||||
Option 2
|
||||
</div>
|
||||
<div class="option">
|
||||
<button class="btn">0</button>
|
||||
etc
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>/poll</pre> (no parameters)</td>
|
||||
<td>Moderators</td>
|
||||
<td>A poll editor is popped up allowing for easy creation of the poll, and allowing commas in the poll title and options</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><pre>/clear</pre></td>
|
||||
<td>Moderators</td>
|
||||
<td>The chat buffer is cleared</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>There are also some other chat features. When your name appears in a message, <span class="nick-highlight">the message will be highlighted.</span> If you type the beginning of someone's name in chat, pressing tab will attempt to autocomplete the name.</p>
|
||||
|
||||
<a name="queuecontrols"></a>
|
||||
<a href="#queuecontrols"><h1>Queue Controls</h1></a>
|
||||
<p>Queue Controls are only visible to moderators by default. A moderator can unlock the queue to make the controls visible to everyone.<br> Below is an example of the queue controls. On your channel, simply paste a link of one of the following accepted formats and press "Next" to add it after the current video, or "End" to add it at the end of the playlist. If Voteskip is enabled in <a href="#channeloptions">Channel Options</a>, then pressing voteskip indicates you would like to skip the current video. If a majority of connected users does this, the video will be skipped.</br>
|
||||
</p>
|
||||
<strong>Acceptable URLs</strong>
|
||||
<ul>
|
||||
<li>http://www.youtube.com/watch?v=(videoid)</li>
|
||||
<li>http://www.youtube.com/playlist?list=(playlistid)</li>
|
||||
<li>http://www.vimeo.com/(videoid)</li>
|
||||
<li>http://www.soundcloud.com/(songid)</li>
|
||||
<li>http://www.dailymotion.com/video/(videoid)</li>
|
||||
<li>http://www.twitch.tv/(channel)</li>
|
||||
<li>http://www.justin.tv/(channel)</li>
|
||||
<li>http://www.livestream.com/(channel)</li>
|
||||
<li>http://www.ustream.tv/(channel)</li>
|
||||
<li>rtmp://(stream url)</li>
|
||||
<li>jw:(stream url) - uses a JWPlayer embed (use this for audio streams)
|
||||
</ul>
|
||||
You can also queue multiple items at once by separating the URLs with commas.
|
||||
<div>
|
||||
<input type="text" id="mediaurl" style="margin:auto;">
|
||||
<div class="btn-group">
|
||||
<button class="btn">Next</button>
|
||||
<button class="btn">End</button>
|
||||
</div>
|
||||
<button class="btn btn-block">Voteskip</button>
|
||||
</div>
|
||||
<p>Below is an example of an entry in the playlist. Please note the control buttons only appear if you are a moderator or if the queue is unlocked. The button with vertical arrows is for moving videos in the playlist. Click and hold the button and drag the mouse up and down to move the video in the playlist. The red "X" button will remove the video from the playlist. The green play button will jump the playlist to that video. The arrow button will move the video to the next position after the currently playing video. The flag button will toggle whether the video is temporary (temporary videos are auto-removed after playing once).
|
||||
</p>
|
||||
<ul class="videolist">
|
||||
<li class="well">
|
||||
<div class="btn-group qe_buttons">
|
||||
<button class="btn qe_btn"><i class="icon-resize-vertical"></i></button>
|
||||
<button class="btn btn-danger qe_btn"><i class="icon-remove"></i></button>
|
||||
<button class="btn btn-success qe_btn"><i class="icon-play"></i></button>
|
||||
<button class="btn qe_btn"><i class="icon-share-alt"></i></button>
|
||||
<button class="btn qe_btn btn-danger"><i class="icon-flag"></i></button>
|
||||
</div>
|
||||
<div class="qe_title">Title</div>
|
||||
<div class="qe_time">00:00</div>
|
||||
<div class="qe_clear"></div>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Moderators will also see the "(Un)Lock Queue" button. This button can be used to toggle whether anyone can add videos, or just moderators.
|
||||
</p>
|
||||
<button class="btn btn-danger" style="width: 100%">Unlock Queue</button>
|
||||
<button class="btn btn-success" style="width: 100%">Lock Queue</button>
|
||||
<a name="userlistcontrols"></a>
|
||||
<a href="#userlistcontrols"><h1>Userlist Controls</h1></a>
|
||||
<div class="dropdown">
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu" style="display: block;">
|
||||
<li><a tabindex="-1" href="javascript:void(0);">Ignore User</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a tabindex="-1" href="javascript:void(0);">Make Leader</a></li>
|
||||
<li><a tabindex="-1" href="javascript:void(0);">Take Leader</a></li>
|
||||
<li><a tabindex="-1" href="javascript:void(0);">Kick</a></li>
|
||||
<li><a tabindex="-1" href="javascript:void(0);">IP Ban</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a tabindex="-1" href="javascript:void(0);">Promote</a></li>
|
||||
<li><a tabindex="-1" href="javascript:void(0);">Demote</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<table class="table table-bordered table-striped" style="margin-top: 280px">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Function</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>Ignore User</td>
|
||||
<td>Ignores incoming chat messages from this user
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Make Leader</td>
|
||||
<td>Assigns leadership of the media to this user. When someone is assigned leadership, the server follows their video/audio and syncs other clients to them. This allows for seeking within the video. By default, the server leads by itself.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Take Leader</td>
|
||||
<td>Revokes leadership from this user and the server takes over</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Kick</td>
|
||||
<td>Kicks this user from the room</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>IP Ban</td>
|
||||
<td>IP bans this user from the room. This can be reversed using the /unban chat command or from the ban list interface</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Promote</td>
|
||||
<td>Increases this user's rank in this channel by 1. All users start with rank 0. Moderators have rank 2, channel owners have rank 3. When you register a channel, you are assigned rank 10.
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Demote</td>
|
||||
<td>Decreases this user's rank in this channel by 1. All users start with rank 0. Moderators have rank 2, channel owners have rank 3. When you register a channel, you are assigned rank 10.
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<a name="synchronization"></a>
|
||||
<a href="#synchronization"><h1>Synchronization and Leaders</h1></a>
|
||||
<p>
|
||||
Synchronization is handled a little bit differently from Synchtube. By default, media synchronization is managed by the server, which sends out synchronization updates every 5 seconds. This means if you attempt to seek your client manually, it will be jumped back to the server's position. If you need to seek the video, you can assign leader to someone (see <a href="#userlistcontrols">Userlist Controls</a>). Giving someone leader makes the video follow their client, so any seeking they do will be broadcast to everyone in the channel.<br>
|
||||
When someone is leader, they also get partial moderator powers temporarily. Leaders can open polls, use <code>/say</code>, and manage the queue, but cannot kick/ban, change channel options, or change chat filters. This is useful if you want to leave someone in charge but not make them a full moderator. Leadership is revoked upon refresh, or you can revoke it manually.
|
||||
</p>
|
||||
<br>
|
||||
<a name="channeloptions"></a>
|
||||
<a href="#channeloptions"><h1>Channel Options</h1></a>
|
||||
<p>
|
||||
Moderators have access to a menu (at the bottom of the page) for toggling various channel options. This is pretty self explanatory. The "Channel Options" tab contains various channel settings, the "Ban List" tab allows you to view and lift IP Bans, and the "MOTD" tab allows you to edit the message of the day. The "Chat Filters" tab is explained below.
|
||||
</p>
|
||||
<br>
|
||||
|
||||
<a name="chatfilters"></a>
|
||||
<a href="#chatfilters"><h1>Chat Filters</h1></a>
|
||||
<p>
|
||||
Moderators can apply various filters to chat messages using Regular Expressions. The first column contains a button to remove filters. The second is a name to identify the filter. The third is the regular expression to match in the message. The fourth is the regular expression flags (g = replace all, i = not case sensitive, gi is the combination of the two, etc). The fifth is the replacement text, and the last is a checkbox for toggling the filter on/off. Regular Expressions are given in Javascript syntax. The following example replaces money amounts of the form "$amount" to "amount dollars":</p><br>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<th></th>
|
||||
<th>Name</th>
|
||||
<th>Regex</th>
|
||||
<th>Flags</th>
|
||||
<th>Replacement</th>
|
||||
<th>Active</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<button class="btn btn-mini btn-danger">
|
||||
<i class="icon-remove-circle"></i>
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
<code>The dollar filter</code>
|
||||
</td>
|
||||
<td>
|
||||
<code>\$([0-9\.]+)</code>
|
||||
</td>
|
||||
<td>
|
||||
<code>g</code>
|
||||
</td>
|
||||
<td>
|
||||
<code>$1 dollars</code>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" checked="checked">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a name="ranks"></a>
|
||||
<a href="#ranks"><h1>Ranks</h1></a>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Rank Name</th>
|
||||
<th>Numeric Rank</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td class="userlist_siteadmin">Website Administrator</td>
|
||||
<td>255+</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="userlist_owner">Channel Administrator</td>
|
||||
<td>3-254</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="userlist_op">Channel Moderator</td>
|
||||
<td>2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>User</td>
|
||||
<td>1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="userlist_guest">Guest</td>
|
||||
<td>0</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<a name="3rdparty"></a>
|
||||
<a href="#3rdparty"><h1>Third party tools</h1></a>
|
||||
<table class="table table-bordered table-stripped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>Link</th>
|
||||
<tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>CyNaoko</td>
|
||||
<td>CyTube version of Naoko SychTube bot</td>
|
||||
<td><a href="https://github.com/Suwako/cyNaoko" target="_blank">Link</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- /container -->
|
||||
|
||||
<script src="./assets/js/jquery.js"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue