-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add referer header for Duck Player #6407
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 referer header for Duck Player #6407
Conversation
14e08f2
to
c7ee8da
Compare
duckplayer/duckplayer-impl/src/main/java/com/duckduckgo/duckplayer/impl/RealDuckPlayer.kt
Show resolved
Hide resolved
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.
Tried to test this but was not able to. Couldn't consistently see embeds calls, with Charles they are all encrypted since we don't own the domain and with chrome inspect it only gave me the basic headers.
Would be great to have more detailed testing steps and also change from draft to ready to review once the TODO is done.
47ca5de
to
c2ffb28
Compare
c2ffb28
to
6222e57
Compare
if (isYoutubeWatchUrl(url)) { | ||
return processYouTubeWatchUri(request, url, webView) | ||
} else if (isSimulatedYoutubeNoCookie(url)) { | ||
return processSimulatedYouTubeNoCookieUri(url, webView) | ||
} else if (duckPlayerFeature.addCustomEmbedReferer().isEnabled() && isYouTubeNoCookieEmbedUri(url, webViewUrl)) { | ||
return try { | ||
WebResourceResponse("text/html", "UTF-8", getEmbedWithReferer(request)) |
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.
getEmbedWithReferer() can return null, would that be the correct thing to send in the WebResourceResponse?
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.
Good call. When I made it nullable, I was thinking to return a null response (so we continue loading the original request), but that's not what I'm doing here. Thanks for catching it!
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.
LGTM
Task/Issue URL: https://app.asana.com/1/137249556945/task/1210811808963690?focus=true ### Description Set referer header to local assets directory in compliance with new TOS ### Steps to test this PR _Feature 1_ - [ ] Set up Charles Proxy - [ ] Disable macOS proxy under Charles toolbar > Proxy - [ ] Enable SSL proxying and include location `*:*` under Charles toolbar > Proxy > SSL Proxying settings - [ ] Check IP address under Charles toolbar > Help > Local IP addresses. Check port under Charles toolbar > Proxy settings - [ ] Set up proxy for WiFi connection on your phone by setting IP address and port from previous step - [ ] Open the app and load http://charlesproxy.com/getssl - [ ] Download the certificate and install as CA certificate - [ ] Load a video on Duck Player - [ ] Using Charles proxy, check that requests to `https://www.youtube-nocookie.com/embed/...` have `referer` header set to `http://android.mobile.duckduckgo.com` ### UI changes n/a
Task/Issue URL: https://app.asana.com/1/137249556945/task/1210811808963690?focus=true
Description
Set referer header to local assets directory in compliance with new TOS
Steps to test this PR
Feature 1
*:*
under Charles toolbar > Proxy > SSL Proxying settingshttps://www.youtube-nocookie.com/embed/...
havereferer
header set tohttp://android.mobile.duckduckgo.com
UI changes
n/a