Commit Graph

304 Commits

Author SHA1 Message Date
Steven Black
0677b534b1
We can now use a "pause" key in update.json to pause updates from specific sources. 2022-05-13 12:20:37 -04:00
XhmikosR
7bf15bf336 Use https in more places 2022-03-12 10:32:32 +02:00
XhmikosR
907c2f5cdc
Update the requests' docs URL 2021-12-12 16:10:35 +02:00
funilrys
4f6ddfaab8
Blacking. 2021-07-13 20:14:25 +02:00
funilrys
6299aebe61
Fix whitelisting issue when RAW list are given.
This patch fixes #1687.

Indeed, before this patch, the whitelisting of a RAW/Plain list of domain
was overlooked.
2021-07-13 20:11:28 +02:00
Steven Black
023eb7faa7
Issue #1628: fix — parse out @ characters from lists. 2021-04-26 17:55:39 -04:00
Steven Black
2b167dcce8
Better name for is_valid_user_provided_domain_format. 2021-04-26 17:08:38 -04:00
Steven Black
1d515c1de3
Standardize the exclusionregexs symbol. 2021-04-26 16:39:07 -04:00
funilrys
4b1a939668
Apply black+isort 2021-03-31 14:57:56 +02:00
funilrys
7971a0cbc9
Introduction of the support of RAW lines.
This patch fixes https://github.com/StevenBlack/hosts/issues/1563#issuecomment-810688754

Indeed, before this patch, the updater was not supporting a RAW (not
hosts) list of domains as input.

Changes:

    matches_exclusions():
        (new) Support for rule formatted as 'example.com' along with
              the pre-existing '0.0.0.0 example.com'.

    normalize_rule():
        (edit) Apply DRY.

        (new) Support the normalization of the rule formatted as
              'example.com' along with the pre-existing '0.0.0.0
              example.com'.

    strip_rule():
        (new) Complete rewrite in order to strip all possible lines.
2021-03-31 14:53:22 +02:00
Steven Black
af9cc115a9
Issue #1464: fix — force a new line prior to the End comment statement. 2020-11-15 13:32:36 -05:00
Alexander Cecile
59ddd34d0e Changed dependency-related exception to be compatible with Python versions < 3.6 2020-08-28 01:51:14 -04:00
Alexander Cecile
1019c6ae00 Improve the error raised when the new dependency is missing 2020-08-28 00:17:50 -04:00
Alexander Cecile
06483cca1d Update error handling in get_file_by_url
I don't believe the the .text could actually raise that exception. Oops.
2020-08-25 20:48:35 -04:00
Alexander Cecile
083db6955e Implement error handling and improve documentation in get_file_by_url 2020-08-25 18:28:21 -04:00
Alexander Cecile
9380fe534e Tweak output formatting of get_file_by_url 2020-08-21 14:44:27 -04:00
Alexander Cecile
beca76acfe Tweak get_file_by_url 2020-08-20 20:00:36 -04:00
Alexander Cecile
4fefecf2e3 Document get_file_by_url 2020-08-20 18:42:31 -04:00
Alexander Cecile
44f41c317b Document get_file_by_url 2020-08-20 17:01:11 -04:00
Alexander Cecile
140c0bd29e Use domain_to_idna in get_file_by_url 2020-08-20 16:15:37 -04:00
Alexander Cecile
79bd7d4122 Tell requests to detect encoding.
Changed the get_file_by_url function to infer/guess the encoding of the content we receive.
2020-08-18 19:36:47 -04:00
Alexander Cecile
5186071948 Introduce the requests library.
Replace the combination of urllib, beautifulsoup and lxml with the requests library.
2020-08-17 19:52:11 -04:00
Steven Black
a09e408c8a
Merge pull request #1342 from codeswhite/patch-network-retry
Implemented connectivity check (Fixed #1038)
2020-07-13 13:41:19 -04:00
Max G
2abefc7cfa Fixed retrying 2020-07-13 18:05:35 +03:00
Steven Black
82791b30c4
Merge pull request #1341 from codeswhite/patch-systemctl-multiple-restarts
Check if a service has already been restarted (Fixes #1338)
2020-07-12 13:36:15 -04:00
Max G
f26168194b Retry to get file from URL once failed
(Resolves #1038)
2020-07-11 14:09:51 +03:00
Max G
0a96dcad34 Use 'with' to not leave a resource open 2020-07-11 13:58:44 +03:00
Max G
0f727b8bed Revert "Implemented connectivity check (Fixed #1038)"
This reverts commit bc8e4c92b8.
2020-07-11 13:57:42 +03:00
Max G
12ee4e0218 Changed to .append() as requested 2020-07-11 13:37:08 +03:00
Max G
bc8e4c92b8 Implemented connectivity check (Fixed #1038) 2020-07-11 00:23:31 +03:00
Max G
bb1b8e81ae Check if a service has already been restarted (Fixes #1338) 2020-07-10 23:48:36 +03:00
Max G
43fe30181b Check if a service is running (Fixed #1337) 2020-07-10 22:47:47 +03:00
funilrys
15df541200
Fix linting issue. 2020-06-07 20:11:57 +02:00
funilrys
5798b17132
Fix location issue under windows.
This patch fix https://github.com/StevenBlack/hosts/issues/1166#issuecomment-634686875
2020-06-07 18:28:32 +02:00
XhmikosR
877814eb22
Update updateHostsFile.py
Escape backslashes
2020-05-27 10:54:15 +03:00
Guilherme Heuser Prestes
d7f8d5ef35
Add back the '-' after hosts in the filename 2020-04-24 21:16:07 +02:00
Steven Black
ef6cff0702
Merge pull request #1236 from adherzog/fix-default-whitelist
Fix default whitelist argument.
2020-04-23 21:38:58 -04:00
XhmikosR
f5358fd0b4 Join a few short lines and fixes a few typos 2020-04-23 09:02:38 +03:00
funilrys
dd7904dcc8
Add forgotten sorting.
Indeed, I forgot to sort the content of the hosts file.
2020-04-21 23:54:01 +02:00
funilrys
665dc98191
Unification of the sorting of the sources.
Before this patch, there was no proper sorting and the sources.

As @XhmikosR mentioned in StevenBlack/hosts#1166, without this patch,
the output is totally different in Windows. But let's be honest, if it
is like that under Windows, chances are that the same behavior happens
across different OSes or machines around the globe.

Another reason behind this patch is that - desperate the fact that we
certainly trust @StevenBlack - the integrity of the generated files
could not be guarenteed because of the sorting which may be completely
different from an OS to another and a machine to another.

For those reasons, this patch introduces a unification of the sorting of
all sources.

The idea behind this patch is to have @StevenBlack's ad-hoc hosts
file always on top (1st) and the rest of the sources sorted
alphabetically based on the name of the folder inside the `data`
or `extensions` directory.

This will ensure that we get the same result everywhere.

Concretely speaking, I just added the function (`sort_sources`) which
sorts a given list of sources files. And later on, call the new function
everywhere it was necessary. Tests of the newly introduced function
are also included.

Contributors:
  * @ScriptTiger
  * @XhmikosR

Notes:
  * This patch fix (completely ?) ScriptTiger/hosts#1
  * This patch fix https://github.com/StevenBlack/hosts/issues/1166#issuecomment-590511086
2020-04-21 22:54:25 +02:00
Adam Herzog
2a742e7f99 Fix default whitelist argument. 2020-04-20 10:22:13 -04:00
Anthony Molinaro
4aa8b65cc2 provide defaults for args 2020-04-13 16:20:22 -07:00
Anthony Molinaro
dd2d878e95 Allow whitelist/blacklist files to be passed via command line 2020-04-13 12:14:34 -07:00
Steven Black
e091bcc185
Merge pull request #1216 from djnym/clean-checkout-fixes
Keep checkout unmodified when adding outputpath.
2020-04-08 16:23:58 -04:00
Anthony Molinaro
cac15b1c11 use nogendata for arg 2020-04-07 22:55:02 -07:00
Anthony Molinaro
37bc3821f8 applied black 2020-04-07 22:44:37 -07:00
Anthony Molinaro
9c1b8b2579 use more succinct name for arg 2020-04-07 22:40:30 -07:00
XhmikosR
787022fea2
Fix typo 2020-04-08 07:36:24 +03:00
Anthony Molinaro
699b52e1bd forgot to remove a debug 2020-04-07 20:17:04 -07:00
Anthony Molinaro
2d696a42d9 keep checkout clean 2020-04-07 20:08:23 -07:00