PRINTFILM: AI short-video marketing and AI short-drama creation platform
fix
增瑞 田3dc487d4c6bb
diff --git a/backend/app/marketplace/drama_media.py b/backend/app/marketplace/drama_media.pyindex 0cb1b0f..962a20a 100644--- a/backend/app/marketplace/drama_media.py+++ b/backend/app/marketplace/drama_media.py@@ -62,10 +62,8 @@ def _local_source(locator: str) -> Path | None:def _source_key(locator: str) -> str:- """只接受配置桶、明确配置的 CDN 基址或上游 generated 对象键。"""+ """只接受当前配置的 OSS 桶或 CDN。目录名可以和现在的 oss_folder 不同。"""settings = get_settings()- folder = settings.oss_folder.strip().strip("/") or "kepu"- prefix = folder + "/generated/"text = locator.strip()if text.startswith(("http://", "https://")):parsed = urlparse(text)@@ -88,11 +86,41 @@ def _source_key(locator: str) -> str:raise _error("SOURCE_NOT_READY", "源视频不属于配置的 OSS 桶")else:key = text- if not settings.oss_bucket or not key.startswith(prefix) or "\\" in key or ".." in key.split("/") or "?" in key or "#" in key:- raise _error("SOURCE_NOT_READY", "源视频不属于上游生成目录")+ if not settings.oss_bucket or not key or "\\" in key or ".." in key.split("/") or "?" in key or "#" in key:+ raise _error("SOURCE_NOT_READY", "源视频不属于当前 OSS")return key+def _generated_local(locator: str) -> Path | None:+ """当前 OSS 或 CDN 地址若能对上 static 里已有的 generated 文件,就当本地成片。"""+ text = locator.strip()+ if not text.startswith(("http://", "https://")):+ return None+ try:+ key = _source_key(text)+ except ValueError:+ return None+ parts = key.split("/")+ if "generated" not in parts:+ return None+ rest = "/".join(parts[parts.index("generated"):])+ path = (STATIC_ROOT / rest).resolve()+ try:+ path.relative_to(STATIC_ROOT.resolve())+ except ValueError:+ return None+ return path if path.is_file() else None+++def _local_stamp(path: Path) -> dict:+ """读取本地成片的大小和指纹。文件在读取过程中变化则要求重新选择。"""+ before = _stat_stamp(path)+ digest = fingerprint(path)+ if before != _stat_stamp(path):+ raise _error("SOURCE_CHANGED", "源视频正在更新,请稍后重新选择")+ return {"kind": "local", "locator": str(path), **before, "fingerprint": digest}++def _stat_stamp(path: Path) -> dict:if not path.is_file():raise _error("SOURCE_NOT_READY", "源视频文件不存在")@@ -106,12 +134,10 @@ def source_stamp(locator: str) -> dict:if not text:raise _error("SOURCE_NOT_READY", "分镜视频尚未生成")local = _local_source(text)+ if local is None:+ local = _generated_local(text)if local is not None:- before = _stat_stamp(local)- digest = fingerprint(local)- if before != _stat_stamp(local):- raise _error("SOURCE_CHANGED", "源视频正在更新,请稍后重新选择")- result = {"kind": "local", "locator": str(local), **before, "fingerprint": digest}+ result = _local_stamp(local)else:key = _source_key(text)result = {"kind": "oss", "locator": key, "key": key, **storage.source_metadata(key)}diff --git a/backend/tests/test_marketplace_drama_media.py b/backend/tests/test_marketplace_drama_media.pyindex b2a4fb1..6fd5dc3 100644--- a/backend/tests/test_marketplace_drama_media.py+++ b/backend/tests/test_marketplace_drama_media.py@@ -50,8 +50,8 @@ def test_local_stamp_and_version_changes_when_same_length_file_changes(local_med@pytest.mark.parametrize("locator", ["/static/../secret.mp4", "https://evil.test/kepu/generated/p1/video.mp4",- "https://test-bucket.oss-cn-hangzhou.aliyuncs.com.evil.test/kepu/generated/a.mp4", "kepu/secrets/a.mp4",- "marketplace/works/1/a.mp4", "https://media.example.test/not-assets/kepu/generated/a.mp4"])+ "https://test-bucket.oss-cn-hangzhou.aliyuncs.com.evil.test/kepu/generated/a.mp4",+ "https://media.example.test/not-assets/kepu/generated/a.mp4"])def test_source_locator_rejects_untrusted_paths(local_media, locator):with pytest.raises(ValueError, match="MARKETPLACE_SOURCE_NOT_READY"):media.source_stamp(locator)@@ -74,6 +74,28 @@ def test_oss_stamp_ignores_temporary_signed_query(local_media, monkeypatch):assert media.stamp_version(first) == media.stamp_version(cdn)+def test_old_folder_oss_url_uses_local_file_when_present(local_media, monkeypatch):+ """存储目录已改名时,旧 OSS 地址仍优先使用磁盘上的成片。"""+ static, _cache, _uploaded, settings = local_media+ settings.oss_folder = "printfilm"+ source = static / "generated" / "p1" / "a.mp4"+ source.parent.mkdir(parents=True)+ source.write_bytes(b"local-video")+ monkeypatch.setattr(media.storage, "source_metadata", lambda key: (_ for _ in ()).throw(AssertionError(key)))+ stamp = media.source_stamp("https://test-bucket.oss-cn-hangzhou.aliyuncs.com/kepu/generated/p1/a.mp4")+ assert stamp["kind"] == "local"+ assert Path(stamp["locator"]) == source.resolve()+++def test_old_folder_oss_object_is_used_when_local_file_missing(local_media, monkeypatch):+ """本地成片已不在时,仍从当前桶按原始对象键复制,不要求目录名是现在的 oss_folder。"""+ _static, _cache, _uploaded, settings = local_media+ settings.oss_folder = "printfilm"+ monkeypatch.setattr(media.storage, "source_metadata", lambda key: {"etag": "E", "size_bytes": 12})+ stamp = media.source_stamp("https://test-bucket.oss-cn-hangzhou.aliyuncs.com/kepu/generated/p1/a.mp4")+ assert stamp["kind"] == "oss" and stamp["key"] == "kepu/generated/p1/a.mp4"++@pytest.mark.asyncioasync def test_source_change_is_rejected_before_upload(local_media):static, cache, uploaded, _settings = local_mediadiff --git a/frontend/src/features/marketplace/DramaPublishModal.tsx b/frontend/src/features/marketplace/DramaPublishModal.tsxindex 4c0709d..ef8f2cc 100644--- a/frontend/src/features/marketplace/DramaPublishModal.tsx+++ b/frontend/src/features/marketplace/DramaPublishModal.tsx@@ -1,20 +1,22 @@import { useEffect, useRef, useState } from 'react'-import { useNavigate } from 'react-router-dom'+import { useNavigate, useLocation } from 'react-router-dom'import { CheckCircle2, Film, Loader2 } from 'lucide-react'import Modal from '../../components/ui/Modal'import Button from '../../components/ui/Button'import { request } from './api'+import { internalReturn, withReturn } from './ui'import { publishSelection, sourceRelation, type DramaPublishContext, type DramaPublishResult } from './dramaPublishing'import './dramaPublishing.css'type Props = {- projectId: number; initialEpisodeId?: number; targetSeriesId?: number+ projectId: number; initialEpisodeId?: number; targetSeriesId?: number; selectReady?: booleanonClose: () => void; onPublished?: (result: DramaPublishResult) => void}// 漫剧卡片、分集预览和市场编辑页共用同一发布流程,只提交服务端校验过的编号与版本。-export default function DramaPublishModal({ projectId, initialEpisodeId, targetSeriesId, onClose, onPublished }: Props) {+export default function DramaPublishModal({ projectId, initialEpisodeId, targetSeriesId, selectReady = false, onClose, onPublished }: Props) {const navigate = useNavigate()+ const location = useLocation()const [context, setContext] = useState<DramaPublishContext | null>(null)const [selected, setSelected] = useState<number[]>([])const [updates, setUpdates] = useState<number[]>([])@@ -33,11 +35,16 @@ export default function DramaPublishModal({ projectId, initialEpisodeId, targetSif (!active) returnsetContext(value)setTitle(current => current || value.project.title)- setSelected(current => current.length ? current.filter(id => value.episodes.some(item => item.id === id && item.ready)) : initialEpisodeId && value.episodes.some(item => item.id === initialEpisodeId && item.ready) ? [initialEpisodeId] : [])+ setSelected(current => {+ const readyIds = value.episodes.filter(item => item.ready).map(item => item.id)+ if (current.length) return current.filter(id => readyIds.includes(id))+ if (initialEpisodeId && readyIds.includes(initialEpisodeId)) return [initialEpisodeId]+ return selectReady ? readyIds : []+ })setUpdates([])}).catch(err => { if (active) setError((err as Error).message) }).finally(() => { if (active) setLoading(false) })return () => { active = false }- }, [projectId, initialEpisodeId, reload])+ }, [projectId, initialEpisodeId, selectReady, reload])const target = context?.series.find(item => String(item.id) === targetId)const changed = context?.episodes.filter(item => selected.includes(item.id) && sourceRelation(item, target).changed) || []const missingUpdates = changed.some(item => !updates.includes(item.id))@@ -54,7 +61,7 @@ export default function DramaPublishModal({ projectId, initialEpisodeId, targetSif (requestKey.current.signature !== signature) requestKey.current = { signature, key: crypto.randomUUID() }const result = await request<DramaPublishResult>(`/printfilm/dramas/${projectId}/publish`, 'POST', { ...payload, idempotency_key: requestKey.current.key })if (onPublished) onPublished(result)- else navigate(`/marketplace/series/${result.series_id}/edit`)+ else navigate(withReturn(`/marketplace/series/${result.series_id}/edit`, internalReturn(`${location.pathname}${location.search}`)))onClose()} catch (err) { setError((err as Error).message) }finally { submitting.current = false; setBusy(false) }diff --git a/frontend/src/features/marketplace/FromPrintfilm.tsx b/frontend/src/features/marketplace/FromPrintfilm.tsxindex 22b9eab..9f5d532 100644--- a/frontend/src/features/marketplace/FromPrintfilm.tsx+++ b/frontend/src/features/marketplace/FromPrintfilm.tsx@@ -1,13 +1,39 @@import { useEffect, useMemo, useState } from 'react'import { useNavigate, useSearchParams } from 'react-router-dom'import { request, type Handoff } from './api'-import { PageHeading } from './ui'+import { internalReturn, PageHeading, withReturn } from './ui'import Button from '../../components/ui/Button'import DramaPublishModal from './DramaPublishModal'type ProjectSource = { id: number; title: string; updated_at: string; has_cover: boolean; status: string }type DramaSource = { id: number; title: string; episodes: { id: number; name: string; ready: boolean }[] }type SeriesOption = { id: number; title: string }+type SeriesStep = { id: number; mode: 'pick' | 'existing' }++// 选了短剧之后,再决定新建一部,或加入已有短剧。+function SeriesStepPanel({ series, busy, mode, onCreate, onExisting, onJoin }: {+ series: SeriesOption[]+ busy: boolean+ mode: 'pick' | 'existing'+ onCreate: () => void+ onExisting: () => void+ onJoin: (id: number) => void+}) {+ const [existingId, setExistingId] = useState('')+ return <div className="pf-market-series-step">+ <p>这部成片会作为短剧的一集,不改已经发布过的旧版本。</p>+ {mode === 'pick' ? <div>+ <Button type="button" variant="lime" disabled={busy} onClick={onCreate}>新建短剧</Button>+ <button type="button" disabled={busy} onClick={onExisting}>加入已有短剧</button>+ </div> : series.length === 0 ? <div>+ <p>还没有短剧,请新建。</p>+ <Button type="button" variant="lime" disabled={busy} onClick={onCreate}>新建短剧</Button>+ </div> : <div>+ <label>已有短剧<select value={existingId} onChange={event => setExistingId(event.target.value)} disabled={busy}><option value="">请选择短剧</option>{series.map(item => <option key={item.id} value={item.id}>{item.title}</option>)}</select></label>+ <button type="button" disabled={busy || !existingId} onClick={() => onJoin(Number(existingId))}>添加到这部短剧</button>+ </div>}+ </div>+}// 从 PrintFilm 已生成成片发起转存。页面只提交编号,不提交视频地址。export default function FromPrintfilm() {@@ -16,12 +42,13 @@ export default function FromPrintfilm() {const focusProject = Number(search.get('project') || 0)const focusDrama = Number(search.get('drama') || 0)const focusEpisode = Number(search.get('episode') || 0)+ const origin = internalReturn(search.get('from'))const [projects, setProjects] = useState<ProjectSource[]>([])const [dramas, setDramas] = useState<DramaSource[]>([])const [series, setSeries] = useState<SeriesOption[]>([])const [dramaId, setDramaId] = useState(focusDrama ? String(focusDrama) : '')const [dramaPublishOpen, setDramaPublishOpen] = useState(Boolean(focusDrama))- const [seriesId, setSeriesId] = useState('')+ const [seriesStep, setSeriesStep] = useState<SeriesStep | null>(null)const [error, setError] = useState('')const [busy, setBusy] = useState(false)const [loading, setLoading] = useState(true)@@ -51,47 +78,56 @@ export default function FromPrintfilm() {project_id: project.id,idempotency_key: `kepu-${project.id}-${project.updated_at}`,})- navigate(`/marketplace/works/${handoff.work_id}/edit?handoff=${handoff.id}`)+ navigate(withReturn(`/marketplace/works/${handoff.work_id}/edit?handoff=${handoff.id}`, origin))} catch (err) { setError((err as Error).message) } finally { setBusy(false) }}- async function ensureSeries(title: string) {- if (seriesId && seriesId !== 'new') return Number(seriesId)- const created = await request<SeriesOption>('/series', 'POST', {- title: title || '未命名短剧', category: '其他', sale_type: 'copyright_contact', copyright_price_fen: 0, description: '',- })- return created.id- }-- async function addProject(project: ProjectSource) {+ async function addProject(project: ProjectSource, target: 'new' | number) {setBusy(true); setError('')try {- const target = await ensureSeries(project.title)- const result = await request<{ handoffs: Handoff[] }>(`/series/${target}/episodes/import-printfilm`, 'POST', {+ const seriesTarget = target === 'new' ? (await request<SeriesOption>('/series', 'POST', {+ title: project.title || '未命名短剧', category: '其他', sale_type: 'copyright_contact', copyright_price_fen: 0, description: '',+ })).id : target+ const result = await request<{ handoffs: Handoff[] }>(`/series/${seriesTarget}/episodes/import-printfilm`, 'POST', {project_id: project.id,idempotency_key: `kepu-${project.id}-${project.updated_at}`,})const handoff = result.handoffs[0]- navigate(`/marketplace/series/${target}/edit${handoff ? `?handoff=${handoff.id}` : ''}`)+ navigate(withReturn(`/marketplace/series/${seriesTarget}/edit${handoff ? `?handoff=${handoff.id}` : ''}`, origin))} catch (err) { setError((err as Error).message) } finally { setBusy(false) }}if (loading) return <p role="status">正在读取已生成的成片…</p>+ const heading = <PageHeading title="发布到数字资产市场" description={focusProject ? '这部成片可以发布为单视频,或作为一集加入短剧。同步后补充资料并提交审核。' : '选择 PrintFilm 已生成的成片,同步到市场后补充资料并提交审核。已签署有效授权函的账号会自动关联,未签署的请在提交前完成一次签署。'} back="/marketplace/works/new" backLabel="返回发布作品" />+ if (focusProject) return <>+ {heading}+ {error && <p role="alert">{error}</p>}+ <section className="pf-market-form">+ <h2>{focused?.title || '当前成片'}</h2>+ {focused ? <>+ <p className="pf-market-notice">先选择发布成一条视频,或作为一集放进短剧。</p>+ <div className="pf-market-publish-actions">+ <Button variant="lime" type="button" disabled={busy} onClick={() => void publishWork(focused)}>发布为单视频</Button>+ <button type="button" disabled={busy} onClick={() => setSeriesStep({ id: focused.id, mode: 'pick' })}>发布为短剧</button>+ </div>+ {seriesStep?.id === focused.id && <SeriesStepPanel series={series} busy={busy} mode={seriesStep.mode} onCreate={() => void addProject(focused, 'new')} onExisting={() => setSeriesStep({ id: focused.id, mode: 'existing' })} onJoin={id => void addProject(focused, id)} />}+ </> : <p role="status">这部成片还没有生成完成,暂时不能发布。</p>}+ </section>+ </>return <>- <PageHeading title="发布到数字资产市场" description="选择 PrintFilm 已生成的成片,同步到市场后补充资料并提交审核。已签署有效授权函的账号会自动关联,未签署的请在提交前完成一次签署。" back="/marketplace/works/new" />+ {heading}{error && <p role="alert">{error}</p>}<section className="pf-market-form"><h2>科普成片</h2>- <p className="pf-market-notice">发布为单视频会生成一条草稿。添加到短剧系列会把这部成片作为一集,不改已经发布过的旧版本。</p>- <label>添加到短剧<select value={seriesId} onChange={event => setSeriesId(event.target.value)}><option value="">选择已有短剧,或新建</option><option value="new">新建短剧</option>{series.map(item => <option key={item.id} value={item.id}>{item.title}</option>)}</select></label>+ <p className="pf-market-notice">每部成片先选择发布为单视频或短剧。选短剧后,再决定新建或加入已有短剧。</p>{projects.length === 0 ? <p>还没有可发布的科普成片。</p> : projects.map(project => <article key={project.id} className="pf-market-handoff">- <strong>{project.title}{project.id === focusProject ? ' · 当前成片' : ''}</strong>- <div>+ <strong>{project.title}</strong>+ <div className="pf-market-publish-actions"><Button variant="lime" type="button" disabled={busy} onClick={() => void publishWork(project)}>发布为单视频</Button>- <button type="button" disabled={busy || !seriesId} onClick={() => void addProject(project)}>添加到短剧系列</button>+ <button type="button" disabled={busy} onClick={() => setSeriesStep({ id: project.id, mode: 'pick' })}>发布为短剧</button></div>+ {seriesStep?.id === project.id && <SeriesStepPanel series={series} busy={busy} mode={seriesStep.mode} onCreate={() => void addProject(project, 'new')} onExisting={() => setSeriesStep({ id: project.id, mode: 'existing' })} onJoin={id => void addProject(project, id)} />}</article>)}- {focused ? null : focusProject ? <p role="status">这部成片还没有生成完成,暂时不能发布。</p> : null}</section><section className="pf-market-form"><h2>漫剧分集</h2>diff --git a/frontend/src/features/marketplace/marketplace.css b/frontend/src/features/marketplace/marketplace.cssindex 95a3ee7..745760a 100644--- a/frontend/src/features/marketplace/marketplace.css+++ b/frontend/src/features/marketplace/marketplace.css@@ -291,7 +291,10 @@ body:has(.pf-market-shell) .pf-wx-fab-root { display:none; }@media(max-width:640px) { .pf-market-kind-choice { grid-template-columns:1fr; } }.pf-market-series-mark { display:grid; place-items:center; width:100%; height:100%; min-height:160px; color:#8ea084; }.pf-market-handoff { display:flex; justify-content:space-between; gap:12px; align-items:center; flex-wrap:wrap; padding:12px 0; border-bottom:1px solid var(--pf-line); }-.pf-market-handoff div { display:flex; gap:8px; flex-wrap:wrap; }+.pf-market-handoff > div,.pf-market-publish-actions,.pf-market-series-step div { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }+.pf-market-series-step,.pf-market-handoff .pf-market-series-step { flex-basis:100%; display:flex; flex-direction:column; align-items:stretch; gap:10px; padding:12px; border:1px solid var(--pf-line); border-radius:10px; background:var(--pf-bg); }+.pf-market-series-step p { margin:0; color:var(--pf-muted); font-size:13px; }+.pf-market-series-step label { display:flex; flex-direction:column; gap:6px; min-width:220px; }.pf-market-purchase-notice { padding:15px 17px; margin:16px 0; border:1px solid #e2e8d8; background:#f5f8ee; border-radius:12px; line-height:1.8; }.pf-market-purchase-notice strong { font-size:14px; }.pf-market-purchase-notice p { font-size:12px; color:var(--pf-muted); }.pf-series-layout { display:grid; grid-template-columns:minmax(640px,1fr) 320px; gap:28px; align-items:start; }diff --git a/frontend/src/features/marketplace/ui.tsx b/frontend/src/features/marketplace/ui.tsxindex 2fdf294..73d7ad2 100644--- a/frontend/src/features/marketplace/ui.tsx+++ b/frontend/src/features/marketplace/ui.tsx@@ -1,11 +1,29 @@import type { ReactNode } from 'react'import { ArrowLeft, ArrowUpRight, FolderOpen, ShieldCheck } from 'lucide-react'-import { Link } from 'react-router-dom'+import { Link, useSearchParams } from 'react-router-dom'import Button from '../../components/ui/Button'-// 模块内统一页头,明确当前任务和返回路径。+/** 只接受站内相对地址,避免把返回链到外部网站。 */+export function internalReturn(value: string | null | undefined): string | undefined {+ if (!value) return+ const path = value.trim()+ if (!path.startsWith('/') || path.startsWith('//') || path.includes('\\') || path.includes('://')) return+ return path+}++/** 把来源页带到下一步地址上,已有查询参数时追加 from。 */+export function withReturn(path: string, from: string | undefined): string {+ if (!from) return path+ return `${path}${path.includes('?') ? '&' : '?'}from=${encodeURIComponent(from)}`+}++// 模块内统一页头。地址带站内 from 时回到来源页,否则用调用方指定的广场。export function PageHeading({ title, description, back, backLabel = '返回广场' }: { title: string; description: string; back?: string; backLabel?: string }) {- return <header className="pf-market-page-heading">{back && <Link className="pf-market-back" to={back}><ArrowLeft size={15} />{backLabel}</Link>}<h1>{title}</h1><p>{description}</p></header>+ const [search] = useSearchParams()+ const from = internalReturn(search.get('from'))+ const href = from || back+ const label = from ? '返回上一页' : backLabel+ return <header className="pf-market-page-heading">{href && <Link className="pf-market-back" to={href}><ArrowLeft size={15} />{label}</Link>}<h1>{title}</h1><p>{description}</p></header>}// 空数据、空搜索和个人工作台共用真实空态,不填充示例作品。diff --git a/frontend/src/pages/HistoryPage.tsx b/frontend/src/pages/HistoryPage.tsxindex 2bd82b6..498d205 100644--- a/frontend/src/pages/HistoryPage.tsx+++ b/frontend/src/pages/HistoryPage.tsx@@ -1,5 +1,5 @@import { useEffect, useMemo, useState } from 'react'-import { Link, useNavigate } from 'react-router-dom'+import { Link, useLocation, useNavigate } from 'react-router-dom'import { api } from '../api'import type { Project } from '../api'import BillingErrorNotice from '../components/billing/BillingErrorNotice'@@ -26,6 +26,7 @@ import {import { hasActiveTasks, isRunning, STATUS_CN } from '../lib/status'import { pageCountOf } from '../lib/pagination'import { SHORT_VIDEO_CREATE_PATH, shortVideoProjectPath } from '../lib/shortVideoRoutes'+import { withReturn } from '../features/marketplace/ui'import { formatDateTime, useI18n } from '../i18n'import './drama/project-list.css'import './shortVideoList.css'@@ -60,6 +61,7 @@ function canDownload(p: HistoryItem) {export default function HistoryPage() {const nav = useNavigate()+ const location = useLocation()const { t, m, locale } = useI18n()/** items 当前页项目@@ -368,7 +370,7 @@ export default function HistoryPage() {<button type="button" className="pf-btn-text" onClick={() => continueEdit(p)}><IconEdit size={14} />{t('history.continueEdit')}</button><button type="button" className="pf-btn-text" disabled={!p.final_video_url} onClick={() => p.final_video_url && setPreview({ url: api.assetUrl(p.final_video_url, p.updated_at), title: p.title, projectId: p.id })}><IconEye size={14} />{t('common.preview')}</button><button type="button" className="pf-btn-text" disabled={!canDownload(p) || busyId === p.id || packing} onClick={() => downloadOne(p)}><IconDownload size={14} />{busyId === p.id ? t('common.downloading') : t('common.download')}</button>- <button type="button" className="pf-btn-text" disabled={!p.final_video_url} onClick={() => nav(`/marketplace/from-printfilm?project=${p.id}`)}><IconSend size={14} />发布到市场</button>+ <button type="button" className="pf-btn-text" disabled={!p.final_video_url} onClick={() => nav(withReturn(`/marketplace/from-printfilm?project=${p.id}`, `${location.pathname}${location.search}`))}><IconSend size={14} />发布到市场</button></>}/>})}diff --git a/frontend/src/pages/drama/DramaListPage.tsx b/frontend/src/pages/drama/DramaListPage.tsxindex e7989e0..586df53 100644--- a/frontend/src/pages/drama/DramaListPage.tsx+++ b/frontend/src/pages/drama/DramaListPage.tsx@@ -379,7 +379,7 @@ function DramaListInner({ workflow }: { workflow: DramaWorkflow }) {</div>) : null}</div>- {publishProjectId && capabilities?.enabled && <DramaPublishModal projectId={publishProjectId} onClose={() => setPublishProjectId(null)} />}+ {publishProjectId && capabilities?.enabled && <DramaPublishModal projectId={publishProjectId} selectReady onClose={() => setPublishProjectId(null)} />}</AppShell>)}diff --git a/frontend/src/pages/studio/EditorPage.tsx b/frontend/src/pages/studio/EditorPage.tsxindex e4addce..a2d3467 100644--- a/frontend/src/pages/studio/EditorPage.tsx+++ b/frontend/src/pages/studio/EditorPage.tsx@@ -1,5 +1,5 @@import { useEffect, useMemo, useRef, useState } from 'react'-import { useNavigate, useParams } from 'react-router-dom'+import { useLocation, useNavigate, useParams } from 'react-router-dom'import { api } from '../../api'import type { Project, Shot } from '../../api'import BillingErrorNotice from '../../components/billing/BillingErrorNotice'@@ -7,6 +7,7 @@ import AppShell from '../../components/layout/AppShell'import ComingSoon from '../../components/ui/ComingSoon'import { STATUS_CN, shotsByNo } from '../../lib/status'import { downloadSingleVideo } from '../../lib/clientDownload'+import { withReturn } from '../../features/marketplace/ui'const PANEL_TABS = ['文案', '画面', '配音', '转场'] as const@@ -14,6 +15,7 @@ export default function EditorPage() {const { id } = useParams()const projectId = Number(id)const nav = useNavigate()+ const location = useLocation()const [project, setProject] = useState<Project | null>(null)const [activeShotId, setActiveShotId] = useState<number | null>(null)const [tab, setTab] = useState<(typeof PANEL_TABS)[number]>('文案')@@ -261,7 +263,7 @@ export default function EditorPage() {type="button"className="pf-btn pf-btn-ghost pf-btn-sm"disabled={!project.final_video_url}- onClick={() => nav(`/marketplace/from-printfilm?project=${project.id}`)}+ onClick={() => nav(withReturn(`/marketplace/from-printfilm?project=${project.id}`, `${location.pathname}${location.search}`))}>发布到数字资产市场</button>diff --git a/frontend/src/pages/studio/StoryboardPage.tsx b/frontend/src/pages/studio/StoryboardPage.tsxindex 696c041..9ac1290 100644--- a/frontend/src/pages/studio/StoryboardPage.tsx+++ b/frontend/src/pages/studio/StoryboardPage.tsx@@ -1,5 +1,5 @@import { useEffect, useMemo, useRef, useState } from 'react'-import { useNavigate, useParams } from 'react-router-dom'+import { useLocation, useNavigate, useParams } from 'react-router-dom'import { api, defaultsFromTemplate } from '../../api'import type { Project, Shot, Template } from '../../api'import AppShell from '../../components/layout/AppShell'@@ -19,6 +19,7 @@ import {import { scenePromptForDisplay } from '../../promptDisplay'import { dialog } from '../../lib/dialog'import { downloadSingleVideo } from '../../lib/clientDownload'+import { withReturn } from '../../features/marketplace/ui'import { handleBillingError } from '../../lib/billingError'import BillingErrorNotice from '../../components/billing/BillingErrorNotice'import {@@ -128,6 +129,7 @@ export default function StoryboardPage() {const { id } = useParams()const projectId = Number(id)const nav = useNavigate()+ const location = useLocation()const [project, setProject] = useState<Project | null>(null)const [template, setTemplate] = useState<Template | null>(null)const [busy, setBusy] = useState(false)@@ -1044,7 +1046,7 @@ title="用当前镜头重新拼接"<button type="button" className="pf-btn pf-btn-ghost pf-btn-sm" onClick={openFinalPreview}>预览成片</button>- <button type="button" className="pf-btn pf-btn-ghost pf-btn-sm" onClick={() => nav(`/marketplace/from-printfilm?project=${project.id}`)}>+ <button type="button" className="pf-btn pf-btn-ghost pf-btn-sm" onClick={() => nav(withReturn(`/marketplace/from-printfilm?project=${project.id}`, `${location.pathname}${location.search}`))}>发布到数字资产市场</button></>