also for Bluesky

This commit is contained in:
n 2024-01-27 13:20:53 +01:00
parent 90d2d81887
commit 9a5eb1acf6
Signed by: n
GPG Key ID: 510227DD6C502CE3
3 changed files with 9 additions and 3 deletions

View File

@ -1,7 +1,7 @@
# ClickAt # ClickAt
[Shaarli](https://github.com/shaarli/Shaarli/) plugin to make microblogging [Shaarli](https://github.com/shaarli/Shaarli/) plugin to make microblogging
social networks (Twitter/𝕏, Threads, and Fediverse) addresses clickable. social networks (Twitter/𝕏, Threads, Bluesky and Fediverse) addresses clickable.
## Manual ## Manual
@ -10,4 +10,5 @@ social networks (Twitter/𝕏, Threads, and Fediverse) addresses clickable.
3. Quote users from: 3. Quote users from:
- Twitter/𝕏 with their `@nic`, - Twitter/𝕏 with their `@nic`,
- Threads with `@nic@threads.net`, - Threads with `@nic@threads.net`,
- Bluesky with `@nic.bsky.social`,
- Fediverse with `@nic@instance`. - Fediverse with `@nic@instance`.

View File

@ -1 +1 @@
description="Make microblogging social networks (Twitter/𝕏, Threads and Fediverse) addresses clickable." description="Make microblogging social networks (Twitter/𝕏, Threads, Bluesky and Fediverse) addresses clickable."

View File

@ -2,7 +2,7 @@
/** /**
* ClickAt * ClickAt
* *
* This plugin makes microblogging social networks (Twitter/𝕏, Threads and Fediverse) addresses clickable. * This plugin makes microblogging social networks (Twitter/𝕏, Threads, Bluesky and Fediverse) addresses clickable.
*/ */
use Shaarli\Config\ConfigManager; use Shaarli\Config\ConfigManager;
@ -13,6 +13,11 @@ function hook_clickat_render_linklist($data)
{ {
foreach ($data['links'] as &$value) { foreach ($data['links'] as &$value) {
$value['description'] = preg_replace(
'/\ @([\w\d]+).bsky.social/',
' <a href="https://bsky.app/profile/\1.bsky.social">&commat;\1.bsky.social</a>',
$value['description']
);
$value['description'] = preg_replace( $value['description'] = preg_replace(
'/\ @([\w\d]+)@([\w\d_\-\.]+)/', '/\ @([\w\d]+)@([\w\d_\-\.]+)/',
' <a href="https://\2/@\1">&commat;\1</a>', ' <a href="https://\2/@\1">&commat;\1</a>',