mirror of
https://github.com/iv-org/invidious.git
synced 2025-07-30 09:18:28 +00:00
Merge branch 'master' into api-only
This commit is contained in:
commit
664ff4b2e0
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Invidious is an alternative front-end to YouTube
|
## Invidious is an alternative front-end to YouTube
|
||||||
|
|
||||||
- Audio-only (and no need to keep window open on mobile)
|
- Audio-only mode (and no need to keep window open on mobile)
|
||||||
- [Open-source](https://github.com/omarroth/invidious) (AGPLv3 licensed)
|
- [Open-source](https://github.com/omarroth/invidious) (AGPLv3 licensed)
|
||||||
- No ads
|
- No ads
|
||||||
- No need to create a Google account to save subscriptions
|
- No need to create a Google account to save subscriptions
|
||||||
|
@ -10,4 +10,3 @@ db:
|
|||||||
dbname: invidious
|
dbname: invidious
|
||||||
full_refresh: false
|
full_refresh: false
|
||||||
https_only: false
|
https_only: false
|
||||||
geo_bypass: true
|
|
||||||
|
@ -83,16 +83,7 @@ spawn do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
proxies = {} of String => Array({ip: String, port: Int32})
|
proxies = PROXY_LIST
|
||||||
if CONFIG.geo_bypass
|
|
||||||
spawn do
|
|
||||||
find_working_proxies(BYPASS_REGIONS) do |region, list|
|
|
||||||
if !list.empty?
|
|
||||||
proxies[region] = list
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# API Endpoints
|
# API Endpoints
|
||||||
|
|
||||||
|
@ -491,8 +491,7 @@ def content_to_comment_html(content)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if run["navigationEndpoint"]?
|
if run["navigationEndpoint"]?
|
||||||
url = run["navigationEndpoint"]["urlEndpoint"]?.try &.["url"].as_s
|
if url = run["navigationEndpoint"]["urlEndpoint"]?.try &.["url"].as_s
|
||||||
if url
|
|
||||||
url = URI.parse(url)
|
url = URI.parse(url)
|
||||||
|
|
||||||
if !url.host || {"m.youtube.com", "www.youtube.com", "youtu.be"}.includes? url.host
|
if !url.host || {"m.youtube.com", "www.youtube.com", "youtu.be"}.includes? url.host
|
||||||
@ -502,11 +501,16 @@ def content_to_comment_html(content)
|
|||||||
url = url.full_path
|
url = url.full_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
|
||||||
url = run["navigationEndpoint"]["commandMetadata"]?.try &.["webCommandMetadata"]["url"].as_s
|
|
||||||
end
|
|
||||||
|
|
||||||
text = %(<a href="#{url}">#{text}</a>)
|
text = %(<a href="#{url}">#{text}</a>)
|
||||||
|
elsif watch_endpoint = run["navigationEndpoint"]["watchEndpoint"]?
|
||||||
|
length_seconds = watch_endpoint["startTimeSeconds"].as_i
|
||||||
|
video_id = watch_endpoint["videoId"].as_s
|
||||||
|
|
||||||
|
text = %(<a href="javascript:void(0)" onclick="player.currentTime(#{length_seconds})">#{text}</a>)
|
||||||
|
elsif url = run["navigationEndpoint"]["commandMetadata"]?.try &.["webCommandMetadata"]["url"].as_s
|
||||||
|
text = %(<a href="#{url}">#{text}</a>)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
text
|
text
|
||||||
|
@ -15,7 +15,6 @@ class Config
|
|||||||
https_only: Bool?,
|
https_only: Bool?,
|
||||||
hmac_key: String?,
|
hmac_key: String?,
|
||||||
full_refresh: Bool,
|
full_refresh: Bool,
|
||||||
geo_bypass: Bool,
|
|
||||||
domain: String?,
|
domain: String?,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
File diff suppressed because one or more lines are too long
@ -203,7 +203,7 @@ end
|
|||||||
def create_response(user_id, operation, key, db, expire = 6.hours)
|
def create_response(user_id, operation, key, db, expire = 6.hours)
|
||||||
expire = Time.now + expire
|
expire = Time.now + expire
|
||||||
nonce = Random::Secure.hex(16)
|
nonce = Random::Secure.hex(16)
|
||||||
db.exec("INSERT INTO nonces VALUES ($1) ON CONFLICT DO NOTHING", nonce)
|
db.exec("INSERT INTO nonces VALUES ($1, $2) ON CONFLICT DO NOTHING", nonce, expire)
|
||||||
|
|
||||||
challenge = "#{expire.to_unix}-#{nonce}-#{user_id}-#{operation}"
|
challenge = "#{expire.to_unix}-#{nonce}-#{user_id}-#{operation}"
|
||||||
token = OpenSSL::HMAC.digest(:sha256, key, challenge)
|
token = OpenSSL::HMAC.digest(:sha256, key, challenge)
|
||||||
|
Loading…
Reference in New Issue
Block a user