Formerly KrillinAI, VideoTranslation and Dubbing Tool for 120+ Languages. Open-source AI workspace for creators, powered by Codex. Video downloader, video translation, create videos, images, audios, and edits with Agents in one place. For your Social Media like YouTube, TikTok, Instagram, etc.
TypeScript agent-skillscodex-clideskop-appdubbingimage-generationlocalizationskillsttsvideo-editingvideo-generationvideo-transcriptionvideo-translation
fix(web): preserve settings return route and cover YouTube shares
Leggettd9971b9543e1
diff --git a/apps/daemon/test/integration/video-metadata-api.test.ts b/apps/daemon/test/integration/video-metadata-api.test.tsindex 5236998a..0d1903d0 100644--- a/apps/daemon/test/integration/video-metadata-api.test.ts+++ b/apps/daemon/test/integration/video-metadata-api.test.ts@@ -30,7 +30,7 @@ describe('video metadata API', () => {const response = await server.inject({method: 'GET',- url: '/video-metadata?url=https%3A%2F%2Fyoutu.be%2Fvideo_123'+ url: '/video-metadata?url=https%3A%2F%2Fyoutu.be%2Fvideo_123%3Fsi%3Dshare-token'});expect(response.statusCode).toBe(200);diff --git a/apps/daemon/test/unit/creator-video-translation-workflow.test.ts b/apps/daemon/test/unit/creator-video-translation-workflow.test.tsindex 9aed99d0..f2495c64 100644--- a/apps/daemon/test/unit/creator-video-translation-workflow.test.ts+++ b/apps/daemon/test/unit/creator-video-translation-workflow.test.ts@@ -20,6 +20,24 @@ afterEach(() => {});describe('video translation workflow', () => {+ it.each([+ 'https://www.youtube.com/watch?v=xVWS7yHdzCU',+ 'https://youtu.be/tAkC-ZdaqWs?si=6LcL-jgzdBaZ1IFD'+ ])('accepts the supported YouTube URL form: %s', async sourceUrl => {+ const fixture = setup({ sourceUrl });+ const config = createDefaultCreatorServicesConfig();+ config.llm.apiKey = 'llm-key';+ const workflow = createVideoTranslationWorkflow({+ creator: fixture.service,+ dispatcher: fixture.dispatcher,+ configStore: { read: vi.fn(async () => config) }+ });++ await expect(workflow.validateStage(fixture.service.getJob(fixture.jobId)!, 'subtitle'))+ .resolves.toBeUndefined();+ fixture.db.close();+ });+it('queues the selected stages in order through the command dispatcher', async () => {const fixture = setup({ dubbing: true, composeVideo: true, videoFormat: 'all' });const config = createDefaultCreatorServicesConfig();diff --git a/apps/web/src/app/App.test.tsx b/apps/web/src/app/App.test.tsxindex 254a19da..13c5c774 100644--- a/apps/web/src/app/App.test.tsx+++ b/apps/web/src/app/App.test.tsx@@ -7417,8 +7417,9 @@ describe('App', () => {});});- it('opens settings and returns to the app', async () => {+ it('returns from settings to the same composer-free Home', async () => {const user = userEvent.setup();+ window.history.replaceState(null, '', '#/new');render(<App fileService={createFileService()} />);@@ -7429,7 +7430,32 @@ describe('App', () => {await user.click(screen.getByRole('button', { name: '返回应用' }));expect(screen.queryByRole('heading', { name: '新对话' })).not.toBeInTheDocument();+ expect(screen.queryByText('需要帮你做点什么')).not.toBeInTheDocument();+ expect(await screen.findByText('精选模板')).toBeInTheDocument();+ expect(window.location.hash).toBe('#/new');+ });++ it('returns from settings to the empty chat when settings were opened there', async () => {+ const user = userEvent.setup();++ render(<App fileService={createFileService()} />);+ await user.click(await screen.findByRole('button', { name: '设置' }));+ await user.click(screen.getByRole('button', { name: '返回应用' }));+expect(await screen.findByText('需要帮你做点什么')).toBeInTheDocument();+ expect(window.location.hash).toBe('#/chat');+ });++ it('returns a directly opened settings page to Home', async () => {+ const user = userEvent.setup();+ window.history.replaceState(null, '', '#/settings');++ render(<App fileService={createFileService()} />);+ await user.click(await screen.findByRole('button', { name: '返回应用' }));++ expect(await screen.findByText('精选模板')).toBeInTheDocument();+ expect(screen.queryByText('需要帮你做点什么')).not.toBeInTheDocument();+ expect(window.location.hash).toBe('#/new');});it('uses a solid conversation background without a dynamic background setting', async () => {diff --git a/apps/web/src/app/AppController.tsx b/apps/web/src/app/AppController.tsxindex 5a075e6b..50498022 100644--- a/apps/web/src/app/AppController.tsx+++ b/apps/web/src/app/AppController.tsx@@ -456,6 +456,9 @@ export function AppController(props: AppControllerProps) {const restoredThreadIdRef = useRef(initialState.selectedThreadId);const initialRouteKeyRef = useRef(formatRoute(props.route));const pendingRouteKeyRef = useRef<string>();+ const settingsReturnRouteRef = useRef<AppRoute>(+ props.route.view === 'settings' ? { view: 'home' } : props.route+ );const skipNextHistoryLoadForThreadRef = useRef<string>();const skillMarketMutationInFlightRef = useRef(false);const skillMarketUseInFlightRef = useRef(false);@@ -4519,6 +4522,7 @@ export function AppController(props: AppControllerProps) {}createProjectError={createProjectError}onOpenRuntimeComponents={() => {+ settingsReturnRouteRef.current = props.route;dispatch({ type: 'open_settings' });navigateToRoute({ view: 'settings', tab: 'local-components' });}}@@ -4644,8 +4648,9 @@ export function AppController(props: AppControllerProps) {initialTab={props.route.view === 'settings' ? props.route.tab : undefined}initialSection={props.route.view === 'settings' ? props.route.section : undefined}onBack={() => {- dispatch({ type: 'back_to_app' });- navigateToRoute(routeForConversation(state.selectedThreadId));+ const returnRoute = settingsReturnRouteRef.current;+ applyRouteFromLocation(returnRoute);+ navigateToRoute(returnRoute);}}/>) : state.activeView === 'plugins' ? (@@ -4759,6 +4764,7 @@ export function AppController(props: AppControllerProps) {onDeleteTask={task => deleteSidebarTask(task)}onOpenSettings={() => {closeMobileSidebar();+ settingsReturnRouteRef.current = props.route;dispatch({ type: 'open_settings' });navigateToRoute({ view: 'settings' });}}diff --git a/apps/web/src/features/dashboard/VideoSourceInput.tsx b/apps/web/src/features/dashboard/VideoSourceInput.tsxindex 2eeeb1a5..d4386897 100644--- a/apps/web/src/features/dashboard/VideoSourceInput.tsx+++ b/apps/web/src/features/dashboard/VideoSourceInput.tsx@@ -93,7 +93,10 @@ export default function VideoSourceInput(props: {type="url"value={props.url}onChange={event => props.onUrlChange(event.target.value)}- placeholder={l('粘贴 YouTube、Bilibili 或其他视频链接', 'Paste a YouTube, Bilibili, or other video link')}+ placeholder={l(+ '粘贴 YouTube 标准链接、youtu.be 分享链接或 Bilibili 链接',+ 'Paste a YouTube URL, youtu.be share link, or Bilibili URL'+ )}aria-invalid={props.invalid}/></div>diff --git a/apps/web/src/features/dashboard/VideoSourcePreview.test.tsx b/apps/web/src/features/dashboard/VideoSourcePreview.test.tsxindex fa44fed8..287cb0f5 100644--- a/apps/web/src/features/dashboard/VideoSourcePreview.test.tsx+++ b/apps/web/src/features/dashboard/VideoSourcePreview.test.tsx@@ -121,7 +121,7 @@ describe('VideoSourcePreview', () => {<VideoSourcePreviewfile={null}sourceType="url"- url="https://youtu.be/preview-two"+ url="https://youtu.be/preview-two?si=share-token"onChooseFile={vi.fn()}onClear={vi.fn()}metadataService={{ getVideoMetadata }}@@ -133,6 +133,7 @@ describe('VideoSourcePreview', () => {);expect(await screen.findByText('Second video title')).toBeInTheDocument();expect(screen.queryByTitle('YouTube 视频预览')).not.toBeInTheDocument();+ expect(getVideoMetadata).toHaveBeenLastCalledWith('https://youtu.be/preview-two?si=share-token');});it('recognizes Bilibili and direct video links', () => {