feat(ark-assets): 方舟素材库 - 支持私域素材授权 (#294)

This commit is contained in:
kinoko
2026-08-23 08:27:55 +08:00
committed by GitHub
parent 1bb5d1423a
commit d77432693e
25 changed files with 1072 additions and 4 deletions

View File

@@ -46,6 +46,11 @@ export type AccountFileStorageUsage = {
totalBytes: number;
};
export type ArkPrivateAssetSync = {
resourceId: string;
status: "active" | string;
};
const api = apiClient;
const resourceCache = new Map<string, RemoteResource>();
const resourceRequests = new Map<string, Promise<RemoteResource>>();
@@ -68,6 +73,11 @@ export async function getAccountFileStorageUsage() {
return data.usage;
}
export async function syncResourceToArkPrivateAsset(id: string) {
const data = await request<{ sync: ArkPrivateAssetSync }>(api.post(`/resources/${encodeURIComponent(id)}/ark-private-asset`));
return data.sync;
}
export function resourceIdFromStorageKey(storageKey?: string) {
return storageKey?.startsWith("resource:") ? storageKey.slice("resource:".length) : "";
}