mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: some implementation for client unmounted mode
This commit is contained in:
1 parent
980fd6e50e
commit
ba4e6dfd68
7 files changed
+29
-26
No files matched your search
+1
-1
Submodule packages/closed updated: 69c3688906...cc81b43447.
@@ -21,21 +21,7 @@ public class BlitzFileProvider : DefaultFileProvider
|
|||||||
Initialize();
|
Initialize();
|
||||||
Mount();
|
Mount();
|
||||||
|
|
||||||
string libraryExtension;
|
// OodleHelper.DownloadOodleDll($"../../temp/oodle.so");
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
OodleHelper.Initialize($"../../temp/oodle.so");
|
||||||
{
|
|
||||||
libraryExtension = "dll";
|
|
||||||
}
|
|
||||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
||||||
{
|
|
||||||
libraryExtension = "so";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new Exception("Unsupported OS");
|
|
||||||
}
|
|
||||||
|
|
||||||
OodleHelper.DownloadOodleDll($"../../temp/oodle.{libraryExtension}");
|
|
||||||
OodleHelper.Initialize($"../../temp/oodle.{libraryExtension}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RootNamespace>BlitzKit.Game</RootNamespace>
|
<RootNamespace>BlitzKit.Game</RootNamespace>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<!-- <RuntimeIdentifier>win-x64</RuntimeIdentifier> -->
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<NodeApiAssemblyJSModuleType>esm</NodeApiAssemblyJSModuleType>
|
<NodeApiAssemblyJSModuleType>esm</NodeApiAssemblyJSModuleType>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export * from "../bin/Debug/net9.0/win-x64/game";
|
export * from "../bin/Debug/net9.0/game";
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
export const clientUnmountedResponse = new Response(null, { status: 503 });
|
||||||
|
|
||||||
|
export const notFoundResponse = new Response(null, { status: 404 });
|
||||||
@@ -1,5 +1,13 @@
|
|||||||
import { GameInterface } from "@blitzkit/game";
|
import { GameInterface } from "@blitzkit/game";
|
||||||
|
|
||||||
export const game = new GameInterface(
|
export const clientUnmounted = !("WOTB_CLIENT" in import.meta.env);
|
||||||
"C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest",
|
|
||||||
);
|
let _game: GameInterface | null = null;
|
||||||
|
|
||||||
|
if (!clientUnmounted) {
|
||||||
|
_game = new GameInterface(import.meta.env.WOTB_CLIENT);
|
||||||
|
} else {
|
||||||
|
console.warn("Running in client denied mode...");
|
||||||
|
}
|
||||||
|
|
||||||
|
export const game = _game;
|
||||||
@@ -1,14 +1,20 @@
|
|||||||
import type { APIContext } from "astro";
|
import type { APIContext } from "astro";
|
||||||
import { api } from "../../../core/api/dynamic";
|
import { api } from "../../../core/api/dynamic";
|
||||||
import { game } from "../../../core/game/game";
|
import {
|
||||||
|
clientUnmountedResponse,
|
||||||
|
notFoundResponse,
|
||||||
|
} from "../../../core/api/responses";
|
||||||
|
import { clientUnmounted, game } from "../../../core/game/game";
|
||||||
|
|
||||||
export { getStaticPaths } from "./[id].json";
|
export { getStaticPaths } from "./[id].json";
|
||||||
|
|
||||||
export async function GET({ params }: APIContext<never, { id: string }>) {
|
export async function GET({ params }: APIContext<never, { id: string }>) {
|
||||||
const tank = await api.tank(params.id);
|
if (clientUnmounted) return clientUnmountedResponse;
|
||||||
const image = game.tankBigIcon(params.id, tank.tank!.visual_data);
|
|
||||||
|
|
||||||
if (image.length === 0) return new Response(null, { status: 404 });
|
const tank = await api.tank(params.id);
|
||||||
|
const image = game!.tankBigIcon(params.id, tank.tank!.visual_data);
|
||||||
|
|
||||||
|
if (image.length === 0) return notFoundResponse;
|
||||||
|
|
||||||
return new Response(new Uint8Array(image));
|
return new Response(new Uint8Array(image));
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user