feat: use xpier media library for uploads and markdown embeds

Store media:ID in post bodies instead of CDN URLs, and keep sablog attach tokens as a fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
gouki
2026-09-16 19:03:52 +00:00
co-authored by Cursor
parent f6a9a8ea50
commit f81397a289
38 changed files with 5390 additions and 2059 deletions
+7 -2
View File
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Blog\Services;
use App\Blog\Support\MarkdownMediaEmbed;
use App\Models\Post;
use Illuminate\Support\Facades\Cache;
use League\CommonMark\Environment\Environment;
@@ -36,11 +37,15 @@ class PostContentRenderer
*/
public function render(Post $post): string
{
$embed = app(MarkdownMediaEmbed::class);
$raw = (string) $post->content;
$content = $post->content_format === 'markdown'
? $this->toHtml($post->content)
: $post->content;
? $this->toHtml($embed->expandMarkdown($raw))
: $raw;
$html = $this->renderShortcodes($content, $post);
$html = $embed->hydrateHtml($html);
// 插件钩子:付费内容过滤、AI 处理等
$html = app(\App\Blog\Support\PluginManager::class)->applyFilters('post.rendered', $html, $post);