// https://github.com/scriptscat/scriptcat/blob/main/src/types/scriptcat.d.ts /** * 设置浏览器代理 * @deprecated 正式版中已废弃,后续可能会在beta版本中添加 */ declare function CAT_setProxy(rule: CATType.ProxyRule[] | string): void; /** * 清理所有代理规则 * @deprecated 正式版中已废弃,后续可能会在beta版本中添加 */ declare function CAT_clearProxy(): void; /** * 输入x、y,模拟真实点击 * @deprecated 正式版中已废弃,后续可能会在beta版本中添加 */ declare function CAT_click(x: number, y: number): void; /** * 打开脚本的用户配置页面 */ declare function CAT_userConfig(): void; declare namespace CATType { interface ProxyRule { proxyServer: ProxyServer; matchUrl: string[]; } type ProxyScheme = "http" | "https" | "quic" | "socks4" | "socks5"; interface ProxyServer { scheme?: ProxyScheme; host: string; port?: number; } interface FileStorageError { // 错误码 -1 未知错误 1 用户未配置文件储存源 2 文件储存源配置错误 3 路径不存在 // 4 上传失败 5 下载失败 6 删除失败 7 不允许的文件路径 8 网络类型的错误 code: -1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; error: string; } interface FileStorageFileInfo { // 文件名 name: string; // 文件路径 path: string; // 储存空间绝对路径 absPath: string; // 文件大小 size: number; // 文件摘要 digest: string; // 文件创建时间 createtime: number; // 文件修改时间 updatetime: number; } type CATFileStorageDetails = { baseDir: string; path: string; filename: any; file: FileStorageFileInfo; data?: string; }; } /** * 操控管理器设置的储存系统,将会在目录下创建一个app/uuid目录供此 API 使用,如果指定了baseDir参数,则会使用baseDir作为基础目录 * 上传时默认覆盖同名文件 * @param action 操作类型 list 列出指定目录所有文件, upload 上传文件, download 下载文件, delete 删除文件, config 打开配置页, 暂时不提供move/mkdir等操作 * @param details */ declare function CAT_fileStorage( action: "list", details: { // 文件路径 path?: string; // 基础目录,如果未设置,则将脚本uuid作为目录 baseDir?: string; onload?: (files: CATType.FileStorageFileInfo[]) => void; onerror?: (error: CATType.FileStorageError) => void; } ): void; declare function CAT_fileStorage( action: "download", details: { file: CATType.FileStorageFileInfo; // 某些平台需要提供文件的hash值,所以需要传入文件信息 onload: (data: Blob) => void; // onprogress?: (progress: number) => void; onerror?: (error: CATType.FileStorageError) => void; // public?: boolean; } ): void; declare function CAT_fileStorage( action: "delete", details: { path: string; onload?: () => void; onerror?: (error: CATType.FileStorageError) => void; // public?: boolean; } ): void; declare function CAT_fileStorage( action: "upload", details: { path: string; // 基础目录,如果未设置,则将脚本uuid作为目录 baseDir?: string; data: Blob; onload?: () => void; // onprogress?: (progress: number) => void; onerror?: (error: CATType.FileStorageError) => void; // public?: boolean; } ): void; declare function CAT_fileStorage(action: "config"): void; /** * 当使用 @early-start 时,可以使用此函数来等待脚本完全加载完成 */ declare function CAT_scriptLoaded(): Promise; export { CAT_setProxy, CAT_clearProxy, CAT_click, CAT_userConfig, CAT_fileStorage, CAT_scriptLoaded };