mirror of
https://github.com/dream-pep/koring-launcher.git
synced 2026-09-12 05:45:18 +08:00
初始化
This commit is contained in:
+116
@@ -0,0 +1,116 @@
|
||||
.logo.vite:hover {
|
||||
filter: drop-shadow(0 0 2em #747bff);
|
||||
}
|
||||
|
||||
.logo.react:hover {
|
||||
filter: drop-shadow(0 0 2em #61dafb);
|
||||
}
|
||||
:root {
|
||||
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
font-weight: 400;
|
||||
|
||||
color: #0f0f0f;
|
||||
background-color: #f6f6f6;
|
||||
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
.container {
|
||||
margin: 0;
|
||||
padding-top: 10vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 6em;
|
||||
padding: 1.5em;
|
||||
will-change: filter;
|
||||
transition: 0.75s;
|
||||
}
|
||||
|
||||
.logo.tauri:hover {
|
||||
filter: drop-shadow(0 0 2em #24c8db);
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: 500;
|
||||
color: #646cff;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #535bf2;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
input,
|
||||
button {
|
||||
border-radius: 8px;
|
||||
border: 1px solid transparent;
|
||||
padding: 0.6em 1.2em;
|
||||
font-size: 1em;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
color: #0f0f0f;
|
||||
background-color: #ffffff;
|
||||
transition: border-color 0.25s;
|
||||
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
border-color: #396cd8;
|
||||
}
|
||||
button:active {
|
||||
border-color: #396cd8;
|
||||
background-color: #e8e8e8;
|
||||
}
|
||||
|
||||
input,
|
||||
button {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#greet-input {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
color: #f6f6f6;
|
||||
background-color: #2f2f2f;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #24c8db;
|
||||
}
|
||||
|
||||
input,
|
||||
button {
|
||||
color: #ffffff;
|
||||
background-color: #0f0f0f98;
|
||||
}
|
||||
button:active {
|
||||
background-color: #0f0f0f69;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
import { useState } from "react";
|
||||
import { RootLayout } from "./layouts/RootLayout";
|
||||
import { Home } from "./pages/Home";
|
||||
import { Debug } from "./pages/Debug";
|
||||
|
||||
type Page = "home" | "debug";
|
||||
|
||||
function App() {
|
||||
const [page, setPage] = useState<Page>("home");
|
||||
|
||||
return (
|
||||
<RootLayout>
|
||||
{page === "home" && <Home onNavigate={setPage} />}
|
||||
{page === "debug" && <Debug onNavigate={setPage} />}
|
||||
</RootLayout>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
@@ -0,0 +1,43 @@
|
||||
import { sidecarRequest } from "./sidecar";
|
||||
|
||||
export interface AuthResult {
|
||||
username: string;
|
||||
uuid: string;
|
||||
accessToken: string;
|
||||
expiresAt?: number;
|
||||
xboxProfile?: {
|
||||
gamertag: string;
|
||||
gamerscore: string;
|
||||
displayPicRaw: string;
|
||||
};
|
||||
}
|
||||
|
||||
export async function offlineLogin(username: string): Promise<AuthResult> {
|
||||
return sidecarRequest<AuthResult>("auth:offline-login", { username });
|
||||
}
|
||||
|
||||
export async function microsoftLoginStart(clientId: string, redirectUri?: string) {
|
||||
return sidecarRequest<{ state: string; authUrl: string }>(
|
||||
"auth:microsoft-login-start",
|
||||
{ client_id: clientId, redirect_uri: redirectUri }
|
||||
);
|
||||
}
|
||||
|
||||
export async function microsoftLoginCallback(
|
||||
code: string,
|
||||
clientId: string,
|
||||
redirectUri?: string
|
||||
): Promise<AuthResult> {
|
||||
return sidecarRequest<AuthResult>("auth:microsoft-login-callback", {
|
||||
code,
|
||||
client_id: clientId,
|
||||
redirect_uri: redirectUri,
|
||||
});
|
||||
}
|
||||
|
||||
export async function validateToken(accessToken: string): Promise<boolean> {
|
||||
const result = await sidecarRequest<{ valid: boolean }>("auth:validate-token", {
|
||||
accessToken,
|
||||
});
|
||||
return result.valid;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { sidecarRequest } from "./sidecar";
|
||||
|
||||
export type AnimationType = "none" | "gradient" | "particles";
|
||||
export type Theme = "light" | "dark" | "system";
|
||||
|
||||
export interface BackgroundConfig {
|
||||
type: "image" | "color" | "gradient" | "particles";
|
||||
image?: string;
|
||||
color?: string;
|
||||
blur: number;
|
||||
opacity: number;
|
||||
animation: AnimationType;
|
||||
animationSpeed: number;
|
||||
theme: Theme;
|
||||
}
|
||||
|
||||
export async function setImageBackground(url: string, blur?: number, opacity?: number): Promise<BackgroundConfig> {
|
||||
return sidecarRequest<BackgroundConfig>("background:set-image", { url, blur, opacity });
|
||||
}
|
||||
|
||||
export async function setColorBackground(color: string): Promise<BackgroundConfig> {
|
||||
return sidecarRequest<BackgroundConfig>("background:set-color", { color });
|
||||
}
|
||||
|
||||
export async function setBackgroundBlur(blur: number): Promise<BackgroundConfig> {
|
||||
return sidecarRequest<BackgroundConfig>("background:set-blur", { blur });
|
||||
}
|
||||
|
||||
export async function setBackgroundOpacity(opacity: number): Promise<BackgroundConfig> {
|
||||
return sidecarRequest<BackgroundConfig>("background:set-opacity", { opacity });
|
||||
}
|
||||
|
||||
export async function setBackgroundAnimation(type: AnimationType, speed?: number): Promise<BackgroundConfig> {
|
||||
return sidecarRequest<BackgroundConfig>("background:set-animation", { type, speed });
|
||||
}
|
||||
|
||||
export async function getBackgroundConfig(): Promise<BackgroundConfig> {
|
||||
return sidecarRequest<BackgroundConfig>("background:get", {});
|
||||
}
|
||||
|
||||
export async function setTheme(theme: Theme): Promise<BackgroundConfig> {
|
||||
return sidecarRequest<BackgroundConfig>("background:set-theme", { theme });
|
||||
}
|
||||
|
||||
export async function resetBackground(): Promise<BackgroundConfig> {
|
||||
return sidecarRequest<BackgroundConfig>("background:reset", {});
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export * from "./sidecar";
|
||||
export * from "./install";
|
||||
export * from "./launch";
|
||||
export * from "./auth";
|
||||
export * from "./mods";
|
||||
export * from "./instance";
|
||||
@@ -0,0 +1,54 @@
|
||||
import { sidecarRequest } from "./sidecar";
|
||||
|
||||
export interface VersionInfo {
|
||||
id: string;
|
||||
type: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface VersionManifest {
|
||||
latest: { release: string; snapshot: string };
|
||||
versions: VersionInfo[];
|
||||
}
|
||||
|
||||
export async function getVersionList(type?: string): Promise<VersionManifest> {
|
||||
return sidecarRequest<VersionManifest>("install:version-list", { type });
|
||||
}
|
||||
|
||||
export async function installMinecraft(
|
||||
version: string,
|
||||
gamePath: string,
|
||||
javaPath?: string,
|
||||
downloadThreads?: number
|
||||
): Promise<{ version: string; gamePath: string }> {
|
||||
return sidecarRequest("install:minecraft", {
|
||||
version,
|
||||
gamePath,
|
||||
javaPath,
|
||||
downloadThreads,
|
||||
});
|
||||
}
|
||||
|
||||
export async function installModLoader(
|
||||
mcVersion: string,
|
||||
gamePath: string,
|
||||
loaderType: "forge" | "fabric" | "quilt" | "neoforge",
|
||||
loaderVersion?: string,
|
||||
javaPath?: string
|
||||
): Promise<{ loaderType: string; mcVersion: string; loaderVersion: string }> {
|
||||
return sidecarRequest("install:mod-loader", {
|
||||
mcVersion,
|
||||
gamePath,
|
||||
loaderType,
|
||||
loaderVersion,
|
||||
javaPath,
|
||||
});
|
||||
}
|
||||
|
||||
export async function getForgeVersions(mcVersion?: string) {
|
||||
return sidecarRequest("install:forge-version-list", { mcVersion });
|
||||
}
|
||||
|
||||
export async function getFabricVersions(mcVersion?: string) {
|
||||
return sidecarRequest("install:fabric-version-list", { mcVersion });
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
import { sidecarRequest } from "./sidecar";
|
||||
|
||||
export interface InstanceConfig {
|
||||
name: string;
|
||||
mcVersion: string;
|
||||
loaderType?: string;
|
||||
loaderVersion?: string;
|
||||
javaPath?: string;
|
||||
memory?: { min?: string; max?: string };
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface InstanceInfo {
|
||||
name: string;
|
||||
path: string;
|
||||
config: InstanceConfig;
|
||||
modCount?: number;
|
||||
}
|
||||
|
||||
export async function createInstance(
|
||||
name: string,
|
||||
gamePath: string,
|
||||
mcVersion: string,
|
||||
loaderType?: string,
|
||||
loaderVersion?: string,
|
||||
javaPath?: string,
|
||||
memory?: { min?: string; max?: string }
|
||||
): Promise<InstanceInfo> {
|
||||
return sidecarRequest<InstanceInfo>("instance:create", {
|
||||
name,
|
||||
gamePath,
|
||||
mcVersion,
|
||||
loaderType,
|
||||
loaderVersion,
|
||||
javaPath,
|
||||
memory,
|
||||
});
|
||||
}
|
||||
|
||||
export async function listInstances(instancesPath: string): Promise<InstanceInfo[]> {
|
||||
return sidecarRequest<InstanceInfo[]>("instance:list", { instancesPath });
|
||||
}
|
||||
|
||||
export async function deleteInstance(
|
||||
name: string,
|
||||
instancesPath: string
|
||||
): Promise<{ deleted: string }> {
|
||||
return sidecarRequest<{ deleted: string }>("instance:delete", {
|
||||
name,
|
||||
instancesPath,
|
||||
});
|
||||
}
|
||||
|
||||
export async function getInstanceInfo(
|
||||
name: string,
|
||||
instancesPath: string
|
||||
): Promise<InstanceInfo> {
|
||||
return sidecarRequest<InstanceInfo>("instance:info", { name, instancesPath });
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { sidecarRequest, onEvent } from "./sidecar";
|
||||
import type { UnlistenFn } from "@tauri-apps/api/event";
|
||||
|
||||
export interface LaunchOptions {
|
||||
gamePath: string;
|
||||
javaPath: string;
|
||||
version: string;
|
||||
username: string;
|
||||
uuid: string;
|
||||
accessToken?: string;
|
||||
memory?: { min?: string; max?: string };
|
||||
jvmArgs?: string[];
|
||||
gameArgs?: string[];
|
||||
server?: { ip: string; port?: number };
|
||||
detached?: boolean;
|
||||
}
|
||||
|
||||
export interface LaunchResult {
|
||||
pid: number;
|
||||
version: string;
|
||||
username: string;
|
||||
requestId: string;
|
||||
}
|
||||
|
||||
export async function launchGame(options: LaunchOptions): Promise<LaunchResult> {
|
||||
return sidecarRequest<LaunchResult>("launch:launch", options);
|
||||
}
|
||||
|
||||
export async function diagnoseVersion(
|
||||
gamePath: string,
|
||||
version: string
|
||||
) {
|
||||
return sidecarRequest("launch:diagnose", { gamePath, version });
|
||||
}
|
||||
|
||||
export function onGameEvent(
|
||||
requestId: string,
|
||||
callback: (event: { event: string; [key: string]: unknown }) => void
|
||||
): Promise<UnlistenFn> {
|
||||
return onEvent(requestId, callback as (e: Record<string, unknown>) => void);
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import { sidecarRequest } from "./sidecar";
|
||||
|
||||
export interface ModSearchResult {
|
||||
id: string;
|
||||
slug: string;
|
||||
name: string;
|
||||
description: string;
|
||||
downloads: number;
|
||||
iconUrl?: string;
|
||||
categories?: string[];
|
||||
versions?: string[];
|
||||
loaders?: string[];
|
||||
source: "modrinth" | "curseforge";
|
||||
}
|
||||
|
||||
export interface ModVersionResult {
|
||||
id: string;
|
||||
name: string;
|
||||
versionNumber: string;
|
||||
gameVersions: string[];
|
||||
loaders: string[];
|
||||
files: {
|
||||
filename: string;
|
||||
url: string;
|
||||
size: number;
|
||||
primary: boolean;
|
||||
}[];
|
||||
}
|
||||
|
||||
export async function searchMods(
|
||||
query?: string,
|
||||
gameVersion?: string,
|
||||
loader?: string,
|
||||
limit?: number,
|
||||
offset?: number,
|
||||
source: "modrinth" | "curseforge" = "modrinth"
|
||||
): Promise<ModSearchResult[]> {
|
||||
return sidecarRequest<ModSearchResult[]>("mods:search", {
|
||||
query,
|
||||
gameVersion,
|
||||
loader,
|
||||
limit,
|
||||
offset,
|
||||
source,
|
||||
});
|
||||
}
|
||||
|
||||
export async function getModDetail(
|
||||
projectId: string,
|
||||
source: "modrinth" | "curseforge"
|
||||
): Promise<ModSearchResult> {
|
||||
return sidecarRequest<ModSearchResult>("mods:detail", { projectId, source });
|
||||
}
|
||||
|
||||
export async function getModVersions(
|
||||
projectId: string,
|
||||
gameVersion?: string,
|
||||
loader?: string,
|
||||
source: "modrinth" | "curseforge" = "modrinth"
|
||||
): Promise<ModVersionResult[]> {
|
||||
return sidecarRequest<ModVersionResult[]>("mods:versions", {
|
||||
projectId,
|
||||
gameVersion,
|
||||
loader,
|
||||
source,
|
||||
});
|
||||
}
|
||||
|
||||
export async function installMod(
|
||||
projectId: string,
|
||||
versionId: string | undefined,
|
||||
gamePath: string,
|
||||
source: "modrinth" | "curseforge" = "modrinth"
|
||||
): Promise<{ projectId: string; versionId: string; filename: string; path: string }> {
|
||||
return sidecarRequest("mods:install", {
|
||||
projectId,
|
||||
versionId,
|
||||
gamePath,
|
||||
source,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
||||
|
||||
export interface SidecarResponse<T = unknown> {
|
||||
id: string;
|
||||
type: "result" | "error" | "progress" | "event";
|
||||
payload: T;
|
||||
}
|
||||
|
||||
export interface CommandResult {
|
||||
success: boolean;
|
||||
data?: { requestId: string };
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface ResultPayload<T = unknown> {
|
||||
success: boolean;
|
||||
data?: T;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface ProgressPayload {
|
||||
stage: string;
|
||||
current: number;
|
||||
total: number;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
// Generic request function
|
||||
export async function sidecarRequest<T = unknown>(
|
||||
type: string,
|
||||
payload: unknown
|
||||
): Promise<T> {
|
||||
const result = await invoke<CommandResult>("sidecar_request", {
|
||||
msgType: type,
|
||||
payload,
|
||||
});
|
||||
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || "Request failed");
|
||||
}
|
||||
|
||||
// Wait for the response via event
|
||||
const requestId = result.data?.requestId;
|
||||
if (!requestId) {
|
||||
throw new Error("No request ID returned");
|
||||
}
|
||||
|
||||
return waitForResponse<T>(requestId);
|
||||
}
|
||||
|
||||
// Wait for a specific response by request ID
|
||||
function waitForResponse<T>(requestId: string, timeout = 60000): Promise<T> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const timer = setTimeout(() => {
|
||||
unlisten();
|
||||
reject(new Error("Request timed out"));
|
||||
}, timeout);
|
||||
|
||||
let unlisten: UnlistenFn;
|
||||
|
||||
listen<SidecarResponse>("sidecar-response", (event) => {
|
||||
const response = event.payload;
|
||||
if (response.id !== requestId) return;
|
||||
|
||||
if (response.type === "result") {
|
||||
clearTimeout(timer);
|
||||
unlisten();
|
||||
const payload = response.payload as ResultPayload<T>;
|
||||
if (payload.success) {
|
||||
resolve(payload.data as T);
|
||||
} else {
|
||||
reject(new Error(payload.error || "Request failed"));
|
||||
}
|
||||
} else if (response.type === "error") {
|
||||
clearTimeout(timer);
|
||||
unlisten();
|
||||
reject(new Error(String(response.payload)));
|
||||
}
|
||||
}).then((fn) => {
|
||||
unlisten = fn;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Listen for progress events
|
||||
export function onProgress(
|
||||
requestId: string,
|
||||
callback: (progress: ProgressPayload) => void
|
||||
): Promise<UnlistenFn> {
|
||||
return listen<SidecarResponse>("sidecar-response", (event) => {
|
||||
const response = event.payload;
|
||||
if (response.id === requestId && response.type === "progress") {
|
||||
callback(response.payload as ProgressPayload);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Listen for events (game lifecycle, etc.)
|
||||
export function onEvent(
|
||||
requestId: string,
|
||||
callback: (event: Record<string, unknown>) => void
|
||||
): Promise<UnlistenFn> {
|
||||
return listen<SidecarResponse>("sidecar-response", (event) => {
|
||||
const response = event.payload;
|
||||
if (response.id === requestId && response.type === "event") {
|
||||
callback(response.payload as Record<string, unknown>);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,82 @@
|
||||
import { useEffect } from "react";
|
||||
import { useBackgroundStore } from "@/stores/backgroundStore";
|
||||
|
||||
const DEFAULT_BG = "/background.png";
|
||||
|
||||
export function BackgroundLayer() {
|
||||
const { type, image, color, blur, opacity, animationSpeed, fetchConfig } = useBackgroundStore();
|
||||
|
||||
useEffect(() => {
|
||||
fetchConfig();
|
||||
}, [fetchConfig]);
|
||||
|
||||
const getBackgroundStyle = (): React.CSSProperties => {
|
||||
const base: React.CSSProperties = {
|
||||
position: "fixed",
|
||||
inset: 0,
|
||||
zIndex: 0,
|
||||
pointerEvents: "none",
|
||||
opacity,
|
||||
};
|
||||
|
||||
if (blur > 0) {
|
||||
base.filter = `blur(${blur}px)`;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case "image":
|
||||
return {
|
||||
...base,
|
||||
backgroundImage: `url(${image || DEFAULT_BG})`,
|
||||
backgroundSize: "cover",
|
||||
backgroundPosition: "center",
|
||||
};
|
||||
case "color":
|
||||
return {
|
||||
...base,
|
||||
backgroundColor: color || "#1a1a2e",
|
||||
backgroundImage: `url(${DEFAULT_BG})`,
|
||||
backgroundSize: "cover",
|
||||
backgroundPosition: "center",
|
||||
};
|
||||
case "gradient":
|
||||
return {
|
||||
...base,
|
||||
background: `linear-gradient(135deg, ${color || "#1a1a2e"}, #16213e, #0f3460)`,
|
||||
animation: `gradient-shift ${10 / animationSpeed}s ease infinite`,
|
||||
};
|
||||
case "particles":
|
||||
return {
|
||||
...base,
|
||||
background: `radial-gradient(circle at 20% 50%, rgba(${color || "26,26,46"}, 0.8) 0%, transparent 50%),
|
||||
radial-gradient(circle at 80% 20%, rgba(22, 33, 62, 0.6) 0%, transparent 40%),
|
||||
radial-gradient(circle at 50% 80%, rgba(15, 52, 96, 0.4) 0%, transparent 60%)`,
|
||||
animation: `particles-float ${20 / animationSpeed}s ease-in-out infinite`,
|
||||
};
|
||||
default:
|
||||
return {
|
||||
...base,
|
||||
backgroundImage: `url(${DEFAULT_BG})`,
|
||||
backgroundSize: "cover",
|
||||
backgroundPosition: "center",
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<style>{`
|
||||
@keyframes gradient-shift {
|
||||
0%, 100% { background-position: 0% 50%; }
|
||||
50% { background-position: 100% 50%; }
|
||||
}
|
||||
@keyframes particles-float {
|
||||
0%, 100% { transform: translateY(0) rotate(0deg); }
|
||||
33% { transform: translateY(-10px) rotate(1deg); }
|
||||
66% { transform: translateY(10px) rotate(-1deg); }
|
||||
}
|
||||
`}</style>
|
||||
<div style={getBackgroundStyle()} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
const VERSION = "0.1.0";
|
||||
|
||||
export default function Splash() {
|
||||
const [phase, setPhase] = useState<"enter" | "visible" | "exit">("enter");
|
||||
|
||||
useEffect(() => {
|
||||
const t1 = setTimeout(() => setPhase("visible"), 50);
|
||||
const t2 = setTimeout(() => setPhase("exit"), 7500);
|
||||
return () => { clearTimeout(t1); clearTimeout(t2); };
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="splash-root w-full h-full flex flex-col overflow-hidden">
|
||||
{/* Main content area */}
|
||||
<div
|
||||
className="flex-1 flex items-center pl-12 transition-all duration-700 ease-out"
|
||||
style={{
|
||||
opacity: phase === "enter" ? 0 : phase === "exit" ? 0 : 1,
|
||||
transform: phase === "enter" ? "translateY(10px)" : phase === "exit" ? "translateY(-10px)" : "translateY(0)",
|
||||
}}
|
||||
>
|
||||
<img
|
||||
src="/koring-licon.svg"
|
||||
alt="Koring Launcher"
|
||||
className="splash-logo w-[260px] h-auto"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Bottom bar */}
|
||||
<div className="flex items-center justify-between px-6 pb-4 text-xs splash-muted">
|
||||
<span>Provided by Lingke Koring Studio</span>
|
||||
<span>v{VERSION}</span>
|
||||
</div>
|
||||
|
||||
<style>{`
|
||||
.splash-root {
|
||||
background: var(--splash-bg);
|
||||
}
|
||||
.splash-logo {
|
||||
fill: var(--splash-fg);
|
||||
}
|
||||
.splash-muted {
|
||||
color: var(--splash-muted);
|
||||
}
|
||||
|
||||
/* Light mode (default) */
|
||||
:root {
|
||||
--splash-bg: #ffffff;
|
||||
--splash-fg: #1a1a2e;
|
||||
--splash-muted: #888888;
|
||||
}
|
||||
|
||||
/* Dark mode via class */
|
||||
.dark {
|
||||
--splash-bg: #1a1a2e;
|
||||
--splash-fg: #ffffff;
|
||||
--splash-muted: #888888;
|
||||
}
|
||||
|
||||
/* System dark mode */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root:not(.light) {
|
||||
--splash-bg: #1a1a2e;
|
||||
--splash-fg: #ffffff;
|
||||
--splash-muted: #888888;
|
||||
}
|
||||
}
|
||||
`}</style>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { TitleBar } from "./TitleBar";
|
||||
|
||||
interface SystemLayerProps {
|
||||
showMinimize?: boolean;
|
||||
showMaximize?: boolean;
|
||||
showClose?: boolean;
|
||||
}
|
||||
|
||||
export function SystemLayer({
|
||||
showMinimize = true,
|
||||
showMaximize = true,
|
||||
showClose = true,
|
||||
}: SystemLayerProps) {
|
||||
return (
|
||||
<div
|
||||
className="fixed inset-0 z-[100] pointer-events-none"
|
||||
>
|
||||
<TitleBar
|
||||
showMinimize={showMinimize}
|
||||
showMaximize={showMaximize}
|
||||
showClose={showClose}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import { WindowControls } from "./WindowControls";
|
||||
|
||||
interface TitleBarProps {
|
||||
showMinimize?: boolean;
|
||||
showMaximize?: boolean;
|
||||
showClose?: boolean;
|
||||
}
|
||||
|
||||
export function TitleBar({
|
||||
showMinimize = true,
|
||||
showMaximize = true,
|
||||
showClose = true,
|
||||
}: TitleBarProps) {
|
||||
const appWindow = getCurrentWindow();
|
||||
|
||||
const handleMouseDown = (e: React.MouseEvent) => {
|
||||
const target = e.target as HTMLElement;
|
||||
if (target.closest("[data-no-drag]")) return;
|
||||
appWindow.startDragging();
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className="titlebar fixed top-0 left-0 right-0 h-[40px] flex items-center justify-between z-[100] pointer-events-auto"
|
||||
onMouseDown={handleMouseDown}
|
||||
style={{
|
||||
background: "rgba(255, 255, 255, 0.1)",
|
||||
backdropFilter: "blur(12px) saturate(180%)",
|
||||
WebkitBackdropFilter: "blur(12px) saturate(180%)",
|
||||
borderBottom: "1px solid rgba(255, 255, 255, 0.1)",
|
||||
userSelect: "none",
|
||||
}}
|
||||
>
|
||||
<div className="flex-1" />
|
||||
<WindowControls
|
||||
showMinimize={showMinimize}
|
||||
showMaximize={showMaximize}
|
||||
showClose={showClose}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
|
||||
interface WindowControlsProps {
|
||||
showMinimize?: boolean;
|
||||
showMaximize?: boolean;
|
||||
showClose?: boolean;
|
||||
}
|
||||
|
||||
export function WindowControls({
|
||||
showMinimize = true,
|
||||
showMaximize = true,
|
||||
showClose = true,
|
||||
}: WindowControlsProps) {
|
||||
const [isMaximized, setIsMaximized] = useState(false);
|
||||
const appWindow = getCurrentWindow();
|
||||
|
||||
useEffect(() => {
|
||||
appWindow.isMaximized().then(setIsMaximized);
|
||||
const unlisten = appWindow.onResized(() => {
|
||||
appWindow.isMaximized().then(setIsMaximized);
|
||||
});
|
||||
return () => { unlisten.then(fn => fn()); };
|
||||
}, [appWindow]);
|
||||
|
||||
const handleMinimize = () => appWindow.minimize();
|
||||
const handleMaximize = () => appWindow.toggleMaximize();
|
||||
const handleClose = () => appWindow.close();
|
||||
|
||||
const btnClass = "flex items-center justify-center w-[25px] h-[25px] rounded transition-colors cursor-default hover:bg-black/10 dark:hover:bg-white/15 text-black/70 dark:text-white/70 hover:text-black dark:hover:text-white";
|
||||
const closeBtnClass = "flex items-center justify-center w-[25px] h-[25px] rounded transition-colors cursor-default hover:bg-red-500 text-black/70 dark:text-white/70 hover:text-white";
|
||||
|
||||
return (
|
||||
<div className="flex items-center gap-0.5 pr-2" data-no-drag>
|
||||
{showMinimize && (
|
||||
<div onClick={handleMinimize} className={btnClass}>
|
||||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.5">
|
||||
<line x1="2" y1="6" x2="10" y2="6" />
|
||||
</svg>
|
||||
</div>
|
||||
)}
|
||||
{showMaximize && (
|
||||
<div onClick={handleMaximize} className={btnClass}>
|
||||
{isMaximized ? (
|
||||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.5">
|
||||
<rect x="2.5" y="0.5" width="7" height="7" rx="1" />
|
||||
<rect x="0.5" y="2.5" width="7" height="7" rx="1" fill="var(--background, #fff)" />
|
||||
<rect x="0.5" y="2.5" width="7" height="7" rx="1" />
|
||||
</svg>
|
||||
) : (
|
||||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.5">
|
||||
<rect x="1" y="1" width="10" height="10" rx="1" />
|
||||
</svg>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{showClose && (
|
||||
<div onClick={handleClose} className={closeBtnClass}>
|
||||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.5">
|
||||
<line x1="2" y1="2" x2="10" y2="10" />
|
||||
<line x1="10" y1="2" x2="2" y2="10" />
|
||||
</svg>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import { Button as ButtonPrimitive } from "@base-ui/react/button"
|
||||
import { cva, type VariantProps } from "class-variance-authority"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const buttonVariants = cva(
|
||||
"group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-primary text-primary-foreground hover:bg-primary/80",
|
||||
outline:
|
||||
"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
|
||||
secondary:
|
||||
"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
|
||||
ghost:
|
||||
"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
|
||||
destructive:
|
||||
"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
|
||||
link: "text-primary underline-offset-4 hover:underline",
|
||||
},
|
||||
size: {
|
||||
default:
|
||||
"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
||||
xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
|
||||
sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
|
||||
lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
|
||||
icon: "size-8",
|
||||
"icon-xs":
|
||||
"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
|
||||
"icon-sm":
|
||||
"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
|
||||
"icon-lg": "size-9",
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: "default",
|
||||
size: "default",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
function Button({
|
||||
className,
|
||||
variant = "default",
|
||||
size = "default",
|
||||
...props
|
||||
}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
|
||||
return (
|
||||
<ButtonPrimitive
|
||||
data-slot="button"
|
||||
className={cn(buttonVariants({ variant, size, className }))}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { Button, buttonVariants }
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
@import "tailwindcss";
|
||||
@import "tw-animate-css";
|
||||
@import "shadcn/tailwind.css";
|
||||
@import "@fontsource-variable/geist";
|
||||
@import "@fontsource-variable/inter";
|
||||
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@font-face {
|
||||
font-family: 'Alimama';
|
||||
src: url('/alimama.ttf') format('truetype');
|
||||
font-weight: 600;
|
||||
font-stretch: condensed;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--font-heading: var(--font-sans);
|
||||
--font-sans: 'Alimama', 'Inter Variable', sans-serif;
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-ring: var(--ring);
|
||||
--color-input: var(--input);
|
||||
--color-border: var(--border);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-card: var(--card);
|
||||
--color-foreground: var(--foreground);
|
||||
--color-background: var(--background);
|
||||
--radius-sm: calc(var(--radius) * 0.6);
|
||||
--radius-md: calc(var(--radius) * 0.8);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) * 1.4);
|
||||
--radius-2xl: calc(var(--radius) * 1.8);
|
||||
--radius-3xl: calc(var(--radius) * 2.2);
|
||||
--radius-4xl: calc(var(--radius) * 2.6);
|
||||
}
|
||||
|
||||
:root {
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.145 0 0);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.145 0 0);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.145 0 0);
|
||||
--primary: oklch(0.205 0 0);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.97 0 0);
|
||||
--secondary-foreground: oklch(0.205 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.97 0 0);
|
||||
--accent-foreground: oklch(0.205 0 0);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.87 0 0);
|
||||
--chart-2: oklch(0.556 0 0);
|
||||
--chart-3: oklch(0.439 0 0);
|
||||
--chart-4: oklch(0.371 0 0);
|
||||
--chart-5: oklch(0.269 0 0);
|
||||
--radius: 0.625rem;
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.205 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.205 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.922 0 0);
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.269 0 0);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.87 0 0);
|
||||
--chart-2: oklch(0.556 0 0);
|
||||
--chart-3: oklch(0.439 0 0);
|
||||
--chart-4: oklch(0.371 0 0);
|
||||
--chart-5: oklch(0.269 0 0);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.556 0 0);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border outline-ring/50;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
html {
|
||||
@apply font-sans;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { type ReactNode } from "react";
|
||||
import { BackgroundLayer } from "@/components/background/BackgroundLayer";
|
||||
import { SystemLayer } from "@/components/system/SystemLayer";
|
||||
|
||||
interface RootLayoutProps {
|
||||
children: ReactNode;
|
||||
showMinimize?: boolean;
|
||||
showMaximize?: boolean;
|
||||
showClose?: boolean;
|
||||
}
|
||||
|
||||
export function RootLayout({
|
||||
children,
|
||||
showMinimize = true,
|
||||
showMaximize = true,
|
||||
showClose = true,
|
||||
}: RootLayoutProps) {
|
||||
return (
|
||||
<div className="relative w-screen h-screen overflow-hidden">
|
||||
{/* Layer 0: Background */}
|
||||
<BackgroundLayer />
|
||||
|
||||
{/* Layer 1: Content */}
|
||||
<div className="absolute z-[1] left-0 right-0 bottom-0 top-[40px] overflow-auto">
|
||||
{children}
|
||||
</div>
|
||||
|
||||
{/* Layer 100: System (titlebar + window controls) */}
|
||||
<SystemLayer
|
||||
showMinimize={showMinimize}
|
||||
showMaximize={showMaximize}
|
||||
showClose={showClose}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { clsx, type ClassValue } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import App from "./App";
|
||||
import "./index.css";
|
||||
|
||||
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
);
|
||||
@@ -0,0 +1,49 @@
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
||||
|
||||
interface DebugProps {
|
||||
onNavigate: (page: "home") => void;
|
||||
}
|
||||
|
||||
export function Debug({ onNavigate }: DebugProps) {
|
||||
const openSplash = async () => {
|
||||
const existing = await WebviewWindow.getByLabel("splashscreen");
|
||||
if (existing) {
|
||||
existing.show();
|
||||
return;
|
||||
}
|
||||
|
||||
new WebviewWindow("splashscreen", {
|
||||
url: "/splash.html",
|
||||
width: 480,
|
||||
height: 320,
|
||||
decorations: false,
|
||||
transparent: true,
|
||||
center: true,
|
||||
});
|
||||
};
|
||||
|
||||
const closeSplash = async () => {
|
||||
const splash = await WebviewWindow.getByLabel("splashscreen");
|
||||
if (splash) {
|
||||
splash.close();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-center h-full">
|
||||
<div className="text-center space-y-4">
|
||||
<h1 className="text-2xl font-bold mb-6">Debug</h1>
|
||||
<div className="flex gap-3">
|
||||
<Button onClick={openSplash}>Open Splash</Button>
|
||||
<Button variant="destructive" onClick={closeSplash}>Close Splash</Button>
|
||||
</div>
|
||||
<div className="pt-4">
|
||||
<Button variant="ghost" onClick={() => onNavigate("home")}>
|
||||
Back to Home
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
interface HomeProps {
|
||||
onNavigate: (page: "debug") => void;
|
||||
}
|
||||
|
||||
export function Home({ onNavigate }: HomeProps) {
|
||||
return (
|
||||
<div className="flex items-center justify-center h-full">
|
||||
<div className="text-center">
|
||||
<h1 className="text-4xl font-bold mb-4">Koring Launcher</h1>
|
||||
<p className="text-muted-foreground mb-6">Core 调试模式</p>
|
||||
<Button variant="outline" onClick={() => onNavigate("debug")}>
|
||||
Debug
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "./index.css";
|
||||
import Splash from "./components/splash/Splash";
|
||||
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<StrictMode>
|
||||
<Splash />
|
||||
</StrictMode>
|
||||
);
|
||||
@@ -0,0 +1,65 @@
|
||||
import { create } from "zustand";
|
||||
import { offlineLogin, microsoftLoginStart, microsoftLoginCallback } from "../api/auth";
|
||||
import type { AuthResult } from "../api/auth";
|
||||
|
||||
interface AuthState {
|
||||
user: AuthResult | null;
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
msAuthUrl: string | null;
|
||||
msAuthState: string | null;
|
||||
|
||||
loginOffline: (username: string) => Promise<void>;
|
||||
startMicrosoftLogin: (clientId: string) => Promise<void>;
|
||||
completeMicrosoftLogin: (code: string, clientId: string) => Promise<void>;
|
||||
logout: () => void;
|
||||
clearError: () => void;
|
||||
}
|
||||
|
||||
export const useAuthStore = create<AuthState>((set) => ({
|
||||
user: null,
|
||||
loading: false,
|
||||
error: null,
|
||||
msAuthUrl: null,
|
||||
msAuthState: null,
|
||||
|
||||
loginOffline: async (username: string) => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const user = await offlineLogin(username);
|
||||
set({ user, loading: false });
|
||||
localStorage.setItem("koring-user", JSON.stringify(user));
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
startMicrosoftLogin: async (clientId: string) => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const { state, authUrl } = await microsoftLoginStart(clientId);
|
||||
set({ msAuthUrl: authUrl, msAuthState: state, loading: false });
|
||||
window.open(authUrl, "_blank");
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
completeMicrosoftLogin: async (code: string, clientId: string) => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const user = await microsoftLoginCallback(code, clientId);
|
||||
set({ user, loading: false, msAuthUrl: null, msAuthState: null });
|
||||
localStorage.setItem("koring-user", JSON.stringify(user));
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
logout: () => {
|
||||
set({ user: null, msAuthUrl: null, msAuthState: null });
|
||||
localStorage.removeItem("koring-user");
|
||||
},
|
||||
|
||||
clearError: () => set({ error: null }),
|
||||
}));
|
||||
@@ -0,0 +1,133 @@
|
||||
import { create } from "zustand";
|
||||
import {
|
||||
setImageBackground,
|
||||
setColorBackground,
|
||||
setBackgroundBlur,
|
||||
setBackgroundOpacity,
|
||||
setBackgroundAnimation,
|
||||
getBackgroundConfig,
|
||||
setTheme,
|
||||
resetBackground,
|
||||
} from "../api/background";
|
||||
import type { AnimationType, Theme, BackgroundConfig } from "../api/background";
|
||||
|
||||
interface BackgroundState {
|
||||
type: "image" | "color" | "gradient" | "particles";
|
||||
image?: string;
|
||||
color?: string;
|
||||
blur: number;
|
||||
opacity: number;
|
||||
animation: AnimationType;
|
||||
animationSpeed: number;
|
||||
theme: Theme;
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
|
||||
setImage: (url: string, blur?: number, opacity?: number) => Promise<void>;
|
||||
setColor: (color: string) => Promise<void>;
|
||||
setBlur: (blur: number) => Promise<void>;
|
||||
setOpacity: (opacity: number) => Promise<void>;
|
||||
setAnimation: (type: AnimationType, speed?: number) => Promise<void>;
|
||||
setTheme: (theme: Theme) => Promise<void>;
|
||||
fetchConfig: () => Promise<void>;
|
||||
reset: () => Promise<void>;
|
||||
clearError: () => void;
|
||||
}
|
||||
|
||||
const defaultConfig: BackgroundConfig = {
|
||||
type: "color",
|
||||
color: "#1a1a2e",
|
||||
blur: 0,
|
||||
opacity: 1,
|
||||
animation: "none",
|
||||
animationSpeed: 1,
|
||||
theme: "dark",
|
||||
};
|
||||
|
||||
export const useBackgroundStore = create<BackgroundState>((set) => ({
|
||||
...defaultConfig,
|
||||
loading: false,
|
||||
error: null,
|
||||
|
||||
setImage: async (url, blur, opacity) => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const config = await setImageBackground(url, blur, opacity);
|
||||
set({ ...config, loading: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
setColor: async (color) => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const config = await setColorBackground(color);
|
||||
set({ ...config, loading: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
setBlur: async (blur) => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const config = await setBackgroundBlur(blur);
|
||||
set({ ...config, loading: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
setOpacity: async (opacity) => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const config = await setBackgroundOpacity(opacity);
|
||||
set({ ...config, loading: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
setAnimation: async (type, speed) => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const config = await setBackgroundAnimation(type, speed);
|
||||
set({ ...config, loading: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
setTheme: async (theme) => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const config = await setTheme(theme);
|
||||
set({ ...config, loading: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
fetchConfig: async () => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const config = await getBackgroundConfig();
|
||||
set({ ...config, loading: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
reset: async () => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const config = await resetBackground();
|
||||
set({ ...config, loading: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
clearError: () => set({ error: null }),
|
||||
}));
|
||||
@@ -0,0 +1,5 @@
|
||||
export { useInstallStore } from "./installStore";
|
||||
export { useAuthStore } from "./authStore";
|
||||
export { useInstanceStore } from "./instanceStore";
|
||||
export { useLaunchStore } from "./launchStore";
|
||||
export { useModsStore } from "./modsStore";
|
||||
@@ -0,0 +1,69 @@
|
||||
import { create } from "zustand";
|
||||
import { getVersionList, installMinecraft, installModLoader } from "../api/install";
|
||||
import type { VersionManifest } from "../api/install";
|
||||
|
||||
interface ProgressInfo {
|
||||
stage: string;
|
||||
current: number;
|
||||
total: number;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
interface InstallState {
|
||||
versions: VersionManifest | null;
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
progress: ProgressInfo | null;
|
||||
installing: boolean;
|
||||
|
||||
fetchVersions: (type?: string) => Promise<void>;
|
||||
install: (version: string, gamePath: string, javaPath?: string) => Promise<void>;
|
||||
installLoader: (
|
||||
mcVersion: string,
|
||||
gamePath: string,
|
||||
loaderType: "forge" | "fabric" | "quilt" | "neoforge",
|
||||
loaderVersion?: string,
|
||||
javaPath?: string
|
||||
) => Promise<void>;
|
||||
clearError: () => void;
|
||||
}
|
||||
|
||||
export const useInstallStore = create<InstallState>((set) => ({
|
||||
versions: null,
|
||||
loading: false,
|
||||
error: null,
|
||||
progress: null,
|
||||
installing: false,
|
||||
|
||||
fetchVersions: async (type?: string) => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const versions = await getVersionList(type);
|
||||
set({ versions, loading: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
install: async (version, gamePath, javaPath?) => {
|
||||
set({ installing: true, error: null, progress: null });
|
||||
try {
|
||||
await installMinecraft(version, gamePath, javaPath);
|
||||
set({ installing: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, installing: false });
|
||||
}
|
||||
},
|
||||
|
||||
installLoader: async (mcVersion, gamePath, loaderType, loaderVersion?, javaPath?) => {
|
||||
set({ installing: true, error: null, progress: null });
|
||||
try {
|
||||
await installModLoader(mcVersion, gamePath, loaderType, loaderVersion, javaPath);
|
||||
set({ installing: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, installing: false });
|
||||
}
|
||||
},
|
||||
|
||||
clearError: () => set({ error: null }),
|
||||
}));
|
||||
@@ -0,0 +1,102 @@
|
||||
import { create } from "zustand";
|
||||
import {
|
||||
createInstance,
|
||||
listInstances,
|
||||
deleteInstance,
|
||||
getInstanceInfo,
|
||||
} from "../api/instance";
|
||||
import type { InstanceInfo } from "../api/instance";
|
||||
|
||||
interface InstanceState {
|
||||
instances: InstanceInfo[];
|
||||
currentInstance: InstanceInfo | null;
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
|
||||
fetchInstances: (instancesPath: string) => Promise<void>;
|
||||
create: (
|
||||
name: string,
|
||||
gamePath: string,
|
||||
mcVersion: string,
|
||||
loaderType?: string,
|
||||
loaderVersion?: string,
|
||||
javaPath?: string,
|
||||
memory?: { min?: string; max?: string }
|
||||
) => Promise<void>;
|
||||
remove: (name: string, instancesPath: string) => Promise<void>;
|
||||
select: (name: string, instancesPath: string) => Promise<void>;
|
||||
clearError: () => void;
|
||||
}
|
||||
|
||||
export const useInstanceStore = create<InstanceState>((set) => ({
|
||||
instances: [],
|
||||
currentInstance: null,
|
||||
loading: false,
|
||||
error: null,
|
||||
|
||||
fetchInstances: async (instancesPath: string) => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const instances = await listInstances(instancesPath);
|
||||
set({ instances, loading: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
create: async (
|
||||
name,
|
||||
gamePath,
|
||||
mcVersion,
|
||||
loaderType?,
|
||||
loaderVersion?,
|
||||
javaPath?,
|
||||
memory?
|
||||
) => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const instance = await createInstance(
|
||||
name,
|
||||
gamePath,
|
||||
mcVersion,
|
||||
loaderType,
|
||||
loaderVersion,
|
||||
javaPath,
|
||||
memory
|
||||
);
|
||||
set((state) => ({
|
||||
instances: [...state.instances, instance],
|
||||
loading: false,
|
||||
}));
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
remove: async (name: string, instancesPath: string) => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
await deleteInstance(name, instancesPath);
|
||||
set((state) => ({
|
||||
instances: state.instances.filter((i) => i.name !== name),
|
||||
currentInstance:
|
||||
state.currentInstance?.name === name ? null : state.currentInstance,
|
||||
loading: false,
|
||||
}));
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
select: async (name: string, instancesPath: string) => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const instance = await getInstanceInfo(name, instancesPath);
|
||||
set({ currentInstance: instance, loading: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
clearError: () => set({ error: null }),
|
||||
}));
|
||||
@@ -0,0 +1,65 @@
|
||||
import { create } from "zustand";
|
||||
import { launchGame, onGameEvent, diagnoseVersion } from "../api/launch";
|
||||
import type { LaunchOptions, LaunchResult } from "../api/launch";
|
||||
|
||||
interface GameEvent {
|
||||
event: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
interface LaunchState {
|
||||
launching: boolean;
|
||||
launched: boolean;
|
||||
gameResult: LaunchResult | null;
|
||||
events: GameEvent[];
|
||||
error: string | null;
|
||||
|
||||
launch: (options: LaunchOptions) => Promise<void>;
|
||||
diagnose: (gamePath: string, version: string) => Promise<void>;
|
||||
reset: () => void;
|
||||
clearError: () => void;
|
||||
}
|
||||
|
||||
export const useLaunchStore = create<LaunchState>((set) => ({
|
||||
launching: false,
|
||||
launched: false,
|
||||
gameResult: null,
|
||||
events: [],
|
||||
error: null,
|
||||
|
||||
launch: async (options: LaunchOptions) => {
|
||||
set({ launching: true, error: null, events: [] });
|
||||
try {
|
||||
const result = await launchGame(options);
|
||||
set({ gameResult: result, launching: false, launched: true });
|
||||
|
||||
// Listen for game events
|
||||
const unlisten = await onGameEvent(result.requestId, (event) => {
|
||||
set((state) => ({
|
||||
events: [...state.events, event],
|
||||
}));
|
||||
|
||||
if (event.event === "exit") {
|
||||
set({ launched: false });
|
||||
unlisten();
|
||||
}
|
||||
});
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, launching: false });
|
||||
}
|
||||
},
|
||||
|
||||
diagnose: async (gamePath: string, version: string) => {
|
||||
try {
|
||||
await diagnoseVersion(gamePath, version);
|
||||
} catch (e: any) {
|
||||
set({ error: e.message });
|
||||
}
|
||||
},
|
||||
|
||||
reset: () => {
|
||||
set({ launching: false, launched: false, gameResult: null, events: [] });
|
||||
},
|
||||
|
||||
clearError: () => set({ error: null }),
|
||||
}));
|
||||
@@ -0,0 +1,90 @@
|
||||
import { create } from "zustand";
|
||||
import { searchMods, getModDetail, getModVersions, installMod } from "../api/mods";
|
||||
import type { ModSearchResult, ModVersionResult } from "../api/mods";
|
||||
|
||||
interface ModsState {
|
||||
searchResults: ModSearchResult[];
|
||||
currentMod: ModSearchResult | null;
|
||||
modVersions: ModVersionResult[];
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
|
||||
search: (
|
||||
query?: string,
|
||||
gameVersion?: string,
|
||||
loader?: string,
|
||||
source?: "modrinth" | "curseforge"
|
||||
) => Promise<void>;
|
||||
getDetail: (projectId: string, source: "modrinth" | "curseforge") => Promise<void>;
|
||||
getVersions: (
|
||||
projectId: string,
|
||||
gameVersion?: string,
|
||||
loader?: string,
|
||||
source?: "modrinth" | "curseforge"
|
||||
) => Promise<void>;
|
||||
install: (
|
||||
projectId: string,
|
||||
versionId: string | undefined,
|
||||
gamePath: string,
|
||||
source?: "modrinth" | "curseforge"
|
||||
) => Promise<void>;
|
||||
clearError: () => void;
|
||||
clear: () => void;
|
||||
}
|
||||
|
||||
export const useModsStore = create<ModsState>((set) => ({
|
||||
searchResults: [],
|
||||
currentMod: null,
|
||||
modVersions: [],
|
||||
loading: false,
|
||||
error: null,
|
||||
|
||||
search: async (query?, gameVersion?, loader?, source = "modrinth") => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const results = await searchMods(query, gameVersion, loader, 20, 0, source);
|
||||
set({ searchResults: results, loading: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
getDetail: async (projectId, source) => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const detail = await getModDetail(projectId, source);
|
||||
set({ currentMod: detail, loading: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
getVersions: async (projectId, gameVersion?, loader?, source = "modrinth") => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
const versions = await getModVersions(projectId, gameVersion, loader, source);
|
||||
set({ modVersions: versions, loading: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
install: async (projectId, versionId, gamePath, source = "modrinth") => {
|
||||
set({ loading: true, error: null });
|
||||
try {
|
||||
await installMod(projectId, versionId, gamePath, source);
|
||||
set({ loading: false });
|
||||
} catch (e: any) {
|
||||
set({ error: e.message, loading: false });
|
||||
}
|
||||
},
|
||||
|
||||
clearError: () => set({ error: null }),
|
||||
|
||||
clear: () =>
|
||||
set({
|
||||
searchResults: [],
|
||||
currentMod: null,
|
||||
modVersions: [],
|
||||
}),
|
||||
}));
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
/// <reference types="vite/client" />
|
||||
Reference in New Issue
Block a user