Add permission for #402; fix a strange jwplayer issue
This commit is contained in:
parent
71114b0060
commit
2b60ab8e10
|
@ -27,6 +27,7 @@ const DEFAULT_PERMISSIONS = {
|
|||
pollvote: -1, // Vote in polls
|
||||
viewhiddenpoll: 1.5, // View results of hidden polls
|
||||
voteskip: -1, // Vote to skip the current video
|
||||
viewvoteskip: 1.5, // View voteskip results
|
||||
mute: 1.5, // Mute other users
|
||||
kick: 1.5, // Kick other users
|
||||
ban: 2, // Ban other users
|
||||
|
@ -253,6 +254,10 @@ PermissionsModule.prototype.canVoteskip = function (account) {
|
|||
return this.hasPermission(account, "voteskip");
|
||||
};
|
||||
|
||||
PermissionsModule.prototype.canSeeVoteskipResults = function (actor) {
|
||||
return this.hasPermission(actor, "viewvoteskip");
|
||||
};
|
||||
|
||||
PermissionsModule.prototype.canMute = function (actor) {
|
||||
return this.hasPermission(actor, "mute");
|
||||
};
|
||||
|
@ -363,6 +368,7 @@ PermissionsModule.prototype.loadUnregistered = function () {
|
|||
pollvote: -1, // Vote in polls
|
||||
viewhiddenpoll: 1.5, // View results of hidden polls
|
||||
voteskip: -1, // Vote to skip the current video
|
||||
viewvoteskip: 1.5, // View voteskip results
|
||||
playlistlock: 2, // Lock/unlock the playlist
|
||||
leaderctl: 0, // Give/take leader
|
||||
drink: 0, // Use the /d command
|
||||
|
|
|
@ -93,8 +93,10 @@ VoteskipModule.prototype.sendVoteskipData = function (users) {
|
|||
: 0
|
||||
};
|
||||
|
||||
var perms = this.channel.modules.permissions;
|
||||
|
||||
users.forEach(function (u) {
|
||||
if (u.account.effectiveRank >= 1.5) {
|
||||
if (perms.canSeeVoteskipResults(u)) {
|
||||
u.socket.emit("voteskip", data);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -18,6 +18,31 @@ var Server = require("./server");
|
|||
var Config = require("./config");
|
||||
var ffmpeg = require("./ffmpeg");
|
||||
|
||||
/*
|
||||
* Preference map of quality => youtube formats.
|
||||
* see https://en.wikipedia.org/wiki/Youtube#Quality_and_codecs
|
||||
*
|
||||
* Prefer WebM over MP4, ignore other codecs (e.g. FLV)
|
||||
*/
|
||||
const GOOGLE_PREFERENCE = {
|
||||
"hd1080": [46, 37],
|
||||
"hd720": [45, 22],
|
||||
"large": [44, 59],
|
||||
"medium": [43, 18, 34] // 34 is 360p FLV as a last-ditch
|
||||
};
|
||||
|
||||
const CONTENT_TYPES = {
|
||||
43: "webm",
|
||||
44: "webm",
|
||||
45: "webm",
|
||||
46: "webm",
|
||||
18: "mp4",
|
||||
22: "mp4",
|
||||
37: "mp4",
|
||||
59: "mp4",
|
||||
34: "flv"
|
||||
};
|
||||
|
||||
var urlRetrieve = function (transport, options, callback) {
|
||||
// Catch any errors that crop up along the way of the request
|
||||
// in order to prevent them from reaching the global handler.
|
||||
|
@ -720,32 +745,26 @@ var Getters = {
|
|||
videos[parts[0]] = parts[1];
|
||||
});
|
||||
|
||||
/*
|
||||
* Preference map of quality => youtube formats.
|
||||
* see https://en.wikipedia.org/wiki/Youtube#Quality_and_codecs
|
||||
*
|
||||
* Prefer WebM over MP4, ignore other codecs (e.g. FLV)
|
||||
*/
|
||||
const preference = {
|
||||
"hd1080": [46, 37],
|
||||
"hd720": [45, 22],
|
||||
"large": [44, 59],
|
||||
"medium": [43, 18]
|
||||
};
|
||||
|
||||
var direct = {};
|
||||
|
||||
for (var key in preference) {
|
||||
for (var i = 0; i < preference[key].length; i++) {
|
||||
var format = preference[key][i];
|
||||
for (var key in GOOGLE_PREFERENCE) {
|
||||
for (var i = 0; i < GOOGLE_PREFERENCE[key].length; i++) {
|
||||
var format = GOOGLE_PREFERENCE[key][i];
|
||||
|
||||
if (format in videos) {
|
||||
direct[key] = videos[format];
|
||||
direct[key] = {
|
||||
url: videos[format],
|
||||
contentType: CONTENT_TYPES[format]
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(direct).length === 0) {
|
||||
return callback("No valid links could be extracted", null);
|
||||
}
|
||||
|
||||
callback(null, new Media(id, title, seconds, "gd", { gpdirect: direct }));
|
||||
} catch (e) {
|
||||
return callback("Failed to parse Google Docs output", null);
|
||||
|
@ -853,25 +872,17 @@ var Getters = {
|
|||
videos[video.format] = video;
|
||||
});
|
||||
|
||||
/*
|
||||
* Preference map of quality => youtube formats.
|
||||
* see https://en.wikipedia.org/wiki/Youtube#Quality_and_codecs
|
||||
*/
|
||||
const preference = {
|
||||
"hd1080": [46, 37],
|
||||
"hd720": [45, 22],
|
||||
"large": [44, 59],
|
||||
"medium": [43, 18]
|
||||
};
|
||||
|
||||
var direct = {};
|
||||
|
||||
for (var key in preference) {
|
||||
for (var i = 0; i < preference[key].length; i++) {
|
||||
var format = preference[key][i];
|
||||
for (var key in GOOGLE_PREFERENCE) {
|
||||
for (var i = 0; i < GOOGLE_PREFERENCE[key].length; i++) {
|
||||
var format = GOOGLE_PREFERENCE[key][i];
|
||||
|
||||
if (format in videos) {
|
||||
direct[key] = videos[format].link;
|
||||
direct[key] = {
|
||||
url: videos[format],
|
||||
contentType: CONTENT_TYPES[format]
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ html(lang="en")
|
|||
script(src="/js/callbacks.js")
|
||||
script(defer, src="https://www.youtube.com/iframe_api")
|
||||
script(defer, src="//api.dmcdn.net/all.js")
|
||||
script(defer, src="/js/jwplayer.js")
|
||||
script(defer, src="//jwpsrv.com/library/QouFCLBMEeKC+CIACpYGxA.js")
|
||||
script(defer, src="/js/sc.js")
|
||||
script(defer, src="/js/froogaloop.min.js")
|
||||
script(defer, src="/js/swf.js")
|
||||
|
|
53
templates/privacy-policy.jade
Normal file
53
templates/privacy-policy.jade
Normal file
|
@ -0,0 +1,53 @@
|
|||
doctype html
|
||||
html(lang="en")
|
||||
head
|
||||
include head
|
||||
mixin head()
|
||||
body
|
||||
#wrap
|
||||
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
|
||||
include nav
|
||||
mixin navheader()
|
||||
#nav-collapsible.collapse.navbar-collapse
|
||||
ul.nav.navbar-nav
|
||||
mixin navdefaultlinks("/policies/privacy")
|
||||
mixin navloginlogout("/policies/privacy")
|
||||
section#mainpage
|
||||
.container
|
||||
.col-md-12
|
||||
h1 Privacy Policy
|
||||
p.
|
||||
Your privacy is very important to us. Accordingly, we have developed this Policy in order for you to understand how we collect, use, communicate, and disclose and make use of personal information. Some of this information is collected automatically, while other information is provided by you. By visiting #{siteTitle} (#{domain}), you agree to allow #{siteTitle} to collect and use the information in the manner described in this policy.
|
||||
h2 Collected Automatically
|
||||
h4 Browser Information
|
||||
p
|
||||
| When you visit #{siteTitle}, certain information is automatically sent by your browser, including:
|
||||
ul
|
||||
li Your IP (Internet Protocol) address, which may be associated with an Internet Service Provider and country of residence
|
||||
li The name and version of the browser you are connecting with (User-Agent string)
|
||||
li The page or resource you are requesting
|
||||
| This information is not shared with third parties, except if you consent to disclosure or we are required by law to disclose this information. Your IP address may be logged and used to identify you for administrative purposes, such as revoking access to abusive users. It may also be used in aggregation of anonymous statistics. Your browser's name and version number (User-Agent string) may be used to provide content best suited for your device, in the case of resources which have multiple representations.
|
||||
h4 Cookies
|
||||
p
|
||||
| Certain information, such as authentication tokens used to identify your account after logging in, and your theme preference are stored in "cookies" on your browser. This information is sent to #{siteTitle}'s servers automatically when you request a page. The login cookie is used to verify your identity with respect to your account, and the theme cookie is used to present the page using your preferred theme. Neither cookie is explicitly shared with third parties, however it is possible they may be observed by an intermediary, especially if you are browsing on an insecure network.
|
||||
h4 localStorage
|
||||
| Information about your website preferences, such as those configurable from the Options dialog on a channel page, is stored in your browser via the HTML5 localStorage interface. This information is used to persist your desired settings across multiple sessions on the website. This information is not explicitly shared with third parties, however any entity which has access to your browser, including userscripts, may read or modify it.
|
||||
h2 Provided by You
|
||||
h4 Account Information
|
||||
p
|
||||
| In order to register an account, you must provide the following information:
|
||||
ul
|
||||
li A username, which uniquely identifies the account
|
||||
li A password
|
||||
| Your username and password will be stored on #{siteTitle}'s servers and used for the purposes of authentication. Passwords are hashed with bcrypt before storage; at no time is the plain password recorded in persistent storage. Usernames and passwords are never shared with third parties, to the extent permitted by United States law.
|
||||
| You may optionally provide additional information associated with your account:
|
||||
ul
|
||||
li An email address
|
||||
li A profile image
|
||||
li A brief profile summary (text)
|
||||
| All of this information is stored on #{siteTitle}'s servers. Your email address will only be used for the purposes of verifying your identity in case you are unable to login to your account. It is not shared with third parties, nor will it be used to communicate arbitrary information to you. Your profile image and summary are visible publicly.
|
||||
h4 Channel Information
|
||||
p
|
||||
| When you register a channel on #{siteTitle}, you may optionally provide certain information
|
||||
include footer
|
||||
mixin footer()
|
|
@ -703,8 +703,14 @@ var JWPlayer = function (data) {
|
|||
file: self.videoURL,
|
||||
width: VWIDTH,
|
||||
height: VHEIGHT,
|
||||
autostart: true
|
||||
autostart: true,
|
||||
type: data.contentType
|
||||
});
|
||||
|
||||
jwplayer().onReady(function () {
|
||||
resizeStuff();
|
||||
});
|
||||
|
||||
jwplayer().onPlay(function() {
|
||||
self.paused = false;
|
||||
if(CLIENT.leader)
|
||||
|
|
|
@ -1766,6 +1766,7 @@ function genPermissionsEditor() {
|
|||
makeOption("Vote", "pollvote", standard, CHANNEL.perms.pollvote+"");
|
||||
makeOption("View hidden poll results", "viewhiddenpoll", standard, CHANNEL.perms.viewhiddenpoll+"");
|
||||
makeOption("Voteskip", "voteskip", standard, CHANNEL.perms.voteskip+"");
|
||||
makeOption("View voteskip results", "viewvoteskip", standard, CHANNEL.perms.viewvoteskip+"");
|
||||
|
||||
addDivider("Moderation");
|
||||
makeOption("Assign/Remove leader", "leaderctl", modplus, CHANNEL.perms.leaderctl+"");
|
||||
|
@ -2756,6 +2757,7 @@ function googlePlusSimulator2014(data) {
|
|||
}
|
||||
}
|
||||
|
||||
data.url = data.meta.gpdirect[q];
|
||||
data.url = data.meta.gpdirect[q].url;
|
||||
data.contentType = data.meta.gpdirect[q].contentType;
|
||||
return data;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue