From e14f4b88e77b380afa8e40e1e66f48772515e95c Mon Sep 17 00:00:00 2001
From: winter Sparkles
Date: Thu, 2 Jul 2026 19:07:41 +0100
Subject: add IDN support in various ui places
---
Digitigrade/Model/Actor.php | 6 ++++--
templates/actor/profile.php | 2 +-
templates/actor/profile_editable.php | 4 ++--
templates/actor/profile_page.php | 4 ++--
templates/note/note.php | 2 +-
templates/thread_page.php | 4 ++--
6 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/Digitigrade/Model/Actor.php b/Digitigrade/Model/Actor.php
index 0e2a9c5..b452703 100644
--- a/Digitigrade/Model/Actor.php
+++ b/Digitigrade/Model/Actor.php
@@ -393,8 +393,10 @@ class Actor extends PushableModel implements RpcReceiver {
return $instances;
}
- public function getFullHandle(bool $alwaysIncludeDomain = false): string {
- return $this->handle . (($alwaysIncludeDomain || !$this->isLocal) ? '@' . hostname_from_uri($this->uri) : '');
+ public function getFullHandle(bool $alwaysIncludeDomain = false, bool $convertIdn = false): string {
+ $domain = hostname_from_uri($this->uri);
+ if ($convertIdn) $domain = idn_to_utf8($domain);
+ return $this->handle . (($alwaysIncludeDomain || !$this->isLocal) ? '@' . $domain : '');
}
public function getLocalUiHref(): string {
diff --git a/templates/actor/profile.php b/templates/actor/profile.php
index 0029e8e..aa403a6 100644
--- a/templates/actor/profile.php
+++ b/templates/actor/profile.php
@@ -21,7 +21,7 @@ $actorUser = UserAccount::findByLinkedActor($actor);
= htmlspecialchars($actor->displayName) ?>
= htmlspecialchars($actor->pronouns) ?>
-
@= $actor->getFullHandle() ?>
+
@= $actor->getFullHandle($convertIdn = true) ?>
= sprintf(__('user.profile.createdAt'), format_datetime($actor->created)) ?>
automated): ?>
diff --git a/templates/actor/profile_editable.php b/templates/actor/profile_editable.php
index f6a0fc4..bb5f72c 100644
--- a/templates/actor/profile_editable.php
+++ b/templates/actor/profile_editable.php
@@ -15,7 +15,7 @@
value="= htmlspecialchars($actor->pronouns) ?>">
- @= $actor->getFullHandle() ?>
+ @= $actor->getFullHandle($convertIdn = true) ?>
= sprintf(__('user.profile.createdAt'), format_datetime($actor->created)) ?>
@@ -38,4 +38,4 @@
-
\ No newline at end of file
+
diff --git a/templates/actor/profile_page.php b/templates/actor/profile_page.php
index f9b688c..53bd47d 100644
--- a/templates/actor/profile_page.php
+++ b/templates/actor/profile_page.php
@@ -8,7 +8,7 @@ $lang = get_ui_language();
$actorUser = UserAccount::findByLinkedActor($actor);
call_template('skeleton', [
- 'pageTitle' => "$actor->displayName - @" . $actor->getFullHandle(),
+ 'pageTitle' => "$actor->displayName - @" . $actor->getFullHandle($convertIdn = true),
'renderTitleHeading' => false,
'ogTitle' => $actor->displayName,
'ogDesc' => $actor->bio,
@@ -58,4 +58,4 @@ call_template('skeleton', [
call_template('placeholder_text', ['count' => $countNotShown]);
}
}
-});
\ No newline at end of file
+});
diff --git a/templates/note/note.php b/templates/note/note.php
index ddc2bac..331a1ea 100644
--- a/templates/note/note.php
+++ b/templates/note/note.php
@@ -156,4 +156,4 @@ if ($user != null) {
$note]); ?>
-
\ No newline at end of file
+
diff --git a/templates/thread_page.php b/templates/thread_page.php
index da7c556..f36930c 100644
--- a/templates/thread_page.php
+++ b/templates/thread_page.php
@@ -3,7 +3,7 @@ use Digitigrade\Model\Note;
use Digitigrade\Model\UserAccount;
call_template('skeleton', [
- 'pageTitle' => '"' . $note->plainContent . '" - @' . $note->author->getFullHandle(),
+ 'pageTitle' => '"' . $note->plainContent . '" - @' . $note->author->getFullHandle($convertIdn = true),
'renderTitleHeading' => false,
'ogTitle' => $note->author->displayName,
'ogDesc' => $note->plainContent,
@@ -21,4 +21,4 @@ call_template('skeleton', [
call_template('note/note', ['note' => $n, 'selected' => $n == $targetNote]);
}
}
-});
\ No newline at end of file
+});
--
cgit v1.3