feat(activitypub): use structure @PreferredUsername@host.tld:port for actors (#9254)

This modifies usernames of ActivityPub accounts to use the @example@example.tld
format with an additional optional port component (e.g. @user@example.tld:42).
This allows accounts from ActivityPub servers with more relaxed username
requirements than those of Forgejo's to interact with Forgejo. Forgejo would
also follow a "de facto" standard of ActivityPub implementations.

By separating different information using @'s, we also gain future
opportunities to store more information about ActivityPub accounts internally,
so that we won't have to rely on e.g. the amount of dashes in a username as
my migration currently does.

Continuation of Aravinth's work: https://codeberg.org/forgejo/forgejo/pulls/4778

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9254
Reviewed-by: jerger <jerger@noreply.codeberg.org>
Reviewed-by: Ellen Εμιλία Άννα Zscheile <fogti@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
Co-committed-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
This commit is contained in:
Panagiotis "Ivory" Vasilopoulos 2026-01-30 23:45:11 +01:00 committed by Gusted
parent 90b3352ed5
commit 81601eab85
13 changed files with 422 additions and 19 deletions

View file

@ -1566,9 +1566,9 @@
-
id: 42
lower_name: federated-example.net
name: federated-example.net
full_name: federated
lower_name: "@federated@example.net"
name: "@federated@example.net"
full_name: "@federated@example.net"
email: f73240e82-c061-41ef-b7d6-4376cb6f2e1c@example.com
keep_email_private: false
email_notifications_preference: enabled
@ -1576,7 +1576,7 @@
passwd_hash_algo: ""
must_change_password: false
login_source: 0
login_name: federated-example.net
login_name: "@federated@example.net"
type: 6
salt: ""
max_repo_creation: -1