-
Notifications
You must be signed in to change notification settings - Fork 882
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
Display IPFS interstitial page when failed to use local node #6782
Conversation
78e08e5
to
899b80a
Compare
899b80a
to
ff9933c
Compare
ff9933c
to
142dfce
Compare
142dfce
to
939b8f0
Compare
IpfsNavigationThrottoleBrowserTest.ShowInterstitialForEmptyConnectedPeers currently times out on CI builds (Release builds) but not my local component builds, currently investigating at the moment. |
"ipfs_service.cc", | ||
"ipfs_service.h", | ||
"ipfs_service_observer.h", | ||
"translate_ipfs_uri.cc", | ||
"translate_ipfs_uri.h", |
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.
basically there is no need to split a component into browser
, common
, etc unless all code lives in the browser process. This is needed only when there is something needed for renderer and something for browesr
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.
@bbondy has a different PR in progress for moving all files into browser folder, I'll leave it as is here, I move this one to common in this PR because I'm using a function in translate_ipfs_uri.cc in ipfs_utils which is currently under common folder.
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.
yeah, np, just a side note. We basically can just keep everything in components/ipfs
will take another look tomorrow |
c34b1b5
to
7f242c3
Compare
7f242c3
to
3157a2e
Compare
@@ -13,6 +13,10 @@ namespace ipfs { | |||
class IpfsUtils { | |||
public: | |||
static bool IsIPFSURL(const GURL& url); | |||
static bool IsDefaultGatewayURL(const GURL& url); |
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.
all of these should be free functions, no need to put them into a class
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.
Thanks for pointing it out, I'll open a small followup for this to minimize the scope here.
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.
Follow-up PR at #6821.
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!
|
||
namespace ipfs { | ||
|
||
class IPFSNotConnectedPage |
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.
can you please briefly describe what this page is for?
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.
Fixed in cb284f6
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, feel free to do the comments I mentioned in a follow up if you prefer too.
app/brave_generated_resources.grd
Outdated
IPFS public gateway fallback | ||
</message> | ||
<message name="IDS_SETTINGS_IPFS_AUTO_FALLBACK_TO_GATEWAY_DESC" desc="The description for the switch of automatically fallback to IPFS public gateway"> | ||
Automatically fallback to IPFS public gateway when failed to access through the local node. |
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.
Automatically fallback to the IPFS public gateway when the local node cannot be accessed.
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.
Fixed in cb284f6
return; | ||
|
||
const GURL url = IpfsUtils::ToPublicGatewayURL( | ||
navigation_handle()->GetURL()); |
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.
nit: I think this can fit on 1 line
clang-format -i components/ipfs/browser/ipfs_navigation_throttle.cc
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.
Fixed in cb284f6
@@ -115,6 +115,12 @@ TEST_F(IpfsNavigationThrottleUnitTest, DeferUntilIpfsProcessLaunched) { | |||
profile()->GetPrefs()->SetInteger( | |||
kIPFSResolveMethod, static_cast<int>(IPFSResolveMethodTypes::IPFS_LOCAL)); | |||
|
|||
auto peers = std::vector<std::string>{ |
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.
nit: minor changes to this file if you run clang-format
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.
Fixed in cb284f6
Hide Advanced | ||
</message> | ||
<message name="IDS_IPFS_NOT_CONNECTED_EXPLANATION" desc="The text of the IPFS not connected interstitial that will be displayed when the user presses the 'Advanced' button for additional information."> | ||
We cannot connect to the requested content using the local IPFS node at the moment because the local node doesn't seem to start or there are no connected peers available at the moment. By proceeding we will automatically fallback to the default public gateway in the future when we cannot connect to IPFS contents using the local IPFS node, this could be turned off later in settings. |
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.
We cannot connect to the requested content using the local IPFS node because the local node didn't start or because there are no connected peers available at the moment. By proceeding, we will automatically fallback to the default public gateway in the future when we cannot connect to IPFS content using the local IPFS node. This can be turned off later in settings.
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.
Fixed in cb284f6
components/ipfs/common/ipfs_utils.cc
Outdated
DCHECK(IsIPFSScheme(url) || IsIPFSURL(url)); | ||
GURL new_url; | ||
|
||
// For ipfs/ipfs schemes, use TranslateIPFSURI directly. |
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.
nit: ipfs/ipns I assume
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.
Yes indeed! Fixed in cb284f6.
] | ||
|
||
deps = [ | ||
"//extensions/common", | ||
"//net", |
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.
I'm not sure if this dep can cause problems being included in common code. I guess we aren't actually depending on this common target from common code though so I think it's ok. And will be cleaned up when I get rid of browser and common.
- Add a comment for IPFSNotConnectedPage. - Strings changes. - Fix typo in a comment. - clang-format
{"ipfsAutoFallbackToGatewayLabel", | ||
IDS_SETTINGS_IPFS_AUTO_FALLBACK_TO_GATEWAY_LABEL}, | ||
{"ipfsAutoFallbackToGatewayDesc", | ||
IDS_SETTINGS_IPFS_AUTO_FALLBACK_TO_GATEWAY_DESC}, |
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.
cc @bridiver here for chromium_src owner review.
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.
No need for @bridiver to review this particular chromium_src change. The codeowner file has some false positives in some cases like this which doesn't need his review.
Resolves brave/brave-browser#11558
Submitter Checklist:
npm run lint
,npm run gn_check
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).QA/Yes
orQA/No
) to the associated issuerelease-notes/include
orrelease-notes/exclude
) to the associated issueTest Plan:
Reviewer Checklist:
After-merge Checklist:
changes has landed on.