This commit is contained in:
tresabhi committed 2026-06-22 20:23:51 -05:00
1 parent 4e72ea567f
commit f41eeba25e
9 files changed
+150 -34

No files matched your search

+2 -12
View File
@@ -3,22 +3,12 @@
"type": "module",
"private": true,
"scripts": {
"build:assets": "bun src/buildAssets/index.ts",
"build:averages": "bun src/averages.ts",
"setup:depotdownloader": "bun src/setupDepotDownloader.ts",
"setup:patches": "bun src/applyPatches.ts",
"build:reviews": "bun src/reviews.ts",
"build:ids": "bun src/discoverIds.ts",
"build:bot": "bun src/buildBot.ts",
"build:ratingleaderboard": "bun src/buildRatingLeaderboard.ts",
"build:proxyclient": "bun src/buildProxyClient.ts",
"build:catalogitemaccessor": "bun src/buildCatalogItemAccessor.ts",
"build:protos": "bun src/protos.ts",
"patchnotes": "bun src/patchNotes.ts"
"discover-servers": "bun src/discoverServers.ts"
},
"dependencies": {
"@blitzkit/closed": "workspace:*",
"@blitzkit/core": "workspace:*",
"@blitzkit/game": "workspace:*",
"@blitzkit/i18n": "workspace:*",
"@gltf-transform/core": "^4.2.1",
"@gltf-transform/extensions": "^4.2.1",
+92
View File
@@ -0,0 +1,92 @@
import { GameInterface } from "@blitzkit/game";
const urls = [
//
];
interface Bindings {
bindings: Binding[];
forbidden: string[];
}
interface Binding {
name: string;
versions: string[];
discovery: string;
env: string;
show_server_selection: boolean;
}
interface Discovery {
version: "1";
clusters: string[];
default_server: string;
servers: Record<string, Server>;
icmp_servers: Record<string, ICMPServer>;
clusters_versions: Record<string, ClusterVersion[]>;
countries_by_clusters: Record<string, Countries>;
extensions: Record<string, Extension>;
}
interface ClusterVersion {
version: string;
server: string;
}
interface Countries {
countries: string[];
}
interface Extension {
playability_config_url: string;
fullscreen_notifications_url: string;
mgg_frontier_url: string;
mgg_pay_url: string;
}
type ICMPServer = Record<string, string[]>;
interface Server {
name: string;
addr: string;
addr_dsapp?: string;
}
const game = new GameInterface();
urls.forEach(async (url) => {
const bindings = await fetch(url).then(
(response) => response.json() as Promise<Bindings>,
);
bindings.bindings.forEach(async (binding) => {
const discovery = await fetch(binding.discovery).then(
(response) => response.json() as Promise<Discovery>,
);
if (discovery.version !== "1") {
throw new Error(`Unsupported discovery version: ${discovery.version}`);
}
Object.values(discovery.servers).forEach(async (server) => {
const url = server.addr
.replace("wss://", "https://")
.replace(/:\d+$/, "");
const response = await fetch(url).catch(() => null);
if (response === null || response.status !== 426) return;
let message = "";
message += `${server.name}:\n`;
message += ` address: ${server.addr}\n`;
message += ` versions:\n`;
for (const version of binding.versions) {
message += ` - ${version}\n`;
}
console.log(message);
});
});
});