merge: Merge dependency updates and lint

This commit is contained in:
LynithDev 2024-06-18 16:54:45 +02:00
commit bf4511e4e3
29 changed files with 1060 additions and 921 deletions

0
.env
View file

3
.gitignore vendored
View file

@ -117,9 +117,6 @@ fabric.properties
.idea/*
!.idea/codeStyles
!.idea/runConfigurations
### Linux ###
*~

View file

@ -1,32 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JSCodeStyleSettings version="0">
<option name="IMPORT_SORT_MODULE_NAME" value="true" />
</JSCodeStyleSettings>
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="JAVA">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JSON">
<indentOptions>
<option name="INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

View file

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

2
.npmrc
View file

@ -1,7 +1,5 @@
; make all engine requirements (e.g. node version) strictly kept
engine-strict=true
; tempfix for pnpm#5909: https://github.com/pnpm/pnpm/issues/5909#issuecomment-1397758156
prefer-symlinked-executables=false
auto-install-peers=true
max-old-space-size=4096
enable-pre-post-scripts=true

View file

@ -9,10 +9,10 @@ members = [
[workspace.package]
license = "GPL-3.0-only"
edition = "2021"
repository = "https://github.com/Polyfrost/Nexus"
documentation = "https://docs.polyfrost.org/nexus"
repository = "https://github.com/Polyfrost/OneLauncher"
documentation = "https://docs.polyfrost.org/onelauncher"
readme = "README.md"
homepage = "https://polyfrost.org"
homepage = "https://polyfrost.org/"
authors = [
"Polyfrost",
"Polyfrost Contributors"
@ -22,6 +22,7 @@ authors = [
tauri = { version = "2.0.0-beta", features = [
"rustls-tls",
"tracing",
"specta"
] }
tauri-build = { version = "2.0.0-beta" }
tauri-plugin-authenticator = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
@ -66,7 +67,7 @@ tracing-subscriber = { version = "0.3", features = [
] }
tracing-error = { version = "0.2" }
tracing-appender = { version = "0.2" }
sentry = { version = "0.33", default-features = false, features = [
sentry = { version = "0.34", default-features = false, features = [
"rustls",
"reqwest",
"backtrace",

View file

@ -18,7 +18,7 @@
"@rspc/solid": "^0.2.0",
"@rspc/tauri": "^0.2.0",
"@solid-primitives/deep": "^0.2.8",
"@tanstack/solid-query": "^5.40.1",
"@tanstack/solid-query": "^5.45.0",
"fast-equals": "^5.0.1",
"plausible-tracker": "^0.3.9",
"solid-js": "^1.8.17",

View file

@ -8,8 +8,8 @@ use crate::proxy::ClusterPayloadType;
use crate::store::ProcessorChild;
// use crate::package::from::{EnvType, PackDependency, PackFile, PackFileHash, PackFormat};
use crate::prelude::{ClusterPath, JavaVersion, PackagePath};
pub use crate::store::{Cluster, JavaOptions, State};
use crate::store::MinecraftCredentials;
pub use crate::store::{Cluster, JavaOptions, State};
use crate::utils::io::{self, IOError};

View file

@ -66,8 +66,8 @@ pub async fn install_java(java_version: u32) -> crate::Result<PathBuf> {
.await?;
let path = state.directories.java_dir().await;
let mut archive = zip::ZipArchive::new(std::io::Cursor::new(file))
.map_err(IOError::from_zip)?;
let mut archive =
zip::ZipArchive::new(std::io::Cursor::new(file)).map_err(IOError::from_zip)?;
if let Some(file) = archive.file_names().next() {
if let Some(dir) = file.split('/').next() {
@ -79,9 +79,7 @@ pub async fn install_java(java_version: u32) -> crate::Result<PathBuf> {
}
send_ingress(&ingress, 0.0, Some("extracing java binary")).await?;
archive
.extract(&path)
.map_err(IOError::from_zip)?;
archive.extract(&path).map_err(IOError::from_zip)?;
send_ingress(&ingress, 10.0, Some("extracted java binary")).await?;
let mut base_path = path.join(
download

View file

@ -142,9 +142,7 @@ pub async fn get_logs_by_file(
.join(&log_file);
let metadata = std::fs::metadata(&path)?;
let age = metadata
.created()
.unwrap_or(SystemTime::UNIX_EPOCH);
let age = metadata.created().unwrap_or(SystemTime::UNIX_EPOCH);
LogManager::initialize(log_type, age, &cluster_path, log_file, Some(true)).await
}

View file

@ -79,9 +79,7 @@ pub async fn import_instances(import: ImportType, path: PathBuf) -> crate::Resul
ImportType::TLauncher => "instances".to_string(),
ImportType::Technic => "instances".to_string(),
ImportType::FTBLauncher => "instances".to_string(),
_ => {
return Err(anyhow::anyhow!("launcher type unknown, cant import").into())
}
_ => return Err(anyhow::anyhow!("launcher type unknown, cant import").into()),
};
let instances_dir = path.join(&instances_path);
@ -97,11 +95,11 @@ pub async fn import_instances(import: ImportType, path: PathBuf) -> crate::Resul
{
let path = e.path();
if path.is_dir() && is_valid_instance(path.clone(), import).await {
let name = path.file_name();
if let Some(name) = name {
instances.push(name.to_string_lossy().to_string());
}
}
let name = path.file_name();
if let Some(name) = name {
instances.push(name.to_string_lossy().to_string());
}
}
}
Ok(instances)

View file

@ -26,8 +26,7 @@ impl Credentials {
) -> crate::Result<Self> {
let path = SnapshotPath::from_path(path);
let stronghold = iota_stronghold::Stronghold::default();
let keyprovider =
KeyProvider::try_from(password).map_err(StrongholdError::MemoryError)?;
let keyprovider = KeyProvider::try_from(password).map_err(StrongholdError::MemoryError)?;
if path.exists() {
stronghold
.load_snapshot(&keyprovider, &path)

View file

@ -1,6 +1,5 @@
//! Handles MSA Authentication flow.
use std::fmt::Write;
use base64::Engine;
use chrono::{DateTime, Utc};
use p256::ecdsa::signature::Signer;
@ -11,6 +10,7 @@ use serde::{Deserialize, Serialize};
use serde_json::json;
use sha2::Digest;
use std::collections::HashMap;
use std::fmt::Write;
use uuid::Uuid;
const AUTH_STORE: &str = "authentication.json";
@ -878,8 +878,7 @@ async fn send_signed_request<T: serde::de::DeserializeOwned>(
step: MinecraftAuthStep,
current_date: DateTime<Utc>,
) -> Result<SignedRequestResponse<T>, MinecraftAuthError> {
let auth = authorization
.map_or(Vec::new(), |v| v.as_bytes().to_vec());
let auth = authorization.map_or(Vec::new(), |v| v.as_bytes().to_vec());
let body = serde_json::to_vec(&raw_body)
.map_err(|source| MinecraftAuthError::SerializeError { step, source })?;
let time: u128 = { ((current_date.timestamp() as u128) + 11644473600) * 10000000 };

View file

@ -1,7 +1,6 @@
//! Handlers for Mod metadata that can be displayed in a GUI mod list or exported as a mod pack
#[allow(clippy::all)]
use async_zip::tokio::read::fs::ZipFileReader;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};

View file

@ -41,9 +41,9 @@ pub enum IngressProcessType {
}
impl Default for IngressProcessor {
fn default() -> Self {
Self::new()
}
fn default() -> Self {
Self::new()
}
}
impl IngressProcessor {

View file

@ -202,9 +202,7 @@ pub fn extract_archive(archive: &PathBuf, dest: &PathBuf) -> crate::Result<()> {
pub fn extract_zip(archive: &PathBuf, dest: &PathBuf) -> Result<(), IOError> {
let file = File::open(archive).map_err(|err| IOError::with_path(err, archive.as_path()))?;
let archive = zip::ZipArchive::new(file).map_err(IOError::from_zip);
archive?
.extract(dest)
.map_err(IOError::from_zip)?;
archive?.extract(dest).map_err(IOError::from_zip)?;
Ok(())
}

View file

@ -24,26 +24,26 @@
"@rspc/tauri": "^0.2.0",
"@solid-primitives/refs": "^1.0.8",
"@solidjs/router": "^0.13.5",
"@tanstack/solid-query": "^5.40.1",
"@tauri-apps/api": "^2.0.0-beta",
"@tanstack/solid-query": "^5.45.0",
"@tauri-apps/api": "^2.0.0-beta.13",
"@tauri-apps/plugin-shell": "github:tauri-apps/tauri-plugin-shell#v2",
"@thisbeyond/solid-dnd": "^0.7.5",
"@unocss/reset": "^0.60.4",
"@unocss/reset": "^0.61.0",
"@untitled-theme/icons-solid": "^0.10.0",
"overlayscrollbars": "^2.8.3",
"overlayscrollbars-solid": "^0.5.5",
"solid-js": "^1.8.17",
"solid-transition-group": "^0.2.3",
"uuid": "^9.0.1"
"uuid": "^10.0.0"
},
"devDependencies": {
"@solidjs/testing-library": "^0.8.8",
"@tauri-apps/cli": "2.0.0-beta.10",
"@testing-library/jest-dom": "^6.4.5",
"@tauri-apps/cli": "^2.0.0-beta.20",
"@testing-library/jest-dom": "^6.4.6",
"@types/uuid": "^9.0.8",
"jsdom": "^24.1.0",
"sass": "^1.77.4",
"unocss": "^0.60.4",
"sass": "^1.77.6",
"unocss": "^0.61.0",
"vite-plugin-solid": "^2.10.2",
"vite-tsconfig-paths": "^4.3.2"
}

View file

@ -1,7 +1,11 @@
use std::{collections::HashMap, path::PathBuf, str::FromStr};
use std::collections::HashMap;
use std::path::PathBuf;
use std::str::FromStr;
use chrono::DateTime;
use onelauncher::{cluster, data::{ClusterMeta, Loader, PackageData, Settings}, store::{Cluster, ClusterPath}, State};
use onelauncher::data::{ClusterMeta, Loader, PackageData, Settings};
use onelauncher::store::{Cluster, ClusterPath};
use onelauncher::{cluster, State};
use serde::{Deserialize, Serialize};
use specta::Type;
use tokio::sync::RwLock;
@ -34,7 +38,7 @@ pub fn is_dev() -> bool {
#[derive(Serialize, Deserialize, Type)]
pub struct CreateCluster {
name: String,
name: String,
mc_version: String,
mod_loader: Loader,
loader_version: Option<String>,
@ -48,77 +52,78 @@ pub struct CreateCluster {
#[specta::specta]
#[tauri::command]
pub async fn create_cluster(props: CreateCluster) -> Result<Uuid, String> {
let path = cluster::create::create_cluster(
props.name,
props.mc_version,
props.mod_loader,
props.loader_version,
props.icon,
props.icon_url,
props.package_data,
props.skip,
props.skip_watch,
).await?;
let path = cluster::create::create_cluster(
props.name,
props.mc_version,
props.mod_loader,
props.loader_version,
props.icon,
props.icon_url,
props.package_data,
props.skip,
props.skip_watch,
)
.await?;
if let Some(cluster) = cluster::get(&path, None).await? {
Ok(cluster.uuid)
} else {
Err("Cluster does not exist".to_string())
}
if let Some(cluster) = cluster::get(&path, None).await? {
Ok(cluster.uuid)
} else {
Err("Cluster does not exist".to_string())
}
}
fn placeholder_cluster() -> Cluster {
let path = ClusterPath("test".into());
Cluster {
uuid: Uuid::from_str("56d1cbcf-1961-4477-b263-80e3b1c7a9d1").unwrap(),
stage: onelauncher::store::ClusterStage::Installed,
path: path.0,
meta: ClusterMeta {
created_at: DateTime::from_timestamp_millis(1718297861712).unwrap(),
modified_at: DateTime::from_timestamp_millis(1718297861712).unwrap(),
group: vec![],
icon: None,
icon_url: None,
loader: Loader::Vanilla,
loader_version: None,
mc_version: "1.8.9".into(),
name: "Test Cluster".into(),
overall_played: 58195,
recently_played: 0,
package_data: None,
played_at: None
},
memory: None,
java: None,
resolution: None,
force_fullscreen: None,
init_hooks: None,
packages: HashMap::new(),
update: None
}
let path = ClusterPath("test".into());
Cluster {
uuid: Uuid::from_str("56d1cbcf-1961-4477-b263-80e3b1c7a9d1").unwrap(),
stage: onelauncher::store::ClusterStage::Installed,
path: path.0,
meta: ClusterMeta {
created_at: DateTime::from_timestamp_millis(1718297861712).unwrap(),
modified_at: DateTime::from_timestamp_millis(1718297861712).unwrap(),
group: vec![],
icon: None,
icon_url: None,
loader: Loader::Vanilla,
loader_version: None,
mc_version: "1.8.9".into(),
name: "Test Cluster".into(),
overall_played: 58195,
recently_played: 0,
package_data: None,
played_at: None,
},
memory: None,
java: None,
resolution: None,
force_fullscreen: None,
init_hooks: None,
packages: HashMap::new(),
update: None,
}
}
#[specta::specta]
#[tauri::command]
pub async fn get_cluster(uuid: Uuid) -> Result<Cluster, String> {
Ok(placeholder_cluster())
Ok(placeholder_cluster())
// match cluster::get_by_uuid(uuid, None).await? {
// Some(cluster) => Ok(cluster),
// None => Err("Cluster does not exist".into())
// }
// match cluster::get_by_uuid(uuid, None).await? {
// Some(cluster) => Ok(cluster),
// None => Err("Cluster does not exist".into())
// }
}
#[specta::specta]
#[tauri::command]
pub async fn get_clusters() -> Result<HashMap<ClusterPath, Cluster>, String> {
let mut map = HashMap::<ClusterPath, Cluster>::new();
let cluster = placeholder_cluster();
map.insert(cluster.cluster_path(), cluster);
let mut map = HashMap::<ClusterPath, Cluster>::new();
let cluster = placeholder_cluster();
map.insert(cluster.cluster_path(), cluster);
Ok(map)
// cluster::list(None).await.map_err(|op| op.into())
Ok(map)
// cluster::list(None).await.map_err(|op| op.into())
}
#[specta::specta]

View file

@ -20,20 +20,20 @@ pub type Result<T> = std::result::Result<T, OneLauncherSerializableError>;
#[derive(thiserror::Error, Debug, Serialize, specta::Type)]
pub enum OneLauncherSerializableError {
#[error("{0}")]
CommonError(String),
#[error("{0}")]
CommonError(String),
}
impl From<OneLauncherError> for OneLauncherSerializableError {
fn from(value: OneLauncherError) -> Self {
Self::CommonError(value.to_string())
}
fn from(value: OneLauncherError) -> Self {
Self::CommonError(value.to_string())
}
}
impl From<onelauncher::Error> for OneLauncherSerializableError {
fn from(value: onelauncher::Error) -> Self {
Self::CommonError(value.to_string())
}
fn from(value: onelauncher::Error) -> Self {
Self::CommonError(value.to_string())
}
}
#[derive(thiserror::Error, Debug)]

View file

@ -1,18 +1,19 @@
use tauri::{plugin::TauriPlugin, Manager, Runtime};
use tauri::plugin::TauriPlugin;
use tauri::{Manager, Runtime};
use tauri_plugin_updater::{Update as TauriPluginUpdate, UpdaterExt};
use tokio::sync::Mutex;
#[derive(Debug, Clone, serde::Serialize)]
pub struct Update {
pub version: String,
pub version: String,
}
impl Update {
fn new(update: &TauriPluginUpdate) -> Self {
Self {
version: update.version.clone(),
}
}
fn new(update: &TauriPluginUpdate) -> Self {
Self {
version: update.version.clone(),
}
}
}
#[derive(Default)]

View file

@ -35,9 +35,7 @@ pub async fn run() {
.await;
}
pub async fn run_app<F: FnOnce(&mut tauri::App) + Send + 'static>(
setup: F,
) {
pub async fn run_app<F: FnOnce(&mut tauri::App) + Send + 'static>(setup: F) {
let builder = tauri::Builder::default()
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_single_instance::init(|app, argv, cwd| {
@ -55,16 +53,14 @@ pub async fn run_app<F: FnOnce(&mut tauri::App) + Send + 'static>(
Ok(())
});
let builder = builder
.plugin(api::init())
.invoke_handler({
let builder = collect_commands!();
let builder = builder.plugin(api::init()).invoke_handler({
let builder = collect_commands!();
#[cfg(debug_assertions)]
let builder = builder.path("../src/bindings.ts");
#[cfg(debug_assertions)]
let builder = builder.path("../src/bindings.ts");
builder.build().unwrap()
});
builder.build().unwrap()
});
let app = builder
.build(tauri::tauri_build_context!())

View file

@ -9,11 +9,10 @@ import { SettingsProvider } from './hooks/useSettings';
import { bridge } from '~index';
function App(props: ParentProps) {
if (!bridge.commands.isDev()) {
if (!bridge.commands.isDev())
document.addEventListener('contextmenu', (event) => {
event.preventDefault();
});
}
return (
<SettingsProvider>

View file

@ -14,7 +14,7 @@ function Dropdown(props: DropdownProps) {
const [split, rest] = splitProps(props, ['children', 'class', 'text', 'onChange', 'selected']);
const [visible, setVisible] = createSignal(false);
// eslint-disable-next-line solid/reactivity
// eslint-disable-next-line solid/reactivity -- todo
const [selected, setSelected] = createSignal<number>(split.selected || 0);
let ref!: HTMLDivElement;

View file

@ -7,7 +7,7 @@ import type {
Setter } from 'solid-js';
import { Portal } from 'solid-js/web';
// eslint-disable-next-line ts/no-namespace
// eslint-disable-next-line ts/no-namespace -- todo
declare namespace Popup {
type PopupProps = Omit<Parameters<typeof Portal>[0], 'children'> & ParentProps & {
visible: Accessor<boolean>;

View file

@ -14,7 +14,7 @@ export function getCluster(uuid: string | undefined | null): Resource<Cluster> |
}
export function ClusterProvider(props: ParentProps & { uuid: string | undefined }) {
// eslint-disable-next-line solid/reactivity
// eslint-disable-next-line solid/reactivity -- todo
const cluster = getCluster(props.uuid);
return (

View file

@ -4,7 +4,6 @@ import Button from '~ui/components/base/Button';
import Tooltip from '~ui/components/base/Tooltip';
import PlayerHead from '~ui/components/game/PlayerHead';
import ScrollableContainer from '~ui/components/ScrollableContainer';
import SettingsRow from '~ui/components/SettingsRow';
import Sidebar from '~ui/components/Sidebar';
const Accounts: {

View file

@ -2,7 +2,7 @@
"name": "@onelauncher/root",
"type": "module",
"version": "1.0.0",
"packageManager": "pnpm@9.1.4",
"packageManager": "pnpm@9.4.0",
"description": "Next-generation open source Minecraft launcher and tools for interacting with Polyfrost",
"license": "GPL-3.0-only",
"repository": {
@ -22,16 +22,16 @@
"release:node": "bumpp -r"
},
"devDependencies": {
"@flowr/eslint-config": "^3.5.2",
"@types/node": "^20.14.2",
"@flowr/eslint-config": "^3.7.0",
"@types/node": "^20.14.3",
"@vitest/ui": "^1.6.0",
"bumpp": "^9.4.1",
"eslint": "^8.56.0",
"eslint-plugin-solid": "^0.14.0",
"ts-node": "^10.9.2",
"tsx": "^4.12.0",
"tsx": "^4.15.6",
"typescript": "^5.4.5",
"vite": "^5.2.12",
"vite": "^5.3.1",
"vitest": "^1.6.0"
},
"pnpm": {

1669
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -17,11 +17,11 @@
"tauri": "tsx tauri.ts"
},
"dependencies": {
"@flowr/utils": "^3.5.2",
"@flowr/utils": "^3.7.0",
"@iarna/toml": "^2.2.5",
"execa": "^9.1.0",
"execa": "^9.2.0",
"semver": "^7.6.2",
"undici": "^6.18.2"
"undici": "^6.19.1"
},
"devDependencies": {
"@types/iarna__toml": "^2.0.5",