diff --git a/Makefile b/Makefile
index ef6c4e16..7d09f39c 100644
--- a/Makefile
+++ b/Makefile
@@ -62,7 +62,8 @@ test:
crystal spec
verify:
- crystal build src/invidious.cr --no-codegen --progress --stats --error-trace
+ crystal build src/invidious.cr -Dskip_videojs_download \
+ --no-codegen --progress --stats --error-trace
# -----------------------
@@ -88,28 +89,28 @@ distclean: clean
# -----------------------
help:
- echo "Targets available in this Makefile:"
- echo ""
- echo "get-libs Fetch Crystal libraries"
- echo "invidious Build Invidious"
- echo "run Launch Invidious"
- echo ""
- echo "format Run the Crystal formatter"
- echo "test Run tests"
- echo "verify Just make sure that the code compiles, but without"
- echo " generating any binaries. Useful to search for errors"
- echo ""
- echo "clean Remove build artifacts"
- echo "distclean Remove build artifacts and libraries"
- echo ""
- echo ""
- echo "Build options available for this Makefile:"
- echo ""
- echo "RELEASE Make a release build (Default: 1)"
- echo "STATIC Link libraries statically (Default: 0)"
- echo ""
- echo "DISABLE_QUIC Disable support for QUIC (Default: 0)"
- echo "NO_DBG_SYMBOLS Strip debug symbols (Default: 0)"
+ @echo "Targets available in this Makefile:"
+ @echo ""
+ @echo " get-libs Fetch Crystal libraries"
+ @echo " invidious Build Invidious"
+ @echo " run Launch Invidious"
+ @echo ""
+ @echo " format Run the Crystal formatter"
+ @echo " test Run tests"
+ @echo " verify Just make sure that the code compiles, but without"
+ @echo " generating any binaries. Useful to search for errors"
+ @echo ""
+ @echo " clean Remove build artifacts"
+ @echo " distclean Remove build artifacts and libraries"
+ @echo ""
+ @echo ""
+ @echo "Build options available for this Makefile:"
+ @echo ""
+ @echo " RELEASE Make a release build (Default: 1)"
+ @echo " STATIC Link libraries statically (Default: 0)"
+ @echo ""
+ @echo " DISABLE_QUIC Disable support for QUIC (Default: 0)"
+ @echo " NO_DBG_SYMBOLS Strip debug symbols (Default: 0)"
diff --git a/README.md b/README.md
index 4e3c7a77..7fd27004 100644
--- a/README.md
+++ b/README.md
@@ -51,8 +51,8 @@
-
-
+
+
@@ -152,19 +152,6 @@ Weblate also allows you to log-in with major SSO providers like Github, Gitlab,
- [HoloPlay](https://github.com/stephane-r/HoloPlay): Funny Android application connecting on Invidious API's with search, playlists and favorites.
-## Contact the team directly
-
-Every team member is available through GitHub or through the Matrix room (bridged to IRC), however, if you need/have to, you can contact the team directly via e-mail (remove `+SPAMGUARD` from the addresses):
-
-- General Inquiries (forwarded to all team members): `contact +SPAMGUARD [at] invidious [dot] io`
-
-Note: before sending a bug report please check that it hasn't already be reported on GitHub - bug reports sent to this address will be copied to GitHub
-
-- Security issues (forwarded to the two project owners, @TheFrenchGhosty and @Perflyst): `security +SPAMGUARD [at] invidious [dot] io`
-
-Note: the creation of a PGP key for this address is planned
-
-
## Liability
We take no responsibility for the use of our tool, or external instances
diff --git a/assets/js/handlers.js b/assets/js/handlers.js
index d3957b89..02175957 100644
--- a/assets/js/handlers.js
+++ b/assets/js/handlers.js
@@ -150,13 +150,13 @@
// Ignore shortcuts if any text input is focused
let focused_tag = document.activeElement.tagName.toLowerCase();
- let focused_type = document.activeElement.type.toLowerCase();
- let allowed = /^(button|checkbox|file|radio|submit)$/;
+ const allowed = /^(button|checkbox|file|radio|submit)$/;
- if (focused_tag === "textarea" ||
- (focused_tag === "input" && !focused_type.match(allowed))
- )
- return;
+ if (focused_tag === "textarea") return;
+ if (focused_tag === "input") {
+ let focused_type = document.activeElement.type.toLowerCase();
+ if (!focused_type.match(allowed)) return;
+ }
// Focus search bar on '/'
if (event.key == "/") {
diff --git a/assets/js/player.js b/assets/js/player.js
index 66d1682f..a1a2cd16 100644
--- a/assets/js/player.js
+++ b/assets/js/player.js
@@ -35,21 +35,11 @@ if (player_data.aspect_ratio) {
var embed_url = new URL(location);
embed_url.searchParams.delete('v');
-short_url = location.origin + '/' + video_data.id + embed_url.search;
+var short_url = location.origin + '/' + video_data.id + embed_url.search;
embed_url = location.origin + '/embed/' + video_data.id + embed_url.search;
var save_player_pos_key = "save_player_pos";
-var shareOptions = {
- socials: ['fbFeed', 'tw', 'reddit', 'email'],
-
- url: short_url,
- title: player_data.title,
- description: player_data.description,
- image: player_data.thumbnail,
- embedCode: ""
-}
-
videojs.Vhs.xhr.beforeRequest = function(options) {
if (options.uri.indexOf('videoplayback') === -1 && options.uri.indexOf('local=true') === -1) {
options.uri = options.uri + '?local=true';
@@ -59,34 +49,55 @@ videojs.Vhs.xhr.beforeRequest = function(options) {
var player = videojs('player', options);
-const storage = (() => {
- try {
- if (localStorage.length !== -1) {
- return localStorage;
- }
- } catch (e) {
- console.info('No storage available: ' + e);
+/**
+ * Function for add time argument to url
+ * @param {String} url
+ * @returns urlWithTimeArg
+ */
+function addCurrentTimeToURL(url) {
+ var urlUsed = new URL(url);
+ urlUsed.searchParams.delete('start');
+ var currentTime = Math.ceil(player.currentTime());
+ if (currentTime > 0)
+ urlUsed.searchParams.set('t', currentTime);
+ else if (urlUsed.searchParams.has('t'))
+ urlUsed.searchParams.delete('t');
+ return urlUsed;
+}
+
+var shareOptions = {
+ socials: ['fbFeed', 'tw', 'reddit', 'email'],
+
+ get url() {
+ return addCurrentTimeToURL(short_url);
+ },
+ title: player_data.title,
+ description: player_data.description,
+ image: player_data.thumbnail,
+ get embedCode() {
+ return "";
}
+};
+
+const storage = (() => {
+ try { if (localStorage.length !== -1) return localStorage; }
+ catch (e) { console.info('No storage available: ' + e); }
+
return undefined;
})();
if (location.pathname.startsWith('/embed/')) {
+ var overlay_content = '
#{translate(locale, "Download is disabled.")}
" + end + + return String.build(4000) do |str| + str << "\n" + end + end +end diff --git a/src/invidious/helpers/errors.cr b/src/invidious/helpers/errors.cr index 3acbac84..6155e561 100644 --- a/src/invidious/helpers/errors.cr +++ b/src/invidious/helpers/errors.cr @@ -38,12 +38,15 @@ def error_template_helper(env : HTTP::Server::Context, status_code : Int32, exce issue_title = "#{exception.message} (#{exception.class})" - issue_template = %(Title: `#{issue_title}`) - issue_template += %(\nDate: `#{Time::Format::ISO_8601_DATE_TIME.format(Time.utc)}`) - issue_template += %(\nRoute: `#{env.request.resource}`) - issue_template += %(\nVersion: `#{SOFTWARE["version"]} @ #{SOFTWARE["branch"]}`) - # issue_template += github_details("Preferences", env.get("preferences").as(Preferences).to_pretty_json) - issue_template += github_details("Backtrace", exception.inspect_with_backtrace) + issue_template = <<-TEXT + Title: `#{HTML.escape(issue_title)}` + Date: `#{Time::Format::ISO_8601_DATE_TIME.format(Time.utc)}` + Route: `#{HTML.escape(env.request.resource)}` + Version: `#{SOFTWARE["version"]} @ #{SOFTWARE["branch"]}` + + TEXT + + issue_template += github_details("Backtrace", HTML.escape(exception.inspect_with_backtrace)) # URLs for the error message below url_faq = "https://github.com/iv-org/documentation/blob/master/FAQ.md" diff --git a/src/invidious/helpers/i18n.cr b/src/invidious/helpers/i18n.cr index 3cf9ad1c..39e183f2 100644 --- a/src/invidious/helpers/i18n.cr +++ b/src/invidious/helpers/i18n.cr @@ -30,6 +30,7 @@ LOCALES_LIST = { "pt-PT" => "Português de Portugal", # Portuguese (Portugal) "ro" => "Română", # Romanian "ru" => "русский", # Russian + "sq" => "Shqip", # Albanian "sr" => "srpski (latinica)", # Serbian (Latin) "sr_Cyrl" => "српски (ћирилица)", # Serbian (Cyrillic) "sv-SE" => "Svenska", # Swedish @@ -135,7 +136,7 @@ def translate_count(locale : String, key : String, count : Int, format = NumberF # Try #2: Fallback to english translation = translate_count("en-US", key, count) 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}\"") return key end diff --git a/src/invidious/helpers/tokens.cr b/src/invidious/helpers/tokens.cr index 9b664646..a44988cd 100644 --- a/src/invidious/helpers/tokens.cr +++ b/src/invidious/helpers/tokens.cr @@ -44,7 +44,7 @@ def sign_token(key, hash) # TODO: figure out which "key" variable is used # 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| next if key == "signature" diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.cr index 3ab9a0fc..c1dc17db 100644 --- a/src/invidious/helpers/utils.cr +++ b/src/invidious/helpers/utils.cr @@ -51,6 +51,24 @@ def recode_length_seconds(time) end end +def decode_interval(string : String) : Time::Span + rawMinutes = string.try &.to_i32? + + if !rawMinutes + hours = /(?<%= translate(locale, "Download is disabled.") %>
- <% else %> -<%= number_with_separator(video.views) %>
<%= number_with_separator(video.likes) %>
diff --git a/src/invidious/yt_backend/extractors.cr b/src/invidious/yt_backend/extractors.cr index 28e920fa..4657bb1d 100644 --- a/src/invidious/yt_backend/extractors.cr +++ b/src/invidious/yt_backend/extractors.cr @@ -588,7 +588,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. # 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| LOGGER.trace("extract_item: Attempting to parse item using \"#{parser.parser_name}\" (cycling...)") diff --git a/src/invidious/yt_backend/youtube_api.cr b/src/invidious/yt_backend/youtube_api.cr index 426c076a..5bbd9213 100644 --- a/src/invidious/yt_backend/youtube_api.cr +++ b/src/invidious/yt_backend/youtube_api.cr @@ -90,7 +90,7 @@ module YoutubeAPI property client_type : ClientType # 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 # ISO code of country where the proxy is located. @@ -205,7 +205,7 @@ module YoutubeAPI # :ditto: def browse( browse_id : String, - *, # Force the following paramters to be passed by name + *, # Force the following parameters to be passed by name params : String, client_config : ClientConfig | Nil = nil ) @@ -215,7 +215,7 @@ module YoutubeAPI "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) if params != "" data["params"] = params @@ -292,14 +292,14 @@ module YoutubeAPI # and POST data in order to get a JSON reply. # # 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 # `struct ClientConfig` above for more details). # def player( video_id : String, - *, # Force the following paramters to be passed by name + *, # Force the following parameters to be passed by name params : String, client_config : ClientConfig | Nil = nil ) @@ -309,7 +309,7 @@ module YoutubeAPI "context" => self.make_context(client_config), } - # Append the additionnal parameters if those were provided + # Append the additional parameters if those were provided if params != "" data["params"] = params end @@ -363,7 +363,7 @@ module YoutubeAPI # order to get non-US results. # # 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 # `struct ClientConfig` above for more details).