Files
wehub-resource-sync 9b395f5cc3
E2E Headed Chrome / e2e-headed (macos-15) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (ubuntu-latest) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (windows-latest) (push) Has been cancelled
CI / build (macos-latest) (push) Has been cancelled
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled
CI / unit-test (push) Has been cancelled
CI / bun-test (push) Has been cancelled
CI / adapter-test (push) Has been cancelled
CI / smoke-test (macos-latest) (push) Has been cancelled
CI / smoke-test (ubuntu-latest) (push) Has been cancelled
Security Audit / audit (push) Has been cancelled
Build Chrome Extension / build (push) Has been cancelled
Trigger Website Rebuild (Docs Updated) / dispatch (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:39:48 +08:00

43 lines
1.5 KiB
JavaScript

import { cli, Strategy } from '@jackwener/opencli/registry';
cli({
site: 'jimeng',
name: 'workspaces',
access: 'read',
description: '即梦AI 查看所有工作区(会话窗口)',
domain: 'jimeng.jianying.com',
strategy: Strategy.COOKIE,
browser: true,
columns: ['workspace_id', 'name', 'is_pinned', 'updated_at'],
pipeline: [
{ navigate: 'https://jimeng.jianying.com/ai-tool/generate?type=image&workspace=0' },
{ evaluate: `(async () => {
const res = await fetch('/mweb/v1/workspace/list?aid=513695&web_version=7.5.0&da_version=3.3.12', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({})
});
const data = await res.json();
if (data.ret === '1014' || data.ret === 1014) {
throw new Error('Not logged in — open jimeng.jianying.com in Chrome and sign in first');
}
if (data.ret !== '0' && data.ret !== 0) {
throw new Error('workspace/list failed: ret=' + data.ret + ' errmsg=' + (data.errmsg || ''));
}
return (data.data?.workspaces || []).map(ws => ({
workspace_id: String(ws.workspace_id),
name: ws.name || '',
is_pinned: ws.is_pinned ? 'yes' : 'no',
updated_at: ws.update_time ? new Date(ws.update_time).toLocaleString('zh-CN') : '',
}));
})()
` },
{ map: {
workspace_id: '${{ item.workspace_id }}',
name: '${{ item.name }}',
is_pinned: '${{ item.is_pinned }}',
updated_at: '${{ item.updated_at }}',
} },
],
});