Indeed, before this patch, no `# Title: XYZ` was describing our generated
host file. This patch fixes that.
Indeed, we now do the following:
- If no extension is included we add:
- `# Title: StevenBlack/hosts`
- If exactly one extension is included we add:
- `# Title: StevenBlack/hosts with the extension_name extension`
- If more than one extension is included we add (in one line):
- `# Title: StevenBlack/hosts with the extname1,
extname2 and extname3 extensions`
Please also note that I disable E203 (whitespace before ':') for flake8
at line 773.
Since we use Black for code formatting let me redirect you to
the documentation of Black which explain what I did.
https://black.readthedocs.io/en/stable/the_black_code_style.html#slices :
> Since E203 is not PEP 8 compliant, you should tell
> Flake8 to ignore these warnings.
I've changed as suggested in https://github.com/StevenBlack/hosts/pull/836#issuecomment-440452979 by @funilrys
The reason I choose NOT to convert this into ISO-8601 is, that we read date.time in different ways depending on with side on the pond we live. By using the "%d %B %Y %H:%M:%S (%Z)" Full date/time this issue is eliminated and any confusion on how to read the date is no longer existent. The ISO-8601 is good for active pages, as the date ordering is to be manipulated by interface.
Alternative to this is we should add extra lines/info about the date.time ordering, do to this i found this as the easiest way to give this information
Since some host files might need to be updated more frequently it's more appropriate to show timezone and the exact time for last build, hince changed the order of month and date to %d %B
This patch fixStevenBlack/hosts#777
This patch:
* Change the default state of keepdomaincomments.
* Indeed, comments are now displayed by default.
* But if you don't need comments, feel free to use the argument.
* Delete the requirement input when calling the `-k` argument.
* Update tests case regarding the new state of keepdomaincomments.
The following files:
* myhosts
* blacklist
* whitelist
can be all be modified by the user for personal usage.
However, git is tracking these files since they exist
in the repository, which makes it difficult to do so
without accidentally pushing one's own customizations.
This commit converts those examples to ".example" files,
which serve as the defaults if one of the files listed
above does not exist.
Closes gh-144.
Checking for zero-length is not necessary here as iterating over a
zero-length list is perfectly valid, and produces exactly zero
iterations, matching the intended behaviour without an extra check.
This patch review the way we get the comment at the end of a line.
I also did an application of DRY (Do not Repeat Yourself)
and/or KISS (Keep It Simple, Stupid) by refactoring the 2 `else`
statements into one line.
This option (--minimise, -m) differs from compress (--compress, -c) in
that it keeps each host on a different line, while still removing
unnecessary newlines and comments.
This is necessary because many implementations of URL blockers that rely
on hosts files do not conform to the standard which allows multiple
hosts on a single line.
An offset of 7 was hardcoded in the function compress_file, presumably
to skip over the default target IP address of 0.0.0.0 in a hosts file.
However, this causes problems when the default is overridden using the
--ip or -i flag, causing visibly garbled output in the generated hosts
file.
Fix is to calculate the length of target IP at runtime.
In particular, the compression option removes non-necessary lines (empty lines and comments) and puts multiple domains in each line.
This option should solve the issue #411 regarding the DNS client service of Windows.
In particular, the compression option removes non-necessary lines (empty lines and comments) and puts multiple domains in each line.
This option should solve the issue #411 regarding the DNS client service of Windows.
* Whitelisting `s.youtube.com` should not whitelist `ads.youtube.com`; but
can whitelist `a.s.youtube.com`
* Whitelisting `twitter.com` should not whitelist `ttwitter.com` or
`twitter.com.au`; but can whitelist `a.twitter.com`
Bugs have been found where we assumed
that query_yes_no returned True/False.
Not only is it easier to check booleans
instead of strings, but it also looks
a lot cleaner in the code.
Previously, it was checking if query_yes_no returned
False, which does not happen, as the function only
returns "yes" or "no". As a result, the check was
always returning True, even when the user did not
want to flush the DNS cache.
Ubuntu 17.04 replaces dnsmasq with systemd-resolve which uses a different local IP address for domain name resolution.
By including this simple line of code we basically do the same what Issue #110 requested to fix Issue #109 but this time for systemd-resolve.