feat: Instance grouping and user count

This commit is contained in:
2026-06-28 03:49:50 +07:00
parent 2dd6931425
commit 387fa18927
11 changed files with 281 additions and 25 deletions
+3
View File
@@ -7,6 +7,7 @@ import type {
} from "./types/auth";
import type { SocialSnapshot, UserProfile, UserStatus } from "./types/user";
import type { FavoriteWorldFolder, World, WorldSnapshot } from "./types/world";
import type { Instance } from "./types/instance";
import type { Avatar } from "./types/avatar";
import type { RepoStats, StoredEntity } from "./types/repository";
import type { AccountSettings, ContentFilterKey, Pending2Fa, RecoveryCode } from "./types/settings";
@@ -46,6 +47,8 @@ export interface IpcRequests {
"world:get": (worldId: string) => IpcResult<World>;
"world:snapshot": () => IpcResult<WorldSnapshot>;
"instance:get": (location: { worldId: string; instanceId: string }) => IpcResult<Instance>;
"avatar:get": (avatarId: string) => IpcResult<Avatar>;
"avatar:favorites": () => IpcResult<Avatar[]>;
+15
View File
@@ -0,0 +1,15 @@
export interface Instance {
id: string;
location: string;
worldId: string;
instanceId: string;
type: string;
region?: string;
ownerId?: string;
userCount: number;
capacity: number;
recommendedCapacity?: number;
full: boolean;
queueEnabled: boolean;
queueSize: number;
}
+2 -1
View File
@@ -17,6 +17,7 @@ export type Location = "offline" | "private" | "traveling" | "" | string;
export interface ParsedLocation {
worldId: string;
instanceId: string;
instance: string;
region?: string;
}
@@ -26,7 +27,7 @@ export function parseLocation(loc?: string): ParsedLocation | null {
if (!worldId?.startsWith("wrld_") || !rest) return null;
const instanceId = rest.split("~")[0];
const region = /~region\(([^)]+)\)/.exec(rest)?.[1];
return { worldId, instanceId, region };
return { worldId, instanceId, instance: rest, region };
}
export interface Badge {