mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-27 23:18:35 +00:00
fix(companion): skip inv-sig-helper when Invidious Companion is enabled
- parser: skip decrypt_signature/decrypt_nsig when CONFIG.invidious_companion.present? - youtube_api: avoid signatureTimestamp (STS) lookup under Companion Aligns with the deprecation of inv-sig-helper in favor of Invidious Companion. No behavior change when Companion is disabled. Refs: iv-org/invidious#5423
This commit is contained in:
parent
8ed07a58d4
commit
93c4a6bf26
@ -542,14 +542,25 @@ private def convert_url(fmt)
|
|||||||
|
|
||||||
LOGGER.debug("convert_url: Decoding '#{cfr}'")
|
LOGGER.debug("convert_url: Decoding '#{cfr}'")
|
||||||
|
|
||||||
unsig = DECRYPT_FUNCTION.try &.decrypt_signature(cfr["s"])
|
# When using Invidious Companion, streaming URLs should already be usable.
|
||||||
|
# Skip inv-sig-helper based signature decryption in that case.
|
||||||
|
unsig = if CONFIG.invidious_companion.present?
|
||||||
|
nil
|
||||||
|
else
|
||||||
|
DECRYPT_FUNCTION.try &.decrypt_signature(cfr["s"])
|
||||||
|
end
|
||||||
params[sp] = unsig if unsig
|
params[sp] = unsig if unsig
|
||||||
else
|
else
|
||||||
url = URI.parse(fmt["url"].as_s)
|
url = URI.parse(fmt["url"].as_s)
|
||||||
params = url.query_params
|
params = url.query_params
|
||||||
end
|
end
|
||||||
|
|
||||||
n = DECRYPT_FUNCTION.try &.decrypt_nsig(params["n"])
|
# Skip nsig decryption when using Invidious Companion
|
||||||
|
n = if CONFIG.invidious_companion.present?
|
||||||
|
nil
|
||||||
|
else
|
||||||
|
DECRYPT_FUNCTION.try &.decrypt_nsig(params["n"])
|
||||||
|
end
|
||||||
params["n"] = n if n
|
params["n"] = n if n
|
||||||
|
|
||||||
if token = CONFIG.po_token
|
if token = CONFIG.po_token
|
||||||
|
@ -473,8 +473,12 @@ module YoutubeAPI
|
|||||||
} of String => String | Int64
|
} of String => String | Int64
|
||||||
|
|
||||||
if {"WEB", "TVHTML5"}.any? { |s| client_config.name.starts_with? s }
|
if {"WEB", "TVHTML5"}.any? { |s| client_config.name.starts_with? s }
|
||||||
if sts = DECRYPT_FUNCTION.try &.get_sts
|
# When using Invidious Companion, player requests are proxied there,
|
||||||
playback_ctx["signatureTimestamp"] = sts.to_i64
|
# so we skip fetching signatureTimestamp via inv-sig-helper.
|
||||||
|
if !CONFIG.invidious_companion.present?
|
||||||
|
if sts = DECRYPT_FUNCTION.try &.get_sts
|
||||||
|
playback_ctx["signatureTimestamp"] = sts.to_i64
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user