From 432c980ce32b3f8111c9e6adaf34a5bcc7f83c3c Mon Sep 17 00:00:00 2001 From: Arron Ohnemus Date: Mon, 22 Jun 2026 04:29:48 -0500 Subject: [PATCH 1/7] fix: update map path for Club ARK to BobsMissions in backup manager and game data --- src-tauri/src/commands/backup_manager.rs | 2 +- src/data/game-data.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/commands/backup_manager.rs b/src-tauri/src/commands/backup_manager.rs index 64824d5..2d22fbb 100644 --- a/src-tauri/src/commands/backup_manager.rs +++ b/src-tauri/src/commands/backup_manager.rs @@ -57,7 +57,7 @@ fn map_id_to_path(map_id: &str) -> &'static str { "crystalisles"=> "CrystalIsles_WP", "amissa" => "Amissa_WP", "svartalfheim"=> "Svartalfheim_WP", - "clubark" => "ClubARK_WP", + "clubark" => "BobsMissions_WP", _ => "TheIsland_WP", } } diff --git a/src/data/game-data.ts b/src/data/game-data.ts index 845aa84..8c6bc09 100644 --- a/src/data/game-data.ts +++ b/src/data/game-data.ts @@ -231,7 +231,7 @@ export const ARK_MAPS: ArkMap[] = [ { id: "clubark", displayName: "Club ARK", - mapPath: "ClubARK_WP", + mapPath: "BobsMissions_WP", isOfficial: false, dlcRequired: false, released: true, From a0a190c63d0c611fce60ea42ceb0205d4a0f0b27 Mon Sep 17 00:00:00 2001 From: Arron Ohnemus Date: Mon, 22 Jun 2026 06:21:32 -0500 Subject: [PATCH 2/7] feat: enhance server configuration with new launch parameters and event handling - Added new launch parameters for performance tuning, anti-cheat options, and gameplay modifications in game-data.ts. - Introduced database migrations to support new fields for save folder names and active events in db.ts. - Updated server-utils.ts to handle the new save folder override and active event parameters when starting servers. - Implemented new Tauri commands for wiping server saves and creating save links to manage save directories effectively. --- src-tauri/Cargo.lock | 11 + src-tauri/Cargo.toml | 4 +- src-tauri/src/commands/backup.rs | 146 +++++- src-tauri/src/lib.rs | 2 + src/components/server/tabs/ConfigTab.tsx | 252 ++++++++--- src/components/server/tabs/ModsTab.tsx | 80 +++- src/components/server/tabs/OverviewTab.tsx | 76 ++++ .../wizard/ServerCreationWizard.tsx | 420 ++++++++++++++---- src/data/game-data.ts | 272 ++++++++++-- src/lib/db.ts | 51 ++- src/lib/server-utils.ts | 15 +- src/lib/tauri-commands.ts | 13 +- 12 files changed, 1151 insertions(+), 191 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 582b9b7..57a8ca7 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2558,6 +2558,16 @@ dependencies = [ "serde_json", ] +[[package]] +name = "junction" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "160f2eade097f30263b548aae5deb12ad349c909baa710fa24b92c9090b2e006" +dependencies = [ + "scopeguard", + "windows-sys 0.61.2", +] + [[package]] name = "keyboard-types" version = "0.7.0" @@ -2731,6 +2741,7 @@ version = "0.14.0" dependencies = [ "configparser", "flate2", + "junction", "lettre", "log", "procfs", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index d7a496e..d28b043 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -76,5 +76,7 @@ procfs = { version = "0.17", default-features = false } # Windows elevation: spawn a child process with "runas" verb (UAC prompt). # Used for netsh firewall rule management which requires admin rights. +# Junction point creation for save directory symlink equivalents on Windows. [target.'cfg(target_os = "windows")'.dependencies] -runas = { version = "0.2" } +runas = { version = "0.2" } +junction = { version = "2.0.0" } diff --git a/src-tauri/src/commands/backup.rs b/src-tauri/src/commands/backup.rs index c6ab372..341323c 100644 --- a/src-tauri/src/commands/backup.rs +++ b/src-tauri/src/commands/backup.rs @@ -705,10 +705,14 @@ pub async fn create_ini_backup( server_id: String, install_path: String, backup_dir: String, - platform: String, ) -> Result { + #[cfg(target_os = "windows")] + let platform = "WindowsServer"; + #[cfg(not(target_os = "windows"))] + let platform = "LinuxServer"; + let config_dir = PathBuf::from(&install_path) - .join("ShooterGame").join("Saved").join("Config").join(&platform); + .join("ShooterGame").join("Saved").join("Config").join(platform); let ini_files = ["GameUserSettings.ini", "Game.ini"]; let sources: Vec = ini_files.iter() @@ -747,6 +751,144 @@ pub async fn create_ini_backup( }) } +/// Create the save directory link used with -SaveDirectoryOverride. +/// +/// Creates: +/// `{base_dir}/Saves/{save_folder_name}/` ← the real save location +/// `{install_path}/ShooterGame/Saved/SavedArks/{save_folder_name}` ← the link target +/// +/// On Linux: a symlink pointing to the base_dir/Saves/ subdirectory. +/// On Windows: an NTFS junction point (no admin rights required for junctions on local filesystems). +/// +/// If the link already exists and already points to the correct target, returns success without changes. +#[tauri::command] +pub async fn create_save_link( + install_path: String, + save_folder_name: String, + base_dir: String, +) -> Result<(), String> { + if save_folder_name.is_empty() { + return Err("save_folder_name must not be empty".to_string()); + } + + // The real save storage directory + let save_target = PathBuf::from(&base_dir).join("Saves").join(&save_folder_name); + fs::create_dir_all(&save_target).map_err(|e| format!("Failed to create save target dir: {e}"))?; + + // The path where the server expects saves (must be the link) + let saved_arks = PathBuf::from(&install_path) + .join("ShooterGame").join("Saved").join("SavedArks"); + fs::create_dir_all(&saved_arks).map_err(|e| format!("Failed to create SavedArks dir: {e}"))?; + + let link_path = saved_arks.join(&save_folder_name); + + // If already correctly linked, do nothing + if link_path.exists() || link_path.is_symlink() { + #[cfg(target_os = "linux")] + { + if let Ok(existing) = std::fs::read_link(&link_path) { + if existing == save_target { + return Ok(()); + } + } + // Wrong target or broken link — remove and recreate + let _ = fs::remove_file(&link_path); + } + #[cfg(target_os = "windows")] + { + // Junction already exists — leave it; user can manage via OS if needed + return Ok(()); + } + } + + #[cfg(target_os = "linux")] + { + std::os::unix::fs::symlink(&save_target, &link_path) + .map_err(|e| format!("Failed to create symlink: {e}"))?; + } + + #[cfg(target_os = "windows")] + { + junction::create(&save_target, &link_path) + .map_err(|e| format!("Failed to create junction point: {e}"))?; + } + + Ok(()) +} + +/// Wipe server save files at one of three tiers: +/// +/// - `"map"` — delete world `.ark` files only (clears map state, preserves characters). +/// - `"players"` — delete `.arkprofile` and `.arktribe` files only (resets characters/tribes). +/// - `"full"` — delete all save files (world + characters + tribe + mod saves). +/// +/// The save directory is `{install_path}/ShooterGame/Saved/SavedArks/{save_folder_name}/` +/// when save_folder_name is non-empty, otherwise `{install_path}/ShooterGame/Saved/SavedArks/`. +/// +/// The server MUST NOT be running when this is called (enforced on the frontend). +#[tauri::command] +pub async fn wipe_server_saves( + install_path: String, + save_folder_name: String, + tier: String, +) -> Result<(), String> { + let saves_root = if save_folder_name.is_empty() { + PathBuf::from(&install_path).join("ShooterGame").join("Saved").join("SavedArks") + } else { + PathBuf::from(&install_path) + .join("ShooterGame").join("Saved").join("SavedArks") + .join(&save_folder_name) + }; + + if !saves_root.exists() { + return Ok(()); + } + + match tier.as_str() { + "map" => { + // Remove world state files: *.ark (but NOT *.arkprofile or *.arktribe) + for entry in fs::read_dir(&saves_root).map_err(|e| e.to_string())? { + let entry = entry.map_err(|e| e.to_string())?; + let path = entry.path(); + if path.is_file() { + let ext = path.extension().and_then(|e| e.to_str()).unwrap_or(""); + if ext == "ark" { + fs::remove_file(&path).map_err(|e| format!("Failed to remove {:?}: {e}", path))?; + } + } + } + } + "players" => { + // Remove character / tribe files: *.arkprofile, *.arktribe + for entry in fs::read_dir(&saves_root).map_err(|e| e.to_string())? { + let entry = entry.map_err(|e| e.to_string())?; + let path = entry.path(); + if path.is_file() { + let ext = path.extension().and_then(|e| e.to_str()).unwrap_or(""); + if ext == "arkprofile" || ext == "arktribe" { + fs::remove_file(&path).map_err(|e| format!("Failed to remove {:?}: {e}", path))?; + } + } + } + } + "full" => { + // Remove everything in the saves directory (but not the directory itself) + for entry in fs::read_dir(&saves_root).map_err(|e| e.to_string())? { + let entry = entry.map_err(|e| e.to_string())?; + let path = entry.path(); + if path.is_file() || path.is_symlink() { + fs::remove_file(&path).map_err(|e| format!("Failed to remove file {:?}: {e}", path))?; + } else if path.is_dir() { + fs::remove_dir_all(&path).map_err(|e| format!("Failed to remove dir {:?}: {e}", path))?; + } + } + } + _ => return Err(format!("Unknown wipe tier: {tier}")), + } + + Ok(()) +} + /// List timestamped INI snapshot folders for a server (newest first). #[tauri::command] pub async fn list_ini_backups( diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 969804d..f0b9c2b 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -494,6 +494,8 @@ pub fn run() { commands::backup::create_player_backup, commands::backup::backup_all_players, commands::backup::create_ini_backup, + commands::backup::create_save_link, + commands::backup::wipe_server_saves, commands::backup::create_full_backup, commands::backup::list_ini_backups, commands::backup::restore_server_backup, diff --git a/src/components/server/tabs/ConfigTab.tsx b/src/components/server/tabs/ConfigTab.tsx index aefc42c..39d9d06 100644 --- a/src/components/server/tabs/ConfigTab.tsx +++ b/src/components/server/tabs/ConfigTab.tsx @@ -19,10 +19,10 @@ import { import { tauriCmd, type ServerConfigJson } from "@/lib/tauri-commands"; import { INI_FIELD_GROUPS, LAUNCH_PARAMETERS, GAME_MODES, PRESET_STYLES, - buildPresetConfig, + buildPresetConfig, ARK_EVENTS, type IniFieldDef, type LaunchParameter, } from "@/data/game-data"; -import { getServerConfig, saveServerConfig, updateServerShutdownSettings, updateServerRestartSettings, updateServerUpdateSettings, getAppSetting, type ServerRow } from "@/lib/db"; +import { getServerConfig, saveServerConfig, updateServerShutdownSettings, updateServerRestartSettings, updateServerUpdateSettings, getAppSetting, setServerActiveEvent, getServers, copyServerConfig, type ServerRow } from "@/lib/db"; import { toast } from "sonner"; import { NumberField } from "@/components/shared/NumberField"; import { open as openFilePicker } from "@tauri-apps/plugin-dialog"; @@ -894,7 +894,6 @@ function QuickSetupModal({ // Quick-edit groups shown in the structured tab (subset of all groups) // --------------------------------------------------------------------------- -const QUICK_EDIT_GROUP_IDS = ["session", "admin", "rates", "breeding"]; // --------------------------------------------------------------------------- // Main ConfigTab @@ -904,6 +903,87 @@ const QUICK_EDIT_GROUP_IDS = ["session", "admin", "rates", "breeding"]; // Shutdown Settings Card // --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// Active Event card +// --------------------------------------------------------------------------- + +function EventCard({ server }: { server: ServerRow }) { + const [activeEventId, setActiveEventId] = useState(server.active_event ?? null); + const [saving, setSaving] = useState(false); + const [saved, setSaved] = useState(false); + + const currentEvent = ARK_EVENTS.find((e) => e.id === activeEventId) ?? null; + + const handleSelect = async (eventId: string | null) => { + setActiveEventId(eventId); + setSaving(true); + try { + await setServerActiveEvent(server.id, eventId); + setSaved(true); + setTimeout(() => setSaved(false), 2000); + } catch (e) { + toast.error(`Failed to save event: ${e}`); + } finally { + setSaving(false); + } + }; + + return ( +
+
+
+ 🎃 +

Active Event

+
+ {saved && Saved} + {saving && !saved && Saving…} +
+ +

+ Activating an event auto-loads its mod on server start and passes -ActiveEvent= to the launcher. + The mod will be locked in the mod list while the event is active. +

+ +
+ + {ARK_EVENTS.map((evt) => ( + + ))} +
+ + {currentEvent && ( +
+ {currentEvent.description} + Mod: {currentEvent.modId} +
+ )} +
+ ); +} + function ShutdownSettingsCard({ server }: { server: ServerRow }) { const [warnPlayers, setWarnPlayers] = useState(server.shutdown_warn_players !== 0); const [warnMinutes, setWarnMinutes] = useState(server.shutdown_warn_minutes ?? 5); @@ -1199,9 +1279,28 @@ export function ConfigTab({ server }: Props) { const [savedFlash, setSavedFlash] = useState(false); const [isDirty, setIsDirty] = useState(false); const [error, setError] = useState(null); - const [showFullModal, setShowFullModal] = useState(false); const [showPasteModal, setShowPasteModal] = useState(false); const [showQuickSetup, setShowQuickSetup] = useState(false); + const [showCopyFromServer, setShowCopyFromServer] = useState(false); + const [copyFromServerId, setCopyFromServerId] = useState(""); + const [otherServers, setOtherServers] = useState([]); + + useEffect(() => { + getServers().then((all) => setOtherServers(all.filter((s) => s.id !== server.id))).catch(() => {}); + }, [server.id]); + + const handleCopyFromServer = async () => { + if (!copyFromServerId) return; + try { + await copyServerConfig(copyFromServerId, server.id); + await loadFromDb(); + setShowCopyFromServer(false); + setCopyFromServerId(""); + toast.success("Config copied"); + } catch (e) { + toast.error(`Failed to copy config: ${e}`); + } + }; // Load from DB on mount — reflects what we last saved, not what the server may have overwritten const loadFromDb = useCallback(async () => { @@ -1360,10 +1459,8 @@ export function ConfigTab({ server }: Props) { // Snapshot INI files into the backup system (best-effort, non-blocking) const backupDir = await getAppSetting("backup_dir").catch(() => null); - const plat = typeof navigator !== "undefined" && !navigator.userAgent.includes("Windows") - ? "LinuxServer" : "WindowsServer"; if (backupDir) { - tauriCmd.createIniBackup(server.id, server.install_path, backupDir, plat).catch(() => {}); + tauriCmd.createIniBackup(server.id, server.install_path, backupDir).catch(() => {}); } } catch (e) { setError(String(e)); @@ -1396,59 +1493,57 @@ export function ConfigTab({ server }: Props) { ); } - // Quick-edit: only show a curated subset of groups - const quickGroups = INI_FIELD_GROUPS.filter((g) => QUICK_EDIT_GROUP_IDS.includes(g.id)); - return (
- {/* Toolbar */} -
-
- - + + {/* ── Sticky toolbar — always visible at top ─────────────────────────── */} +
+ {/* Tab selectors */} +
+ + {!rawMode && ( - <> - - - + )}
+ + {/* Right: dirty badge + import + save */}
{isDirty && ( Unsaved changes )} - {/* Import dropdown */} -
)} - {/* Structured editor — quick groups */} + {/* ── Structured view — ALL INI groups ──────────────────────────────── */} {!rawMode && config && (
- {quickGroups.map((g, idx) => ( + {INI_FIELD_GROUPS.map((g, idx) => ( -

- Click Full INI Editor in the toolbar to access all server settings. -

)} - {/* Raw INI editor */} + {/* ── Raw INI editor ────────────────────────────────────────────────── */} {rawMode && (
@@ -1529,7 +1627,7 @@ export function ConfigTab({ server }: Props) {