-
Notifications
You must be signed in to change notification settings - Fork 834
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Web DNS Resolver for SNS + ENS V2 #4284
base: master
Are you sure you want to change the base?
Conversation
} | ||
|
||
async domainContentIPFSGatewayUpdate(ipfsGateway: string): Promise<string> { | ||
const uuid = (await this.keyringStore.activeUserKeyring()).uuid; |
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.
const userUUID = await this.keyringStore.activeUserKeyring()?.uuid;
It will great if you use Nullish Coalescing Operator(?) 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.
Not neccessary just saying.
start({ | ||
isMobile: false, | ||
}); | ||
|
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.
import { start } from "@coral-xyz/background";
import { supportedDomains, urlPatterns } from "../dns-redirects/constants";
import { redirect } from "../dns-redirects/helpers/tabHelper";
// Start the background process
start({
isMobile: false,
});
// Event listener for handling URL navigation
chrome.webNavigation.onBeforeNavigate.addListener(async (details) => {
try {
// Extract the domain URL
const url = new URL(details.url);
const domainUrl = url.searchParams.get("q") || url.hostname;
// Check if the domain URL contains spaces
if (domainUrl && !domainUrl.includes(" ")) {
// Redirect to the resolved URL
await redirect(domainUrl);
}
} catch (error) {
console.error("Error occurred during navigation:", error);
}
}, {
// Define URL patterns to match
url: supportedDomains.flatMap((param) =>
urlPatterns.map((pattern) => ({
urlMatches: pattern.includes("duckduckgo")
? `${pattern}\\.${param}$`
: `${pattern}\\.${param}&.*$`,
}))
),
});
Instead of having two separate chrome.webNavigation.onBeforeNavigate event listeners, we can combine them into one to reduce redundancy.
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.
just a suggestion, please verify on your own.
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 have put an suggestion for the change in whole file for this
Purpose
Revived an old feature from #2335 which adds Web domain name resolutions via SNS and ENS.
Understandable if the team wants to bench this while they work on other top priority items. Just wanted to get this out of the way.