activitypub: drop circular import of web

for #486
pull/729/head
Ryan Barrett 2023-11-15 13:21:34 -08:00
rodzic 59c6d44f6d
commit 4c61770017
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
1 zmienionych plików z 3 dodań i 6 usunięć

Wyświetl plik

@ -37,10 +37,6 @@ from models import Follower, Object, User
from protocol import Protocol
import webfinger
# TODO: remove this. we only need it to make sure Web is registered in PROTOCOLS
# before the URL route registrations below.
import web
logger = logging.getLogger(__name__)
CONNEG_HEADERS_AS2_HTML = {
@ -776,8 +772,9 @@ def actor(handle_or_id):
cls = Protocol.for_request(fed='web')
if not cls:
error(f"Couldn't determine protocol", status=404)
elif cls == web.Web and (request.path.startswith('/ap/') or
request.host not in LOCAL_DOMAINS + (PRIMARY_DOMAIN,)):
elif (cls.LABEL == 'web' and
(request.path.startswith('/ap/')
or request.host not in LOCAL_DOMAINS + (PRIMARY_DOMAIN,))):
# we started out with web users' AP ids as fed.brid.gy/[domain], so we
# need to preserve those for backward compatibility
return redirect(subdomain_wrap(None, f'/{handle_or_id}'), code=301)