From 13927927b37b2a262b71ec30d436a0fade8cb5ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Fri, 10 Apr 2026 14:56:30 -0500 Subject: [PATCH] feat: update remote storage and parsing --- packages/closed | 2 +- .../src/components/AvatarCard/index.tsx | 4 +-- packages/website-ue/src/core/api/client.ts | 7 ++--- packages/website-ue/src/core/api/dynamic.ts | 6 ++-- packages/website-ue/src/core/api/server.ts | 29 ++++++++++--------- .../src/pages/api/avatars/all.pb.ts | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/packages/closed b/packages/closed index 636cf9aeb..660413e95 160000 --- a/packages/closed +++ b/packages/closed @@ -1 +1 @@ -Subproject commit 636cf9aeb2efc9b11760a631f4a7dc01d2608689 +Subproject commit 660413e955b6e875802351b11eb5512025e3693a diff --git a/packages/website-ue/src/components/AvatarCard/index.tsx b/packages/website-ue/src/components/AvatarCard/index.tsx index 2065f9e40..1290434d4 100644 --- a/packages/website-ue/src/components/AvatarCard/index.tsx +++ b/packages/website-ue/src/components/AvatarCard/index.tsx @@ -1,10 +1,10 @@ import { literals } from "@blitzkit/i18n"; -import { Grade } from "@protos/blitz_static_standard_grades_enum"; +import type { Avatar } from "@protos/blitzkit/avatar"; +import { Grade } from "@protos/game/proto/legacy/blitz_static_standard_grades_enum"; import { DownloadIcon, StarFilledIcon } from "@radix-ui/react-icons"; import type { Color } from "../../core/ui/color"; import { useGameStrings } from "../../hooks/useGameStrings"; import { useStrings } from "../../hooks/useStrings"; -import type { Avatar } from "../../protos/avatar"; import type { PropsWithSkeleton } from "../../types/propsWithSkeleton"; import { Badge } from "../Badge"; import { Button } from "../Button"; diff --git a/packages/website-ue/src/core/api/client.ts b/packages/website-ue/src/core/api/client.ts index 804ed45ec..c6565ebf2 100644 --- a/packages/website-ue/src/core/api/client.ts +++ b/packages/website-ue/src/core/api/client.ts @@ -1,8 +1,8 @@ import { fetchPB } from "@blitzkit/core"; import type { Strings } from "@blitzkit/i18n"; -import { Avatars } from "../../protos/avatars"; -import { PopularTanks } from "../../protos/popular_tanks"; -import { Tank } from "../../protos/tank"; +import { Avatars } from "@protos/blitzkit/avatars"; +import { PopularTanks } from "@protos/blitzkit/popular_tanks"; +import { Tank } from "@protos/blitzkit/tank"; import { AbstractAPI, Cache } from "./abstract"; const rejected = Promise.reject("Not implemented on client"); @@ -59,7 +59,6 @@ export class ClientAPI extends AbstractAPI { return rejected; } - @UnimplementedOnClient avatars() { return fetchPB("/api/avatars/all.pb", Avatars); } diff --git a/packages/website-ue/src/core/api/dynamic.ts b/packages/website-ue/src/core/api/dynamic.ts index b119f3923..8e64b2e94 100644 --- a/packages/website-ue/src/core/api/dynamic.ts +++ b/packages/website-ue/src/core/api/dynamic.ts @@ -8,8 +8,8 @@ if (typeof window === "undefined") { const { ServerAPI } = await import("./server"); const proxyClient = await new ProxyClient( - assertSecret(import.meta.env.WOTB_SERVER) - ).handshake(); + assertSecret(import.meta.env.WOTB_SERVER), + ).handshake(assertSecret(import.meta.env.WOTB_VERSION)); const metadata = await proxyClient.metadata(); dynamicAPI = new ServerAPI(metadata); @@ -20,5 +20,3 @@ if (typeof window === "undefined") { } export const api = dynamicAPI; - - diff --git a/packages/website-ue/src/core/api/server.ts b/packages/website-ue/src/core/api/server.ts index 8c7933117..854be96e7 100644 --- a/packages/website-ue/src/core/api/server.ts +++ b/packages/website-ue/src/core/api/server.ts @@ -2,19 +2,18 @@ import type { MetadataAccessor } from "@blitzkit/closed"; import { assertSecret, sluggify } from "@blitzkit/core"; import type { Strings } from "@blitzkit/i18n"; import locales from "@blitzkit/i18n/locales.json"; -import type { RemoteStorageComponent } from "@protos/blitz_static_remote_storage_component"; -import type { DeepPartial } from "@protos/blitz_static_reward_currency"; +import type { Avatar, DeepPartial } from "@protos/blitzkit/avatar"; +import type { Background } from "@protos/blitzkit/background"; +import type { PopularTanks } from "@protos/blitzkit/popular_tanks"; +import type { Tank } from "@protos/blitzkit/tank"; +import type { TankListEntry } from "@protos/blitzkit/tank_list"; +import type { Tanks } from "@protos/blitzkit/tanks"; +import type { RemoteStorageComponent } from "@protos/game/proto/legacy/blitz_static_remote_storage_component"; import { existsSync } from "fs"; import { mkdir, readFile, writeFile } from "fs/promises"; import { google } from "googleapis"; import { merge } from "lodash-es"; import { parse } from "yaml"; -import type { Avatar } from "../../protos/avatar"; -import type { Background } from "../../protos/background"; -import type { PopularTanks } from "../../protos/popular_tanks"; -import type { Tank } from "../../protos/tank"; -import type { TankListEntry } from "../../protos/tank_list"; -import type { Tanks } from "../../protos/tanks"; import { AbstractAPI, Cache } from "./abstract"; if (typeof window !== "undefined") { @@ -200,15 +199,19 @@ export class ServerAPI extends AbstractAPI { const clientConfig = this.metadata.item(group[0].id); const localizationResources = clientConfig.LocalizationResources(); - if (!localizationResources.remote_storage) { - throw new Error("Localization resources not found"); + console.log("localizationResources", localizationResources); + + if (localizationResources.remote_storages.length !== 1) { + throw new RangeError( + `Don't know how to handle ${group.length} remote_storages`, + ); } + const remoteStorageName = localizationResources.remote_storages[0]; let remoteStorage: RemoteStorageComponent | undefined = undefined; - for (const candidateId of localizationResources.remote_storage - .remote_urls) { - const item = this.metadata.item(candidateId); + for (const remoteUrl of remoteStorageName.remote_urls) { + const item = this.metadata.item(remoteUrl); const candidate = item.RemoteStorage(); if ( diff --git a/packages/website-ue/src/pages/api/avatars/all.pb.ts b/packages/website-ue/src/pages/api/avatars/all.pb.ts index f93f9afb1..615bb59f4 100644 --- a/packages/website-ue/src/pages/api/avatars/all.pb.ts +++ b/packages/website-ue/src/pages/api/avatars/all.pb.ts @@ -1,5 +1,5 @@ +import { Avatars } from "@protos/blitzkit/avatars"; import { api } from "../../../core/api/dynamic"; -import { Avatars } from "../../../protos/avatars"; export async function GET() { const avatars = await api.avatars();