+++ /dev/null
-# Fedi API Block - An aggregator for fetching blocking data from fediverse nodes
-# Copyright (C) 2023 Free Software Foundation
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as published
-# by the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <https://www.gnu.org/licenses/>.
-
-# Don't check these, known trolls/flooders/testing/developing
-blacklist = [
- # Floods federation with fake nodes as "research" project
- "activitypub-troll.cf",
- # Similar troll
- "gab.best",
- # Similar troll
- "4chan.icu",
- # Flooder (?)
- "social.shrimpcam.pw",
- # Flooder (?)
- "mastotroll.netz.org",
- # Testing/developing installations
- "ngrok.io",
- "ngrok-free.app",
- "misskeytest.chn.moe",
- # block flooder
- "everyoneattack.com",
-]
-
-def is_blacklisted(domain: str) -> bool:
- # DEBUG: print(f"DEBUG: domain='{domain}' - CALLED!")
- if not isinstance(domain, str):
- raise ValueError(f"Parameter domain[]='{type(domain)}' is not 'str'")
- elif domain == "":
- raise ValueError("Parameter 'domain' is empty")
-
- blacklisted = False
- for peer in blacklist:
- # DEBUG: print(f"DEBUG: Checking peer='{peer}' ...")
- if peer in domain:
- # DEBUG: print(f"DEBUG: domain='{domain}' is blacklisted.")
- blacklisted = True
-
- # DEBUG: print(f"DEBUG: blacklisted='{blacklisted}' - EXIT!")
- return blacklisted
import reqto
import validators
-from fba import blacklist
from fba import config
from fba import federation
from fba import fba
from fba import network
+from fba.helpers import blacklist
from fba.helpers import cookies
from fba.helpers import locking
from fba.helpers import tidyup
import requests
import validators
-from fba import blacklist
from fba import federation
from fba import network
+from fba.helpers import blacklist
+
from fba.models import instances
# Connect to database
import bs4
import validators
-from fba import blacklist
from fba import config
from fba import csrf
from fba import network
+from fba.helpers import blacklist
from fba.helpers import tidyup
from fba.helpers import version
--- /dev/null
+# Fedi API Block - An aggregator for fetching blocking data from fediverse nodes
+# Copyright (C) 2023 Free Software Foundation
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+# Don't check these, known trolls/flooders/testing/developing
+blacklist = [
+ # Floods federation with fake nodes as "research" project
+ "activitypub-troll.cf",
+ # Similar troll
+ "gab.best",
+ # Similar troll
+ "4chan.icu",
+ # Flooder (?)
+ "social.shrimpcam.pw",
+ # Flooder (?)
+ "mastotroll.netz.org",
+ # Testing/developing installations
+ "ngrok.io",
+ "ngrok-free.app",
+ "misskeytest.chn.moe",
+ # block flooder
+ "everyoneattack.com",
+]
+
+def is_blacklisted(domain: str) -> bool:
+ # DEBUG: print(f"DEBUG: domain='{domain}' - CALLED!")
+ if not isinstance(domain, str):
+ raise ValueError(f"Parameter domain[]='{type(domain)}' is not 'str'")
+ elif domain == "":
+ raise ValueError("Parameter 'domain' is empty")
+
+ blacklisted = False
+ for peer in blacklist:
+ # DEBUG: print(f"DEBUG: Checking peer='{peer}' ...")
+ if peer in domain:
+ # DEBUG: print(f"DEBUG: domain='{domain}' is blacklisted.")
+ blacklisted = True
+
+ # DEBUG: print(f"DEBUG: blacklisted='{blacklisted}' - EXIT!")
+ return blacklisted
import time
import validators
-from fba import blacklist
from fba import fba
+
+from fba.helpers import blacklist
from fba.helpers import tidyup
def update_reason(reason: str, blocker: str, blocked: str, block_level: str):
import requests
import validators
-from fba import blacklist
from fba import config
from fba import fba
from fba import federation
from fba import network
+from fba.helpers import blacklist
from fba.helpers import cache
from fba.models import error_log
import bs4
import validators
-from fba import blacklist
from fba import config
from fba import csrf
from fba import fba
from fba import federation
from fba import network
+from fba.helpers import blacklist
from fba.helpers import tidyup
from fba.models import blocks
import bs4
import validators
-from fba import blacklist
from fba import config
from fba import csrf
from fba import fba
from fba import network
+from fba.helpers import blacklist
from fba.helpers import tidyup
from fba.models import blocks
import json
-from fba import blacklist
from fba import config
from fba import csrf
from fba import network
+from fba.helpers import blacklist
from fba.helpers import dicts
from fba.helpers import tidyup
import bs4
import validators
-from fba import blacklist
from fba import config
from fba import fba
from fba import federation
from fba import network
+from fba.helpers import blacklist
from fba.helpers import tidyup
from fba.models import blocks