mirror of
https://github.com/iv-org/invidious.git
synced 2025-07-09 21:55:47 -05:00
Merge 789b561c76b3f746ad1ce22d78a14919d5d4eb5a into 03f89be9291b70ea7234e4291348e80b6c2c5d4e
This commit is contained in:
commit
d88770e571
@ -550,6 +550,11 @@ span > select {
|
|||||||
color: #565d64;
|
color: #565d64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.light-theme .video-badges > span {
|
||||||
|
background: rgb(235, 235, 235);
|
||||||
|
color: #828282;
|
||||||
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: light) {
|
@media (prefers-color-scheme: light) {
|
||||||
.no-theme a:hover,
|
.no-theme a:hover,
|
||||||
.no-theme a:active,
|
.no-theme a:active,
|
||||||
@ -596,6 +601,11 @@ span > select {
|
|||||||
.light-theme .pure-menu-heading {
|
.light-theme .pure-menu-heading {
|
||||||
color: #565d64;
|
color: #565d64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-theme .video-badges > span {
|
||||||
|
background: rgb(235, 235, 235);
|
||||||
|
color: #828282;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -658,6 +668,12 @@ body.dark-theme {
|
|||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dark-theme .video-badges > span {
|
||||||
|
background: rgb(50, 50, 50);
|
||||||
|
color: #9e9e9e;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
.no-theme a:hover,
|
.no-theme a:hover,
|
||||||
.no-theme a:active,
|
.no-theme a:active,
|
||||||
@ -719,6 +735,11 @@ body.dark-theme {
|
|||||||
.no-theme footer a {
|
.no-theme footer a {
|
||||||
color: #adadad !important;
|
color: #adadad !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-theme .video-badges > span {
|
||||||
|
background: rgb(50, 50, 50);
|
||||||
|
color: #9e9e9e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -816,3 +837,19 @@ h1, h2, h3, h4, h5, p,
|
|||||||
#download_widget {
|
#download_widget {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.video-badges > span {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
|
||||||
|
padding: 2px 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.video-badges > i {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
@ -1008,3 +1008,12 @@ default_user_preferences:
|
|||||||
## Default: false
|
## Default: false
|
||||||
##
|
##
|
||||||
#extend_desc: false
|
#extend_desc: false
|
||||||
|
|
||||||
|
##
|
||||||
|
## Allows excluding videos that are exclusive to channel members
|
||||||
|
## from the frontend
|
||||||
|
##
|
||||||
|
## Accepted values: true, false
|
||||||
|
## Default: false
|
||||||
|
##
|
||||||
|
#exclude_members_only_videos: false
|
||||||
|
@ -501,5 +501,8 @@
|
|||||||
"toggle_theme": "Toggle Theme",
|
"toggle_theme": "Toggle Theme",
|
||||||
"carousel_slide": "Slide {{current}} of {{total}}",
|
"carousel_slide": "Slide {{current}} of {{total}}",
|
||||||
"carousel_skip": "Skip the Carousel",
|
"carousel_skip": "Skip the Carousel",
|
||||||
"carousel_go_to": "Go to slide `x`"
|
"carousel_go_to": "Go to slide `x`",
|
||||||
|
"video_badges_members_only": "Members only",
|
||||||
|
"video_badges_members_first": "Members first",
|
||||||
|
"preferences_exclude_members_only_videos_label": "Hide channel member-only videos"
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ struct ConfigPreferences
|
|||||||
property vr_mode : Bool = true
|
property vr_mode : Bool = true
|
||||||
property show_nick : Bool = true
|
property show_nick : Bool = true
|
||||||
property save_player_pos : Bool = false
|
property save_player_pos : Bool = false
|
||||||
|
property exclude_members_only_videos : Bool = false
|
||||||
|
|
||||||
def to_tuple
|
def to_tuple
|
||||||
{% begin %}
|
{% begin %}
|
||||||
|
@ -9,6 +9,8 @@ enum VideoBadges
|
|||||||
VR180
|
VR180
|
||||||
VR360
|
VR360
|
||||||
ClosedCaptions
|
ClosedCaptions
|
||||||
|
MembersOnly
|
||||||
|
MembersFirst
|
||||||
end
|
end
|
||||||
|
|
||||||
struct SearchVideo
|
struct SearchVideo
|
||||||
@ -133,6 +135,7 @@ struct SearchVideo
|
|||||||
json.field "isVr360", self.badges.vr360?
|
json.field "isVr360", self.badges.vr360?
|
||||||
json.field "is3d", self.badges.three_d?
|
json.field "is3d", self.badges.three_d?
|
||||||
json.field "hasCaptions", self.badges.closed_captions?
|
json.field "hasCaptions", self.badges.closed_captions?
|
||||||
|
json.field "isMembersOnly", self.badges.members_only?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -150,6 +153,13 @@ struct SearchVideo
|
|||||||
def upcoming?
|
def upcoming?
|
||||||
premiere_timestamp ? true : false
|
premiere_timestamp ? true : false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Shorthand to check whether the video is restricted to only channel members
|
||||||
|
#
|
||||||
|
# Whether as an early access video ("members first") or only for members ("members only")
|
||||||
|
def restricted_to_members?
|
||||||
|
return badges.members_only? || badges.members_first?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
struct SearchPlaylistVideo
|
struct SearchPlaylistVideo
|
||||||
|
@ -144,6 +144,10 @@ module Invidious::Routes::PreferencesRoute
|
|||||||
notifications_only ||= "off"
|
notifications_only ||= "off"
|
||||||
notifications_only = notifications_only == "on"
|
notifications_only = notifications_only == "on"
|
||||||
|
|
||||||
|
exclude_members_only_videos = env.params.body["exclude_members_only_videos"]?.try &.as(String)
|
||||||
|
exclude_members_only_videos ||= "off"
|
||||||
|
exclude_members_only_videos = exclude_members_only_videos == "on"
|
||||||
|
|
||||||
# Convert to JSON and back again to take advantage of converters used for compatibility
|
# Convert to JSON and back again to take advantage of converters used for compatibility
|
||||||
preferences = Preferences.from_json({
|
preferences = Preferences.from_json({
|
||||||
annotations: annotations,
|
annotations: annotations,
|
||||||
@ -180,6 +184,7 @@ module Invidious::Routes::PreferencesRoute
|
|||||||
vr_mode: vr_mode,
|
vr_mode: vr_mode,
|
||||||
show_nick: show_nick,
|
show_nick: show_nick,
|
||||||
save_player_pos: save_player_pos,
|
save_player_pos: save_player_pos,
|
||||||
|
exclude_members_only_videos: exclude_members_only_videos,
|
||||||
}.to_json)
|
}.to_json)
|
||||||
|
|
||||||
if user = env.get? "user"
|
if user = env.get? "user"
|
||||||
|
@ -57,6 +57,8 @@ struct Preferences
|
|||||||
property volume : Int32 = CONFIG.default_user_preferences.volume
|
property volume : Int32 = CONFIG.default_user_preferences.volume
|
||||||
property save_player_pos : Bool = CONFIG.default_user_preferences.save_player_pos
|
property save_player_pos : Bool = CONFIG.default_user_preferences.save_player_pos
|
||||||
|
|
||||||
|
property exclude_members_only_videos : Bool = CONFIG.default_user_preferences.exclude_members_only_videos
|
||||||
|
|
||||||
module BoolToString
|
module BoolToString
|
||||||
def self.to_json(value : String, json : JSON::Builder)
|
def self.to_json(value : String, json : JSON::Builder)
|
||||||
json.string value
|
json.string value
|
||||||
|
@ -200,6 +200,19 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
<% if item.responds_to?(:badges) && !item.badges.none? %>
|
||||||
|
<div class="video-card-row flexible video-badges">
|
||||||
|
<%
|
||||||
|
# TODO Other types of badges
|
||||||
|
%>
|
||||||
|
<% if item.badges.members_only? %>
|
||||||
|
<span><i class="icon ion ion-md-lock"></i><%=translate(locale, "video_badges_members_only")%></span>
|
||||||
|
<% end %>
|
||||||
|
<% if item.badges.members_first? %>
|
||||||
|
<span><i class="icon ion ion-md-lock"></i><%=translate(locale, "video_badges_members_first")%></span>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<%end%>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
<%= page_nav_html %>
|
<%= page_nav_html %>
|
||||||
|
<% exclude_members_only_videos = env.get("preferences").as(Preferences).exclude_members_only_videos %>
|
||||||
|
|
||||||
<div class="pure-g">
|
<div class="pure-g">
|
||||||
<%- items.each do |item| -%>
|
<%- items.each do |item| -%>
|
||||||
|
<% next if exclude_members_only_videos && item.responds_to?(:restricted_to_members?) && item.restricted_to_members? %>
|
||||||
<%= rendered "components/item" %>
|
<%= rendered "components/item" %>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
<div class="pure-g">
|
<div class="pure-g">
|
||||||
<% trending.each do |item| %>
|
<% trending.each do |item| %>
|
||||||
|
<% next %>
|
||||||
<%= rendered "components/item" %>
|
<%= rendered "components/item" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -194,6 +194,12 @@
|
|||||||
</select>
|
</select>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="pure-control-group">
|
||||||
|
<label for="exclude_members_only_videos"><%= translate(locale, "preferences_exclude_members_only_videos_label") %></label>
|
||||||
|
<input name="exclude_members_only_videos" id="exclude_members_only_videos" type="checkbox" <% if preferences.exclude_members_only_videos %>checked<% end %>>
|
||||||
|
</div>
|
||||||
|
|
||||||
<% if env.get? "user" %>
|
<% if env.get? "user" %>
|
||||||
<div class="pure-control-group">
|
<div class="pure-control-group">
|
||||||
<label for="show_nick"><%= translate(locale, "preferences_show_nick_label") %></label>
|
<label for="show_nick"><%= translate(locale, "preferences_show_nick_label") %></label>
|
||||||
|
@ -135,6 +135,10 @@ private module Parsers
|
|||||||
when "Premium"
|
when "Premium"
|
||||||
# TODO: Potentially available as item_contents["topStandaloneBadge"]["metadataBadgeRenderer"]
|
# TODO: Potentially available as item_contents["topStandaloneBadge"]["metadataBadgeRenderer"]
|
||||||
badges |= VideoBadges::Premium
|
badges |= VideoBadges::Premium
|
||||||
|
when "Members only"
|
||||||
|
badges |= VideoBadges::MembersOnly
|
||||||
|
when "Members first"
|
||||||
|
badges |= VideoBadges::MembersFirst
|
||||||
else nil # Ignore
|
else nil # Ignore
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user