Compare commits

...

8 Commits

Author SHA1 Message Date
ac11f91d79 games_in_download: Mutex -> RwLock 2025-08-27 21:29:55 +02:00
8e76e8d1e2 introduce cargo vet 2025-08-27 21:21:01 +02:00
3b6fc80578 [deps] cargo update 2025-08-27 19:55:56 +02:00
8c6fd139c8 [deps] cargo update 2025-08-20 08:54:56 +02:00
66572e16ce [deps] cargo update
Updating anyhow         v1.0.98  -> v1.0.99
Updating async-trait    v0.1.88  -> v0.1.89
Updating bitflags       v2.9.1   -> v2.9.2
Updating brotli         v8.0.1   -> v8.0.2
Updating cc             v1.2.32  -> v1.2.33
Updating clap_builder   v4.5.43  -> v4.5.44
Updating clap_derive    v4.5.41  -> v4.5.45
Updating clap           v4.5.43  -> v4.5.45
Updating dlopen2        v0.7.0   -> v0.8.0
Updating glob           v0.3.2   -> v0.3.3
Updating libc           v0.2.174 -> v0.2.175
Updating objc2          v0.6.1   -> v0.6.2
Updating proc-macro2    v1.0.96  -> v1.0.101
Updating reqwest        v0.12.22 -> v0.12.23
Updating serde-untagged v0.1.7   -> v0.1.8
Updating syn            v2.0.104 -> v2.0.106
Updating tao            v0.34.0  -> v0.34.1
Updating thiserror-impl v2.0.12  -> v2.0.15
Updating thiserror      v2.0.12  -> v2.0.15
Updating uuid           v1.17.0  -> v1.18.0
2025-08-17 16:37:01 +02:00
3b19cb8b18 clippy: apply and fix new lints 2025-08-17 16:35:54 +02:00
61a41c7122 clippy: add same lints to all crates 2025-08-17 16:12:42 +02:00
cbad9389ee code: remove unnecessary else branch 2025-08-17 16:08:38 +02:00
12 changed files with 4534 additions and 302 deletions

594
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,14 @@ name = "lanspread-compat"
version = "0.1.0"
edition = "2024"
[lints.rust]
unsafe_code = "forbid"
[lints.clippy]
pedantic = { level = "warn", priority = -1 }
todo = "warn"
unwrap_used = "warn"
[dependencies]
# local
lanspread-db = { path = "../lanspread-db" }

View File

@@ -58,6 +58,7 @@ impl From<EtiGame> for Game {
max_players: eti_game.game_maxplayers,
version: eti_game.game_version,
genre: eti_game.genre_de,
#[allow(clippy::cast_sign_loss, clippy::cast_possible_truncation)]
size: (eti_game.game_size * 1024.0 * 1024.0 * 1024.0) as u64,
thumbnail: None,
installed: false,

View File

@@ -3,6 +3,14 @@ name = "lanspread-mdns"
version = "0.1.0"
edition = "2024"
[lints.rust]
unsafe_code = "forbid"
[lints.clippy]
pedantic = { level = "warn", priority = -1 }
todo = "warn"
unwrap_used = "warn"
[dependencies]
mdns-sd = { workspace = true }
eyre = { workspace = true }

View File

@@ -1,3 +1,5 @@
#![allow(clippy::missing_errors_doc, clippy::missing_panics_doc)]
use std::net::SocketAddr;
use eyre::bail;

View File

@@ -14,6 +14,15 @@ edition = "2024"
name = "lanspread_tauri_deno_ts_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
[lints.rust]
unsafe_code = "forbid"
[lints.clippy]
pedantic = { level = "warn", priority = -1 }
todo = "warn"
unwrap_used = "warn"
needless_pass_by_value = "allow"
[build-dependencies]
tauri-build = { version = "2", features = [] }

View File

@@ -1,3 +1,3 @@
fn main() {
tauri_build::build()
tauri_build::build();
}

View File

@@ -11,7 +11,7 @@ use lanspread_db::db::{Game, GameDB};
use lanspread_mdns::{LANSPREAD_INSTANCE_NAME, LANSPREAD_SERVICE_TYPE, discover_service};
use tauri::{AppHandle, Emitter as _, Manager};
use tauri_plugin_shell::{ShellExt, process::Command};
use tokio::sync::{Mutex, RwLock, mpsc::UnboundedSender};
use tokio::sync::{RwLock, mpsc::UnboundedSender};
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
@@ -19,7 +19,7 @@ struct LanSpreadState {
server_addr: RwLock<Option<SocketAddr>>,
client_ctrl: UnboundedSender<ClientCommand>,
games: Arc<RwLock<GameDB>>,
games_in_download: Arc<Mutex<HashSet<String>>>,
games_in_download: Arc<RwLock<HashSet<String>>>,
games_folder: Arc<RwLock<String>>,
}
@@ -35,7 +35,7 @@ fn request_games(state: tauri::State<LanSpreadState>) {
#[tauri::command]
fn install_game(id: String, state: tauri::State<LanSpreadState>) -> bool {
let already_in_download = tauri::async_runtime::block_on(async {
if state.inner().games_in_download.lock().await.contains(&id) {
if state.inner().games_in_download.read().await.contains(&id) {
log::warn!("Game is already downloading: {id}");
return true;
}
@@ -171,7 +171,7 @@ fn update_game_directory(app_handle: tauri::AppHandle, path: String) {
.state::<LanSpreadState>()
.client_ctrl
.send(ClientCommand::SetGameDir(path.clone()))
.unwrap();
.expect("Failed to send ClientCommand: SetGameDir");
{
tauri::async_runtime::block_on(async {
@@ -182,13 +182,13 @@ fn update_game_directory(app_handle: tauri::AppHandle, path: String) {
.write()
.await;
*games_folder = path.clone();
games_folder.clone_from(&path);
});
}
let path = PathBuf::from(path);
if !path.exists() {
log::error!("game dir {path:?} does not exist");
log::error!("game dir {} does not exist", path.display());
}
let entries = match path.read_dir() {
@@ -241,7 +241,7 @@ async fn find_server(app: AppHandle) {
state
.client_ctrl
.send(ClientCommand::ServerAddr(server_addr))
.unwrap();
.expect("Failed to send ClientCommand: ServerAddr");
request_games(state);
break;
}
@@ -312,14 +312,11 @@ async fn do_unrar(sidecar: Command, rar_file: &Path, dest_dir: &Path) -> eyre::R
}
return Ok(());
} else {
log::error!("dest_dir canonicalize failed: {:?}", &dest_dir);
}
log::error!("dest_dir canonicalize failed: {}", dest_dir.display());
} else {
log::error!("rar_file canonicalize failed: {:?}", &rar_file);
log::error!("rar_file canonicalize failed: {}", rar_file.display());
}
} else {
log::error!("failed to create dest_dir: {:?}", &dest_dir);
}
bail!("failed to create directory: {dest_dir:?}");
@@ -331,10 +328,12 @@ async fn unpack_game(id: &str, sidecar: Command, games_folder: String) {
let local_path = game_path.join("local");
if let Err(e) = do_unrar(sidecar, &eti_rar, &local_path).await {
log::error!("{eti_rar:?} -> {local_path:?}: {e}");
log::error!("{} -> {}: {e}", eti_rar.display(), local_path.display());
}
}
#[allow(clippy::too_many_lines)]
#[allow(clippy::missing_panics_doc)]
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
let tauri_logger_builder = tauri_plugin_log::Builder::new()
@@ -357,8 +356,8 @@ pub fn run() {
server_addr: RwLock::new(None),
client_ctrl: tx_client_control,
games: Arc::new(RwLock::new(GameDB::empty())),
games_in_download: Arc::new(Mutex::new(HashSet::new())),
games_folder: Arc::new(RwLock::new("".to_string())),
games_in_download: Arc::new(RwLock::new(HashSet::new())),
games_folder: Arc::new(RwLock::new(String::new())),
};
tauri::Builder::default()
@@ -407,7 +406,7 @@ pub fn run() {
id,
file_descriptions,
})
.unwrap();
.expect("Failed to send ClientCommand: DownloadGameFiles");
}
ClientEvent::DownloadGameFilesBegin { id } => {
@@ -417,7 +416,7 @@ pub fn run() {
.state::<LanSpreadState>()
.inner()
.games_in_download
.lock()
.write()
.await
.insert(id.clone());
@@ -435,7 +434,7 @@ pub fn run() {
.state::<LanSpreadState>()
.inner()
.games_in_download
.lock()
.write()
.await
.remove(&id.clone());
@@ -468,7 +467,7 @@ pub fn run() {
.state::<LanSpreadState>()
.inner()
.games_in_download
.lock()
.write()
.await
.remove(&id.clone());
},

View File

@@ -7,5 +7,5 @@ use mimalloc::MiMalloc;
static GLOBAL: MiMalloc = MiMalloc;
fn main() {
lanspread_tauri_deno_ts_lib::run()
lanspread_tauri_deno_ts_lib::run();
}

7
supply-chain/audits.toml Normal file
View File

@@ -0,0 +1,7 @@
# cargo-vet audits file
[[audits.windows-link]]
who = "ddidderr <ddidderr@paul.network>"
criteria = "safe-to-deploy"
delta = "0.1.1 -> 0.1.3"

2184
supply-chain/config.toml Normal file

File diff suppressed because it is too large Load Diff

1982
supply-chain/imports.lock Normal file

File diff suppressed because it is too large Load Diff