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

Profile Groups #31

Closed
smhmd opened this issue Apr 7, 2020 · 3 comments
Closed

Profile Groups #31

smhmd opened this issue Apr 7, 2020 · 3 comments
Assignees
Labels
feature New feature or request

Comments

@smhmd
Copy link
Contributor

smhmd commented Apr 7, 2020

Is your feature request related to a problem? Please describe.
I use /etc/hosts to block websites during work. for example, I block youtube, twitter, ycombinator, etc. I would love to have profiles for individual websites (e.g., sudo hostctl enable -p youtube) but at the same time have a group of profiles that I can manipulate all at once (e.g., sudo hostctl disable -p socialmedia).

Describe the solution you'd like

$ hostctl group socialmedia -p youtube twitter linkedin
$ hostctl disable -p socialmedia # disable all social media
$ hostcl enable -p youtube          # except for youtube
@smhmd smhmd added the feature New feature or request label Apr 7, 2020
@guumaster guumaster added bug Something isn't working documentation Improvements or additions to documentation labels Apr 7, 2020
@guumaster
Copy link
Owner

Not sure if I understand the request correctly. Profiles are already groups of urls. You can add YouTube, twitter and such to a social media group:

hostctl add domain --ip 1.1.1.1 youtube.com -p socialmedia
hostctl add domain --ip 2.2.2.2 twitter.com -p socialmedia

And then enable/disable all together

@guumaster guumaster removed bug Something isn't working documentation Improvements or additions to documentation labels Apr 7, 2020
@smhmd
Copy link
Contributor Author

smhmd commented Apr 7, 2020

As I've said, I'm not using hosts to manage a server or anything, I'm using hosts to block websites when I wanna focus on work or block NSFW material. My idea was to have a master profile for individual profiles. To block Twitter I have the following in hosts:

...15 lines blocking facebook 
127.0.0.1       www.twitter.com
127.0.0.1       twitter.com
127.0.0.1       www.mobile.twitter.com
127.0.0.1       mobile.twitter.com
127.0.0.1       api.twitter.com
...27 lines blocking some google stuff

And that's the same for most other websites. It only makes sense to have profiles for these websites as they aren't a single domain to be blocked.

But, comes 7 PM and I'm Ok with social media and news websites. A profile group for all of these profiles to enable them at mass.

I'm only asking for this feature thinking it could be useful to others. If it's not so, I could easily make a shell script for myself.

@guumaster
Copy link
Owner

you can also add all your blocks into a file, for example $HOME/block-etchost, and block all once with a single command:

hostctl add -p superblock --from $HOME/block-etchost

And all would be added easily.

Also, if all have the same IP, you can do with a single command: hostctl add domain facebook.com twitter.com -p socialmedia (defaults to localhost ip), but it would be a long command if you have too many domains.

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

No branches or pull requests

2 participants