mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-22 19:25:56 +00:00
feat: install a new Docker server from the install screen (Linux)
The install commands ask coa_core::platform::flavor() once and hand a Docker install to src-tauri/src/docker_install.rs; the repack arm of each command is untouched (an early return and an extra optional parameter are all that changed in lib.rs). New command install_environment tells the screen the kind of server, the suggested folder (~/CoaServer) and why Docker cannot be used, if it cannot. On Linux the install screen shows the game data folder (used in place, read-only) and the server package (a folder or an address; there is no default address until a signed Linux package is published), and disables Install until both are given and Docker works. It shows Docker's own message with a "Check again" button when Docker is missing, stopped or not allowed for the user. The Windows screen is unchanged (checked side by side in the browser mock). A debug build (tauri dev) accepts another package key named in COA_DEV_TRUSTED_KEY, to try the installer on a package signed with a throwaway key; a release build always uses the embedded key. New text is English only for now (other languages fall back to it).
This commit is contained in:
1 parent
58c1e1aee0
commit
45a699d2ca
9 files changed
+276
-16
No files matched your search
@@ -31,6 +31,7 @@ pub mod repair;
|
||||
pub mod schema_check;
|
||||
pub mod net;
|
||||
pub mod package;
|
||||
pub mod platform;
|
||||
pub mod ra;
|
||||
pub mod allsettings;
|
||||
pub mod modules;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
//! Which kind of server a new installation is on this computer. This is the one place where the host decides: a Windows
|
||||
//! computer installs a repack, anything else installs a Docker server. The screens and the commands ask here and then
|
||||
//! call the code of that kind, so no platform check is scattered through shared code.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub enum Flavor {
|
||||
/// The CoA Repack: Windows executables supervised by the repack's launcher.
|
||||
Repack,
|
||||
/// MySQL, the auth server and the world server in Docker containers.
|
||||
Docker,
|
||||
}
|
||||
|
||||
pub fn flavor() -> Flavor {
|
||||
if cfg!(windows) {
|
||||
Flavor::Repack
|
||||
} else {
|
||||
Flavor::Docker
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn the_host_decides_once() {
|
||||
#[cfg(windows)]
|
||||
assert_eq!(flavor(), Flavor::Repack);
|
||||
#[cfg(not(windows))]
|
||||
assert_eq!(flavor(), Flavor::Docker);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_screens_read_the_flavor_as_a_plain_word() {
|
||||
assert_eq!(serde_json::to_string(&Flavor::Repack).unwrap(), "\"repack\"");
|
||||
assert_eq!(serde_json::to_string(&Flavor::Docker).unwrap(), "\"docker\"");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user