diff --git a/backend/Cargo.lock b/backend/Cargo.lock index d194ab7..d76f0c1 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -1170,7 +1170,7 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "powertools" -version = "2.0.0-beta1" +version = "2.0.0-beta2" dependencies = [ "async-trait", "chrono", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 22c2fbd..5d5e6a9 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "powertools" -version = "2.0.0-beta1" +version = "2.0.0-beta2" edition = "2021" authors = ["NGnius (Graham) "] description = "Backend (superuser) functionality for PowerTools" diff --git a/backend/src/api/web.rs b/backend/src/api/web.rs index 9301064..8222fa2 100644 --- a/backend/src/api/web.rs +++ b/backend/src/api/web.rs @@ -265,6 +265,7 @@ fn web_config_to_settings_json( root: None, }, provider: Some(crate::persist::DriverJson::AutoDetect), + tags: meta.tags, } } @@ -328,7 +329,7 @@ fn settings_to_web_config( steam_app_id: app_id, steam_user_id: user_id, steam_username: username, - tags: vec!["wip".to_owned()], + tags: settings.tags, id: "".to_owned(), config: community_settings_core::v1::Config { cpus: settings diff --git a/backend/src/persist/general.rs b/backend/src/persist/general.rs index fe18898..8cc93b7 100644 --- a/backend/src/persist/general.rs +++ b/backend/src/persist/general.rs @@ -14,6 +14,7 @@ pub struct SettingsJson { pub gpu: GpuJson, pub battery: BatteryJson, pub provider: Option, + pub tags: Vec, } impl Default for SettingsJson { @@ -27,6 +28,7 @@ impl Default for SettingsJson { gpu: GpuJson::default(), battery: BatteryJson::default(), provider: None, + tags: Vec::new(), } } } diff --git a/backend/src/settings/detect/auto_detect.rs b/backend/src/settings/detect/auto_detect.rs index 7ebba0e..256f97a 100644 --- a/backend/src/settings/detect/auto_detect.rs +++ b/backend/src/settings/detect/auto_detect.rs @@ -69,6 +69,7 @@ pub fn auto_detect0( variant_id, variant_name, driver: DriverJson::AutoDetect, + tags: settings_opt.map(|s| s.tags.clone()).unwrap_or_else(|| Vec::new()), }); let cpu_info: String = usdpl_back::api::files::read_single("/proc/cpuinfo").unwrap_or_default(); diff --git a/backend/src/settings/general.rs b/backend/src/settings/general.rs index 1cc1a33..ea95661 100644 --- a/backend/src/settings/general.rs +++ b/backend/src/settings/general.rs @@ -37,6 +37,7 @@ pub struct General { pub variant_id: u64, pub variant_name: String, pub driver: crate::persist::DriverJson, + pub tags: Vec, } impl OnSet for General { @@ -175,6 +176,10 @@ impl TGeneral for General { fn provider(&self) -> crate::persist::DriverJson { self.driver.clone() } + + fn tags(&self) -> &[String] { + &self.tags + } } #[derive(Debug)] @@ -439,6 +444,7 @@ impl Settings { gpu: self.gpu.json(), battery: self.battery.json(), provider: Some(self.general.provider()), + tags: self.general.tags().to_owned(), } } } diff --git a/backend/src/settings/traits.rs b/backend/src/settings/traits.rs index 2c8524f..468f676 100644 --- a/backend/src/settings/traits.rs +++ b/backend/src/settings/traits.rs @@ -139,6 +139,8 @@ pub trait TGeneral: OnSet + OnResume + OnPowerEvent + OnLoad + OnUnload + Debug ) -> Result, SettingError>; fn provider(&self) -> crate::persist::DriverJson; + + fn tags(&self) -> &'_ [String]; } pub trait TBattery: OnSet + OnResume + OnPowerEvent + OnLoad + OnUnload + Debug + Send { diff --git a/package.json b/package.json index 540a2fc..be7d9cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "PowerTools", - "version": "2.0.0-beta1", + "version": "2.0.0-beta2", "description": "Power tweaks for power users", "scripts": { "build": "shx rm -rf dist && rollup -c",