mirror of
https://github.com/iv-org/invidious.git
synced 2024-06-07 19:40:52 +00:00
commit
1c5db46a4d
@ -86,7 +86,7 @@ if (location.pathname.startsWith('/embed/')) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect mobile users and initalize mobileUi for better UX
|
// Detect mobile users and initialize mobileUi for better UX
|
||||||
// Detection code taken from https://stackoverflow.com/a/20293441
|
// Detection code taken from https://stackoverflow.com/a/20293441
|
||||||
|
|
||||||
function isMobile() {
|
function isMobile() {
|
||||||
@ -119,7 +119,7 @@ if (isMobile()) {
|
|||||||
operations_bar_element.className += " mobile-operations-bar"
|
operations_bar_element.className += " mobile-operations-bar"
|
||||||
player.addChild(operations_bar)
|
player.addChild(operations_bar)
|
||||||
|
|
||||||
// Playback menu doesn't work when its initalized outside of the primary control bar
|
// Playback menu doesn't work when it's initialized outside of the primary control bar
|
||||||
playback_element = document.getElementsByClassName("vjs-playback-rate")[0]
|
playback_element = document.getElementsByClassName("vjs-playback-rate")[0]
|
||||||
operations_bar_element.append(playback_element)
|
operations_bar_element.append(playback_element)
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ if (isMobile()) {
|
|||||||
player.on('error', function (event) {
|
player.on('error', function (event) {
|
||||||
if (player.error().code === 2 || player.error().code === 4) {
|
if (player.error().code === 2 || player.error().code === 4) {
|
||||||
setTimeout(function (event) {
|
setTimeout(function (event) {
|
||||||
console.log('An error occured in the player, reloading...');
|
console.log('An error occurred in the player, reloading...');
|
||||||
|
|
||||||
var currentTime = player.currentTime();
|
var currentTime = player.currentTime();
|
||||||
var playbackRate = player.playbackRate();
|
var playbackRate = player.playbackRate();
|
||||||
|
@ -77,7 +77,7 @@ function update_mode (mode) {
|
|||||||
// If preference for dark mode indicated
|
// If preference for dark mode indicated
|
||||||
set_mode(true);
|
set_mode(true);
|
||||||
}
|
}
|
||||||
else if (mode === 'false' /* for backwards compaibility */ || mode === 'light') {
|
else if (mode === 'false' /* for backwards compatibility */ || mode === 'light') {
|
||||||
// If preference for light mode indicated
|
// If preference for light mode indicated
|
||||||
set_mode(false);
|
set_mode(false);
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ https_only: false
|
|||||||
#use_quic: false
|
#use_quic: false
|
||||||
|
|
||||||
##
|
##
|
||||||
## Additionnal cookies to be sent when requesting the youtube API.
|
## Additional cookies to be sent when requesting the youtube API.
|
||||||
##
|
##
|
||||||
## Accepted values: a string in the format "name1=value1; name2=value2..."
|
## Accepted values: a string in the format "name1=value1; name2=value2..."
|
||||||
## Default: <none>
|
## Default: <none>
|
||||||
@ -188,7 +188,7 @@ https_only: false
|
|||||||
|
|
||||||
##
|
##
|
||||||
## Path to log file. Can be absolute or relative to the invidious
|
## Path to log file. Can be absolute or relative to the invidious
|
||||||
## binary. This is overriden if "-o OUTPUT" or "--output=OUTPUT"
|
## binary. This is overridden if "-o OUTPUT" or "--output=OUTPUT"
|
||||||
## are passed on the command line.
|
## are passed on the command line.
|
||||||
##
|
##
|
||||||
## Accepted values: a filesystem path or 'STDOUT'
|
## Accepted values: a filesystem path or 'STDOUT'
|
||||||
@ -197,7 +197,7 @@ https_only: false
|
|||||||
#output: STDOUT
|
#output: STDOUT
|
||||||
|
|
||||||
##
|
##
|
||||||
## Logging Verbosity. This is overriden if "-l LEVEL" or
|
## Logging Verbosity. This is overridden if "-l LEVEL" or
|
||||||
## "--log-level=LEVEL" are passed on the command line.
|
## "--log-level=LEVEL" are passed on the command line.
|
||||||
##
|
##
|
||||||
## Accepted values: All, Trace, Debug, Info, Warn, Error, Fatal, Off
|
## Accepted values: All, Trace, Debug, Info, Warn, Error, Fatal, Off
|
||||||
@ -306,7 +306,7 @@ https_only: false
|
|||||||
##
|
##
|
||||||
## Notes:
|
## Notes:
|
||||||
## - Setting this to 0 will disable the channel videos crawl job.
|
## - Setting this to 0 will disable the channel videos crawl job.
|
||||||
## - This setting is overriden if "-c THREADS" or
|
## - This setting is overridden if "-c THREADS" or
|
||||||
## "--channel-threads=THREADS" are passed on the command line.
|
## "--channel-threads=THREADS" are passed on the command line.
|
||||||
##
|
##
|
||||||
## Accepted values: a positive integer
|
## Accepted values: a positive integer
|
||||||
@ -328,7 +328,7 @@ full_refresh: false
|
|||||||
##
|
##
|
||||||
## Notes:
|
## Notes:
|
||||||
## - Setting this to 0 will disable the channel videos crawl job.
|
## - Setting this to 0 will disable the channel videos crawl job.
|
||||||
## - This setting is overriden if "-f THREADS" or
|
## - This setting is overridden if "-f THREADS" or
|
||||||
## "--feed-threads=THREADS" are passed on the command line.
|
## "--feed-threads=THREADS" are passed on the command line.
|
||||||
##
|
##
|
||||||
## Accepted values: a positive integer
|
## Accepted values: a positive integer
|
||||||
@ -371,7 +371,7 @@ feed_threads: 1
|
|||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Miscellanous
|
# Miscellaneous
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
|
||||||
##
|
##
|
||||||
@ -433,7 +433,7 @@ feed_threads: 1
|
|||||||
#cache_annotations: false
|
#cache_annotations: false
|
||||||
|
|
||||||
##
|
##
|
||||||
## Source code URL. If your instance is running a modfied source
|
## Source code URL. If your instance is running a modified source
|
||||||
## code, you MUST publish it somewhere and set this option.
|
## code, you MUST publish it somewhere and set this option.
|
||||||
##
|
##
|
||||||
## Accepted values: a string
|
## Accepted values: a string
|
||||||
@ -520,9 +520,9 @@ default_user_preferences:
|
|||||||
#region: US
|
#region: US
|
||||||
|
|
||||||
##
|
##
|
||||||
## Top 3 prefered languages for video captions.
|
## Top 3 preferred languages for video captions.
|
||||||
##
|
##
|
||||||
## Note: overridin the default (no preferred
|
## Note: overriding the default (no preferred
|
||||||
## caption language) is not recommended, in order
|
## caption language) is not recommended, in order
|
||||||
## to not penalize people using other languages.
|
## to not penalize people using other languages.
|
||||||
##
|
##
|
||||||
@ -594,7 +594,7 @@ default_user_preferences:
|
|||||||
#feed_menu: ["Popular", "Trending", "Subscriptions", "Playlists"]
|
#feed_menu: ["Popular", "Trending", "Subscriptions", "Playlists"]
|
||||||
|
|
||||||
##
|
##
|
||||||
## Default feed to diplay on the home page.
|
## Default feed to display on the home page.
|
||||||
##
|
##
|
||||||
## Note: setting this option to "Popular" has no
|
## Note: setting this option to "Popular" has no
|
||||||
## effect when 'popular_enabled' is set to false.
|
## effect when 'popular_enabled' is set to false.
|
||||||
@ -812,7 +812,7 @@ default_user_preferences:
|
|||||||
|
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Miscellanous
|
# Miscellaneous
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -91,8 +91,8 @@ class Config
|
|||||||
|
|
||||||
@[YAML::Field(converter: Preferences::FamilyConverter)]
|
@[YAML::Field(converter: Preferences::FamilyConverter)]
|
||||||
property force_resolve : Socket::Family = Socket::Family::UNSPEC # Connect to YouTube over 'ipv6', 'ipv4'. Will sometimes resolve fix issues with rate-limiting (see https://github.com/ytdl-org/youtube-dl/issues/21729)
|
property force_resolve : Socket::Family = Socket::Family::UNSPEC # Connect to YouTube over 'ipv6', 'ipv4'. Will sometimes resolve fix issues with rate-limiting (see https://github.com/ytdl-org/youtube-dl/issues/21729)
|
||||||
property port : Int32 = 3000 # Port to listen for connections (overrided by command line argument)
|
property port : Int32 = 3000 # Port to listen for connections (overridden by command line argument)
|
||||||
property host_binding : String = "0.0.0.0" # Host to bind (overrided by command line argument)
|
property host_binding : String = "0.0.0.0" # Host to bind (overridden by command line argument)
|
||||||
property pool_size : Int32 = 100 # Pool size for HTTP requests to youtube.com and ytimg.com (each domain has a separate pool of `pool_size`)
|
property pool_size : Int32 = 100 # Pool size for HTTP requests to youtube.com and ytimg.com (each domain has a separate pool of `pool_size`)
|
||||||
property use_quic : Bool = false # Use quic transport for youtube api
|
property use_quic : Bool = false # Use quic transport for youtube api
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ def translate_count(locale : String, key : String, count : Int, format = NumberF
|
|||||||
# Try #2: Fallback to english
|
# Try #2: Fallback to english
|
||||||
translation = translate_count("en-US", key, count)
|
translation = translate_count("en-US", key, count)
|
||||||
else
|
else
|
||||||
# Return key if we're already in english, as the tranlation is missing
|
# Return key if we're already in english, as the translation is missing
|
||||||
LOGGER.warn("i18n: Missing translation key \"#{key}\"")
|
LOGGER.warn("i18n: Missing translation key \"#{key}\"")
|
||||||
return key
|
return key
|
||||||
end
|
end
|
||||||
|
@ -44,7 +44,7 @@ def sign_token(key, hash)
|
|||||||
|
|
||||||
# TODO: figure out which "key" variable is used
|
# TODO: figure out which "key" variable is used
|
||||||
# Ameba reports a warning for "Lint/ShadowingOuterLocalVar" on this
|
# Ameba reports a warning for "Lint/ShadowingOuterLocalVar" on this
|
||||||
# variable, but its preferrable to not touch that (works fine atm).
|
# variable, but it's preferable to not touch that (works fine atm).
|
||||||
hash.each do |key, value|
|
hash.each do |key, value|
|
||||||
next if key == "signature"
|
next if key == "signature"
|
||||||
|
|
||||||
|
@ -161,11 +161,11 @@ def short_text_to_number(short_text : String) : Int32
|
|||||||
end
|
end
|
||||||
|
|
||||||
def number_to_short_text(number)
|
def number_to_short_text(number)
|
||||||
seperated = number_with_separator(number).gsub(",", ".").split("")
|
separated = number_with_separator(number).gsub(",", ".").split("")
|
||||||
text = seperated.first(2).join
|
text = separated.first(2).join
|
||||||
|
|
||||||
if seperated[2]? && seperated[2] != "."
|
if separated[2]? && separated[2] != "."
|
||||||
text += seperated[2]
|
text += separated[2]
|
||||||
end
|
end
|
||||||
|
|
||||||
text = text.rchop(".0")
|
text = text.rchop(".0")
|
||||||
@ -323,8 +323,8 @@ def fetch_random_instance
|
|||||||
instance_list.each do |data|
|
instance_list.each do |data|
|
||||||
# TODO Check if current URL is onion instance and use .onion types if so.
|
# TODO Check if current URL is onion instance and use .onion types if so.
|
||||||
if data[1]["type"] == "https"
|
if data[1]["type"] == "https"
|
||||||
# Instances can have statisitics disabled, which is an requirement of version validation.
|
# Instances can have statistics disabled, which is an requirement of version validation.
|
||||||
# as_nil? doesn't exist. Thus we'll have to handle the error rasied if as_nil fails.
|
# as_nil? doesn't exist. Thus we'll have to handle the error raised if as_nil fails.
|
||||||
begin
|
begin
|
||||||
data[1]["stats"].as_nil
|
data[1]["stats"].as_nil
|
||||||
next
|
next
|
||||||
|
@ -401,7 +401,7 @@ def fetch_playlist(plid : String)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_playlist_videos(playlist : InvidiousPlaylist | Playlist, offset : Int32, video_id = nil)
|
def get_playlist_videos(playlist : InvidiousPlaylist | Playlist, offset : Int32, video_id = nil)
|
||||||
# Show empy playlist if requested page is out of range
|
# Show empty playlist if requested page is out of range
|
||||||
# (e.g, when a new playlist has been created, offset will be negative)
|
# (e.g, when a new playlist has been created, offset will be negative)
|
||||||
if offset >= playlist.video_count || offset < 0
|
if offset >= playlist.video_count || offset < 0
|
||||||
return [] of PlaylistVideo
|
return [] of PlaylistVideo
|
||||||
|
@ -136,7 +136,7 @@ module Invidious::Routes::PreferencesRoute
|
|||||||
notifications_only ||= "off"
|
notifications_only ||= "off"
|
||||||
notifications_only = notifications_only == "on"
|
notifications_only = notifications_only == "on"
|
||||||
|
|
||||||
# Convert to JSON and back again to take advantage of converters used for compatability
|
# 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,
|
||||||
annotations_subscribed: annotations_subscribed,
|
annotations_subscribed: annotations_subscribed,
|
||||||
|
@ -568,7 +568,7 @@ def extract_item(item : JSON::Any, author_fallback : String? = "",
|
|||||||
|
|
||||||
# Cycles through all of the item parsers and attempt to parse the raw YT JSON data.
|
# Cycles through all of the item parsers and attempt to parse the raw YT JSON data.
|
||||||
# Each parser automatically validates the data given to see if the data is
|
# Each parser automatically validates the data given to see if the data is
|
||||||
# applicable to itself. If not nil is returned and the next parser is attemped.
|
# applicable to itself. If not nil is returned and the next parser is attempted.
|
||||||
ITEM_PARSERS.each do |parser|
|
ITEM_PARSERS.each do |parser|
|
||||||
LOGGER.trace("extract_item: Attempting to parse item using \"#{parser.parser_name}\" (cycling...)")
|
LOGGER.trace("extract_item: Attempting to parse item using \"#{parser.parser_name}\" (cycling...)")
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ module YoutubeAPI
|
|||||||
property client_type : ClientType
|
property client_type : ClientType
|
||||||
|
|
||||||
# Region to provide to youtube, e.g to alter search results
|
# Region to provide to youtube, e.g to alter search results
|
||||||
# (this is passed as the `gl` parmeter).
|
# (this is passed as the `gl` parameter).
|
||||||
property region : String | Nil
|
property region : String | Nil
|
||||||
|
|
||||||
# ISO code of country where the proxy is located.
|
# ISO code of country where the proxy is located.
|
||||||
@ -205,7 +205,7 @@ module YoutubeAPI
|
|||||||
# :ditto:
|
# :ditto:
|
||||||
def browse(
|
def browse(
|
||||||
browse_id : String,
|
browse_id : String,
|
||||||
*, # Force the following paramters to be passed by name
|
*, # Force the following parameters to be passed by name
|
||||||
params : String,
|
params : String,
|
||||||
client_config : ClientConfig | Nil = nil
|
client_config : ClientConfig | Nil = nil
|
||||||
)
|
)
|
||||||
@ -215,7 +215,7 @@ module YoutubeAPI
|
|||||||
"context" => self.make_context(client_config),
|
"context" => self.make_context(client_config),
|
||||||
}
|
}
|
||||||
|
|
||||||
# Append the additionnal parameters if those were provided
|
# Append the additional parameters if those were provided
|
||||||
# (this is required for channel info, playlist and community, e.g)
|
# (this is required for channel info, playlist and community, e.g)
|
||||||
if params != ""
|
if params != ""
|
||||||
data["params"] = params
|
data["params"] = params
|
||||||
@ -292,14 +292,14 @@ module YoutubeAPI
|
|||||||
# and POST data in order to get a JSON reply.
|
# and POST data in order to get a JSON reply.
|
||||||
#
|
#
|
||||||
# The requested data is a video ID (`v=` parameter), with some
|
# The requested data is a video ID (`v=` parameter), with some
|
||||||
# additional paramters, formatted as a base64 string.
|
# additional parameters, formatted as a base64 string.
|
||||||
#
|
#
|
||||||
# An optional ClientConfig parameter can be passed, too (see
|
# An optional ClientConfig parameter can be passed, too (see
|
||||||
# `struct ClientConfig` above for more details).
|
# `struct ClientConfig` above for more details).
|
||||||
#
|
#
|
||||||
def player(
|
def player(
|
||||||
video_id : String,
|
video_id : String,
|
||||||
*, # Force the following paramters to be passed by name
|
*, # Force the following parameters to be passed by name
|
||||||
params : String,
|
params : String,
|
||||||
client_config : ClientConfig | Nil = nil
|
client_config : ClientConfig | Nil = nil
|
||||||
)
|
)
|
||||||
@ -309,7 +309,7 @@ module YoutubeAPI
|
|||||||
"context" => self.make_context(client_config),
|
"context" => self.make_context(client_config),
|
||||||
}
|
}
|
||||||
|
|
||||||
# Append the additionnal parameters if those were provided
|
# Append the additional parameters if those were provided
|
||||||
if params != ""
|
if params != ""
|
||||||
data["params"] = params
|
data["params"] = params
|
||||||
end
|
end
|
||||||
@ -363,7 +363,7 @@ module YoutubeAPI
|
|||||||
# order to get non-US results.
|
# order to get non-US results.
|
||||||
#
|
#
|
||||||
# The requested data is a search string, with some additional
|
# The requested data is a search string, with some additional
|
||||||
# paramters, formatted as a base64 string.
|
# parameters, formatted as a base64 string.
|
||||||
#
|
#
|
||||||
# An optional ClientConfig parameter can be passed, too (see
|
# An optional ClientConfig parameter can be passed, too (see
|
||||||
# `struct ClientConfig` above for more details).
|
# `struct ClientConfig` above for more details).
|
||||||
|
Loading…
Reference in New Issue
Block a user