Giter Club home page Giter Club logo

blk's People

Contributors

mhgbrg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

hjorthjort

blk's Issues

Use a linter to check for code errors

I don't know anything about bash, so there are probably a whole lot of errors in the code. Using a linter would teach me more about bash and help me fix some of these errors.

Make it easier to block websites

It is a hassle to have to supply the -s flag each time a site is blocked. Could this be make easier? Maybe the first argument always have to be the site that is blocked or unblocked.

Remove need for using sudo

It is a drag to always have to use sudo for blocking or unblocking websites. Can sudo be incorporated in the script in some way?

Maybe it is as easy as adding a section in the readme about changing the permission of the hosts file.

Write tests

The functionality of blk is beginning to get too big to manually test each time some change is made. I don't know if writing tests for bash scripts are considered good practice (or if it's just an indication of that your script is beginning to get too large...), but it is something that could be looked into.

Leverage more of at's power

at can take arguments such as now + 2 minutes. Right now the script only parses one parameter after the keyword until. Maybe it could be worth it to parse any extra parameters to leverage the complete power of at.

Prettier output

Right now the script outputs one line for each website blocked or unblocked. It would probably be nicer to just output one line for all websites, or something similar.

Redirect to other sites served by HTTPS

Right now when redirecting a site to another site served by HTTPS the certificate for the site redirected to is not valid, since the url in the browser doesn't match the url for the certificate. True redirects are not supported by the hosts file, so the easiest solution to this problem would probably be to redirect to a local web server that can redirect to the correct site.

This web server would have to run on the default port, since you can't specify which port to redirect to in the hosts file.

Show if websites are blocked for or until a time in blk list

Right now there is no indication whether a website is blocked for 2 seconds or eternally. This should be shown when using blk list.

To do this the information could be saved after '# blk' in the hosts file. For example '# blk until 17.30'.

Another interesting thing could be to also show sites that are unblocked for or until a certain time. Information about this is currently not saved in the hosts file, but it could be stored in commented out lines. Another solution is to save a file with state in the user's home folder with this information.

Update readme

The way the script is used has been changed and the examples in the readme needs to be updated.

Using `until` for several websites at once fails

When using until for several websites at once, only one of the websites are blocked/unblocked at the specified time. This is because the at-jobs both try to edit the hosts-file at the same time, which results in only one of the succeeding.

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.