Giter Site home page Giter Site logo

Comments (3)

penge avatar penge commented on July 29, 2024 1

Hi @Zeeex

Thank you for the suggestions. Support for both subdomains and wildcards definitely sounds nice, and I am keen on adding them both. Let's see what would be the best way to approach.

Blocking subdomains

Because wildcard in DNS does not cover root domain, *.fandom.com would block only subdomains, but not fandom.com. To block them both, both would need to be stated:

fandom.com
*.fandom.com

I think this is the control you were referring to. No hidden behaviour as well. To block only subdomains:

*.fandom.com

And to block all subdomains except one:

*.fandom.com
!pokemon.fandom.com

Can we agree this is the behaviour we would want?

Wildcards support

Besides blocking subdomains, wildcard could be used anywhere in the path, to match any directory for example. The following example would block all topics:

fandom.com/topics/*

And similarly, to block all topics except one:

fandom.com/topics/*
!fandom.com/topics/anime

Can we agree this is the behaviour we would want?

from block-site.

penge avatar penge commented on July 29, 2024 1

Hi again @Zeeex

I have it implemented. Also added support for matching any one character using ?.

Note:
With the addition of * and ?, blocked sites no longer expand automatically. That means, blocking youtube.com does NOT block any page on youtube.com, but only youtube.com and that's it. To block youtube.com AND any page on it, we would have to write youtube.com/*.
To make it convenient for the user to block the homepage only, he can write either youtube.com or youtube.com/.

Please, feel free to check out #70. The most important file to look at, is find-rule.test.ts, where are all the test scenarios I could think of. It would be nice to double check on that!
I have also added Examples section to README.

from block-site.

Zeeex avatar Zeeex commented on July 29, 2024

Absolutely, both blocking subdomains and wildcard support are fantastic additions! Excellent examples as well.

I'm eagerly anticipating this implementation.

from block-site.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.