diff --git a/src/bin/kawari-admin.rs b/src/bin/kawari-admin.rs index 6a408a7..6d4f4ed 100644 --- a/src/bin/kawari-admin.rs +++ b/src/bin/kawari-admin.rs @@ -18,7 +18,7 @@ async fn root() -> Html { let environment = setup_default_environment(); let template = environment.get_template("admin.html").unwrap(); - Html(template.render(context! { worlds_open => config.frontier.worlds_open, login_open => config.frontier.login_open, boot_patch_location => config.boot_patches_location }).unwrap()) + Html(template.render(context! { worlds_open => config.frontier.worlds_open, login_open => config.frontier.login_open, boot_patch_location => config.patch.patches_location }).unwrap()) } #[derive(Deserialize, Debug)] @@ -47,7 +47,7 @@ async fn apply(Form(input): Form) -> Redirect { } if let Some(boot_patch_location) = input.boot_patch_location { - config.boot_patches_location = boot_patch_location; + config.patch.patches_location = boot_patch_location; } serde_yaml_ng::to_writer(&std::fs::File::create("config.yaml").unwrap(), &config) diff --git a/src/bin/kawari-patch.rs b/src/bin/kawari-patch.rs index a9ba9b4..bc195fd 100644 --- a/src/bin/kawari-patch.rs +++ b/src/bin/kawari-patch.rs @@ -108,7 +108,7 @@ async fn verify_boot( let actual_boot_version = boot_version.split("?time").collect::>()[0]; // check if we need any patching - let patches = list_patch_files(&config.boot_patches_location); + let patches = list_patch_files(&config.patch.patches_location); for patch in patches { let patch_str: &str = &patch; if actual_boot_version.partial_cmp(patch_str).unwrap() == Ordering::Less { @@ -119,7 +119,7 @@ async fn verify_boot( patch_length: todo!(), content_location: todo!(), patches: vec![PatchEntry { - url: format!("http://{}", patch).to_string(), + url: format!("http://{}/{}", config.patch.patch_dl_url, patch).to_string(), version: "2023.09.15.0000.0000".to_string(), hash_block_size: 50000000, length: 1479062470, diff --git a/src/config.rs b/src/config.rs index 703239f..e8461c6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -118,6 +118,17 @@ impl LoginConfig { pub struct PatchConfig { pub port: u16, pub listen_address: String, + /// Publicly accessible URL to download patches from. + /// For example, "patch-dl.ffxiv.localhost". Patch files must be served so they're accessible as: "http://patch-dl.ffxiv.localhost/game/ex4/somepatchfilename.patch" + pub patch_dl_url: String, + /// Location of the patches directory on disk. Must be setup like so: + /// ``` + /// (e.g. ffxivneo_release_game) / + /// game/ + /// ex1/ + /// ... + /// ``` + pub patches_location: String, } impl Default for PatchConfig { @@ -125,6 +136,8 @@ impl Default for PatchConfig { Self { port: 6900, listen_address: "127.0.0.1".to_string(), + patch_dl_url: "patch-dl.ffxiv.localhost".to_string(), + patches_location: String::new(), } } } @@ -201,9 +214,6 @@ pub struct Config { #[serde(default = "default_supported_platforms")] pub supported_platforms: Vec, - #[serde(default)] - pub boot_patches_location: String, - #[serde(default)] pub game_location: String, @@ -232,7 +242,6 @@ pub struct Config { impl Default for Config { fn default() -> Self { Self { - boot_patches_location: String::new(), supported_platforms: default_supported_platforms(), game_location: String::new(), admin: AdminConfig::default(),