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

Blacklist #402

Open
dabukalam opened this issue Jun 17, 2021 · 3 comments
Open

Blacklist #402

dabukalam opened this issue Jun 17, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@dabukalam
Copy link
Contributor

It would be good to be able to specify a list of URLs that one doesn't want url-bot to resolve.

@nuxeh
Copy link
Owner

nuxeh commented Jun 17, 2021

Sure, seems like a good feature... PRs welcome ;)

How I'd go about this would be something like:

  • Add a blacklist: Vec<Url> field to the configuration settings struct. Serde will then automatically verify any specified urls on configuration load.
  • Check the blacklist vector when resolving URLs and bail if it contains the current url token.

However this would then have to be an exhaustive list of URLs you want to black list, providing a domain probably wouldn't black list all urls under this domain, for example. That would require some more thought.

@nuxeh
Copy link
Owner

nuxeh commented Jun 17, 2021

I guess one simple solution could be to have separate e.g. blacklisted_urls and blacklisted_domains configuration fields.

Then in the resolve function you could check whether blacklisted_domains contains url.domain() and bail if so.

@nuxeh
Copy link
Owner

nuxeh commented Jun 17, 2021

Originally I thought maybe Url might itself have a contains() method, so you could identify whether the current url's path contains the blacklisted URL, but a quick look suggests not.

@nuxeh nuxeh added the enhancement New feature or request label Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants