1
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-20 09:54:17 +08:00
parent 67c584b4df
commit 50759f3c1e
159 changed files with 16938 additions and 16925 deletions

View File

@@ -40,6 +40,8 @@ const RUNTIME_WRITE_RETRY: ApiRetryOptions = {
export type RuntimeRequestOptions = {
signal?: AbortSignal;
retry?: ApiRetryOptions;
skipAuth?: boolean;
skipRefresh?: boolean;
};
function requestRuntimeJson<T>(
@@ -60,10 +62,27 @@ function requestRuntimeJson<T>(
signal: options.signal,
},
fallbackMessage,
{ retry },
{
retry,
skipAuth: options.skipAuth,
skipRefresh: options.skipRefresh,
},
);
}
function requestPublicRuntimeJson<T>(
path: string,
init: RequestInit,
fallbackMessage: string,
options: RuntimeRequestOptions = {},
) {
return requestRuntimeJson<T>(path, init, fallbackMessage, {
...options,
skipAuth: true,
skipRefresh: true,
});
}
export async function getSaveSnapshot(options: RuntimeRequestOptions = {}) {
const snapshot = await requestRuntimeJson<HydratedSavedGameSnapshot | null>(
'/save/snapshot',
@@ -300,7 +319,7 @@ export async function unpublishCustomWorldProfile(
export async function listCustomWorldGallery(
options: RuntimeRequestOptions = {},
) {
const response = await requestRuntimeJson<CustomWorldGalleryResponse>(
const response = await requestPublicRuntimeJson<CustomWorldGalleryResponse>(
'/custom-world-gallery',
{ method: 'GET' },
'读取作品广场失败',
@@ -315,7 +334,7 @@ export async function getCustomWorldGalleryDetail(
profileId: string,
options: RuntimeRequestOptions = {},
) {
const response = await requestRuntimeJson<
const response = await requestPublicRuntimeJson<
CustomWorldGalleryDetailResponse<CustomWorldProfile>
>(
`/custom-world-gallery/${encodeURIComponent(ownerUserId)}/${encodeURIComponent(profileId)}`,