feat(web): add account workspaces and signed content flows
This commit is contained in:
1 parent
7b8d61d1ba
commit
b5cf3d5958
117 files changed
+2789
-1674
No files matched your search
@@ -1,18 +1,8 @@
|
||||
const API_BASE = import.meta.env.VITE_WEBDROP_API_URL ?? '/api/v1';
|
||||
|
||||
interface ServerInfo {
|
||||
captcha?: { enabled?: boolean; api_endpoint?: string };
|
||||
}
|
||||
import { serverApi } from './server';
|
||||
|
||||
/** Cap performs challenge solving in its own workers and only returns a one-use token. */
|
||||
export async function solveCreationCaptcha(): Promise<string | undefined> {
|
||||
const response = await fetch(`${API_BASE.replace(/\/$/, '')}/info`, {
|
||||
cache: 'no-store',
|
||||
credentials: 'omit',
|
||||
referrerPolicy: 'no-referrer',
|
||||
});
|
||||
if (!response.ok) throw new Error('无法读取服务端能力');
|
||||
const info = await response.json() as ServerInfo;
|
||||
const info = await serverApi.info();
|
||||
if (!info.captcha?.enabled) return undefined;
|
||||
if (typeof info.captcha.api_endpoint !== 'string') throw new Error('验证码服务配置无效');
|
||||
|
||||
|
||||
Reference in new issue
Block a user