From de6b931823b3fe49811d1026393c38f073480054 Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 31 Oct 2026 16:30:06 +0800 Subject: [PATCH] Move resource follow prompts to header Telegram icon --- app/Services/ResourceArticlePresentation.php | 19 +++++++++++++++++++ config/community.php | 5 +++++ resources/views/components/nav-bar.blade.php | 2 ++ .../views/components/telegram-link.blade.php | 8 ++++++++ .../pages/articles/default/show.blade.php | 2 +- 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 app/Services/ResourceArticlePresentation.php create mode 100644 config/community.php create mode 100644 resources/views/components/telegram-link.blade.php diff --git a/app/Services/ResourceArticlePresentation.php b/app/Services/ResourceArticlePresentation.php new file mode 100644 index 00000000..9612ce96 --- /dev/null +++ b/app/Services/ResourceArticlePresentation.php @@ -0,0 +1,19 @@ +]*>.*?

(?:\s*]*>\s*

)*~si', static function (array $match): string { + $text = html_entity_decode(strip_tags($match[0]), ENT_QUOTES | ENT_HTML5, 'UTF-8'); + $text = preg_replace('/\s+/u', '', $text); + if (preg_match('/点击加入我们的(?:tg|telegram)频道|点击关注我们的github仓库/iu', $text)) return ''; + return $match[0]; + }, $html); + } +} diff --git a/config/community.php b/config/community.php new file mode 100644 index 00000000..e4c103fa --- /dev/null +++ b/config/community.php @@ -0,0 +1,5 @@ + env('COMMUNITY_TELEGRAM_URL', 'https://t.me/clashfreenode'), +]; diff --git a/resources/views/components/nav-bar.blade.php b/resources/views/components/nav-bar.blade.php index 2280ef15..0d417aaf 100644 --- a/resources/views/components/nav-bar.blade.php +++ b/resources/views/components/nav-bar.blade.php @@ -13,6 +13,7 @@ class="d-none logo-dark nc-no-lazy" id="sidebarCollapse" aria-label="打开导航菜单" aria-controls="mobile-navigation" aria-expanded="false"> +
@include('components.telegram-link')