Compare commits

..

39 commits

Author SHA1 Message Date
Samantaz Fox
d286cc4ec2
Update CHANGELOG.md 2024-10-31 19:59:38 -03:00
Samantaz Fox
d84754bf56
Add "Filipino (auto-generated)" to the list of caption languages 2024-10-31 19:59:38 -03:00
Samantaz Fox
cbf11d7697
Makefile: Add MT option to enable the 'preview_mt' flag 2024-10-31 19:59:37 -03:00
e419cee0ff
SigHelper: Reconnect to signature helper
Signed-off-by: Fijxu <fijxu@nadeko.net>
2024-10-31 19:59:36 -03:00
giacomocerquone
50e83e0446
Fix player menus hiding onHover 2024-10-31 19:59:17 -03:00
syeopite
9eab43e58a
Remove useless proc usage in images.cr 2024-10-31 19:59:17 -03:00
syeopite
2c0d9c8292
Preserve connection close header of get_storyboard 2024-10-31 19:59:17 -03:00
syeopite
82e0406ebd
Move YTIMG_POOLS to connection_pool.cr 2024-10-31 19:59:16 -03:00
syeopite
aed4fc220b
Fix headers not being added in image requests
Regression from #2364
2024-10-31 19:59:05 -03:00
syeopite
66f90e8898
Refactor duplicate logic in image routes 2024-10-31 19:59:05 -03:00
syeopite
c23d85c6e5
Use HTTP pools for image requests to YouTube 2024-10-31 19:59:03 -03:00
syeopite
201d9ab743
Validate override for crystal 1.12.1 2024-10-31 19:58:49 -03:00
syeopite
505b0a13c1
Bump http_proxy to v0.10.3 2024-10-31 19:58:48 -03:00
syeopite
81be6991ae
Automatically initialize proxy via stdlib override 2024-10-31 19:58:48 -03:00
syeopite
34737b23a4
Add support for using HTTP proxies 2024-10-31 19:58:47 -03:00
syeopite
e8fb37475a
Bump CI matrix (#5015) 2024-10-31 19:58:14 -03:00
Emilien Devos
0d0c5ed2be
libsqlite3-dev is now missing in the CI env 2024-10-31 19:58:14 -03:00
Emilien Devos
d8e4daa615
update submodule 2024-10-31 19:58:14 -03:00
Emilien Devos
84f456f8a9
update the mocks with the latest updated data 2024-10-31 19:58:14 -03:00
3cb8b69846
Videos: Fix audio tracks language.
Video will only return the default language. The rest of the audio
tracks are deleted since they will not be used.
2024-10-31 19:58:14 -03:00
7c990e1627
External Proxies: Rotate between proxies with balance enabled
Closes #17
2024-10-31 19:58:13 -03:00
0cb11bbab2
Config: Also reload env variables 2024-10-31 19:58:13 -03:00
e6eee402dd
Use POST requests for /videoplayback requests 2024-10-31 19:58:13 -03:00
75452d2537
Config: Reload configuration on modification
It detects changes on the config.yml automtically if invidious is
running on linux. If not, the configuration can be reloaded using
`kill -s HUP $(pidof invidious)` or any other tool that sends a SIGHUP
signal to the invidious process.

Closes #16
2024-10-31 19:58:13 -03:00
3ee98051e4
Tokens: Option to disable user tokens. 2024-10-31 19:58:13 -03:00
e17ca9735d
Tokens: Server side generated tokens.
#18
2024-10-31 19:58:13 -03:00
98cfcbf4b8
PubSub: Use external domain for pubsub feeds 2024-10-31 19:58:13 -03:00
5e1b795895
External Proxies: Proxyfi HLS Playlists 2024-10-31 19:58:13 -03:00
07b88415db
Videos: Completly disable annotations due to archive.org being down
Closes #15
2024-10-31 19:58:12 -03:00
d124a225a1
Tokens: Refresh po_token and visitor_data every 5 seconds
Closes #11
2024-10-31 19:58:12 -03:00
9d71ce050a
External Proxies: Proxyfi HD720 2024-10-31 19:58:12 -03:00
41977eb7c1
Videos: Increase video cache to 4 hours 2024-10-31 19:58:12 -03:00
025fa8b64b
Feat: Experimental support for potoken inside redis
Using https://git.nadeko.net/Fijxu/youtube-po-token-generator
2024-10-31 19:58:12 -03:00
c85c6808b5
External Proxies: Use list of external videoplayback proxies 2024-10-31 19:58:10 -03:00
Samantaz Fox
9207f41472
Videos: Fix missing host parameter on playback URLs when local=true 2024-10-31 19:57:32 -03:00
3718062a4b
CI: Experimental branches for testing builds 2024-10-31 19:57:32 -03:00
62318f8cc6
Feat: User supplied po_token and visitor_data 2024-10-31 19:57:29 -03:00
7dd75caa7d
Small try. 2024-10-31 19:56:56 -03:00
ccfbe58968
Feeds: Get rid of feed_needs_update() since it appears to be unused 2024-10-31 19:56:54 -03:00
10 changed files with 54 additions and 75 deletions

View file

@ -37,15 +37,13 @@ jobs:
type=sha,format=short,prefix={{date 'YYYY.MM.DD'}}-,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
- uses: https://code.forgejo.org/docker/build-push-action@v6
- uses: https://code.forgejo.org/docker/build-push-action@v5
name: Build images
with:
context: .
file: docker/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64
# cache-from: type=gha
# cache-to: type=gha,mode=max
push: true
build-args: |
"release=1"

View file

@ -1,4 +1,4 @@
FROM crystallang/crystal:1.14.0-alpine AS builder
FROM crystallang/crystal:1.12.1-alpine AS builder
RUN apk add --no-cache sqlite-static yaml-static

View file

@ -23,6 +23,7 @@ shards:
inotify:
git: https://github.com/petoem/inotify.cr.git
version: 1.0.3
http_proxy:
git: https://github.com/mamantoha/http_proxy.git
version: 0.10.3

View file

@ -23,31 +23,14 @@ def produce_channel_content_continuation(ucid, content_type, page = 1, auto_gene
else 15 # Fallback to "videos"
end
sort_type_numerical =
case content_type
when "videos" then 3
when "livestreams" then 5
else 3 # Fallback to "videos"
sort_by_numerical =
case sort_by
when "newest" then 1_i64
when "popular" then 2_i64
when "oldest" then 4_i64
else 1_i64 # Fallback to "newest"
end
if content_type == "livestreams"
sort_by_numerical =
case sort_by
when "newest" then 12_i64
when "popular" then 14_i64
when "oldest" then 13_i64
else 12_i64 # Fallback to "newest"
end
else
sort_by_numerical =
case sort_by
when "newest" then 1_i64
when "popular" then 2_i64
when "oldest" then 4_i64
else 1_i64 # Fallback to "newest"
end
end
object_inner_1 = {
"110:embedded" => {
"3:embedded" => {
@ -58,7 +41,7 @@ def produce_channel_content_continuation(ucid, content_type, page = 1, auto_gene
"2:embedded" => {
"1:string" => "00000000-0000-0000-0000-000000000000",
},
"#{sort_type_numerical}:varint" => sort_by_numerical,
"3:varint" => sort_by_numerical,
},
},
},

View file

@ -6,14 +6,9 @@ module Tokens
def refresh_tokens
@@po_token = REDIS_DB.get("invidious:po_token")
@@visitor_data = REDIS_DB.get("invidious:visitor_data")
if !@@po_token.nil? && !@@visitor_data.nil?
LOGGER.debug("RefreshTokens: Successfully updated tokens")
else
LOGGER.warn("RefreshTokens: Tokens are empty!")
end
LOGGER.trace("RefreshTokens: Tokens are:")
LOGGER.trace("RefreshTokens: po_token: #{@@po_token}")
LOGGER.trace("RefreshTokens: visitor_data: #{@@visitor_data}")
LOGGER.debug("RefreshTokens: Tokens are:")
LOGGER.debug("RefreshTokens: po_token: #{@@po_token}")
LOGGER.debug("RefreshTokens: visitor_data: #{@@visitor_data}")
end
def get_tokens

View file

@ -4,28 +4,51 @@ module Invidious::HttpServer
module Utils
extend self
@@proxy_alive : String = ""
@@proxy_list : Array(String) = [] of String
@@current_proxy : String = ""
@@count : Int64 = Time.utc.to_unix
def check_external_proxy
CONFIG.external_videoplayback_proxy.each do |proxy|
begin
response = HTTP::Client.get("#{proxy[:url]}/health")
if response.status_code == 200
@@proxy_alive = proxy[:url]
LOGGER.debug("CheckExternalProxy: Proxy set to: '#{proxy[:url]}'")
break
if @@proxy_list.includes?(proxy[:url])
next
end
if proxy[:balance]
@@proxy_list << proxy[:url]
LOGGER.debug("CheckExternalProxy: Adding proxy '#{proxy[:url]}' to the list of proxies")
end
break if proxy[:balance] == false && !@@proxy_list.empty?
@@proxy_list << proxy[:url]
end
rescue
if @@proxy_list.includes?(proxy[:url])
LOGGER.debug("CheckExternalProxy: Proxy '#{proxy[:url]}' is not available, removing it from the list of proxies")
@@proxy_list.delete(proxy[:url])
end
LOGGER.debug("CheckExternalProxy: Proxy '#{proxy[:url]}' is not available")
end
end
if @@proxy_alive.empty?
LOGGER.warn("CheckExternalProxy: No proxies alive! Using own server proxy")
end
LOGGER.trace("CheckExternalProxy: List of proxies:")
LOGGER.trace("#{@@proxy_list.inspect}")
end
# TODO: If the function is called many times, it will return a random
# proxy from the list. That is not how it should be.
# It should return the same proxy, in multiple function calls
def select_proxy
if (@@count - (Time.utc.to_unix - 30)) <= 0
return if @@proxy_list.size <= 0
@@current_proxy = @@proxy_list[Random.rand(@@proxy_list.size)]
LOGGER.debug("Current proxy is: '#{@@current_proxy}'")
@@count = Time.utc.to_unix
end
end
def get_external_proxy
return @@proxy_alive
return @@current_proxy
end
def proxy_video_url(raw_url : String, *, region : String? = nil, absolute : Bool = false)
@ -38,8 +61,8 @@ module Invidious::HttpServer
url.query_params = params
if absolute
if !@@proxy_alive.empty?
return "#{@@proxy_alive}#{url.request_target}"
if !(proxy = get_external_proxy()).empty?
return "#{proxy}#{url.request_target}"
else
return "#{HOST_URL}#{url.request_target}"
end

View file

@ -5,8 +5,9 @@ class Invidious::Jobs::CheckExternalProxy < Invidious::Jobs::BaseJob
def begin
loop do
HttpServer::Utils.check_external_proxy
LOGGER.info("CheckExternalProxy: Done, sleeping for 10 seconds")
sleep 10.seconds
HttpServer::Utils.select_proxy
LOGGER.info("CheckExternalProxy: Done, sleeping for 15 seconds")
sleep 15.seconds
Fiber.yield
end
end

View file

@ -152,7 +152,6 @@ module Invidious::Routes::Watch
end
end
# Removes non default audio tracks
audio_streams.reject! do |z|
z if z.dig?("audioTrack", "audioIsDefault") == false
end
@ -219,12 +218,6 @@ module Invidious::Routes::Watch
captions: video.captions
)
begin
video_url = fmt_stream[0]["url"].to_s
rescue
video_url = nil
end
templated "watch"
end

View file

@ -13,13 +13,11 @@
<meta property="og:image" content="<%= HOST_URL %>/vi/<%= video.id %>/maxres.jpg">
<meta property="og:description" content="<%= HTML.escape(video.short_description) %>">
<meta property="og:type" content="video.other">
<!-- This shouldn't be empty, ever. -->
<meta property="og:video" content="<%= video_url %>">
<meta property="og:video:url" content="<%= video_url %>">
<meta property="og:video:secure_url" content="<%= video_url %>">
<meta property="og:video:type" content="video/mp4">
<meta property="og:video:width" content="640">
<meta property="og:video:height" content="360">
<meta property="og:video:url" content="<%= HOST_URL %>/embed/<%= video.id %>">
<meta property="og:video:secure_url" content="<%= HOST_URL %>/embed/<%= video.id %>">
<meta property="og:video:type" content="text/html">
<meta property="og:video:width" content="1280">
<meta property="og:video:height" content="720">
<meta name="twitter:card" content="player">
<meta name="twitter:url" content="<%= HOST_URL %>/watch?v=<%= video.id %>">
<meta name="twitter:title" content="<%= title %>">

View file

@ -86,19 +86,6 @@ def make_client(url : URI, region = nil, force_resolve : Bool = false, &)
end
end
def make_configured_http_proxy_client
# This method is only called when configuration for an HTTP proxy are set
config_proxy = CONFIG.http_proxy.not_nil!
return HTTP::Proxy::Client.new(
config_proxy.host,
config_proxy.port,
username: config_proxy.user,
password: config_proxy.password,
)
end
# Fetches a HTTP pool for the specified subdomain of ytimg.com
#
# Creates a new one when the specified pool for the subdomain does not exist