🐛 fix: formatting
Signed-off-by: Pauline <git@ethanlibs.co>
This commit is contained in:
parent
8ab0ea17cb
commit
ec7d19652a
15 changed files with 465 additions and 377 deletions
11
.taplo.toml
11
.taplo.toml
|
|
@ -1,11 +0,0 @@
|
|||
[formatting]
|
||||
align_comments = true
|
||||
align_entries = true
|
||||
array_auto_collapse = true
|
||||
array_trailing_comma = true
|
||||
column_width = 100
|
||||
crlf = false
|
||||
indent_string = ' '
|
||||
reorder_arrays = true
|
||||
reorder_keys = true
|
||||
trailing_newline = true
|
||||
116
Cargo.toml
116
Cargo.toml
|
|
@ -1,10 +1,10 @@
|
|||
[workspace]
|
||||
resolver = "2" # virtual workspace resolver so we don't need a root package
|
||||
members = [
|
||||
"apps/testing", # onelauncher_test -- test the core crate in a cli setting
|
||||
"apps/desktop", # onelauncher_gui -- the rust code for our tauri app
|
||||
"packages/core", # onelauncher -- the rust core for onelauncher
|
||||
"packages/macros" # onelauncher_macros -- utility procedural macros for onelauncher
|
||||
"apps/testing", # onelauncher_test -- test the core crate in a cli setting
|
||||
"apps/desktop", # onelauncher_gui -- the rust code for our tauri app
|
||||
"packages/core", # onelauncher -- the rust core for onelauncher
|
||||
"packages/macros" # onelauncher_macros -- utility procedural macros for onelauncher
|
||||
]
|
||||
|
||||
[workspace.package] # sets default [package] settings for workspace members
|
||||
|
|
@ -14,10 +14,7 @@ repository = "https://github.com/Polyfrost/OneLauncher"
|
|||
documentation = "https://docs.polyfrost.org/onelauncher"
|
||||
readme = "README.md"
|
||||
homepage = "https://polyfrost.org/projects/onelauncher"
|
||||
authors = [
|
||||
"Polyfrost",
|
||||
"Polyfrost Contributors"
|
||||
]
|
||||
authors = [ "Polyfrost", "Polyfrost Contributors" ]
|
||||
version = "1.0.0-alpha.1" # bump this manually for now
|
||||
|
||||
[workspace.dependencies]
|
||||
|
|
@ -33,11 +30,11 @@ onelauncher_test = { path = "./apps/testing" }
|
|||
# tauri uses latest crates.io rc channel
|
||||
# (temporarily can use v2 and main branches if necessary)
|
||||
tauri = { version = "=2.0.0-rc.0", features = [
|
||||
"rustls-tls",
|
||||
"tracing",
|
||||
"specta",
|
||||
"uuid",
|
||||
"protocol-asset"
|
||||
"rustls-tls",
|
||||
"tracing",
|
||||
"specta",
|
||||
"uuid",
|
||||
"protocol-asset"
|
||||
] }
|
||||
|
||||
# tauri-build is the codegen utility for our tauri buildscript.
|
||||
|
|
@ -63,10 +60,7 @@ tauri-plugin-dialog = { version = "=2.0.0-rc.0" }
|
|||
# this means we don't have to redefine all our core apis as tauri commands.
|
||||
# features: "specta2" is for using the latest v2 rc of specta.
|
||||
# TODO: the api migration is blocked until rspc updates to a newer version of tauri v2.
|
||||
rspc = { version = "=0.2.0", features = [
|
||||
"specta2",
|
||||
"tracing"
|
||||
] }
|
||||
rspc = { version = "=0.2.0", features = [ "specta2", "tracing" ] }
|
||||
|
||||
# specta is used as a peer dependency for tauri-specta and rspc.
|
||||
# it generates rust code into other languages, in our case, typescript.
|
||||
|
|
@ -77,21 +71,17 @@ rspc = { version = "=0.2.0", features = [
|
|||
# respective dependencies of the same name. if we add a new dependency
|
||||
# and run into specta errors, adding the dependency as a feature will usually solve this.
|
||||
specta = { version = "=2.0.0-rc.20", features = [
|
||||
"chrono",
|
||||
"uuid",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"function",
|
||||
"derive",
|
||||
"time"
|
||||
"chrono",
|
||||
"uuid",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"function",
|
||||
"derive",
|
||||
"time"
|
||||
] }
|
||||
|
||||
# tauri-specta is the tauri adapter for specta.
|
||||
tauri-specta = { version = "=2.0.0-rc.15", features = [
|
||||
"javascript",
|
||||
"typescript",
|
||||
"derive"
|
||||
] }
|
||||
tauri-specta = { version = "=2.0.0-rc.15", features = [ "javascript", "typescript", "derive" ] }
|
||||
|
||||
# specta-typescript is the typescript adapter for specta.
|
||||
specta-typescript = { version = "=0.0.7" }
|
||||
|
|
@ -107,19 +97,16 @@ interpulse = { version = "1", features = [ "specta" ] }
|
|||
thiserror = { version = "1.0" }
|
||||
anyhow = { version = "1.0" }
|
||||
tracing = { version = "0.1" }
|
||||
tracing-subscriber = { version = "0.3", features = [
|
||||
"chrono",
|
||||
"env-filter"
|
||||
] }
|
||||
tracing-subscriber = { version = "0.3", features = [ "chrono", "env-filter" ] }
|
||||
tracing-error = { version = "0.2" }
|
||||
tracing-appender = { version = "0.2" }
|
||||
sentry = { version = "0.34", default-features = false, features = [
|
||||
"rustls",
|
||||
"reqwest",
|
||||
"backtrace",
|
||||
"panic",
|
||||
"anyhow",
|
||||
"debug-images"
|
||||
"rustls",
|
||||
"reqwest",
|
||||
"backtrace",
|
||||
"panic",
|
||||
"anyhow",
|
||||
"debug-images"
|
||||
] }
|
||||
iota_stronghold = { version = "2.1" }
|
||||
zeroize = { version = "1.8", features = [ "zeroize_derive" ] }
|
||||
|
|
@ -136,26 +123,20 @@ rand = { version = "0.8.5" }
|
|||
byteorder = { version = "1.5.0" }
|
||||
base64 = { version = "0.22" }
|
||||
p256 = { version = "0.13.2", features = [ "ecdsa" ] }
|
||||
uuid = { version = "1.8", features = [
|
||||
"serde",
|
||||
"v4"
|
||||
] }
|
||||
uuid = { version = "1.8", features = [ "serde", "v4" ] }
|
||||
|
||||
# # ============= NETWORK ============= # #
|
||||
reqwest = { version = "0.12", default-features = false, features = [
|
||||
"json",
|
||||
"stream",
|
||||
"multipart",
|
||||
"blocking",
|
||||
"rustls-tls-native-roots",
|
||||
"deflate",
|
||||
"gzip",
|
||||
"brotli"
|
||||
] }
|
||||
async-tungstenite = { version = "0.26", features = [
|
||||
"tokio-runtime",
|
||||
"tokio-rustls-native-certs"
|
||||
"json",
|
||||
"stream",
|
||||
"multipart",
|
||||
"blocking",
|
||||
"rustls-tls-native-roots",
|
||||
"deflate",
|
||||
"gzip",
|
||||
"brotli"
|
||||
] }
|
||||
async-tungstenite = { version = "0.26", features = [ "tokio-runtime", "tokio-rustls-native-certs" ] }
|
||||
webbrowser = { version = "1.0" }
|
||||
|
||||
# # ============= SYSTEM ============= # #
|
||||
|
|
@ -168,10 +149,7 @@ dunce = { version = "1.0.4" }
|
|||
zip = { version = "2.1.6" }
|
||||
dirs = { version = "5.0" }
|
||||
async_zip = { version = "0.0.17", features = [ "full" ] }
|
||||
async-compression = { version = "0.4.12", features = [
|
||||
"flate2",
|
||||
"tokio"
|
||||
] }
|
||||
async-compression = { version = "0.4.12", features = [ "flate2", "tokio" ] }
|
||||
flate2 = { version = "1.0" }
|
||||
sha1_smol = { version = "1.0", features = [ "std" ] }
|
||||
sha2 = { version = "0.10" }
|
||||
|
|
@ -199,11 +177,11 @@ objc = { version = "0.2" }
|
|||
git = "https://github.com/brendonovich/prisma-client-rust"
|
||||
rev = "4f9ef9d38ca732162accff72b2eb684d2f120bab"
|
||||
features = [
|
||||
"migrations",
|
||||
"specta",
|
||||
"sqlite",
|
||||
"sqlite-create-many",
|
||||
"rspc"
|
||||
"migrations",
|
||||
"specta",
|
||||
"sqlite",
|
||||
"sqlite-create-many",
|
||||
"rspc"
|
||||
]
|
||||
default-features = false
|
||||
|
||||
|
|
@ -211,11 +189,11 @@ default-features = false
|
|||
git = "https://github.com/brendonovich/prisma-client-rust"
|
||||
rev = "4f9ef9d38ca732162accff72b2eb684d2f120bab"
|
||||
features = [
|
||||
"migrations",
|
||||
"specta",
|
||||
"sqlite",
|
||||
"sqlite-create-many",
|
||||
"rspc"
|
||||
"migrations",
|
||||
"specta",
|
||||
"sqlite",
|
||||
"sqlite-create-many",
|
||||
"rspc"
|
||||
]
|
||||
default-features = false
|
||||
|
||||
|
|
|
|||
|
|
@ -13,11 +13,7 @@ authors = { workspace = true }
|
|||
|
||||
[lib]
|
||||
name = "onelauncher_gui"
|
||||
crate-type = [
|
||||
"staticlib",
|
||||
"cdylib",
|
||||
"lib"
|
||||
]
|
||||
crate-type = [ "staticlib", "cdylib", "lib" ]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { workspace = true, features = [ "isolation" ] }
|
||||
|
|
@ -52,12 +48,12 @@ tracing-error = { workspace = true }
|
|||
[dependencies.tauri]
|
||||
workspace = true
|
||||
features = [
|
||||
"isolation",
|
||||
"macos-private-api",
|
||||
"image-ico",
|
||||
"image-png",
|
||||
"protocol-asset",
|
||||
"specta"
|
||||
"isolation",
|
||||
"macos-private-api",
|
||||
"image-ico",
|
||||
"image-png",
|
||||
"protocol-asset",
|
||||
"specta"
|
||||
]
|
||||
|
||||
[dev-dependencies.tauri]
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
"@solid-primitives/refs": "^1.0.8",
|
||||
"@solidjs/router": "^0.14.3",
|
||||
"@t3-oss/env-core": "^0.11.0",
|
||||
"zod": "^3.23.8",
|
||||
"@tanstack/solid-query": "^5.51.21",
|
||||
"@tauri-apps/api": "2.0.0-rc.0",
|
||||
"@tauri-apps/plugin-clipboard-manager": "github:tauri-apps/tauri-plugin-clipboard-manager#v2",
|
||||
|
|
@ -40,13 +39,14 @@
|
|||
"pathe": "^1.1.2",
|
||||
"solid-js": "^1.8.21",
|
||||
"solid-transition-group": "^0.2.3",
|
||||
"uuid": "^10.0.0"
|
||||
"uuid": "^10.0.0",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sentry/vite-plugin": "^2.22.2",
|
||||
"@solidjs/testing-library": "^0.8.9",
|
||||
"@tauri-apps/cli": "2.0.0-rc.3",
|
||||
"@testing-library/jest-dom": "^6.4.8",
|
||||
"@sentry/vite-plugin": "^2.22.2",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"jsdom": "^24.1.1",
|
||||
"sass": "^1.77.8",
|
||||
|
|
|
|||
|
|
@ -1,64 +1,84 @@
|
|||
|
||||
// This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually.
|
||||
|
||||
/** user-defined commands **/
|
||||
/** user-defined commands */
|
||||
|
||||
/** tauri-specta globals */
|
||||
|
||||
import {
|
||||
invoke as TAURI_INVOKE,
|
||||
} from '@tauri-apps/api/core';
|
||||
import * as TAURI_API_EVENT from '@tauri-apps/api/event';
|
||||
import type { WebviewWindow as __WebviewWindow__ } from '@tauri-apps/api/webviewWindow';
|
||||
|
||||
export const commands = {
|
||||
async authLogin(): Promise<Result<MinecraftCredentials | null, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("auth_login") };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('auth_login') };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getUsers(): Promise<Result<MinecraftCredentials[], string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_users") };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_users') };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getUser(uuid: string): Promise<Result<MinecraftCredentials, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_user", { uuid }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_user', { uuid }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getDefaultUser(fallback: boolean | null): Promise<Result<MinecraftCredentials | null, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_default_user", { fallback }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_default_user', { fallback }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async setDefaultUser(uuid: string | null): Promise<Result<null, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("set_default_user", { uuid }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('set_default_user', { uuid }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async removeUser(uuid: string): Promise<Result<null, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("remove_user", { uuid }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('remove_user', { uuid }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async createCluster(props: CreateCluster): Promise<Result<string, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("create_cluster", { props }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('create_cluster', { props }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
|
@ -66,236 +86,285 @@ export const commands = {
|
|||
*/
|
||||
async editGameSettings(uuid: string, newCluster: Cluster): Promise<Result<null, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("edit_game_settings", { uuid, newCluster }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('edit_game_settings', { uuid, newCluster }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async editClusterMeta(uuid: string, name: string | null, iconPath: string | null): Promise<Result<null, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("edit_cluster_meta", { uuid, name, iconPath }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('edit_cluster_meta', { uuid, name, iconPath }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async removeCluster(uuid: string): Promise<Result<null, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("remove_cluster", { uuid }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('remove_cluster', { uuid }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getCluster(uuid: string): Promise<Result<Cluster, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_cluster", { uuid }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_cluster', { uuid }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getClusters(): Promise<Result<Cluster[], string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_clusters") };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_clusters') };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getClustersGrouped(): Promise<Result<{ [key in string]: Cluster[] }, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_clusters_grouped") };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_clusters_grouped') };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async runCluster(uuid: string): Promise<Result<[string, number], string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("run_cluster", { uuid }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('run_cluster', { uuid }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getClusterLogs(uuid: string): Promise<Result<string[], string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_cluster_logs", { uuid }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_cluster_logs', { uuid }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getClusterLog(uuid: string, logName: string): Promise<Result<string, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_cluster_log", { uuid, logName }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_cluster_log', { uuid, logName }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async uploadLog(uuid: string, logName: string): Promise<Result<string, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("upload_log", { uuid, logName }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('upload_log', { uuid, logName }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getScreenshots(uuid: string): Promise<Result<string[], string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_screenshots", { uuid }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_screenshots', { uuid }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getWorlds(uuid: string): Promise<Result<string[], string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_worlds", { uuid }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_worlds', { uuid }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getRunningClusters(): Promise<Result<Cluster[], string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_running_clusters") };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_running_clusters') };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getProcessesByPath(path: ClusterPath): Promise<Result<string[], string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_processes_by_path", { path }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_processes_by_path', { path }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async killProcess(uuid: string): Promise<Result<null, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("kill_process", { uuid }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('kill_process', { uuid }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async isClusterRunning(uuid: string): Promise<Result<boolean, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("is_cluster_running", { uuid }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('is_cluster_running', { uuid }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getPidByUuid(uuid: string): Promise<Result<number, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_pid_by_uuid", { uuid }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_pid_by_uuid', { uuid }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getSettings(): Promise<Result<Settings, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_settings") };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_settings') };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async setSettings(settings: Settings): Promise<Result<null, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("set_settings", { settings }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('set_settings', { settings }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getMinecraftVersions(): Promise<Result<Version[], string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_minecraft_versions") };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_minecraft_versions') };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async randomMods(): Promise<Result<ManagedPackage[], string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("random_mods") };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('random_mods') };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async getMod(projectId: string): Promise<Result<ManagedPackage, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("get_mod", { projectId }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('get_mod', { projectId }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async downloadMod(clusterId: string, versionId: string): Promise<Result<null, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("download_mod", { clusterId, versionId }) };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('download_mod', { clusterId, versionId }) };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async checkForUpdate(): Promise<Result<Update | null, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("check_for_update") };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('check_for_update') };
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
async installUpdate(): Promise<Result<null, string>> {
|
||||
try {
|
||||
return { status: "ok", data: await TAURI_INVOKE("install_update") };
|
||||
} catch (e) {
|
||||
if (e instanceof Error) throw e;
|
||||
else return { status: "error", error: e as any };
|
||||
return { status: 'ok', data: await TAURI_INVOKE('install_update') };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** user-defined events **/
|
||||
catch (e) {
|
||||
if (e instanceof Error)
|
||||
throw e;
|
||||
else return { status: 'error', error: e as any };
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/** user-defined events */
|
||||
|
||||
export const events = __makeEvents__<{
|
||||
clusterPayload: ClusterPayload,
|
||||
ingressPayload: IngressPayload,
|
||||
internetPayload: InternetPayload,
|
||||
messagePayload: MessagePayload,
|
||||
offlinePayload: OfflinePayload,
|
||||
processPayload: ProcessPayload
|
||||
clusterPayload: ClusterPayload;
|
||||
ingressPayload: IngressPayload;
|
||||
internetPayload: InternetPayload;
|
||||
messagePayload: MessagePayload;
|
||||
offlinePayload: OfflinePayload;
|
||||
processPayload: ProcessPayload;
|
||||
}>({
|
||||
clusterPayload: "cluster-payload",
|
||||
ingressPayload: "ingress-payload",
|
||||
internetPayload: "internet-payload",
|
||||
messagePayload: "message-payload",
|
||||
offlinePayload: "offline-payload",
|
||||
processPayload: "process-payload"
|
||||
})
|
||||
clusterPayload: 'cluster-payload',
|
||||
ingressPayload: 'ingress-payload',
|
||||
internetPayload: 'internet-payload',
|
||||
messagePayload: 'message-payload',
|
||||
offlinePayload: 'offline-payload',
|
||||
processPayload: 'process-payload',
|
||||
});
|
||||
|
||||
/** user-defined constants **/
|
||||
/** user-defined constants */
|
||||
|
||||
export const PROGRAM_INFO = { "arch": "64", "dev_build": true, "launcher_version": "1.0.0-alpha.1", "platform": "osx", "tauri_version": "2.0.0-rc.0", "webview_version": "19618.3.11.11.5" } as const;
|
||||
export const PROGRAM_INFO = { arch: '64', dev_build: true, launcher_version: '1.0.0-alpha.1', platform: 'osx', tauri_version: '2.0.0-rc.0', webview_version: '19618.3.11.11.5' } as const;
|
||||
|
||||
/** user-defined types **/
|
||||
/** user-defined types */
|
||||
|
||||
/**
|
||||
* Represents a single Instance and installation of Minecraft
|
||||
* Contains settings and identifiers on a per-Cluster basis, falling back to default settings for Options<>
|
||||
*/
|
||||
export type Cluster = {
|
||||
export interface Cluster {
|
||||
/**
|
||||
* The Uuid of a specific cluster.
|
||||
*/
|
||||
|
|
@ -327,12 +396,15 @@ export type Cluster = {
|
|||
/**
|
||||
* The per-cluster Minecraft window fullscreen status.
|
||||
*/
|
||||
force_fullscreen: boolean | null; init_hooks?: InitHooks | null; packages: { [key in PackagePath]: Package }; update?: string | null
|
||||
}
|
||||
force_fullscreen: boolean | null;
|
||||
init_hooks?: InitHooks | null;
|
||||
packages: { [key in PackagePath]: Package };
|
||||
update?: string | null;
|
||||
};
|
||||
/**
|
||||
* Represents core Cluster metadata ([`Cluster#meta`]).
|
||||
*/
|
||||
export type ClusterMeta = {
|
||||
export interface ClusterMeta {
|
||||
/**
|
||||
* The user-facing name of the cluster stored as a string.
|
||||
*/
|
||||
|
|
@ -385,14 +457,14 @@ export type ClusterMeta = {
|
|||
/**
|
||||
* The user-facing cluster icon as a URL string.
|
||||
*/
|
||||
icon_url?: string | null
|
||||
}
|
||||
icon_url?: string | null;
|
||||
};
|
||||
/**
|
||||
* Relative Path wrapper to be used as an identifer for a cluster path.
|
||||
*/
|
||||
export type ClusterPath = string
|
||||
export type ClusterPayload = { uuid: string; cluster_path: ClusterPath; path: string; name: string; event: ClusterPayloadType }
|
||||
export type ClusterPayloadType = "created" | "inserted" | "synced" | "edited" | "deleted"
|
||||
export type ClusterPath = string;
|
||||
export interface ClusterPayload { uuid: string; cluster_path: ClusterPath; path: string; name: string; event: ClusterPayloadType };
|
||||
export type ClusterPayloadType = 'created' | 'inserted' | 'synced' | 'edited' | 'deleted';
|
||||
/**
|
||||
* Core Cluster stages used in package logic.
|
||||
*/
|
||||
|
|
@ -400,26 +472,26 @@ export type ClusterStage =
|
|||
/**
|
||||
* Installed with no downloads left.
|
||||
*/
|
||||
"installed" |
|
||||
'installed' |
|
||||
/**
|
||||
* Downloading any sort of core metadata or mod file.
|
||||
*/
|
||||
"downloading" |
|
||||
'downloading' |
|
||||
/**
|
||||
* Downloading a full pack file, which is granted lower priority due to the high network demand.
|
||||
*/
|
||||
"pack_downloading" |
|
||||
'pack_downloading' |
|
||||
/**
|
||||
* Not installed at all.
|
||||
*/
|
||||
"not_installed"
|
||||
export type CreateCluster = { name: string; mc_version: string; mod_loader: Loader; loader_version: string | null; icon: string | null; icon_url: string | null; package_data: PackageData | null; skip: boolean | null; skip_watch: boolean | null }
|
||||
export type IngressPayload = { event: IngressType; ingress_uuid: string; fraction: number | null; message: string }
|
||||
export type IngressType = { type: "initialize" } | { type: "download_java"; version: number } | { type: "download_loader"; cluster_path: string; cluster_name: string } | { type: "sync_cluster"; cluster_path: string; cluster_name: string } | { type: "copy_cluster"; import: string; cluster_name: string } | { type: "sync_config"; new_path: string } | { type: "archival"; cluster_path: string; cluster_name: string } | { type: "download_package"; cluster_path: string; package_name: string; icon: string | null; package_id: string | null; package_version: string | null } | { type: "download_pack"; cluster_path: string; package_name: string; icon: string | null; package_version: string }
|
||||
'not_installed';
|
||||
export interface CreateCluster { name: string; mc_version: string; mod_loader: Loader; loader_version: string | null; icon: string | null; icon_url: string | null; package_data: PackageData | null; skip: boolean | null; skip_watch: boolean | null };
|
||||
export interface IngressPayload { event: IngressType; ingress_uuid: string; fraction: number | null; message: string };
|
||||
export type IngressType = { type: 'initialize' } | { type: 'download_java'; version: number } | { type: 'download_loader'; cluster_path: string; cluster_name: string } | { type: 'sync_cluster'; cluster_path: string; cluster_name: string } | { type: 'copy_cluster'; import: string; cluster_name: string } | { type: 'sync_config'; new_path: string } | { type: 'archival'; cluster_path: string; cluster_name: string } | { type: 'download_package'; cluster_path: string; package_name: string; icon: string | null; package_id: string | null; package_version: string | null } | { type: 'download_pack'; cluster_path: string; package_name: string; icon: string | null; package_version: string };
|
||||
/**
|
||||
* Global initialization hooks for all Minecraft clusters.
|
||||
*/
|
||||
export type InitHooks = {
|
||||
export interface InitHooks {
|
||||
/**
|
||||
* Pre-launch hook.
|
||||
*/
|
||||
|
|
@ -431,13 +503,13 @@ export type InitHooks = {
|
|||
/**
|
||||
* Post-launch hook.
|
||||
*/
|
||||
post?: string | null
|
||||
}
|
||||
export type InternetPayload = { event: "InstallPackage"; id: string } | { event: "InstallPack"; id: string } | { event: "InstallPath"; path: string }
|
||||
post?: string | null;
|
||||
};
|
||||
export type InternetPayload = { event: 'InstallPackage'; id: string } | { event: 'InstallPack'; id: string } | { event: 'InstallPath'; path: string };
|
||||
/**
|
||||
* Custom Java arguments on a per-cluster basis.
|
||||
*/
|
||||
export type JavaOptions = {
|
||||
export interface JavaOptions {
|
||||
/**
|
||||
* A custom java version from the global java store, if specified.
|
||||
*/
|
||||
|
|
@ -449,8 +521,8 @@ export type JavaOptions = {
|
|||
/**
|
||||
* Custom environment variables when running the cluster.
|
||||
*/
|
||||
custom_env_arguments?: ([string, string])[] | null
|
||||
}
|
||||
custom_env_arguments?: ([string, string])[] | null;
|
||||
};
|
||||
/**
|
||||
* A struct representing a single version of the Java Runtime Environment.
|
||||
* Use [`locate_java`] to get an array of all located java instances on the machine.
|
||||
|
|
@ -459,11 +531,11 @@ export type JavaOptions = {
|
|||
*
|
||||
* java check functionality from https://github.com/modrinth/theseus/blob/master/theseus/src/util/jre.rs under MIT
|
||||
*/
|
||||
export type JavaVersion = { version: string; arch: string; path: string }
|
||||
export interface JavaVersion { version: string; arch: string; path: string };
|
||||
/**
|
||||
* A HashMap of all located and installed available Java versions
|
||||
*/
|
||||
export type JavaVersions = { [key in string]: JavaVersion }
|
||||
export type JavaVersions = { [key in string]: JavaVersion };
|
||||
/**
|
||||
* Available mod loaders to be used for a cluster.
|
||||
*/
|
||||
|
|
@ -471,31 +543,31 @@ export type Loader =
|
|||
/**
|
||||
* The default vanilla loader, no modding supported.
|
||||
*/
|
||||
"vanilla" |
|
||||
'vanilla' |
|
||||
/**
|
||||
* The MinecraftForge Minecraft mod loader.
|
||||
*/
|
||||
"forge" |
|
||||
'forge' |
|
||||
/**
|
||||
* The FabircMC Minecraft mod loader.
|
||||
*/
|
||||
"fabric" |
|
||||
'fabric' |
|
||||
/**
|
||||
* The NeoForge Minecraft mod loader.
|
||||
*/
|
||||
"neoforge" |
|
||||
'neoforge' |
|
||||
/**
|
||||
* The Quilt Minecraft mod loader.
|
||||
*/
|
||||
"quilt" |
|
||||
'quilt' |
|
||||
/**
|
||||
* The Legacy Fabric port mod loader.
|
||||
*/
|
||||
"legacyfabric"
|
||||
'legacyfabric';
|
||||
/**
|
||||
* A version of a Minecraft mod loader
|
||||
*/
|
||||
export type LoaderVersion = {
|
||||
export interface LoaderVersion {
|
||||
/**
|
||||
* The version ID of the loader
|
||||
*/
|
||||
|
|
@ -507,32 +579,32 @@ export type LoaderVersion = {
|
|||
/**
|
||||
* Whether the loader is stable or not
|
||||
*/
|
||||
stable: boolean
|
||||
}
|
||||
stable: boolean;
|
||||
};
|
||||
/**
|
||||
* Universal interface for managed package dependencies.
|
||||
*/
|
||||
export type ManagedDependency = { version_id: string | null; package_id: string | null; file_name: string | null; dependency_type: PackageDependency }
|
||||
export interface ManagedDependency { version_id: string | null; package_id: string | null; file_name: string | null; dependency_type: PackageDependency };
|
||||
/**
|
||||
* Universal metadata for any managed package from a Mod distribution platform.
|
||||
*/
|
||||
export type ManagedPackage = { id: string; uid: string | null; package_type: PackageType; title: string; description: string; main: string; versions: string[]; game_versions: string[]; loaders: string[]; icon_url: string | null; created: string; updated: string; client: PackageSide; server: PackageSide; downloads: number; followers: number; categories: string[]; optional_categories: string[] | null }
|
||||
export interface ManagedPackage { id: string; uid: string | null; package_type: PackageType; title: string; description: string; main: string; versions: string[]; game_versions: string[]; loaders: string[]; icon_url: string | null; created: string; updated: string; client: PackageSide; server: PackageSide; downloads: number; followers: number; categories: string[]; optional_categories: string[] | null };
|
||||
/**
|
||||
* Universal interface for managed package authors and users.
|
||||
*/
|
||||
export type ManagedUser = { id: string; role: string; username: string; name: string | null; avatar: string | null; description: string | null; created: string }
|
||||
export interface ManagedUser { id: string; role: string; username: string; name: string | null; avatar: string | null; description: string | null; created: string };
|
||||
/**
|
||||
* Universal managed package version of a package.
|
||||
*/
|
||||
export type ManagedVersion = { id: string; package_id: string; author: string; name: string; featured: boolean; version_id: string; changelog: string; changelog_url: string | null; published: string; downloads: number; version_type: string; files: ManagedVersionFile[]; deps: ManagedDependency[]; game_versions: string[]; loaders: string[] }
|
||||
export interface ManagedVersion { id: string; package_id: string; author: string; name: string; featured: boolean; version_id: string; changelog: string; changelog_url: string | null; published: string; downloads: number; version_type: string; files: ManagedVersionFile[]; deps: ManagedDependency[]; game_versions: string[]; loaders: string[] };
|
||||
/**
|
||||
* Universal interface for managed package files.
|
||||
*/
|
||||
export type ManagedVersionFile = { url: string; file_name: string; primary: boolean; size: number; file_type: PackageFile | null; hashes: { [key in string]: string } }
|
||||
export interface ManagedVersionFile { url: string; file_name: string; primary: boolean; size: number; file_type: PackageFile | null; hashes: { [key in string]: string } };
|
||||
/**
|
||||
* Global memory settings across all clusters.
|
||||
*/
|
||||
export type Memory = {
|
||||
export interface Memory {
|
||||
/**
|
||||
* Maximum amount of Java memory available globally.
|
||||
*/
|
||||
|
|
@ -540,13 +612,13 @@ export type Memory = {
|
|||
/**
|
||||
* Minimum amount of Java memory available globally.
|
||||
*/
|
||||
minimum: number
|
||||
}
|
||||
export type MessagePayload = { message: string }
|
||||
minimum: number;
|
||||
};
|
||||
export interface MessagePayload { message: string };
|
||||
/**
|
||||
* A structure of all needed Minecraft credentials for logging in and account management.
|
||||
*/
|
||||
export type MinecraftCredentials = {
|
||||
export interface MinecraftCredentials {
|
||||
/**
|
||||
* The uuid of the credentials.
|
||||
*/
|
||||
|
|
@ -566,17 +638,17 @@ export type MinecraftCredentials = {
|
|||
/**
|
||||
* The time that the access token expires as a [`DateTime<Utc>`].
|
||||
*/
|
||||
expires: string
|
||||
}
|
||||
export type OfflinePayload = { offline: boolean }
|
||||
expires: string;
|
||||
};
|
||||
export interface OfflinePayload { offline: boolean };
|
||||
/**
|
||||
* A struct that represents a Package.
|
||||
*/
|
||||
export type Package = { sha512: string; meta: PackageMetadata; file_name: string; disabled: boolean }
|
||||
export interface Package { sha512: string; meta: PackageMetadata; file_name: string; disabled: boolean };
|
||||
/**
|
||||
* Optional data used to link a specific cluster to a package project.
|
||||
*/
|
||||
export type PackageData = {
|
||||
export interface PackageData {
|
||||
/**
|
||||
* The package ID as a String.
|
||||
*/
|
||||
|
|
@ -588,28 +660,28 @@ export type PackageData = {
|
|||
/**
|
||||
* Whether or not the current package is locked (for legacy modpack support).
|
||||
*/
|
||||
locked?: boolean | null
|
||||
}
|
||||
locked?: boolean | null;
|
||||
};
|
||||
/**
|
||||
* The type of a [`ManagedDependency`].
|
||||
*/
|
||||
export type PackageDependency = "Required" | "Optional" | "Incompatible" | "Embedded"
|
||||
export type PackageDependency = 'Required' | 'Optional' | 'Incompatible' | 'Embedded';
|
||||
/**
|
||||
* The file type of a [`Package`].
|
||||
*/
|
||||
export type PackageFile = "required_pack" | "optional_pack" | "unknown"
|
||||
export type PackageFile = 'required_pack' | 'optional_pack' | 'unknown';
|
||||
/**
|
||||
* Metadata that represents a [`Package`].
|
||||
*/
|
||||
export type PackageMetadata = { type: "managed"; package: ManagedPackage; version: ManagedVersion; users: ManagedUser; update: ManagedVersion | null; incompatible: boolean } | { type: "mapped"; title: string | null; description: string | null; authors: string[]; version: string | null; icon: string | null; package_type: string | null } | { type: "unknown" }
|
||||
export type PackageMetadata = { type: 'managed'; package: ManagedPackage; version: ManagedVersion; users: ManagedUser; update: ManagedVersion | null; incompatible: boolean } | { type: 'mapped'; title: string | null; description: string | null; authors: string[]; version: string | null; icon: string | null; package_type: string | null } | { type: 'unknown' };
|
||||
/**
|
||||
* Relative [`PathBuf`] for a specific [`Package`] of a [`Cluster`].
|
||||
*/
|
||||
export type PackagePath = string
|
||||
export type PackagePath = string;
|
||||
/**
|
||||
* The Client/Server side type of a [`Package`].
|
||||
*/
|
||||
export type PackageSide = "required" | "optional" | "unsupported" | "unknown"
|
||||
export type PackageSide = 'required' | 'optional' | 'unsupported' | 'unknown';
|
||||
/**
|
||||
* Represents types of packages handled by the launcher.
|
||||
*/
|
||||
|
|
@ -617,29 +689,29 @@ export type PackageType =
|
|||
/**
|
||||
* represents a mod jarfile
|
||||
*/
|
||||
"mod" |
|
||||
'mod' |
|
||||
/**
|
||||
* represents a datapack file
|
||||
*/
|
||||
"datapack" |
|
||||
'datapack' |
|
||||
/**
|
||||
* represents a resourcepack file
|
||||
*/
|
||||
"resource" |
|
||||
'resource' |
|
||||
/**
|
||||
* represents a shaderpack file
|
||||
*/
|
||||
"shader"
|
||||
export type ProcessPayload = { uuid: string; pid: number; event: ProcessPayloadType; message: string }
|
||||
export type ProcessPayloadType = "started" | "modified" | "finished"
|
||||
'shader';
|
||||
export interface ProcessPayload { uuid: string; pid: number; event: ProcessPayloadType; message: string };
|
||||
export type ProcessPayloadType = 'started' | 'modified' | 'finished';
|
||||
/**
|
||||
* Global Minecraft resolution.
|
||||
*/
|
||||
export type Resolution = [number, number]
|
||||
export type Resolution = [number, number];
|
||||
/**
|
||||
* A global settings state for the launcher.
|
||||
*/
|
||||
export type Settings = {
|
||||
export interface Settings {
|
||||
/**
|
||||
* A OneLauncher [`Theme`] managed by the core GUI.
|
||||
*/
|
||||
|
|
@ -715,8 +787,8 @@ export type Settings = {
|
|||
/**
|
||||
* Enable/disable advanced rendering and window decorations.
|
||||
*/
|
||||
rendering?: boolean
|
||||
}
|
||||
rendering?: boolean;
|
||||
};
|
||||
/**
|
||||
* A OneLauncher theme managed by the GUI.
|
||||
*/
|
||||
|
|
@ -724,24 +796,24 @@ export type Theme =
|
|||
/**
|
||||
* A default Dark theme.
|
||||
*/
|
||||
"dark" |
|
||||
'dark' |
|
||||
/**
|
||||
* A default Light theme.
|
||||
*/
|
||||
"light" |
|
||||
'light' |
|
||||
/**
|
||||
* OLED Dark Theme.
|
||||
*/
|
||||
"contrast" |
|
||||
'contrast' |
|
||||
/**
|
||||
* Cute and colorful theme.
|
||||
*/
|
||||
"cat"
|
||||
export type Update = { version: string }
|
||||
'cat';
|
||||
export interface Update { version: string };
|
||||
/**
|
||||
* A game version of Minecraft
|
||||
*/
|
||||
export type Version = {
|
||||
export interface Version {
|
||||
/**
|
||||
* A unique identifier of the version
|
||||
*/
|
||||
|
|
@ -774,8 +846,8 @@ export type Version = {
|
|||
* The SHA1 hash of the original unmodified Minecraft version's JSON
|
||||
* This is only available when using the Pulseflow mirror
|
||||
*/
|
||||
originalSha1?: string | null
|
||||
}
|
||||
originalSha1?: string | null;
|
||||
};
|
||||
/**
|
||||
* The version type
|
||||
*/
|
||||
|
|
@ -783,30 +855,21 @@ export type VersionType =
|
|||
/**
|
||||
* A major version, which is stable for all players to use
|
||||
*/
|
||||
"release" |
|
||||
'release' |
|
||||
/**
|
||||
* An experimental version, which is unstable and used for feature previews and beta testing
|
||||
*/
|
||||
"snapshot" |
|
||||
'snapshot' |
|
||||
/**
|
||||
* The oldest versions before the game was released
|
||||
*/
|
||||
"old_alpha" |
|
||||
'old_alpha' |
|
||||
/**
|
||||
* Early versions of the game
|
||||
*/
|
||||
"old_beta"
|
||||
'old_beta';
|
||||
|
||||
/** tauri-specta globals **/
|
||||
|
||||
import {
|
||||
invoke as TAURI_INVOKE,
|
||||
Channel as TAURI_CHANNEL,
|
||||
} from "@tauri-apps/api/core";
|
||||
import * as TAURI_API_EVENT from "@tauri-apps/api/event";
|
||||
import { type WebviewWindow as __WebviewWindow__ } from "@tauri-apps/api/webviewWindow";
|
||||
|
||||
type __EventObj__<T> = {
|
||||
interface __EventObj__<T> {
|
||||
listen: (
|
||||
cb: TAURI_API_EVENT.EventCallback<T>,
|
||||
) => ReturnType<typeof TAURI_API_EVENT.listen<T>>;
|
||||
|
|
@ -814,13 +877,13 @@ type __EventObj__<T> = {
|
|||
cb: TAURI_API_EVENT.EventCallback<T>,
|
||||
) => ReturnType<typeof TAURI_API_EVENT.once<T>>;
|
||||
emit: T extends null
|
||||
? (payload?: T) => ReturnType<typeof TAURI_API_EVENT.emit>
|
||||
: (payload: T) => ReturnType<typeof TAURI_API_EVENT.emit>;
|
||||
};
|
||||
? (payload?: T) => ReturnType<typeof TAURI_API_EVENT.emit>
|
||||
: (payload: T) => ReturnType<typeof TAURI_API_EVENT.emit>;
|
||||
}
|
||||
|
||||
export type Result<T, E> =
|
||||
| { status: "ok"; data: T }
|
||||
| { status: "error"; error: E };
|
||||
| { status: 'ok'; data: T }
|
||||
| { status: 'error'; error: E };
|
||||
|
||||
function __makeEvents__<T extends Record<string, any>>(
|
||||
mappings: Record<keyof T, string>,
|
||||
|
|
@ -843,11 +906,11 @@ function __makeEvents__<T extends Record<string, any>>(
|
|||
}),
|
||||
get: (_, command: keyof __EventObj__<any>) => {
|
||||
switch (command) {
|
||||
case "listen":
|
||||
case 'listen':
|
||||
return (arg: any) => TAURI_API_EVENT.listen(name, arg);
|
||||
case "once":
|
||||
case 'once':
|
||||
return (arg: any) => TAURI_API_EVENT.once(name, arg);
|
||||
case "emit":
|
||||
case 'emit':
|
||||
return (arg: any) => TAURI_API_EVENT.emit(name, arg);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -7,6 +7,6 @@ export const queryClient = new QueryClient({
|
|||
},
|
||||
mutations: {
|
||||
networkMode: 'always',
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,17 +8,18 @@ declare global {
|
|||
}
|
||||
}
|
||||
|
||||
export type Update = { version: string };
|
||||
export interface Update { version: string }
|
||||
export type UpdateStore =
|
||||
| { status: 'idle' }
|
||||
| { status: 'loading' }
|
||||
| { status: 'error' }
|
||||
| { status: 'updateAvailable'; update: Update }
|
||||
| { status: 'noUpdateAvailable' }
|
||||
| { status: 'installing' };
|
||||
| { status: 'idle' }
|
||||
| { status: 'loading' }
|
||||
| { status: 'error' }
|
||||
| { status: 'updateAvailable'; update: Update }
|
||||
| { status: 'noUpdateAvailable' }
|
||||
| { status: 'installing' };
|
||||
|
||||
export function createUpdater() {
|
||||
if (!window.__LAUNCHER_UPDATER__) return;
|
||||
if (!window.__LAUNCHER_UPDATER__)
|
||||
return;
|
||||
|
||||
const updateStore: UpdateStore = { status: 'idle' };
|
||||
listen<UpdateStore>('updater', e => Object.assign(updateStore, e.payload));
|
||||
|
|
@ -53,7 +54,8 @@ export function createUpdater() {
|
|||
const lastVersion = localStorage.getItem(ONELAUNCHER_VERSION_LOCALSTORAGE);
|
||||
const updaterStore = { tagline: null };
|
||||
|
||||
if (!lastVersion) return;
|
||||
if (!lastVersion)
|
||||
return;
|
||||
|
||||
if (lastVersion !== version) {
|
||||
localStorage.setItem(ONELAUNCHER_VERSION_LOCALSTORAGE, version);
|
||||
|
|
@ -62,7 +64,8 @@ export function createUpdater() {
|
|||
const req = await fetch(`${import.meta.env.VITE_LANDING_ORIGIN}/api/releases/${version}`);
|
||||
const { frontmatter } = await req.json();
|
||||
updaterStore.tagline = frontmatter?.tagline;
|
||||
} catch (error) {
|
||||
}
|
||||
catch (error) {
|
||||
console.warn('[updater]: failed to fetch release info');
|
||||
console.error('[updater]: ', error);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import type { ChangelogConfig } from 'changelogen';
|
||||
|
||||
const config: Partial<ChangelogConfig> = {
|
||||
const config = {
|
||||
types: {
|
||||
chore: { title: '🔨 Chores' },
|
||||
feature: { title: '✨ Features' },
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ export default defineConfig({
|
|||
unocss: true,
|
||||
toml: true,
|
||||
gitignore: true,
|
||||
schema: false,
|
||||
ignores: [
|
||||
'**/types',
|
||||
'**/cache',
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@
|
|||
"build": "pnpm --filter=./* run build",
|
||||
"dev": "pnpm --filter=./* run dev",
|
||||
"start": "pnpm --filter=./* run start",
|
||||
"typecheck": "pnpm -r typecheck",
|
||||
"bootstrap": "cargo clean && ./packages/scripts/setup.sh && pnpm install && pnpm prep",
|
||||
"autoformat": "./packages/scripts/format.sh",
|
||||
"test": "pnpm test:vi && pnpm --filter=./* run test",
|
||||
"format": "pnpm format:es && pnpm format:rs",
|
||||
"lint": "pnpm lint:es && pnpm lint:rs",
|
||||
|
|
@ -35,6 +38,7 @@
|
|||
"core": "cd packages/core && cargo",
|
||||
"testing": "cd apps/testing && cargo",
|
||||
"tauri": "cd apps/desktop && cargo",
|
||||
|
||||
"test:vi": "pnpm vitest run",
|
||||
"test:update": "pnpm vitest -u",
|
||||
"test:ui": "pnpm vitest --ui",
|
||||
|
|
@ -56,7 +60,6 @@
|
|||
"@unocss/eslint-plugin": "^0.62.1",
|
||||
"@vitest/ui": "^2.0.5",
|
||||
"bumpp": "^9.5.1",
|
||||
"@taplo/cli": "^0.7.0",
|
||||
"eslint": "^9.9.0",
|
||||
"eslint-plugin-solid": "^0.14.1",
|
||||
"jiti": "^1.21.6",
|
||||
|
|
|
|||
|
|
@ -14,11 +14,7 @@ authors = { workspace = true }
|
|||
default = []
|
||||
# feature flag allowing us to interact with tauri (for loading animations, errors showing on gui, etc)
|
||||
# also allows us to compile onelauncher core without tauri
|
||||
tauri = [
|
||||
"dep:tauri",
|
||||
"dep:tauri-specta",
|
||||
"specta"
|
||||
]
|
||||
tauri = [ "dep:tauri", "dep:tauri-specta", "specta" ]
|
||||
specta = [ "dep:specta" ]
|
||||
cli = [ "dep:indicatif" ]
|
||||
|
||||
|
|
|
|||
70
packages/scripts/format.sh
Executable file
70
packages/scripts/format.sh
Executable file
|
|
@ -0,0 +1,70 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eEumo pipefail
|
||||
|
||||
has() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
handle_exit() {
|
||||
_exit=$?
|
||||
set +e
|
||||
trap '' SIGINT
|
||||
trap - EXIT
|
||||
|
||||
if [ "$_exit" -ne 0 ]; then
|
||||
git restore --staged .
|
||||
git restore .
|
||||
fi
|
||||
exit "$_exit"
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
set +e
|
||||
trap '' SIGINT
|
||||
trap - EXIT
|
||||
|
||||
jobs -p | xargs kill -SIGTERM
|
||||
git restore --staged .
|
||||
git restore .
|
||||
kill -- -$$ 2>/dev/null
|
||||
}
|
||||
|
||||
if ! has git pnpm; then
|
||||
echo "missing required dependencies: git, pnpm" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
__dirname="$(CDPATH='' cd "$(dirname "$0")" && pwd -P)"
|
||||
cd "$__dirname/../.."
|
||||
|
||||
if [ -n "$(git diff --name-only HEAD)" ] || [ -n "$(git ls-files --others --exclude-standard)" ]; then
|
||||
echo "uncommitted changes found; please commit or stash your changes first." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! {
|
||||
if [ -n "${CI:-}" ]; then
|
||||
ancestor="$(git merge-base HEAD "HEAD~$((${PR_FETCH_DEPTH:?Missing PR_FETCH_DEPTH} - 1))")"
|
||||
else
|
||||
ancestor="$(git merge-base HEAD origin/main)"
|
||||
fi
|
||||
}; then
|
||||
echo "failed to find the common ancestor of the current branch and main" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
trap 'handle_exit' EXIT
|
||||
trap 'cleanup' SIGINT
|
||||
|
||||
pnpm run format:es &
|
||||
wait
|
||||
|
||||
if [ "${1:-}" != "no-cargo" ]; then
|
||||
cargo clippy --fix --all --all-targets --all-features --allow-dirty --allow-staged
|
||||
cargo fmt --all
|
||||
fi
|
||||
|
||||
git diff --diff-filtered=d --cached --name-only "${ancestor:?Ancestor is not set}" | xargs git add
|
||||
|
||||
git restore .
|
||||
|
|
@ -11,7 +11,7 @@ export type CheckedEnvironment = ReturnType<typeof checkEnvironment>;
|
|||
|
||||
export function checkEnvironment(meta: ImportMeta) {
|
||||
if (/^(?:msys|mingw|cygwin)$/i.test(process.env.OSTYPE ?? '')) {
|
||||
console.error('bash for windows is not supported. please use powershell or cmd');
|
||||
console.error('bash for windows is not supported. please use Powershell or cmd');
|
||||
process.exit(255);
|
||||
}
|
||||
|
||||
|
|
|
|||
9
pnpm-lock.yaml
generated
9
pnpm-lock.yaml
generated
|
|
@ -11,9 +11,6 @@ importers:
|
|||
'@flowr/eslint-config':
|
||||
specifier: ^3.11.5
|
||||
version: 3.11.5(@typescript-eslint/utils@8.1.0(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(@unocss/eslint-plugin@0.62.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint-plugin-solid@0.14.1(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4))(eslint-plugin-vue@9.27.0(eslint@9.9.0(jiti@1.21.6)))(eslint-processor-vue-blocks@0.1.2(@vue/compiler-sfc@3.4.38)(eslint@9.9.0(jiti@1.21.6)))(eslint@9.9.0(jiti@1.21.6))(typescript@5.5.4)(vitest@2.0.5(@types/node@22.3.0)(@vitest/ui@2.0.5)(jsdom@24.1.1)(sass@1.77.8))(vue-eslint-parser@9.4.3(eslint@9.9.0(jiti@1.21.6)))
|
||||
'@taplo/cli':
|
||||
specifier: ^0.7.0
|
||||
version: 0.7.0
|
||||
'@types/node':
|
||||
specifier: ^22.3.0
|
||||
version: 22.3.0
|
||||
|
|
@ -1375,10 +1372,6 @@ packages:
|
|||
peerDependencies:
|
||||
solid-js: ^1.6.0
|
||||
|
||||
'@taplo/cli@0.7.0':
|
||||
resolution: {integrity: sha512-Ck3zFhQhIhi02Hl6T4ZmJsXdnJE+wXcJz5f8klxd4keRYgenMnip3JDPMGDRLbnC/2iGd8P0sBIQqI3KxfVjBg==}
|
||||
hasBin: true
|
||||
|
||||
'@tauri-apps/api@2.0.0-rc.0':
|
||||
resolution: {integrity: sha512-v454Qs3REHc3Za59U+/eSmBsdmF+3NE5+76+lFDaitVqN4ZglDHENDaMARYKGJVZuxiSkzyqG0SeG7lLQjVkPA==}
|
||||
engines: {node: '>= 18.18', npm: '>= 6.6.0', yarn: '>= 1.19.1'}
|
||||
|
|
@ -5360,8 +5353,6 @@ snapshots:
|
|||
'@tanstack/query-core': 5.51.21
|
||||
solid-js: 1.8.21
|
||||
|
||||
'@taplo/cli@0.7.0': {}
|
||||
|
||||
'@tauri-apps/api@2.0.0-rc.0': {}
|
||||
|
||||
'@tauri-apps/cli-darwin-arm64@2.0.0-rc.3':
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
channel = "1.80.1"
|
||||
profile = "minimal"
|
||||
components = [
|
||||
"cargo",
|
||||
"clippy",
|
||||
"llvm-tools-preview",
|
||||
"rustc",
|
||||
"rust-src",
|
||||
"rustfmt",
|
||||
"cargo",
|
||||
"clippy",
|
||||
"llvm-tools-preview",
|
||||
"rustc",
|
||||
"rust-src",
|
||||
"rustfmt",
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue