feat: Create Instance, Auto Instance Region

This commit is contained in:
2026-06-28 23:31:02 +07:00
parent 23748b15ae
commit d9ed86fe77
24 changed files with 865 additions and 19 deletions
+9 -2
View File
@@ -7,7 +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 { CreateInstanceInput, Instance, InstanceRegion } from "./types/instance";
import type { UnityStatus } from "./types/unity";
import type { Avatar } from "./types/avatar";
import type { RepoStats, StoredEntity } from "./types/repository";
@@ -15,7 +15,7 @@ import type { AccountSettings, ContentFilterKey, Pending2Fa, RecoveryCode } from
import type { Group, GroupSnapshot } from "./types/group";
import type { EnhancementId, EnhancementsSnapshot } from "./types/enhancements";
import type { GallerySnapshot, Photo, ThumbCacheStats } from "./types/gallery";
import type { AppConfig } from "./types/appConfig";
import type { AppConfig, PreferredRegion, RegionPing } from "./types/appConfig";
import type { GameStatus } from "./types/game";
import type { IpcResult } from "./types/result";
import type { CacheEntryInfo, CacheStats, DebugSnapshot, LogEntry, WsEvent } from "./types/debug";
@@ -53,6 +53,8 @@ export interface IpcRequests {
"world:snapshot": () => IpcResult<WorldSnapshot>;
"instance:get": (location: { worldId: string; instanceId: string }) => IpcResult<Instance>;
"instance:create": (input: CreateInstanceInput) => IpcResult<Instance>;
"instance:inviteSelf": (p: { worldId: string; instanceId: string }) => IpcResult<void>;
"avatar:get": (avatarId: string) => IpcResult<Avatar>;
"avatar:favorites": () => IpcResult<Avatar[]>;
@@ -95,12 +97,17 @@ export interface IpcRequests {
"config:get": () => IpcResult<AppConfig>;
"config:setGamePath": (p: { gamePath: string | null }) => IpcResult<AppConfig>;
"config:pickGamePath": () => IpcResult<AppConfig>;
"config:setPreferredRegion": (p: { region: PreferredRegion }) => IpcResult<AppConfig>;
"region:detect": () => IpcResult<InstanceRegion>;
"region:ping": () => IpcResult<RegionPing[]>;
"unity:status": () => IpcResult<UnityStatus>;
"unity:install": (url: string) => IpcResult<void>;
"game:status": () => IpcResult<GameStatus>;
"game:launch": () => IpcResult<GameStatus>;
"game:join": (p: { location: string }) => IpcResult<void>;
"gallery:snapshot": () => IpcResult<GallerySnapshot>;
"gallery:reveal": (path: string) => IpcResult<void>;
+10
View File
@@ -1,5 +1,15 @@
import type { InstanceRegion } from "./instance";
export type PreferredRegion = InstanceRegion | "auto";
export interface AppConfig {
version: string;
gamePath: string | null;
detectedGamePath: string | null;
preferredRegion: PreferredRegion;
}
export interface RegionPing {
region: InstanceRegion;
ms: number | null;
}
+11
View File
@@ -12,4 +12,15 @@ export interface Instance {
full: boolean;
queueEnabled: boolean;
queueSize: number;
secureName?: string;
shortName?: string | null;
}
export type CreateInstanceType = "public" | "friends+" | "friends" | "invite" | "invite+";
export type InstanceRegion = "us" | "use" | "eu" | "jp";
export interface CreateInstanceInput {
worldId: string;
type: CreateInstanceType;
region: InstanceRegion;
}