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

feat: enhance domain validate with regex, support wildcard domain and path validate #150

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ausir0726
Copy link

@ausir0726 ausir0726 commented Jul 25, 2023

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

I modified the original simple hostname check to support both hostname and pathname validation, and I also added the capability to use wildcard domain verification. ( use regex )

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.
    This feature has not been documented yet.

@pi0 pi0 added the v1 label Sep 5, 2023
@jameswragg
Copy link
Contributor

jameswragg commented Nov 23, 2023

This looks good & certainly a useful addition. If the merge conflicts were addressed & potentially IPX_HTTP_DOMAINS docs updated to mention wildcard support, is there reason not to merge @pi0?

@@ -26,18 +26,31 @@ export const createHTTPSource: SourceFactory<HTTPSourceOptions> = (options) => {
if (!HTTP_RE.test(d)) {
d = "http://" + d;
}
return new URL(d).hostname;
const { hostname, pathname } = new URL(d);
const regExpUrl = `${hostname}${pathname}`.replaceAll("*.", "(\\w*.)?");
Copy link
Contributor

Choose a reason for hiding this comment

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

Allow for multiple subdomains?

Suggested change
const regExpUrl = `${hostname}${pathname}`.replaceAll("*.", "(\\w*.)?");
const regExpUrl = `${hostname}${pathname}`.replaceAll("*.", "(\\w*.)+?");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allow domain validation with subpaths Support wildcard domains
3 participants