mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: update remote storage and parsing
This commit is contained in:
1 parent
68edf520c5
commit
13927927b3
6 files changed
+25
-25
No files matched your search
+1
-1
Submodule packages/closed updated: 636cf9aeb2...660413e955.
@@ -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";
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user