Skip to content
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

fix: mutinynet url matching #329

Merged
merged 2 commits into from
Dec 5, 2023

Conversation

Kodylow
Copy link
Member

@Kodylow Kodylow commented Nov 30, 2023

Noticed that if you have a trailing slash on the https://mutinynet.com/api/ rpc it doesn't register as mutinynet, so this converts to URL to match against trailing slash and http

@Kodylow Kodylow requested review from a team as code owners November 30, 2023 20:44
Copy link
Collaborator

@wbobeirne wbobeirne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new URL will throw if it's not a valid URL which could cause the app to crash. Do the URL constructor inside of the component, not at the call site, and wrap in a try / catch.

packages/ui/src/NetworkIndicator.tsx Show resolved Hide resolved
@Kodylow
Copy link
Member Author

Kodylow commented Dec 1, 2023

updated and refactored out to separate the check.

const isMutinynet = (bitcoinRpcUrl: string) => {
try {
const url = new URL(bitcoinRpcUrl);
return url.host === 'mutinynet.com' && url.pathname === '/api';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still doesn't work, do you just want to drop the pathname and make it mutinynet if it's from mutinynet.com?

CleanShot 2023-12-05 at 12 19 13@2x

@wbobeirne wbobeirne merged commit 13add9e into fedimint:master Dec 5, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants