From e7e2f097675ee16bad84fa886f14c9e9b714a238 Mon Sep 17 00:00:00 2001 From: circlesabound Date: Mon, 15 Apr 2024 15:29:38 +1000 Subject: [PATCH] Update to point to new factorio-file-parser lib --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- src/agent/error.rs | 8 ++++---- src/agent/main.rs | 2 +- src/agent/server/mods.rs | 2 +- src/mgmt-server/error.rs | 10 +++++----- src/mgmt-server/routes/server.rs | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 606c7b0..5ba6599 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -550,9 +550,9 @@ dependencies = [ ] [[package]] -name = "factorio-mod-settings-parser" -version = "0.1.0" -source = "git+https://github.com/circlesabound/factorio-mod-settings-parser?rev=a9fecd6#a9fecd61ba6851430e1b324c336278d95c8e31d8" +name = "factorio-file-parser" +version = "0.2.0" +source = "git+https://github.com/circlesabound/factorio-file-parser?rev=172a700#172a700e391570dac510603b9c5062bcfb536312" dependencies = [ "serde", ] @@ -567,7 +567,7 @@ dependencies = [ "chrono", "derive_more", "env_logger", - "factorio-mod-settings-parser", + "factorio-file-parser", "futures", "futures-util", "http 1.0.0", diff --git a/Cargo.toml b/Cargo.toml index 59b4323..f55e307 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ bytes = "1.0" chrono = { version = "0.4.37", features = [ "serde" ] } derive_more = "0.99" env_logger = "0.11.3" -factorio-mod-settings-parser = { git = "https://github.com/circlesabound/factorio-mod-settings-parser", rev = "a9fecd6" } +factorio-file-parser = { git = "https://github.com/circlesabound/factorio-file-parser", rev = "172a700" } futures = "0.3" futures-util = "0.3" http = "1.0" diff --git a/src/agent/error.rs b/src/agent/error.rs index fc4738f..6078d5d 100644 --- a/src/agent/error.rs +++ b/src/agent/error.rs @@ -23,9 +23,9 @@ pub enum Error { Aggregate(Vec), // Generic wrappers around external error types + FactorioDatFileSerde(factorio_file_parser::Error), Io(std::io::Error), Json(serde_json::error::Error), - ModSettingsSerde(factorio_mod_settings_parser::Error), Rcon(rcon::Error), Reqwest(reqwest::Error), TomlDe(toml::de::Error), @@ -52,9 +52,9 @@ impl From for Error { } } -impl From for Error { - fn from(e: factorio_mod_settings_parser::Error) -> Self { - Error::ModSettingsSerde(e) +impl From for Error { + fn from(e: factorio_file_parser::Error) -> Self { + Error::FactorioDatFileSerde(e) } } diff --git a/src/agent/main.rs b/src/agent/main.rs index 34bc341..414b674 100644 --- a/src/agent/main.rs +++ b/src/agent/main.rs @@ -18,7 +18,7 @@ use crate::{ }, }; use chrono::Utc; -use factorio_mod_settings_parser::ModSettings; +use factorio_file_parser::ModSettings; use fctrl::schema::*; use futures::Sink; use futures_util::{ diff --git a/src/agent/server/mods.rs b/src/agent/server/mods.rs index a88fe8c..3dd03ae 100644 --- a/src/agent/server/mods.rs +++ b/src/agent/server/mods.rs @@ -4,7 +4,7 @@ use std::{ path::{Path, PathBuf}, }; -use factorio_mod_settings_parser::ModSettings; +use factorio_file_parser::ModSettings; use futures::future; use lazy_static::lazy_static; use log::{debug, error, info}; diff --git a/src/mgmt-server/error.rs b/src/mgmt-server/error.rs index 2bd00bf..787f571 100644 --- a/src/mgmt-server/error.rs +++ b/src/mgmt-server/error.rs @@ -27,10 +27,10 @@ pub enum Error { Rpc(String), // Specific errors + FactorioDatFileParseError(factorio_file_parser::Error), DiscordAlertingDisabled, InvalidLink, ModSettingsNotInitialised, - ModSettingsParseError(factorio_mod_settings_parser::Error), SaveNotFound, SecretsNotInitialised, @@ -51,9 +51,9 @@ impl std::fmt::Display for Error { } } -impl From for Error { - fn from(e: factorio_mod_settings_parser::Error) -> Self { - Error::ModSettingsParseError(e) +impl From for Error { + fn from(e: factorio_file_parser::Error) -> Self { + Error::FactorioDatFileParseError(e) } } @@ -121,7 +121,7 @@ impl<'r> Responder<'r, 'static> for Error { | Error::Io(_) | Error::Json(_) | Error::Reqwest(_) - | Error::ModSettingsParseError(_) + | Error::FactorioDatFileParseError(_) | Error::Misconfiguration(_) | Error::NotImplemented | Error::Rpc(_) => Status::InternalServerError, diff --git a/src/mgmt-server/routes/server.rs b/src/mgmt-server/routes/server.rs index c39e3d2..e94358a 100644 --- a/src/mgmt-server/routes/server.rs +++ b/src/mgmt-server/routes/server.rs @@ -4,7 +4,7 @@ use std::{ time::Duration, }; -use factorio_mod_settings_parser::ModSettings; +use factorio_file_parser::ModSettings; use fctrl::schema::{ mgmt_server_rest::*, FactorioVersion, ModSettingsBytes, RconConfig, SecretsObject, ServerSettingsConfig, ServerStartSaveFile, ServerStatus }; @@ -13,7 +13,7 @@ use rocket::{get, post, put}; use rocket::{http::Status, State}; use crate::{ - auth::AuthorizedUser, clients::AgentApiClient, guards::HostHeader, link_download::{LinkDownloadManager, LinkDownloadTarget}, routes::ContentDisposition, ws::WebSocketServer + auth::AuthorizedUser, clients::AgentApiClient, guards::HostHeader, link_download::{LinkDownloadManager, LinkDownloadTarget}, ws::WebSocketServer }; use crate::{error::Result, routes::WsStreamingResponder};