From 5f64f4fed1a1b2cf0bbc66415d91c7c9a81c4c05 Mon Sep 17 00:00:00 2001 From: Pauline Date: Thu, 12 Sep 2024 18:32:02 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20wip:=20is=20somebody=20gonna=20m?= =?UTF-8?q?atch=20my=20tweaks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pauline --- Cargo.lock | 62 +++++--- Cargo.toml | 6 +- .../ui/components/content/SearchResults.tsx | 8 +- apps/frontend/src/ui/pages/Home.tsx | 14 +- .../src/ui/pages/cluster/ClusterSettings.tsx | 6 +- .../pages/settings/game/SettingsAccounts.tsx | 2 +- .../pages/settings/game/SettingsMinecraft.tsx | 18 +-- .../settings/launcher/SettingsAppearance.tsx | 6 +- packages/client/src/utils/highlight.ts | 13 -- packages/core/Cargo.toml | 5 +- packages/core/prisma/schema.prisma | 2 +- .../core/src/api/cluster/content/logger.rs | 72 +++++----- .../core/src/api/cluster/content/package.rs | 33 +++-- .../src/api/cluster/content/screenshots.rs | 2 +- .../core/src/api/cluster/content/worlds.rs | 2 +- packages/core/src/api/cluster/create.rs | 35 ++--- packages/core/src/api/cluster/mod.rs | 13 +- packages/core/src/api/handler.rs | 2 +- packages/core/src/api/java.rs | 32 ++--- packages/core/src/api/metadata.rs | 13 +- packages/core/src/api/mod.rs | 3 +- packages/core/src/api/package/content/mod.rs | 39 ++--- .../core/src/api/package/content/modrinth.rs | 57 ++++---- packages/core/src/api/package/from.rs | 32 ++--- .../core/src/api/package/import/atlauncher.rs | 16 +-- .../core/src/api/package/import/curseforge.rs | 16 +-- packages/core/src/api/package/import/ftb.rs | 2 +- .../core/src/api/package/import/gdlauncher.rs | 17 ++- packages/core/src/api/package/import/mod.rs | 39 ++--- .../core/src/api/package/import/modrinth.rs | 6 +- .../core/src/api/package/import/multibased.rs | 27 ++-- .../core/src/api/package/import/technic.rs | 2 +- .../core/src/api/package/import/tlauncher.rs | 2 +- packages/core/src/api/package/mod.rs | 4 +- packages/core/src/api/package/mrpack.rs | 15 +- packages/core/src/api/proxy/send.rs | 2 +- packages/core/src/api/settings.rs | 23 +-- packages/core/src/constants.rs | 4 +- packages/core/src/error.rs | 12 +- packages/core/src/game/arguments.rs | 68 ++------- packages/core/src/game/metadata.rs | 17 +-- packages/core/src/game/mod.rs | 61 ++++---- packages/core/src/lib.rs | 38 ++++- packages/core/src/logger.rs | 9 +- packages/core/src/store/clusters.rs | 46 +++--- packages/core/src/store/credentials.rs | 16 +-- packages/core/src/store/dirs.rs | 2 + packages/core/src/store/discord.rs | 2 +- packages/core/src/store/java_versions.rs | 14 +- packages/core/src/store/metadata.rs | 23 ++- packages/core/src/store/minecraft.rs | 7 +- packages/core/src/store/mod.rs | 10 +- packages/core/src/store/oneconfig.rs | 6 +- packages/core/src/store/package.rs | 95 ++++++------ packages/core/src/store/processor.rs | 79 +++++----- packages/core/src/store/settings.rs | 18 +-- packages/core/src/utils/http.rs | 30 ++-- packages/core/src/utils/java.rs | 24 ++-- packages/core/src/utils/mod.rs | 26 +--- packages/core/src/utils/watcher.rs | 13 +- packages/gamemode/src/lib.rs | 33 +++++ packages/macros/src/lib.rs | 34 ++++- packages/prisma/src/lib.rs | 11 ++ packages/utils/Cargo.toml | 32 +++++ packages/{core/src/utils => utils/src}/io.rs | 21 ++- packages/utils/src/lib.rs | 82 +++++++++++ .../{core/src/utils => utils/src}/logging.rs | 27 ++-- .../{core/src/utils => utils/src}/platform.rs | 18 +-- packages/utils/src/prisma.rs | 136 ++++++++++++++++++ 69 files changed, 1000 insertions(+), 662 deletions(-) create mode 100644 packages/utils/Cargo.toml rename packages/{core/src/utils => utils/src}/io.rs (92%) create mode 100644 packages/utils/src/lib.rs rename packages/{core/src/utils => utils/src}/logging.rs (89%) rename packages/{core/src/utils => utils/src}/platform.rs (92%) create mode 100644 packages/utils/src/prisma.rs diff --git a/Cargo.lock b/Cargo.lock index 66ac7f0a..de85933f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,9 +10,9 @@ checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" dependencies = [ "gimli", ] @@ -458,17 +458,17 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", - "miniz_oxide 0.7.4", + "miniz_oxide 0.8.0", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -1870,9 +1870,9 @@ dependencies = [ [[package]] name = "error-code" -version = "3.2.0" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0474425d51df81997e2f90a21591180b38eccf27292d755f3e30750225c175b" +checksum = "a5d9305ccc6942a704f4335694ecd3de2ea531b114ac2d51f5f843750787a92f" [[package]] name = "event-listener" @@ -2404,9 +2404,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" [[package]] name = "gio" @@ -2904,9 +2904,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" dependencies = [ "bytes", "futures-channel", @@ -4350,7 +4350,6 @@ name = "onelauncher" version = "1.0.0-alpha.1" dependencies = [ "anyhow", - "async-compression", "async-recursion", "async-tungstenite", "async_zip", @@ -4360,19 +4359,18 @@ dependencies = [ "chrono", "dirs 5.0.1", "discord-rich-presence", - "dunce", "flate2", "futures", "indicatif", "interpulse", "iota_stronghold", "lazy_static", - "nom", "notify", "notify-debouncer-mini", "onelauncher_gamemode", "onelauncher_macros", "onelauncher_prisma", + "onelauncher_utils", "p256", "paste", "rand 0.8.5", @@ -4384,7 +4382,6 @@ dependencies = [ "sha1_smol", "sha2 0.10.8", "specta 2.0.0-rc.20", - "sys-info", "sysinfo", "tauri", "tauri-specta", @@ -4483,6 +4480,31 @@ dependencies = [ "webbrowser", ] +[[package]] +name = "onelauncher_utils" +version = "1.0.0-alpha.1" +dependencies = [ + "async-channel", + "async-compression", + "chrono", + "dunce", + "futures", + "interpulse", + "nom", + "onelauncher_prisma", + "pin-project-lite", + "prisma-client-rust", + "regex", + "serde", + "sys-info", + "tempfile", + "thiserror", + "tokio", + "tracing", + "uuid 1.10.0", + "zip", +] + [[package]] name = "opaque-debug" version = "0.3.1" @@ -6002,9 +6024,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.12" +version = "0.23.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" +checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" dependencies = [ "once_cell", "ring", @@ -6041,9 +6063,9 @@ checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-webpki" -version = "0.102.7" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84678086bd54edf2b415183ed7a94d0efb049f1b646a33e22a36f3794be6ae56" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", diff --git a/Cargo.toml b/Cargo.toml index 5a6a035a..b79e71d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,8 @@ members = [ "packages/macros", # onelauncher_macros -- utility procedural macros for onelauncher "packages/gamemode", # onelauncher_gamemode -- rust wrapper for feral gamemode "packages/prisma-cli", # onelauncher_prisma_cli -- rust wrapper for prisma cli - "packages/prisma" # onelauncher_prisma -- rust client for prisma + "packages/prisma", # onelauncher_prisma -- rust client for prisma + "packages/utils" # onelauncher_utils -- standard utilities for use within all crates ] [workspace.package] # sets default [package] settings for workspace members @@ -31,6 +32,7 @@ onelauncher_test = { path = "./apps/testing" } onelauncher_gamemode = { path = "./packages/gamemode" } onelauncher_prisma = { path = "./packages/prisma" } onelauncher_prisma_cli = { path = "./packages/prisma-cli" } +onelauncher_utils = { path = "./packages/utils" } # # ============= TAURI ============= # # # tauri uses latest crates.io rc channel @@ -158,6 +160,8 @@ sha2 = { version = "0.10" } bytes = { version = "1.7" } # # ============= UTILITY ============= # # +async-channel = { version = "2.3" } +pin-project-lite = { version = "0.2" } once_cell = { version = "1.19" } quote = { version = "1.0" } syn = { version = "2.0", features = [ "full" ] } diff --git a/apps/frontend/src/ui/components/content/SearchResults.tsx b/apps/frontend/src/ui/components/content/SearchResults.tsx index 3e4fd812..da7317c8 100644 --- a/apps/frontend/src/ui/components/content/SearchResults.tsx +++ b/apps/frontend/src/ui/components/content/SearchResults.tsx @@ -1,11 +1,11 @@ import { ChevronDownIcon, Download01Icon, HeartIcon } from '@untitled-theme/icons-solid'; -import { For, Match, Show, Switch, createSignal } from 'solid-js'; +import useBrowser from '~ui/hooks/useBrowser'; +import useSettings from '~ui/hooks/useSettings'; +import { abbreviateNumber } from '~utils'; +import { createSignal, For, Match, Show, Switch } from 'solid-js'; import type { Providers, SearchResult } from '@onelauncher/client/bindings'; import type { JSX } from 'solid-js'; import Button from '../base/Button'; -import { abbreviateNumber } from '~utils'; -import useSettings from '~ui/hooks/useSettings'; -import useBrowser from '~ui/hooks/useBrowser'; interface SearchResultsContainerProps { provider: Providers; diff --git a/apps/frontend/src/ui/pages/Home.tsx b/apps/frontend/src/ui/pages/Home.tsx index de228faf..96634ac2 100644 --- a/apps/frontend/src/ui/pages/Home.tsx +++ b/apps/frontend/src/ui/pages/Home.tsx @@ -6,19 +6,19 @@ import { RefreshCw01Icon, SearchMdIcon, } from '@untitled-theme/icons-solid'; -import { For, Show, onMount } from 'solid-js'; -import type { Cluster } from '@onelauncher/client/bindings'; -import BannerBackground from '../../assets/images/header.png'; -import Button from '../components/base/Button'; -import TextField from '../components/base/TextField'; -import ClusterRoot from './cluster/ClusterRoot'; import { bridge } from '~imports'; - import ClusterCover from '~ui/components/game/ClusterCover'; import { useClusterCreator } from '~ui/components/overlay/cluster/ClusterCreationModal'; import { useLaunchCluster, useRecentCluster } from '~ui/hooks/useCluster'; import useCommand from '~ui/hooks/useCommand'; import { formatAsDuration, upperFirst } from '~utils'; +import { For, onMount, Show } from 'solid-js'; + +import type { Cluster } from '@onelauncher/client/bindings'; +import BannerBackground from '../../assets/images/header.png'; +import Button from '../components/base/Button'; +import TextField from '../components/base/TextField'; +import ClusterRoot from './cluster/ClusterRoot'; type GroupedClusters = Record; diff --git a/apps/frontend/src/ui/pages/cluster/ClusterSettings.tsx b/apps/frontend/src/ui/pages/cluster/ClusterSettings.tsx index 8b9b2b50..4a6efed8 100644 --- a/apps/frontend/src/ui/pages/cluster/ClusterSettings.tsx +++ b/apps/frontend/src/ui/pages/cluster/ClusterSettings.tsx @@ -1,13 +1,13 @@ import { useBeforeLeave } from '@solidjs/router'; -import { type Accessor, Show } from 'solid-js'; -import type { Cluster } from '@onelauncher/client/bindings'; -import { GameSettings, JvmSettings, LauncherSettings, ProcessSettings, createSetting } from '../settings/game/SettingsMinecraft'; import { bridge } from '~imports'; import ScrollableContainer from '~ui/components/ScrollableContainer'; import Sidebar from '~ui/components/Sidebar'; import useClusterContext from '~ui/hooks/useCluster'; import { tryResult } from '~ui/hooks/useCommand'; import useSettings from '~ui/hooks/useSettings'; +import { type Accessor, Show } from 'solid-js'; +import type { Cluster } from '@onelauncher/client/bindings'; +import { createSetting, GameSettings, JvmSettings, LauncherSettings, ProcessSettings } from '../settings/game/SettingsMinecraft'; function ClusterSettings() { const [cluster] = useClusterContext(); diff --git a/apps/frontend/src/ui/pages/settings/game/SettingsAccounts.tsx b/apps/frontend/src/ui/pages/settings/game/SettingsAccounts.tsx index 116449d8..18381599 100644 --- a/apps/frontend/src/ui/pages/settings/game/SettingsAccounts.tsx +++ b/apps/frontend/src/ui/pages/settings/game/SettingsAccounts.tsx @@ -1,11 +1,11 @@ import { InfoCircleIcon, Trash01Icon, UserPlus02Icon } from '@untitled-theme/icons-solid'; -import { For, Match, Show, Switch, createSignal, mergeProps } from 'solid-js'; import Button from '~ui/components/base/Button'; import Tooltip from '~ui/components/base/Tooltip'; import PlayerHead from '~ui/components/game/PlayerHead'; import useAccountController from '~ui/components/overlay/account/AddAccountModal'; import ScrollableContainer from '~ui/components/ScrollableContainer'; import Sidebar from '~ui/components/Sidebar'; +import { createSignal, For, Match, mergeProps, Show, Switch } from 'solid-js'; function SettingsAccounts() { const controller = useAccountController(); diff --git a/apps/frontend/src/ui/pages/settings/game/SettingsMinecraft.tsx b/apps/frontend/src/ui/pages/settings/game/SettingsMinecraft.tsx index 97f205cf..bd0bce15 100644 --- a/apps/frontend/src/ui/pages/settings/game/SettingsMinecraft.tsx +++ b/apps/frontend/src/ui/pages/settings/game/SettingsMinecraft.tsx @@ -1,15 +1,15 @@ import { ActivityIcon, CpuChip01Icon, Database01Icon, EyeIcon, FilePlus02Icon, FileX02Icon, LayoutTopIcon, Maximize01Icon, ParagraphWrapIcon, VariableIcon, XIcon } from '@untitled-theme/icons-solid'; -import { type Accessor, For, type Setter, Show, createSignal, onMount, splitProps, untrack } from 'solid-js'; -import type { JavaVersion, JavaVersions, Memory, Resolution } from '@onelauncher/client/bindings'; +import Button from '~ui/components/base/Button'; import TextField from '~ui/components/base/TextField'; import Toggle from '~ui/components/base/Toggle'; +import Modal, { createModal } from '~ui/components/overlay/Modal'; import ScrollableContainer from '~ui/components/ScrollableContainer'; import BaseSettingsRow, { type SettingsRowProps } from '~ui/components/SettingsRow'; import Sidebar from '~ui/components/Sidebar'; import useSettings from '~ui/hooks/useSettings'; import { asEnvVariables } from '~utils'; -import Modal, { createModal } from '~ui/components/overlay/Modal'; -import Button from '~ui/components/base/Button'; +import { type Accessor, createSignal, For, onMount, type Setter, Show, splitProps, untrack } from 'solid-js'; +import type { JavaVersion, JavaVersions, Memory, Resolution } from '@onelauncher/client/bindings'; function SettingsMinecraft() { return ( @@ -300,14 +300,14 @@ export function JvmSettings(props: { }) { const modal = createModal(controller => ( , ]} + title="Java Versions" {...controller} >
@@ -318,10 +318,10 @@ export function JvmSettings(props: { <> {prettified} { props.javaVersions?.set({ ...props.javaVersions.get(), [version]: { ...meta, path: value } }); }} + value={meta.path} /> ); @@ -343,9 +343,9 @@ export function JvmSettings(props: { title="Version" >