From 1074b82d60ed7aa897ba896cf1fde6e2070b0729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?s=C3=B8renpeter?= Date: Sat, 20 Apr 2024 11:24:36 +0200 Subject: [PATCH] how to follow is now a.button --- libs/timeline.css | 8 ++++++++ libs/twtxt.php | 17 +++++++++++++---- partials/profile.php | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/libs/timeline.css b/libs/timeline.css index 668e585..11bec0f 100644 --- a/libs/timeline.css +++ b/libs/timeline.css @@ -178,6 +178,14 @@ a.author { color: var(--accent); } +.profile a.button { + font-size: small; + color: var(--accent); + background-color: var(--accent-bg); + padding: 0.25em 0.5rem; + margin-left: 0.5rem; +} + .profile-nav { margin-top: 1rem; font-size: smaller; diff --git a/libs/twtxt.php b/libs/twtxt.php index a45ef1c..bc3c1c6 100644 --- a/libs/twtxt.php +++ b/libs/twtxt.php @@ -365,12 +365,21 @@ function getTwtsFromTwtxtString($url) { } } + // Clean up nick if set to something like `@soren@darch.dk` instead of just `soren` + // mosty for (re)feeds from Mastodon etc. + if (str_contains($twtxtData->nick, "@")) { + $str = $twtxtData->nick; + $str = ltrim($str,"@"); + $twtxtData->nick = explode("@",$str)[0]; // take the first [0] from splitting the nick at "@" + } + // Fallback for nick and url if not set in twtxt.txt + // TODO: Use nick from local follow list as fallback? if ($twtxtData->nick === "") { - $host_to_nick = parse_url($url, PHP_URL_HOST); - $host_to_nick = str_replace("www.", "", $host_to_nick); - $host_to_nick = explode(".", $host_to_nick)[0]; - $twtxtData->nick = $host_to_nick; + $str = parse_url($url, PHP_URL_HOST); + $str = str_replace("www.", "", $str); + $str = explode(".", $str)[0]; // take the first [0] from splitting the host at "." + $twtxtData->nick = $str; } if ($twtxtData->mainURL === "") { $twtxtData->mainURL = $url; diff --git a/partials/profile.php b/partials/profile.php index bb90ce3..54d80ab 100644 --- a/partials/profile.php +++ b/partials/profile.php @@ -85,7 +85,7 @@ if ($is_gallery) { mainURL?> - (How to follow) + How to follow