-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add invidious companion support #4985
Open
unixfox
wants to merge
26
commits into
iv-org:master
Choose a base branch
from
unixfox:invidious-companion
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
3dff7a7
add support for invidious companion
unixfox 73c84ba
redirect latest_version and dash manifest to invidious companion
unixfox 1954463
fix Shadowing outer local variable `response`
unixfox c612423
fixing condition for Content-Security-Policy
unixfox 2cc204a
throw error if inv_sig_helper and invidious_companion used same time
unixfox 1c9f5b0
Use sample instead of Random.rand
unixfox 27b24f5
Remove debug puts functions
unixfox 409df4c
modify the description for config.example.yaml about invidious companion
unixfox ff3305d
move config checks for invidious companion
unixfox 1aa154b
separate invidious_companion logic + better config.yaml config
unixfox 9f84612
fixing "end" misplacement
unixfox b51770d
fix linting + use .empty?
unixfox bb2e3b2
crystal handle decompression already by itself
unixfox 734e725
fix download function when invidious companion used
unixfox 1f51edd
fix linting
unixfox 7a070fa
invidious companion always used so always add CSP and redirect latest…
unixfox f710dd3
apply all the suggestions + rework invidious_companion parameter
unixfox a571eea
format watch.cr
unixfox ab72bba
fix ameba Redundant use of `Object#to_s` in interpolation
unixfox 1de2054
add ability for invidious companion to check request from invidious
unixfox 0dba767
Better document private_url and public_url
unixfox e9c354d
Better doc for invidious_companion_key
unixfox f550359
!empty? to present?
unixfox bfaf72b
skip proxy for invidious companion
unixfox 84b87be
fixing format
unixfox a5acdde
missing ,
unixfox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,6 +201,13 @@ module Invidious::Routes::Embed | |
return env.redirect url | ||
end | ||
|
||
if companion_base_url = video.invidious_companion.try &.["baseUrl"].as_s | ||
env.response.headers["Content-Security-Policy"] = | ||
env.response.headers["Content-Security-Policy"] | ||
.gsub("media-src", "media-src #{companion_base_url}") | ||
.gsub("connect-src", "connect-src #{companion_base_url}") | ||
end | ||
unixfox marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+204
to
+209
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you move these to the before_all handler instead maybe under a: if {"/embed", "/watch"}.any? { |r| env.request.resource.starts_with? r }
env.response.headers["Content-Security-Policy"] =
env.response.headers["Content-Security-Policy"]
.gsub("media-src", "media-src #{companion_base_url}")
.gsub("connect-src", "connect-src #{companion_base_url}")
end |
||
|
||
rendered "embed" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I'm really excited we can deprecate
inv-sig-helper
and that it fixes many issues!Maybe you could mention which paths have to go through the Companion if Invidious and Companion domains are the same.
AFAIK these are:
/api/manifest/dash/id/*
/latest_version
In my K8S / helm template:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's in the temporary doc: https://docs.invidious.io/companion-installation/