1 # Fedi API Block - An aggregator for fetching blocking data from fediverse nodes
2 # Copyright (C) 2023 Free Software Foundation
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU Affero General Public License as published
6 # by the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU Affero General Public License for more details.
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 from fba.helpers import blacklist
20 from fba.helpers import domain as domain_helper
22 logging.basicConfig(level=logging.INFO)
23 logger = logging.getLogger(__name__)
24 #logger.setLevel(logging.DEBUG)
26 # Blocklists hosted by oliphant
27 oliphant_blocklists = (
29 "blocker": "artisan.chat",
30 "csv_url": "mastodon/artisan.chat.csv",
32 "blocker": "colorid.es",
33 "csv_url": "mastodon/colorid.es.csv",
35 "blocker": "indiepocalypse.social",
36 "csv_url": "mastodon/indiepocalypse.social.csv",
38 "blocker": "mastodon.art",
39 "csv_url": "mastodon/mastodon.art.csv",
41 "blocker": "pleroma.envs.net",
42 "csv_url": "mastodon/pleroma.envs.net.csv",
44 "blocker": "oliphant.social",
45 "csv_url": "mastodon/_unified_tier3_blocklist.csv",
47 "blocker": "mastodon.online",
48 "csv_url": "mastodon/mastodon.online.csv",
50 "blocker": "mastodon.social",
51 "csv_url": "mastodon/mastodon.social.csv",
53 "blocker": "mastodon.social",
54 "csv_url": "other/missing-tier0-mastodon.social.csv",
56 "blocker": "rage.love",
57 "csv_url": "mastodon/rage.love.csv",
59 "blocker": "sunny.garden",
60 "csv_url": "mastodon/sunny.garden.csv",
62 "blocker": "sunny.garden",
63 "csv_url": "mastodon/gardenfence.csv",
65 "blocker": "solarpunk.moe",
66 "csv_url": "mastodon/solarpunk.moe.csv",
68 "blocker": "toot.wales",
69 "csv_url": "mastodon/toot.wales.csv",
71 "blocker": "union.place",
72 "csv_url": "mastodon/union.place.csv",
74 "blocker": "oliphant.social",
75 "csv_url": "mastodon/birdsite.csv",
82 "blocker": "seirdy.one",
83 "url" : "https://seirdy.one/pb/bsl.txt",
85 "blocker": "seirdy.one",
86 "url" : "https://seirdy.one/pb/FediNuke.txt",
88 "blocker": "seirdy.one",
89 "url" : "https://seirdy.one/pb/spammy-subdomains.txt",
96 "blocker": "tooters.org",
97 "csv_url": "https://raw.githubusercontent.com/victorwynne/victorwynne/tooters/federation/tooters_defederations.csv",
99 "blocker": "pleroma.envs.net",
100 "csv_url": "https://seirdy.one/pb/pleroma.envs.net.csv",
104 def has(domain: str) -> bool:
105 logger.debug("domain='%s' - CALLED!")
106 domain_helper.raise_on(domain)
108 if blacklist.is_blacklisted(domain):
109 raise ValueError(f"domain='{domain}' is blacklisted but function was invoked")
111 # Default is not found
113 for row in oliphant_blocklists + csv_files:
114 logger.debug("row[blocker]='%s',domain='%s'", row["blocker"], domain)
115 if row["blocker"] == domain:
117 logger.debug("domain='%s' is found and excluded from regular fetch_blocks command - BREAK!", domain)
120 logger.debug("found='%s' - EXIT!", found)