diff --git a/bsky.brid.gy.as2.json b/bsky.brid.gy.as2.json index b28048d..aeb90f9 100644 --- a/bsky.brid.gy.as2.json +++ b/bsky.brid.gy.as2.json @@ -7,7 +7,7 @@ "id": "https://bsky.brid.gy/bsky.brid.gy", "url": "https://bsky.brid.gy/", "preferredUsername": "bsky.brid.gy", - "summary": "Bridgy Fed bot user for Bluesky. To bridge your fediverse account to Bluesky, follow this account or reply yes when it promps you with a DM. More info here.", + "summary": "Bridgy Fed bot user for Bluesky. To bridge your fediverse account to Bluesky, follow this account or reply yes when it promps you with a DM. More info here.", "name": "Bridgy Fed", "attachment": [{ "name": "Web site", diff --git a/tests/test_activitypub.py b/tests/test_activitypub.py index 9f44819..d03e5cd 100644 --- a/tests/test_activitypub.py +++ b/tests/test_activitypub.py @@ -495,7 +495,7 @@ class ActivityPubTest(TestCase): activitypub._INSTANCE_ACTOR = testutil.global_user self.addCleanup(reset_instance_actor) - actor_as2 = json_loads(util.read('static/instance-actor.as2.json')) + actor_as2 = json_loads(util.read('fed.brid.gy.as2.json')) self.make_user(common.PRIMARY_DOMAIN, cls=Web, obj_as2=actor_as2) activitypub._INSTANCE_ACTOR = None diff --git a/tests/test_web.py b/tests/test_web.py index df66023..bac0f68 100644 --- a/tests/test_web.py +++ b/tests/test_web.py @@ -2755,8 +2755,7 @@ class WebUtilTest(TestCase): def test_fetch_instance_actor(self, _, __): obj = Object(id=f'https://{common.PRIMARY_DOMAIN}/') self.assertTrue(Web.fetch(obj)) - self.assertEqual(obj.as2, - json_loads(util.read('static/instance-actor.as2.json'))) + self.assertEqual(obj.as2, json_loads(util.read('fed.brid.gy.as2.json'))) def test_fetch_resolves_relative_urls(self, mock_get, __): mock_get.return_value = requests_response("""\ diff --git a/web.py b/web.py index 7471b69..6975ea9 100644 --- a/web.py +++ b/web.py @@ -24,7 +24,7 @@ from requests.auth import HTTPBasicAuth from werkzeug.exceptions import BadGateway, BadRequest, HTTPException, NotFound import common -from common import add, DOMAIN_RE, SUPERDOMAIN +from common import add, DOMAIN_RE, PRIMARY_DOMAIN, PROTOCOL_DOMAINS, SUPERDOMAIN from flask_app import app, cache from ids import translate_handle, translate_object_id, translate_user_id from models import Follower, Object, PROTOCOLS, Target, User @@ -440,10 +440,11 @@ class Web(User, Protocol): return False is_homepage = urlparse(url).path.strip('/') == '' - - if is_homepage and util.domain_from_link(url) == common.PRIMARY_DOMAIN: - obj.as2 = json_loads(util.read('static/instance-actor.as2.json')) - return True + if is_homepage: + domain = util.domain_from_link(url) + if domain == PRIMARY_DOMAIN or domain in PROTOCOL_DOMAINS: + obj.as2 = json_loads(util.read(f'{domain}.as2.json')) + return True require_backlink = (common.host_url().rstrip('/') if check_backlink and not is_homepage