mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-08-27 11:11:02 +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
|
<VideoBanner
|
||||||
audioMeta={currentTask?.audioMeta}
|
audioMeta={currentTask?.audioMeta}
|
||||||
videoUrl={currentTask?.formData?.video_url}
|
videoUrl={currentTask?.formData?.video_url}
|
||||||
|
baseURL={baseURL}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={'markdown-body w-full px-2'}>
|
<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>
|
</ReactMarkdown>
|
||||||
</div>
|
</div>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import type { AudioMeta } from '@/store/taskStore'
|
|||||||
interface VideoBannerProps {
|
interface VideoBannerProps {
|
||||||
audioMeta?: AudioMeta
|
audioMeta?: AudioMeta
|
||||||
videoUrl?: string
|
videoUrl?: string
|
||||||
|
baseURL?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 平台 label 映射 */
|
/** 平台 label 映射 */
|
||||||
@@ -14,10 +15,14 @@ const platformLabel: Record<string, string> = {
|
|||||||
xiaohongshu: '小红书',
|
xiaohongshu: '小红书',
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function VideoBanner({ audioMeta, videoUrl }: VideoBannerProps) {
|
export default function VideoBanner({ audioMeta, videoUrl, baseURL = '' }: VideoBannerProps) {
|
||||||
if (!audioMeta) return null
|
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 title = audioMeta.title
|
||||||
const uploader = audioMeta.raw_info?.uploader || ''
|
const uploader = audioMeta.raw_info?.uploader || ''
|
||||||
const platform = platformLabel[audioMeta.platform] || audioMeta.platform || ''
|
const platform = platformLabel[audioMeta.platform] || audioMeta.platform || ''
|
||||||
@@ -31,6 +36,7 @@ export default function VideoBanner({ audioMeta, videoUrl }: VideoBannerProps) {
|
|||||||
<img
|
<img
|
||||||
src={coverUrl}
|
src={coverUrl}
|
||||||
alt=""
|
alt=""
|
||||||
|
referrerPolicy="no-referrer"
|
||||||
className="h-full w-full object-cover blur-md brightness-[0.4] scale-110"
|
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
|
<img
|
||||||
src={coverUrl}
|
src={coverUrl}
|
||||||
alt={title}
|
alt={title}
|
||||||
|
referrerPolicy="no-referrer"
|
||||||
className="h-16 w-28 shrink-0 rounded-md object-cover shadow-md"
|
className="h-16 w-28 shrink-0 rounded-md object-cover shadow-md"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user