feat: 支持工作流对话匿名分享

- 增加免登录公共接口、访客隔离、限流和匿名上传校验

- 分离 SSE 连接与运行生命周期,支持刷新恢复服务端权威状态

- 持久化分享页对话并优化时间线滚动与输入区交互
This commit is contained in:
2026-08-31 16:45:21 +08:00
parent fa174f6c16
commit 1bd9810518
46 changed files with 3742 additions and 180 deletions

View File

@@ -0,0 +1,42 @@
import { createMemoryHistory, createRouter } from 'vue-router';
import { useAccessStore } from '@easyflow/stores';
import { createPinia, setActivePinia } from 'pinia';
import { beforeEach, describe, expect, it } from 'vitest';
import { createRouterGuard } from '../guard';
describe('public route guard', () => {
beforeEach(() => {
setActivePinia(createPinia());
});
it('bypasses stale login state for an anonymous workflow share', async () => {
const accessStore = useAccessStore();
accessStore.setAccessToken('stale-token');
const router = createRouter({
history: createMemoryHistory(),
routes: [
{
component: { template: '<div>login</div>' },
name: 'Login',
path: '/auth/login',
},
{
component: { template: '<div>workflow share</div>' },
meta: { ignoreAccess: true, title: 'Workflow Share' },
name: 'WorkflowShare',
path: '/share/workflow',
},
],
});
createRouterGuard(router);
await router.push('/share/workflow?shareKey=share-key');
await router.isReady();
expect(router.currentRoute.value.name).toBe('WorkflowShare');
expect(router.currentRoute.value.query.shareKey).toBe('share-key');
});
});