mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-05-06 20:42:52 +08:00
fix(ui): Banner 封面通过后端代理加载,移除来源链接模块
- 封面图通过 /image_proxy 代理请求,解决 B 站等 CDN 跨域问题 - 渲染 markdown 时过滤掉开头的「来源链接」行, 该信息已由 VideoBanner 的「原视频」按钮替代 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -233,6 +233,7 @@ const MarkdownViewer: FC<MarkdownViewerProps> = ({ status }) => {
|
||||
<VideoBanner
|
||||
audioMeta={currentTask?.audioMeta}
|
||||
videoUrl={currentTask?.formData?.video_url}
|
||||
baseURL={baseURL}
|
||||
/>
|
||||
</div>
|
||||
<div className={'markdown-body w-full px-2'}>
|
||||
@@ -480,7 +481,7 @@ const MarkdownViewer: FC<MarkdownViewerProps> = ({ status }) => {
|
||||
),
|
||||
}}
|
||||
>
|
||||
{selectedContent}
|
||||
{selectedContent.replace(/^>\s*来源链接:[^\n]*\n*/m, '')}
|
||||
</ReactMarkdown>
|
||||
</div>
|
||||
</ScrollArea>
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { AudioMeta } from '@/store/taskStore'
|
||||
interface VideoBannerProps {
|
||||
audioMeta?: AudioMeta
|
||||
videoUrl?: string
|
||||
baseURL?: string
|
||||
}
|
||||
|
||||
/** 平台 label 映射 */
|
||||
@@ -14,10 +15,14 @@ const platformLabel: Record<string, string> = {
|
||||
xiaohongshu: '小红书',
|
||||
}
|
||||
|
||||
export default function VideoBanner({ audioMeta, videoUrl }: VideoBannerProps) {
|
||||
export default function VideoBanner({ audioMeta, videoUrl, baseURL = '' }: VideoBannerProps) {
|
||||
if (!audioMeta) return null
|
||||
|
||||
const coverUrl = audioMeta.cover_url
|
||||
const rawCover = audioMeta.cover_url
|
||||
// 通过后端代理加载封面,避免跨域/Referrer 限制
|
||||
const coverUrl = rawCover
|
||||
? `${baseURL}/image_proxy?url=${encodeURIComponent(rawCover)}`
|
||||
: ''
|
||||
const title = audioMeta.title
|
||||
const uploader = audioMeta.raw_info?.uploader || ''
|
||||
const platform = platformLabel[audioMeta.platform] || audioMeta.platform || ''
|
||||
@@ -31,6 +36,7 @@ export default function VideoBanner({ audioMeta, videoUrl }: VideoBannerProps) {
|
||||
<img
|
||||
src={coverUrl}
|
||||
alt=""
|
||||
referrerPolicy="no-referrer"
|
||||
className="h-full w-full object-cover blur-md brightness-[0.4] scale-110"
|
||||
/>
|
||||
) : (
|
||||
@@ -45,6 +51,7 @@ export default function VideoBanner({ audioMeta, videoUrl }: VideoBannerProps) {
|
||||
<img
|
||||
src={coverUrl}
|
||||
alt={title}
|
||||
referrerPolicy="no-referrer"
|
||||
className="h-16 w-28 shrink-0 rounded-md object-cover shadow-md"
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user