Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL for a bluesky account bridged to the fediverse #1529

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions activitypub.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from requests import TooManyRedirects
from requests.models import DEFAULT_REDIRECT_LIMIT
from werkzeug.exceptions import BadGateway
import atproto

from flask_app import app
import common
Expand Down Expand Up @@ -591,6 +592,17 @@ def _load_key(cls, key_id, follow_owner=True):

return actor

@classmethod
def bridged_web_url_for(cls, user, fallback=False):
"""Returns a bridged user's profile URL on ``https://bsky.brid.gy/r/*``.

For example, returns ``https://bsky.brid.gy/r/https://bsky.app/profile/alice.bsky.social``
for BlueSky user ``alice.bsky.social``.
"""
if isinstance(user, atproto.ATProto):
return f"https://bsky.brid.gy/r/{user.web_url()}"
return super().bridged_web_url_for(user, fallback)


def signed_get(url, from_user=None, **kwargs):
return signed_request(util.requests_get, url, from_user=from_user, **kwargs)
Expand Down