mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
feat: more more more!
This commit is contained in:
1 parent
75f6f133ca
commit
eb5e2a935c
2 files changed
+56
-30
No files matched your search
@@ -41,17 +41,25 @@ jobs:
|
|||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
token: ${{ secrets.GH_TOKEN }}
|
token: ${{ secrets.GH_TOKEN }}
|
||||||
|
|
||||||
- uses: oven-sh/setup-bun@v1
|
- name: Setup bun
|
||||||
- uses: actions/configure-pages@v5
|
uses: oven-sh/setup-bun@v1
|
||||||
- uses: actions/setup-dotnet@v4
|
|
||||||
|
- name: Configure pages
|
||||||
|
uses: actions/configure-pages@v5
|
||||||
|
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
with:
|
with:
|
||||||
dotnet-version: 9.0
|
dotnet-version: 9.0
|
||||||
- run: |
|
|
||||||
|
- name: Download Steam Depot
|
||||||
|
run: |
|
||||||
mkdir -p temp
|
mkdir -p temp
|
||||||
|
|
||||||
echo "Downloading..."
|
echo "Downloading..."
|
||||||
@@ -67,11 +75,16 @@ jobs:
|
|||||||
echo "Download complete; files:"
|
echo "Download complete; files:"
|
||||||
ls temp/depotDownloader
|
ls temp/depotDownloader
|
||||||
|
|
||||||
- run: bun install
|
- name: Download dependencies
|
||||||
- run: |
|
run: bun install
|
||||||
|
|
||||||
|
- name: Restore dependencies
|
||||||
|
run: |
|
||||||
cd src/BlitzKit.CLI
|
cd src/BlitzKit.CLI
|
||||||
dotnet restore
|
dotnet restore
|
||||||
- run: |
|
|
||||||
|
- name: Download client
|
||||||
|
run: |
|
||||||
chmod +x temp/depotDownloader/DepotDownloader
|
chmod +x temp/depotDownloader/DepotDownloader
|
||||||
temp/depotDownloader/DepotDownloader \
|
temp/depotDownloader/DepotDownloader \
|
||||||
-username "${{ env.DEPOT_DOWNLOADER_USERNAME }}" \
|
-username "${{ env.DEPOT_DOWNLOADER_USERNAME }}" \
|
||||||
@@ -82,11 +95,13 @@ jobs:
|
|||||||
-dir temp/depot \
|
-dir temp/depot \
|
||||||
-filelist filelist.txt
|
-filelist filelist.txt
|
||||||
|
|
||||||
- run: |
|
- name: Download containers
|
||||||
|
run: |
|
||||||
cd src/BlitzKit.CLI
|
cd src/BlitzKit.CLI
|
||||||
dotnet run unpack ../../temp/depot
|
dotnet run unpack ../../temp/depot
|
||||||
- run: bun run build:website
|
|
||||||
- run: |
|
- name: Run API and build website
|
||||||
|
run: |
|
||||||
cd src/BlitzKit.CLI
|
cd src/BlitzKit.CLI
|
||||||
dotnet run api --verbosepa &
|
dotnet run api --verbosepa &
|
||||||
SERVER_PID=$!
|
SERVER_PID=$!
|
||||||
@@ -96,7 +111,8 @@ jobs:
|
|||||||
|
|
||||||
kill $SERVER_PID || true
|
kill $SERVER_PID || true
|
||||||
|
|
||||||
- uses: actions/upload-pages-artifact@v3
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-pages-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: dist/website
|
path: dist/website
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,10 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using BlitzKit.CLI.Models;
|
|
||||||
using BlitzKit.CLI.Quicktype.DLCManifest;
|
using BlitzKit.CLI.Quicktype.DLCManifest;
|
||||||
using BlitzKit.CLI.Utils;
|
using BlitzKit.CLI.Utils;
|
||||||
using CUE4Parse.FileProvider;
|
using CUE4Parse.FileProvider;
|
||||||
using CUE4Parse.FileProvider.Objects;
|
|
||||||
using CUE4Parse.UE4.Pak;
|
|
||||||
using CUE4Parse.UE4.Pak.Objects;
|
using CUE4Parse.UE4.Pak.Objects;
|
||||||
using CUE4Parse.UE4.Readers;
|
|
||||||
using CUE4Parse.UE4.Versions;
|
using CUE4Parse.UE4.Versions;
|
||||||
using DotNet.Globbing;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading;
|
|
||||||
using System.IO;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace BlitzKit.CLI.Functions
|
namespace BlitzKit.CLI.Functions
|
||||||
{
|
{
|
||||||
@@ -25,7 +15,7 @@ namespace BlitzKit.CLI.Functions
|
|||||||
private const string TEMP_DEPOT_DIR = "../../temp/depot/";
|
private const string TEMP_DEPOT_DIR = "../../temp/depot/";
|
||||||
public const string WG_DLC_DOMAIN = "http://dl-wotblitz-gc.wargaming.net";
|
public const string WG_DLC_DOMAIN = "http://dl-wotblitz-gc.wargaming.net";
|
||||||
private const string BUILD_MANIFEST_OS = "Windows";
|
private const string BUILD_MANIFEST_OS = "Windows";
|
||||||
private static readonly SemaphoreSlim semaphore = new(4); // Limit to 4 concurrent downloads
|
private static readonly SemaphoreSlim semaphore = new(8); // Limit to 4 concurrent downloads
|
||||||
|
|
||||||
public static async Task Unpack(string[] args)
|
public static async Task Unpack(string[] args)
|
||||||
{
|
{
|
||||||
@@ -68,13 +58,17 @@ namespace BlitzKit.CLI.Functions
|
|||||||
{
|
{
|
||||||
var localContainerPath = Path.Combine(CONTAINERS_PATH, pakFile.FileName);
|
var localContainerPath = Path.Combine(CONTAINERS_PATH, pakFile.FileName);
|
||||||
var fullContainerURL = $"{WG_DLC_DOMAIN}/dlc/{CONTENT_GROUP}/dlc/{pakFile.RelativeUrl}";
|
var fullContainerURL = $"{WG_DLC_DOMAIN}/dlc/{CONTENT_GROUP}/dlc/{pakFile.RelativeUrl}";
|
||||||
downloadTasks.Add(DownloadFileAsync(client, fullContainerURL, localContainerPath, manifest.PakFiles.Count));
|
downloadTasks.Add(
|
||||||
|
DownloadFileAsync(client, fullContainerURL, localContainerPath, manifest.PakFiles.Count)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await Task.WhenAll(downloadTasks);
|
await Task.WhenAll(downloadTasks);
|
||||||
|
|
||||||
PrettyLog.Log("Moving pre-bundled containers...");
|
PrettyLog.Log("Moving pre-bundled containers...");
|
||||||
foreach (var file in Directory.GetFiles(Path.Combine(TEMP_DEPOT_DIR, "Blitz/Content/Paks"), "*.pak"))
|
foreach (
|
||||||
|
var file in Directory.GetFiles(Path.Combine(TEMP_DEPOT_DIR, "Blitz/Content/Paks"), "*.pak")
|
||||||
|
)
|
||||||
{
|
{
|
||||||
File.Move(file, Path.Combine(CONTAINERS_PATH, Path.GetFileName(file)));
|
File.Move(file, Path.Combine(CONTAINERS_PATH, Path.GetFileName(file)));
|
||||||
}
|
}
|
||||||
@@ -83,16 +77,31 @@ namespace BlitzKit.CLI.Functions
|
|||||||
Directory.Delete(TEMP_DEPOT_DIR, true);
|
Directory.Delete(TEMP_DEPOT_DIR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task DownloadFileAsync(HttpClient client, string url, string localPath, int totalFiles)
|
private static async Task DownloadFileAsync(
|
||||||
|
HttpClient client,
|
||||||
|
string url,
|
||||||
|
string localPath,
|
||||||
|
int totalFiles
|
||||||
|
)
|
||||||
{
|
{
|
||||||
await semaphore.WaitAsync();
|
await semaphore.WaitAsync();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using HttpResponseMessage response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
|
using HttpResponseMessage response = await client.GetAsync(
|
||||||
|
url,
|
||||||
|
HttpCompletionOption.ResponseHeadersRead
|
||||||
|
);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
|
|
||||||
using Stream contentStream = await response.Content.ReadAsStreamAsync(),
|
using Stream contentStream = await response.Content.ReadAsStreamAsync(),
|
||||||
fileStream = new FileStream(localPath, FileMode.Create, FileAccess.Write, FileShare.None, 8192, true);
|
fileStream = new FileStream(
|
||||||
|
localPath,
|
||||||
|
FileMode.Create,
|
||||||
|
FileAccess.Write,
|
||||||
|
FileShare.None,
|
||||||
|
8192,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
await contentStream.CopyToAsync(fileStream);
|
await contentStream.CopyToAsync(fileStream);
|
||||||
PrettyLog.Log($"Downloaded {Path.GetFileName(localPath)} ({totalFiles} total)");
|
PrettyLog.Log($"Downloaded {Path.GetFileName(localPath)} ({totalFiles} total)");
|
||||||
@@ -111,11 +120,12 @@ namespace BlitzKit.CLI.Functions
|
|||||||
{
|
{
|
||||||
PrettyLog.Log($"Fetching manifest for group {group} and build {build}");
|
PrettyLog.Log($"Fetching manifest for group {group} and build {build}");
|
||||||
|
|
||||||
string url = $"{WG_DLC_DOMAIN}/dlc/{group}/dlc/BuildManifest-{BUILD_MANIFEST_OS}-{build}.json";
|
string url =
|
||||||
|
$"{WG_DLC_DOMAIN}/dlc/{group}/dlc/BuildManifest-{BUILD_MANIFEST_OS}-{build}.json";
|
||||||
using HttpClient client = new();
|
using HttpClient client = new();
|
||||||
string jsonString = await client.GetStringAsync(url);
|
string jsonString = await client.GetStringAsync(url);
|
||||||
return JsonSerializer.Deserialize<DlcManifest>(jsonString)
|
return JsonSerializer.Deserialize<DlcManifest>(jsonString)
|
||||||
?? throw new Exception("Failed to deserialize manifest");
|
?? throw new Exception("Failed to deserialize manifest");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user