✨ feature: normalize specta feature flag
Signed-off-by: Pauline <git@ethanlibs.co>
This commit is contained in:
parent
43f16ceecf
commit
112b3303a0
17 changed files with 100 additions and 67 deletions
|
|
@ -19,7 +19,7 @@ crate-type = [ "staticlib", "cdylib", "lib" ]
|
|||
tauri-build = { workspace = true, features = [ "isolation" ] }
|
||||
|
||||
[dependencies]
|
||||
onelauncher = { workspace = true, features = [ "tauri" ] }
|
||||
onelauncher = { workspace = true, features = [ "tauri", "specta" ] }
|
||||
onelauncher_macros = { workspace = true }
|
||||
tauri-plugin-shell = { workspace = true }
|
||||
tauri-plugin-window-state = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -23,7 +23,9 @@ pub async fn get_processes_by_path(path: ClusterPath) -> Result<Vec<Uuid>, Strin
|
|||
|
||||
#[specta::specta]
|
||||
#[tauri::command]
|
||||
pub async fn get_processes_detailed_by_path(path: ClusterPath) -> Result<Vec<DetailedProcess>, String> {
|
||||
pub async fn get_processes_detailed_by_path(
|
||||
path: ClusterPath,
|
||||
) -> Result<Vec<DetailedProcess>, String> {
|
||||
Ok(processor::get_processes_detailed_by_path(path).await?)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -238,18 +238,26 @@ pub async fn delete_logs_by_file(
|
|||
|
||||
pub async fn read_log_to_string(path: &std::path::PathBuf) -> crate::Result<String> {
|
||||
if let Some(ext) = path.extension() {
|
||||
let mut file = std::fs::File::open(&path).map_err(|e| IOError::with_path(e, &path))?;
|
||||
let mut file = std::fs::File::open(path).map_err(|e| IOError::with_path(e, path))?;
|
||||
let mut contents = [0; 1024];
|
||||
let mut result = String::new();
|
||||
|
||||
if ext == "gz" {
|
||||
let mut gz = flate2::read::GzDecoder::new(std::io::BufReader::new(file));
|
||||
while gz.read(&mut contents).map_err(|e| IOError::with_path(e, &path))? > 0 {
|
||||
while gz
|
||||
.read(&mut contents)
|
||||
.map_err(|e| IOError::with_path(e, path))?
|
||||
> 0
|
||||
{
|
||||
result.push_str(&String::from_utf8_lossy(&contents));
|
||||
contents = [0; 1024];
|
||||
}
|
||||
} else if ext == "log" || ext == "txt" {
|
||||
while file.read(&mut contents).map_err(|e| IOError::with_path(e, &path))? > 0 {
|
||||
while file
|
||||
.read(&mut contents)
|
||||
.map_err(|e| IOError::with_path(e, path))?
|
||||
> 0
|
||||
{
|
||||
result.push_str(&String::from_utf8_lossy(&contents));
|
||||
contents = [0; 1024];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use crate::Result;
|
|||
mod modrinth;
|
||||
|
||||
/// Providers for content packages
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)]
|
||||
pub enum Providers {
|
||||
// Curseforge,
|
||||
|
|
@ -84,8 +84,7 @@ impl Providers {
|
|||
Ok(versions
|
||||
.into_iter()
|
||||
.find(|v| v.game_versions.contains(&game_version.to_string()))
|
||||
.ok_or(anyhow!("no game version found"))?
|
||||
) // TODO: error handling
|
||||
.ok_or(anyhow!("no game version found"))?) // TODO: error handling
|
||||
}
|
||||
|
||||
// pub async fn search(&self, query: &str) -> Result<Vec<ManagedPackage>> {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ pub mod technic;
|
|||
pub mod tlauncher;
|
||||
|
||||
/// List of launcher types we support importing from.
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub enum ImportType {
|
||||
/// MultiMC based launchers
|
||||
|
|
|
|||
|
|
@ -31,9 +31,16 @@ pub async fn get_process_detailed_by_id(uuid: Uuid) -> crate::Result<DetailedPro
|
|||
let state = State::get().await?;
|
||||
let processor = state.processor.read().await;
|
||||
|
||||
let child = processor.get(uuid).ok_or(anyhow::anyhow!("process not found"))?;
|
||||
let child = processor
|
||||
.get(uuid)
|
||||
.ok_or(anyhow::anyhow!("process not found"))?;
|
||||
let child = child.read().await;
|
||||
let pid = child.current_child.read().await.id().ok_or(anyhow::anyhow!("process not found"))?;
|
||||
let pid = child
|
||||
.current_child
|
||||
.read()
|
||||
.await
|
||||
.id()
|
||||
.ok_or(anyhow::anyhow!("process not found"))?;
|
||||
Ok(DetailedProcess {
|
||||
uuid,
|
||||
user: child.user,
|
||||
|
|
@ -44,16 +51,25 @@ pub async fn get_process_detailed_by_id(uuid: Uuid) -> crate::Result<DetailedPro
|
|||
|
||||
/// get detailed processes by a [`ClusterPath`].
|
||||
#[tracing::instrument]
|
||||
pub async fn get_processes_detailed_by_path(path: ClusterPath) -> crate::Result<Vec<DetailedProcess>> {
|
||||
pub async fn get_processes_detailed_by_path(
|
||||
path: ClusterPath,
|
||||
) -> crate::Result<Vec<DetailedProcess>> {
|
||||
let state = State::get().await?;
|
||||
let processor = state.processor.read().await;
|
||||
|
||||
let uuids = processor.running_cluster(path).await?;
|
||||
let mut processes = Vec::new();
|
||||
for uuid in uuids {
|
||||
let child = processor.get(uuid).ok_or(anyhow::anyhow!("process not found"))?;
|
||||
let child = processor
|
||||
.get(uuid)
|
||||
.ok_or(anyhow::anyhow!("process not found"))?;
|
||||
let child = child.read().await;
|
||||
let pid = child.current_child.read().await.id().ok_or(anyhow::anyhow!("process not found"))?;
|
||||
let pid = child
|
||||
.current_child
|
||||
.read()
|
||||
.await
|
||||
.id()
|
||||
.ok_or(anyhow::anyhow!("process not found"))?;
|
||||
processes.push(DetailedProcess {
|
||||
uuid,
|
||||
user: child.user,
|
||||
|
|
|
|||
|
|
@ -185,7 +185,8 @@ pub enum IngressType {
|
|||
},
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type, tauri_specta::Event))]
|
||||
#[cfg_attr(feature = "tauri", derive(tauri_specta::Event))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Clone)]
|
||||
pub struct IngressPayload {
|
||||
pub event: IngressType,
|
||||
|
|
@ -194,19 +195,22 @@ pub struct IngressPayload {
|
|||
pub message: String,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type, tauri_specta::Event))]
|
||||
#[cfg_attr(feature = "tauri", derive(tauri_specta::Event))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Clone)]
|
||||
pub struct OfflinePayload {
|
||||
pub offline: bool,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type, tauri_specta::Event))]
|
||||
#[cfg_attr(feature = "tauri", derive(tauri_specta::Event))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Clone)]
|
||||
pub struct MessagePayload {
|
||||
pub message: String,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type, tauri_specta::Event))]
|
||||
#[cfg_attr(feature = "tauri", derive(tauri_specta::Event))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Clone)]
|
||||
#[serde(tag = "event")]
|
||||
pub enum InternetPayload {
|
||||
|
|
@ -215,7 +219,8 @@ pub enum InternetPayload {
|
|||
InstallPath { path: PathBuf },
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type, tauri_specta::Event))]
|
||||
#[cfg_attr(feature = "tauri", derive(tauri_specta::Event))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Clone)]
|
||||
pub struct ProcessPayload {
|
||||
pub uuid: Uuid,
|
||||
|
|
@ -234,7 +239,8 @@ pub enum ProcessPayloadType {
|
|||
Logging,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type, tauri_specta::Event))]
|
||||
#[cfg_attr(feature = "tauri", derive(tauri_specta::Event))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Clone)]
|
||||
pub struct ClusterPayload {
|
||||
pub uuid: Uuid,
|
||||
|
|
|
|||
|
|
@ -182,12 +182,7 @@ pub async fn send_offline(offline: bool) -> crate::Result<()> {
|
|||
let proxy_state = crate::ProxyState::get().await?;
|
||||
proxy_state
|
||||
.app
|
||||
.emit(
|
||||
OfflinePayload::NAME,
|
||||
OfflinePayload {
|
||||
offline,
|
||||
},
|
||||
)
|
||||
.emit(OfflinePayload::NAME, OfflinePayload { offline })
|
||||
.map_err(ProxyError::from)?;
|
||||
}
|
||||
|
||||
|
|
@ -201,10 +196,7 @@ pub async fn send_internet(internet: InternetPayload) -> crate::Result<()> {
|
|||
let proxy_state = crate::ProxyState::get().await?;
|
||||
proxy_state
|
||||
.app
|
||||
.emit(
|
||||
InternetPayload::NAME,
|
||||
internet
|
||||
)
|
||||
.emit(InternetPayload::NAME, internet)
|
||||
.map_err(ProxyError::from)?;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ pub async fn launch_minecraft(
|
|||
command,
|
||||
post_hook,
|
||||
censors,
|
||||
Some(credentials.id)
|
||||
Some(credentials.id),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use super::{Directories, InitHooks, Memory, Package, PackageType, Resolution};
|
|||
pub(crate) struct Clusters(pub HashMap<ClusterPath, Cluster>);
|
||||
|
||||
/// Core Cluster stages used in package logic.
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Deserialize, Clone, Copy, Debug, Default, Eq, PartialEq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ClusterStage {
|
||||
|
|
@ -40,7 +40,7 @@ pub enum ClusterStage {
|
|||
}
|
||||
|
||||
/// Relative Path wrapper to be used as an identifer for a cluster path.
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, Hash)]
|
||||
#[serde(transparent)]
|
||||
pub struct ClusterPath(pub PathBuf);
|
||||
|
|
@ -148,7 +148,7 @@ impl From<InnerPathLinux> for RawPackagePath {
|
|||
}
|
||||
|
||||
/// Relative [`PathBuf`] for a specific [`Package`] of a [`Cluster`].
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, Hash)]
|
||||
#[serde(transparent)]
|
||||
pub struct PackagePath(pub PathBuf);
|
||||
|
|
@ -195,7 +195,7 @@ impl PackagePath {
|
|||
|
||||
/// Represents a single Instance and installation of Minecraft
|
||||
/// Contains settings and identifiers on a per-Cluster basis, falling back to default settings for Options<>
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct Cluster {
|
||||
/// The Uuid of a specific cluster.
|
||||
|
|
@ -228,7 +228,7 @@ pub struct Cluster {
|
|||
}
|
||||
|
||||
/// Represents core Cluster metadata ([`Cluster#meta`]).
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct ClusterMeta {
|
||||
/// The user-facing name of the cluster stored as a string.
|
||||
|
|
@ -277,7 +277,7 @@ pub struct ClusterMeta {
|
|||
}
|
||||
|
||||
/// Optional data used to link a specific cluster to a package project.
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct PackageData {
|
||||
/// The package ID as a String.
|
||||
|
|
@ -294,7 +294,7 @@ pub fn default_locked() -> Option<bool> {
|
|||
}
|
||||
|
||||
/// Available mod loaders to be used for a cluster.
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Copy, Deserialize, Serialize, Default)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum Loader {
|
||||
|
|
@ -328,7 +328,7 @@ impl std::fmt::Display for Loader {
|
|||
|
||||
/// Custom Java arguments on a per-cluster basis.
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
pub struct JavaOptions {
|
||||
/// A custom java version from the global java store, if specified.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
|
|
|||
|
|
@ -61,9 +61,7 @@ impl DiscordRPC {
|
|||
|
||||
let activity = Activity::new()
|
||||
.state(msg)
|
||||
.buttons(vec![
|
||||
Button::new("Download", "https://polyfrost.org/"),
|
||||
])
|
||||
.buttons(vec![Button::new("Download", "https://polyfrost.org/")])
|
||||
.assets(
|
||||
Assets::new()
|
||||
.large_image("polyfrost_logo_512")
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use crate::utils::java;
|
|||
use crate::utils::java::JavaVersion;
|
||||
|
||||
/// A HashMap of all located and installed available Java versions
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct JavaVersions(HashMap<String, JavaVersion>);
|
||||
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ pub struct SaveDeviceToken {
|
|||
|
||||
/// Core variables passed throughout the Minecraft login flow.
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
pub struct MinecraftLogin {
|
||||
pub verify: String,
|
||||
/// The OAuth challenge generated at the start of the flow.
|
||||
|
|
@ -378,7 +378,7 @@ pub struct MinecraftLogin {
|
|||
|
||||
/// A structure of all needed Minecraft credentials for logging in and account management.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
pub struct MinecraftCredentials {
|
||||
/// The uuid of the credentials.
|
||||
pub id: Uuid,
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ pub async fn generate_context(
|
|||
}
|
||||
|
||||
/// Represents types of packages handled by the launcher.
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum PackageType {
|
||||
|
|
@ -151,7 +151,7 @@ impl PackageType {
|
|||
|
||||
/// A struct that represents a Package.
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
pub struct Package {
|
||||
pub sha512: String,
|
||||
pub meta: PackageMetadata,
|
||||
|
|
@ -160,7 +160,7 @@ pub struct Package {
|
|||
}
|
||||
|
||||
/// Metadata that represents a [`Package`].
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
pub enum PackageMetadata {
|
||||
|
|
@ -183,7 +183,7 @@ pub enum PackageMetadata {
|
|||
}
|
||||
|
||||
/// Universal metadata for any managed package from a Mod distribution platform.
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct ManagedPackage {
|
||||
// Core Metadata
|
||||
|
|
@ -209,7 +209,7 @@ pub struct ManagedPackage {
|
|||
}
|
||||
|
||||
/// Universal managed package version of a package.
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct ManagedVersion {
|
||||
pub id: String,
|
||||
|
|
@ -233,7 +233,7 @@ pub struct ManagedVersion {
|
|||
}
|
||||
|
||||
/// Universal interface for managed package files.
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
|
||||
pub struct ManagedVersionFile {
|
||||
pub url: String,
|
||||
|
|
@ -267,7 +267,7 @@ impl ManagedVersionFile {
|
|||
}
|
||||
|
||||
/// Universal interface for managed package dependencies.
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct ManagedDependency {
|
||||
pub version_id: Option<String>,
|
||||
|
|
@ -277,7 +277,7 @@ pub struct ManagedDependency {
|
|||
}
|
||||
|
||||
/// Universal interface for managed package authors and users.
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct ManagedUser {
|
||||
pub id: String,
|
||||
|
|
@ -290,7 +290,7 @@ pub struct ManagedUser {
|
|||
}
|
||||
|
||||
/// The type of a [`ManagedDependency`].
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub enum PackageDependency {
|
||||
Required,
|
||||
|
|
@ -302,7 +302,7 @@ pub enum PackageDependency {
|
|||
/// The Client/Server side type of a [`Package`].
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
pub enum PackageSide {
|
||||
Required,
|
||||
Optional,
|
||||
|
|
@ -311,7 +311,7 @@ pub enum PackageSide {
|
|||
}
|
||||
|
||||
/// The file type of a [`Package`].
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum PackageFile {
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
use chrono::{DateTime, TimeZone, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::io::{AsyncBufReadExt, BufReader};
|
||||
use std::collections::HashMap;
|
||||
use std::process::Stdio;
|
||||
use std::sync::Arc;
|
||||
use tokio::io::{AsyncBufReadExt, BufReader};
|
||||
use tokio::process::{Child, Command};
|
||||
use tokio::sync::RwLock;
|
||||
use tokio::task::JoinHandle;
|
||||
|
|
@ -170,7 +170,7 @@ impl ChildType {
|
|||
exe,
|
||||
cluster_path,
|
||||
post,
|
||||
user
|
||||
user,
|
||||
};
|
||||
|
||||
let path = state.directories.caches_dir().await.join(PROCESSOR_FILE);
|
||||
|
|
@ -463,7 +463,9 @@ impl Processor {
|
|||
censored = censored.replace(key, value);
|
||||
}
|
||||
|
||||
if let Err(err) = send_process(uuid, pid, ProcessPayloadType::Logging, &censored).await {
|
||||
if let Err(err) =
|
||||
send_process(uuid, pid, ProcessPayloadType::Logging, &censored).await
|
||||
{
|
||||
tracing::warn!("failed to send process log: {}", err);
|
||||
};
|
||||
}
|
||||
|
|
@ -557,7 +559,12 @@ impl Processor {
|
|||
.id()
|
||||
.ok_or_else(|| anyhow::anyhow!("process failed, couldnt get pid"))?;
|
||||
process
|
||||
.cache(cache.uuid, cache.cluster_path.clone(), cache.post.clone(), cache.user)
|
||||
.cache(
|
||||
cache.uuid,
|
||||
cache.cluster_path.clone(),
|
||||
cache.post.clone(),
|
||||
cache.user,
|
||||
)
|
||||
.await?;
|
||||
let current_child = Arc::new(RwLock::new(process));
|
||||
let manager = Some(tokio::spawn(Self::manager(
|
||||
|
|
@ -580,7 +587,12 @@ impl Processor {
|
|||
let child = ProcessorChild {
|
||||
uuid: cache.uuid,
|
||||
cluster_path: cache.cluster_path,
|
||||
started_at: Utc.timestamp_opt(cache.start_time as i64, 0).single().ok_or(anyhow::anyhow!("couldn't convert processor cache timestamp to Utc"))?, // TODO: Look into this
|
||||
started_at: Utc
|
||||
.timestamp_opt(cache.start_time as i64, 0)
|
||||
.single()
|
||||
.ok_or(anyhow::anyhow!(
|
||||
"couldn't convert processor cache timestamp to Utc"
|
||||
))?, // TODO: Look into this
|
||||
current_child,
|
||||
manager,
|
||||
last_updated,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
|
|||
use std::path::{Path, PathBuf};
|
||||
|
||||
/// A global settings state for the launcher.
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
pub struct Settings {
|
||||
/// A OneLauncher [`Theme`] managed by the core GUI.
|
||||
|
|
@ -133,7 +133,7 @@ impl Settings {
|
|||
}
|
||||
|
||||
/// A OneLauncher theme managed by the GUI.
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Theme {
|
||||
|
|
@ -149,7 +149,7 @@ pub enum Theme {
|
|||
|
||||
/// Global memory settings across all clusters.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
pub struct Memory {
|
||||
/// Maximum amount of Java memory available globally.
|
||||
pub maximum: u32,
|
||||
|
|
@ -168,7 +168,7 @@ impl Default for Memory {
|
|||
|
||||
/// Global Minecraft resolution.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
pub struct Resolution(pub u16, pub u16);
|
||||
|
||||
impl Default for Resolution {
|
||||
|
|
@ -180,7 +180,7 @@ impl Default for Resolution {
|
|||
/// Global initialization hooks for all Minecraft clusters.
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
|
||||
#[serde(default)]
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
pub struct InitHooks {
|
||||
/// Pre-launch hook.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ use super::io;
|
|||
/// common java paths from https://github.com/PrismLauncher/PrismLauncher/blob/develop/launcher/java/JavaUtils.cpp under GPL 3.0
|
||||
///
|
||||
/// java check functionality from https://github.com/modrinth/theseus/blob/master/theseus/src/util/jre.rs under MIT
|
||||
#[cfg_attr(feature = "tauri", derive(specta::Type))]
|
||||
#[cfg_attr(feature = "specta", derive(specta::Type))]
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Serialize, Deserialize, Clone)]
|
||||
pub struct JavaVersion {
|
||||
pub version: String,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue