forked from NG-SD-Plugins/PowerTools
Add tags for persistent settings variants
This commit is contained in:
parent
0373e8d47a
commit
ccf0c04020
8 changed files with 16 additions and 4 deletions
2
backend/Cargo.lock
generated
2
backend/Cargo.lock
generated
|
@ -1170,7 +1170,7 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
|||
|
||||
[[package]]
|
||||
name = "powertools"
|
||||
version = "2.0.0-beta1"
|
||||
version = "2.0.0-beta2"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"chrono",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "powertools"
|
||||
version = "2.0.0-beta1"
|
||||
version = "2.0.0-beta2"
|
||||
edition = "2021"
|
||||
authors = ["NGnius (Graham) <ngniusness@gmail.com>"]
|
||||
description = "Backend (superuser) functionality for PowerTools"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -14,6 +14,7 @@ pub struct SettingsJson {
|
|||
pub gpu: GpuJson,
|
||||
pub battery: BatteryJson,
|
||||
pub provider: Option<DriverJson>,
|
||||
pub tags: Vec<String>,
|
||||
}
|
||||
|
||||
impl Default for SettingsJson {
|
||||
|
@ -27,6 +28,7 @@ impl Default for SettingsJson {
|
|||
gpu: GpuJson::default(),
|
||||
battery: BatteryJson::default(),
|
||||
provider: None,
|
||||
tags: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -37,6 +37,7 @@ pub struct General {
|
|||
pub variant_id: u64,
|
||||
pub variant_name: String,
|
||||
pub driver: crate::persist::DriverJson,
|
||||
pub tags: Vec<String>,
|
||||
}
|
||||
|
||||
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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,6 +139,8 @@ pub trait TGeneral: OnSet + OnResume + OnPowerEvent + OnLoad + OnUnload + Debug
|
|||
) -> Result<Vec<crate::api::VariantInfo>, SettingError>;
|
||||
|
||||
fn provider(&self) -> crate::persist::DriverJson;
|
||||
|
||||
fn tags(&self) -> &'_ [String];
|
||||
}
|
||||
|
||||
pub trait TBattery: OnSet + OnResume + OnPowerEvent + OnLoad + OnUnload + Debug + Send {
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue