refactor: api cleanup (#7812)

* refactor(config): unify YAML persistence

* refactor(config): remove redundant config APIs

* refactor(config): remove unused config APIs

* refactor(config): narrow profile APIs

* fix(config): preserve profiles on invalid reorder

* refactor(startup): narrow resolve helpers

* refactor(config): unify mixed port defaults

* refactor(network): simplify response APIs

* refactor(config): make profile builders infallible

* refactor(config): make profile activation infallible

* refactor(api): simplify internal runtime APIs

* refactor: consolidate internal config and window APIs
This commit is contained in:
Tunglies
2026-08-25 07:19:17 +00:00
committed by GitHub
parent 272c09568c
commit b7c4f7d39b
29 changed files with 277 additions and 413 deletions
+3 -3
View File
@@ -153,7 +153,7 @@ impl Timer {
// Redundant with first_delay == ZERO, kept as the immediate path; mark_task_running
// no-ops whichever of the two arrives second.
let cur_timestamp = chrono::Local::now().timestamp();
if let Some(items) = Config::profiles().await.data_arc().get_items() {
if let Some(items) = Config::profiles().await.data_arc().items.as_ref() {
for item in items.iter() {
if let Some(option) = item.option.as_ref()
&& option.allow_auto_update.unwrap_or(true)
@@ -204,7 +204,7 @@ impl Timer {
}
async fn gen_map(&self) -> HashMap<String, TaskSchedule> {
if let Some(items) = Config::profiles().await.data_arc().get_items() {
if let Some(items) = Config::profiles().await.data_arc().items.as_ref() {
return Self::gen_map_from_items(items);
}
@@ -446,7 +446,7 @@ impl Timer {
let task_interval = *self.timer_map.read().get(uid)?;
let profiles = Config::profiles().await;
let profiles_guard = profiles.latest_arc();
let items = profiles_guard.get_items()?;
let items = profiles_guard.items.as_ref()?;
let profile = items.iter().find(|item| item.uid.as_deref() == Some(uid))?;
let updated = profile.updated.unwrap_or(0) as i64;