how to follow is now a.button

This commit is contained in:
sørenpeter 2024-04-20 11:24:36 +02:00
parent 8242a49f80
commit 1074b82d60
3 changed files with 22 additions and 5 deletions

View file

@ -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;

View file

@ -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;

View file

@ -85,7 +85,7 @@ if ($is_gallery) {
<span class="right">
<!-- <a href="following.php">Following <?php echo count($twtFollowingList); ?></a> | -->
<a target="_blank" href="<?=$profile->mainURL?>"><?=$profile->mainURL?></a>
(<a href="https://yarn.social">How to follow</a>)
<a class="button" href="https://yarn.social" >How to follow</a>
</span>
<div class="tagcloud">