mirror of
https://gitea.invidious.io/iv-org/invidious.git
synced 2024-08-15 00:53:41 +00:00
Merge branch 'master' into patch-1
This commit is contained in:
commit
4fd51ec880
13 changed files with 44 additions and 51 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -19,7 +19,7 @@ jobs:
|
||||||
- name: Install Crystal
|
- name: Install Crystal
|
||||||
uses: oprypin/install-crystal@v1.2.4
|
uses: oprypin/install-crystal@v1.2.4
|
||||||
with:
|
with:
|
||||||
crystal: 0.36.1
|
crystal: 1.0.0
|
||||||
|
|
||||||
- name: Cache Shards
|
- name: Cache Shards
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
|
|
4
.github/workflows/lock.yml
vendored
4
.github/workflows/lock.yml
vendored
|
@ -18,5 +18,5 @@ jobs:
|
||||||
issue-lock-reason: 'resolved'
|
issue-lock-reason: 'resolved'
|
||||||
pr-lock-reason: 'resolved'
|
pr-lock-reason: 'resolved'
|
||||||
|
|
||||||
issue-lock-comment: 'This issue has been automatically locked since there has not been any activity in it in the last 30 days. If this is still applicable to the current version of Invidious feel free to open a new issue.'
|
# issue-lock-comment: 'This issue has been automatically locked since there has not been any activity in it in the last 30 days. If this is still applicable to the current version of Invidious feel free to open a new issue.'
|
||||||
pr-lock-comment: 'This pull request has been automatically locked since there has not been any activity in it in the last 30 days. If you want to tell us about needed or wanted changes or if problems related to this code are discovered, feel free to open an issue or a new pull request.'
|
# pr-lock-comment: 'This pull request has been automatically locked since there has not been any activity in it in the last 30 days. If you want to tell us about needed or wanted changes or if problems related to this code are discovered, feel free to open an issue or a new pull request.'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM crystallang/crystal:0.36.1-alpine AS builder
|
FROM crystallang/crystal:1.0.0-alpine AS builder
|
||||||
RUN apk add --no-cache curl sqlite-static yaml-static
|
RUN apk add --no-cache curl sqlite-static yaml-static
|
||||||
WORKDIR /invidious
|
WORKDIR /invidious
|
||||||
COPY ./shard.yml ./shard.yml
|
COPY ./shard.yml ./shard.yml
|
||||||
|
|
|
@ -200,7 +200,7 @@
|
||||||
"Token is expired, please try again": "Lejárt token, kérem próbáld újra",
|
"Token is expired, please try again": "Lejárt token, kérem próbáld újra",
|
||||||
"English": "angol",
|
"English": "angol",
|
||||||
"English (auto-generated)": "angol (automatikusan generált)",
|
"English (auto-generated)": "angol (automatikusan generált)",
|
||||||
"Afrikaans": "",
|
"Afrikaans": "afrikaans",
|
||||||
"Albanian": "albán",
|
"Albanian": "albán",
|
||||||
"Amharic": "amhara",
|
"Amharic": "amhara",
|
||||||
"Arabic": "arab",
|
"Arabic": "arab",
|
||||||
|
@ -208,7 +208,7 @@
|
||||||
"Azerbaijani": "azerbajdzsáni",
|
"Azerbaijani": "azerbajdzsáni",
|
||||||
"Bangla": "bengáli",
|
"Bangla": "bengáli",
|
||||||
"Basque": "baszk",
|
"Basque": "baszk",
|
||||||
"Belarusian": "belarusz",
|
"Belarusian": "fehérorosz",
|
||||||
"Bosnian": "bosnyák",
|
"Bosnian": "bosnyák",
|
||||||
"Bulgarian": "bolgár",
|
"Bulgarian": "bolgár",
|
||||||
"Burmese": "burmai",
|
"Burmese": "burmai",
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
{
|
{
|
||||||
"`x` subscribers": {
|
"`x` subscribers": {
|
||||||
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` pelanggan",
|
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` pelanggan",
|
||||||
"": "`x` pelanggan"
|
"": "`x` pelanggan."
|
||||||
},
|
},
|
||||||
"`x` videos": {
|
"`x` videos": {
|
||||||
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` video",
|
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` video",
|
||||||
"": "`x` video"
|
"": "`x` video."
|
||||||
},
|
},
|
||||||
"`x` playlists": {
|
"`x` playlists": {
|
||||||
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` daftar putar",
|
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` daftar putar",
|
||||||
"": "`x` daftar putar"
|
"": "`x` daftar putar."
|
||||||
},
|
},
|
||||||
"LIVE": "SIARAN LANGSUNG",
|
"LIVE": "SIARAN LANGSUNG",
|
||||||
"Shared `x` ago": "Dibagikan`x` lalu",
|
"Shared `x` ago": "Dibagikan`x` lalu",
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
"Fallback captions: ": "Subtitel fallback: ",
|
"Fallback captions: ": "Subtitel fallback: ",
|
||||||
"Show related videos: ": "Tampilkan video terkait: ",
|
"Show related videos: ": "Tampilkan video terkait: ",
|
||||||
"Show annotations by default: ": "Tampilkan anotasi secara default: ",
|
"Show annotations by default: ": "Tampilkan anotasi secara default: ",
|
||||||
"Automatically extend video description: ": "Luaskan keterangan video secara matis: ",
|
"Automatically extend video description: ": "Perluas deskripsi video secara otomatis: ",
|
||||||
"Interactive 360 degree videos: ": "Video interaktif 360°: ",
|
"Interactive 360 degree videos: ": "Video interaktif 360°: ",
|
||||||
"Visual preferences": "Preferensi visual",
|
"Visual preferences": "Preferensi visual",
|
||||||
"Player style: ": "Gaya pemutar: ",
|
"Player style: ": "Gaya pemutar: ",
|
||||||
|
@ -126,11 +126,11 @@
|
||||||
"Token": "Token",
|
"Token": "Token",
|
||||||
"`x` subscriptions": {
|
"`x` subscriptions": {
|
||||||
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` langganan",
|
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` langganan",
|
||||||
"": "`x` langganan"
|
"": "`x` langganan."
|
||||||
},
|
},
|
||||||
"`x` tokens": {
|
"`x` tokens": {
|
||||||
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` token",
|
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` token",
|
||||||
"": "`x` token"
|
"": "`x` token."
|
||||||
},
|
},
|
||||||
"Import/export": "Impor/ekspor",
|
"Import/export": "Impor/ekspor",
|
||||||
"unsubscribe": "batal langganan",
|
"unsubscribe": "batal langganan",
|
||||||
|
@ -138,7 +138,7 @@
|
||||||
"Subscriptions": "Langganan",
|
"Subscriptions": "Langganan",
|
||||||
"`x` unseen notifications": {
|
"`x` unseen notifications": {
|
||||||
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` pemberitahuan belum dilihat",
|
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` pemberitahuan belum dilihat",
|
||||||
"": "`x` pemberitahuan belum dilihat"
|
"": "`x` pemberitahuan belum dilihat."
|
||||||
},
|
},
|
||||||
"search": "cari",
|
"search": "cari",
|
||||||
"Log out": "Keluar",
|
"Log out": "Keluar",
|
||||||
|
@ -158,8 +158,8 @@
|
||||||
"Title": "Judul",
|
"Title": "Judul",
|
||||||
"Playlist privacy": "Privasi daftar putar",
|
"Playlist privacy": "Privasi daftar putar",
|
||||||
"Editing playlist `x`": "Menyunting daftar putar `x`",
|
"Editing playlist `x`": "Menyunting daftar putar `x`",
|
||||||
"Show more": "Tampil lebih",
|
"Show more": "Tampilkan lainnya",
|
||||||
"Show less": "Tampil kurang",
|
"Show less": "Tampilkan lebih sedikit",
|
||||||
"Watch on YouTube": "Tonton di YouTube",
|
"Watch on YouTube": "Tonton di YouTube",
|
||||||
"Hide annotations": "Sembunyikan anotasi",
|
"Hide annotations": "Sembunyikan anotasi",
|
||||||
"Show annotations": "Tampilkan anotasi",
|
"Show annotations": "Tampilkan anotasi",
|
||||||
|
@ -363,7 +363,7 @@
|
||||||
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` detik.([^.,0-9]|^)1([^.,0-9]|$)",
|
"([^.,0-9]|^)1([^.,0-9]|$)": "`x` detik.([^.,0-9]|^)1([^.,0-9]|$)",
|
||||||
"": "`x` detik."
|
"": "`x` detik."
|
||||||
},
|
},
|
||||||
"Fallback comments: ": "Komentar ganti: ",
|
"Fallback comments: ": "Komentar mundur: ",
|
||||||
"Popular": "Populer",
|
"Popular": "Populer",
|
||||||
"Search": "Cari",
|
"Search": "Cari",
|
||||||
"Top": "Teratas",
|
"Top": "Teratas",
|
||||||
|
@ -373,7 +373,7 @@
|
||||||
"View as playlist": "Tampilkan sebagai daftar putar",
|
"View as playlist": "Tampilkan sebagai daftar putar",
|
||||||
"Default": "Asali",
|
"Default": "Asali",
|
||||||
"Music": "Musik",
|
"Music": "Musik",
|
||||||
"Gaming": "Gaming",
|
"Gaming": "Permainan",
|
||||||
"News": "Berita",
|
"News": "Berita",
|
||||||
"Movies": "Film",
|
"Movies": "Film",
|
||||||
"Download": "Unduh",
|
"Download": "Unduh",
|
||||||
|
|
20
shard.lock
20
shard.lock
|
@ -2,39 +2,35 @@ version: 2.0
|
||||||
shards:
|
shards:
|
||||||
db:
|
db:
|
||||||
git: https://github.com/crystal-lang/crystal-db.git
|
git: https://github.com/crystal-lang/crystal-db.git
|
||||||
version: 0.10.0
|
version: 0.10.1
|
||||||
|
|
||||||
exception_page:
|
exception_page:
|
||||||
git: https://github.com/crystal-loot/exception_page.git
|
git: https://github.com/crystal-loot/exception_page.git
|
||||||
version: 0.1.4
|
version: 0.1.5
|
||||||
|
|
||||||
kemal:
|
kemal:
|
||||||
git: https://github.com/kemalcr/kemal.git
|
git: https://github.com/kemalcr/kemal.git
|
||||||
version: 0.27.0
|
version: 1.0.0
|
||||||
|
|
||||||
kilt:
|
kilt:
|
||||||
git: https://github.com/jeromegn/kilt.git
|
git: https://github.com/jeromegn/kilt.git
|
||||||
version: 0.4.0
|
version: 0.4.1
|
||||||
|
|
||||||
lsquic:
|
lsquic:
|
||||||
git: https://github.com/iv-org/lsquic.cr.git
|
git: https://github.com/iv-org/lsquic.cr.git
|
||||||
version: 2.18.1-1
|
version: 2.18.1-2
|
||||||
|
|
||||||
pg:
|
pg:
|
||||||
git: https://github.com/will/crystal-pg.git
|
git: https://github.com/will/crystal-pg.git
|
||||||
version: 0.23.1
|
version: 0.23.2
|
||||||
|
|
||||||
pool:
|
|
||||||
git: https://github.com/ysbaddaden/pool.git
|
|
||||||
version: 0.2.3
|
|
||||||
|
|
||||||
protodec:
|
protodec:
|
||||||
git: https://github.com/iv-org/protodec.git
|
git: https://github.com/iv-org/protodec.git
|
||||||
version: 0.1.3
|
version: 0.1.4
|
||||||
|
|
||||||
radix:
|
radix:
|
||||||
git: https://github.com/luislavena/radix.git
|
git: https://github.com/luislavena/radix.git
|
||||||
version: 0.3.9
|
version: 0.4.1
|
||||||
|
|
||||||
sqlite3:
|
sqlite3:
|
||||||
git: https://github.com/crystal-lang/crystal-sqlite3.git
|
git: https://github.com/crystal-lang/crystal-sqlite3.git
|
||||||
|
|
13
shard.yml
13
shard.yml
|
@ -12,23 +12,20 @@ targets:
|
||||||
dependencies:
|
dependencies:
|
||||||
pg:
|
pg:
|
||||||
github: will/crystal-pg
|
github: will/crystal-pg
|
||||||
version: ~> 0.23.1
|
version: ~> 0.23.2
|
||||||
sqlite3:
|
sqlite3:
|
||||||
github: crystal-lang/crystal-sqlite3
|
github: crystal-lang/crystal-sqlite3
|
||||||
version: ~> 0.18.0
|
version: ~> 0.18.0
|
||||||
kemal:
|
kemal:
|
||||||
github: kemalcr/kemal
|
github: kemalcr/kemal
|
||||||
version: ~> 0.27.0
|
version: ~> 1.0.0
|
||||||
pool:
|
|
||||||
github: ysbaddaden/pool
|
|
||||||
version: ~> 0.2.3
|
|
||||||
protodec:
|
protodec:
|
||||||
github: iv-org/protodec
|
github: iv-org/protodec
|
||||||
version: ~> 0.1.3
|
version: ~> 0.1.4
|
||||||
lsquic:
|
lsquic:
|
||||||
github: iv-org/lsquic.cr
|
github: iv-org/lsquic.cr
|
||||||
version: ~> 2.18.1-1
|
version: ~> 2.18.1-2
|
||||||
|
|
||||||
crystal: 0.36.1
|
crystal: 1.0.0
|
||||||
|
|
||||||
license: AGPLv3
|
license: AGPLv3
|
||||||
|
|
|
@ -166,7 +166,7 @@ end
|
||||||
|
|
||||||
before_all do |env|
|
before_all do |env|
|
||||||
preferences = begin
|
preferences = begin
|
||||||
Preferences.from_json(env.request.cookies["PREFS"]?.try &.value || "{}")
|
Preferences.from_json(URI.decode_www_form(env.request.cookies["PREFS"]?.try &.value || "{}"))
|
||||||
rescue
|
rescue
|
||||||
Preferences.from_json("{}")
|
Preferences.from_json("{}")
|
||||||
end
|
end
|
||||||
|
@ -421,7 +421,7 @@ get "/modify_notifications" do |env|
|
||||||
|
|
||||||
html = YT_POOL.client &.get("/subscription_manager?disable_polymer=1", headers)
|
html = YT_POOL.client &.get("/subscription_manager?disable_polymer=1", headers)
|
||||||
|
|
||||||
cookies = HTTP::Cookies.from_headers(headers)
|
cookies = HTTP::Cookies.from_client_headers(headers)
|
||||||
html.cookies.each do |cookie|
|
html.cookies.each do |cookie|
|
||||||
if {"VISITOR_INFO1_LIVE", "YSC", "SIDCC"}.includes? cookie.name
|
if {"VISITOR_INFO1_LIVE", "YSC", "SIDCC"}.includes? cookie.name
|
||||||
if cookies[cookie.name]?
|
if cookies[cookie.name]?
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
require "lsquic"
|
require "lsquic"
|
||||||
require "pool/connection"
|
require "db"
|
||||||
|
|
||||||
def add_yt_headers(request)
|
def add_yt_headers(request)
|
||||||
request.headers["user-agent"] ||= "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36"
|
request.headers["user-agent"] ||= "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36"
|
||||||
|
@ -20,7 +20,7 @@ struct YoutubeConnectionPool
|
||||||
property! url : URI
|
property! url : URI
|
||||||
property! capacity : Int32
|
property! capacity : Int32
|
||||||
property! timeout : Float64
|
property! timeout : Float64
|
||||||
property pool : ConnectionPool(QUIC::Client | HTTP::Client)
|
property pool : DB::Pool(QUIC::Client | HTTP::Client)
|
||||||
|
|
||||||
def initialize(url : URI, @capacity = 5, @timeout = 5.0, use_quic = true)
|
def initialize(url : URI, @capacity = 5, @timeout = 5.0, use_quic = true)
|
||||||
@url = url
|
@url = url
|
||||||
|
@ -43,7 +43,7 @@ struct YoutubeConnectionPool
|
||||||
conn.before_request { |r| add_yt_headers(r) } if url.host == "www.youtube.com"
|
conn.before_request { |r| add_yt_headers(r) } if url.host == "www.youtube.com"
|
||||||
response = yield conn
|
response = yield conn
|
||||||
ensure
|
ensure
|
||||||
pool.checkin(conn)
|
pool.release(conn)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ struct YoutubeConnectionPool
|
||||||
end
|
end
|
||||||
|
|
||||||
private def build_pool(use_quic)
|
private def build_pool(use_quic)
|
||||||
ConnectionPool(QUIC::Client | HTTP::Client).new(capacity: capacity, timeout: timeout) do
|
DB::Pool(QUIC::Client | HTTP::Client).new(initial_pool_size: 0, max_pool_size: capacity, max_idle_pool_size: capacity, checkout_timeout: timeout) do
|
||||||
if use_quic
|
if use_quic
|
||||||
conn = QUIC::Client.new(url)
|
conn = QUIC::Client.new(url)
|
||||||
else
|
else
|
||||||
|
|
|
@ -112,7 +112,7 @@ class Invidious::Jobs::BypassCaptchaJob < Invidious::Jobs::BaseJob
|
||||||
headers = HTTP::Headers{
|
headers = HTTP::Headers{
|
||||||
"Cookie" => URI.parse(response.headers["location"]).query_params["google_abuse"].split(";")[0],
|
"Cookie" => URI.parse(response.headers["location"]).query_params["google_abuse"].split(";")[0],
|
||||||
}
|
}
|
||||||
cookies = HTTP::Cookies.from_headers(headers)
|
cookies = HTTP::Cookies.from_client_headers(headers)
|
||||||
|
|
||||||
cookies.each { |cookie| CONFIG.cookies << cookie }
|
cookies.each { |cookie| CONFIG.cookies << cookie }
|
||||||
|
|
||||||
|
|
|
@ -238,7 +238,7 @@ class Invidious::Routes::Login < Invidious::Routes::BaseRoute
|
||||||
traceback << "Logging in..."
|
traceback << "Logging in..."
|
||||||
|
|
||||||
location = URI.parse(challenge_results[0][-1][2].to_s)
|
location = URI.parse(challenge_results[0][-1][2].to_s)
|
||||||
cookies = HTTP::Cookies.from_headers(headers)
|
cookies = HTTP::Cookies.from_client_headers(headers)
|
||||||
|
|
||||||
headers.delete("Content-Type")
|
headers.delete("Content-Type")
|
||||||
headers.delete("Google-Accounts-XSRF")
|
headers.delete("Google-Accounts-XSRF")
|
||||||
|
@ -261,7 +261,7 @@ class Invidious::Routes::Login < Invidious::Routes::BaseRoute
|
||||||
location = login.headers["Location"]?.try { |u| URI.parse(u) }
|
location = login.headers["Location"]?.try { |u| URI.parse(u) }
|
||||||
end
|
end
|
||||||
|
|
||||||
cookies = HTTP::Cookies.from_headers(headers)
|
cookies = HTTP::Cookies.from_client_headers(headers)
|
||||||
sid = cookies["SID"]?.try &.value
|
sid = cookies["SID"]?.try &.value
|
||||||
if !sid
|
if !sid
|
||||||
raise "Couldn't get SID."
|
raise "Couldn't get SID."
|
||||||
|
|
|
@ -198,10 +198,10 @@ class Invidious::Routes::PreferencesRoute < Invidious::Routes::BaseRoute
|
||||||
end
|
end
|
||||||
|
|
||||||
if CONFIG.domain
|
if CONFIG.domain
|
||||||
env.response.cookies["PREFS"] = HTTP::Cookie.new(name: "PREFS", domain: "#{CONFIG.domain}", value: preferences, expires: Time.utc + 2.years,
|
env.response.cookies["PREFS"] = HTTP::Cookie.new(name: "PREFS", domain: "#{CONFIG.domain}", value: URI.encode_www_form(preferences), expires: Time.utc + 2.years,
|
||||||
secure: secure, http_only: true)
|
secure: secure, http_only: true)
|
||||||
else
|
else
|
||||||
env.response.cookies["PREFS"] = HTTP::Cookie.new(name: "PREFS", value: preferences, expires: Time.utc + 2.years,
|
env.response.cookies["PREFS"] = HTTP::Cookie.new(name: "PREFS", value: URI.encode_www_form(preferences), expires: Time.utc + 2.years,
|
||||||
secure: secure, http_only: true)
|
secure: secure, http_only: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -250,10 +250,10 @@ class Invidious::Routes::PreferencesRoute < Invidious::Routes::BaseRoute
|
||||||
end
|
end
|
||||||
|
|
||||||
if CONFIG.domain
|
if CONFIG.domain
|
||||||
env.response.cookies["PREFS"] = HTTP::Cookie.new(name: "PREFS", domain: "#{CONFIG.domain}", value: preferences, expires: Time.utc + 2.years,
|
env.response.cookies["PREFS"] = HTTP::Cookie.new(name: "PREFS", domain: "#{CONFIG.domain}", value: URI.encode_www_form(preferences), expires: Time.utc + 2.years,
|
||||||
secure: secure, http_only: true)
|
secure: secure, http_only: true)
|
||||||
else
|
else
|
||||||
env.response.cookies["PREFS"] = HTTP::Cookie.new(name: "PREFS", value: preferences, expires: Time.utc + 2.years,
|
env.response.cookies["PREFS"] = HTTP::Cookie.new(name: "PREFS", value: URI.encode_www_form(preferences), expires: Time.utc + 2.years,
|
||||||
secure: secure, http_only: true)
|
secure: secure, http_only: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -462,7 +462,7 @@ def subscribe_ajax(channel_id, action, env_headers)
|
||||||
|
|
||||||
html = YT_POOL.client &.get("/subscription_manager?disable_polymer=1", headers)
|
html = YT_POOL.client &.get("/subscription_manager?disable_polymer=1", headers)
|
||||||
|
|
||||||
cookies = HTTP::Cookies.from_headers(headers)
|
cookies = HTTP::Cookies.from_client_headers(headers)
|
||||||
html.cookies.each do |cookie|
|
html.cookies.each do |cookie|
|
||||||
if {"VISITOR_INFO1_LIVE", "YSC", "SIDCC"}.includes? cookie.name
|
if {"VISITOR_INFO1_LIVE", "YSC", "SIDCC"}.includes? cookie.name
|
||||||
if cookies[cookie.name]?
|
if cookies[cookie.name]?
|
||||||
|
|
Loading…
Reference in a new issue