put blocked URLs in its own file to make contributions easier

This commit is contained in:
Lionel Dricot 2023-09-26 22:21:19 +02:00
parent 7ffbd1b288
commit eeae7e3ad7
3 changed files with 38 additions and 15 deletions

View File

@ -3,6 +3,7 @@
## 2.0-beta2 - unreleased
Changes since beta1
- "--sync" can optionnaly take some lists as arguments, in order to make for specific sync
- default URL blocked list is now its own file to make contributions easier
- prompt color is now part of the theme
- improves handling of base64 images
- fixes gophermap being considered as gemtext files

33
offblocklist.py Normal file
View File

@ -0,0 +1,33 @@
# The following are the default redirections from Offpunk
# Those are by default because they should make sens with offpunk
redirects = {
"*twitter.com" : "nitter.net",
"youtube.com" : "yewtu.be",
"youtu.be" : "yewtu.be",
"*reddit.com" : "teddit.net",
"*medium.com" : "scribe.rip",
}
#following are blocked URLs. Visiting them with offpunk doesnt make sense.
#Blocking them will save a lot of bandwith
blocked = {
"*facebook.com",
"*facebook.net",
"*fbcdn.net",
"*linkedin.com",
"*licdn.com",
"*admanager.google.com",
"*google-health-ads.blogspot.com",
"*firebase.google.com",
"*google-webfonts-helper.herokuapp.com",
"*tiktok.com" ,
"*doubleclick.net",
"*google-analytics.com" ,
"*ads.yahoo.com",
"*advertising.amazon.com",
"*advertising.theguardian.com",
"*advertise.newrepublic.com",
}

View File

@ -27,6 +27,7 @@ import ansicat
import offthemes
from offutils import run,term_width,is_local,mode_url,unmode_url
from offutils import _CONFIG_DIR,_DATA_DIR,_CACHE_PATH
import offblocklist
try:
import setproctitle
setproctitle.setproctitle("offpunk")
@ -178,21 +179,9 @@ class GeminiClient(cmd.Cmd):
"search" : "gemini://kennedy.gemi.dev/search?%s",
"accept_bad_ssl_certificates" : False,
}
self.redirects = {
"*twitter.com" : "nitter.42l.fr",
"*facebook.com" : "blocked",
"*tiktok.com" : "blocked",
"*doubleclick.net": "blocked",
"*google-analytics.com" : "blocked",
"youtube.com" : "yewtu.be",
"*reddit.com" : "teddit.net",
"*medium.com" : "scribe.rip",
"*admanager.google.com": "blocked",
"*google-health-ads.blogspot.com": "blocked",
"*firebase.google.com": "blocked",
"*google-webfonts-helper.herokuapp.com": "blocked",
}
self.redirects = offblocklist.redirects
for i in offblocklist.blocked:
self.redirects[i] = "blocked"
term_width(new_width=self.options["width"])
self.log = {
"start_time": time.time(),