mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-10 19:47:42 +00:00
chore(deps): refresh package locks and Rust warnings
This commit is contained in:
@@ -436,7 +436,7 @@ fn normalize_download(mut payload: ExtensionRequest) -> Option<ExtensionDownload
|
||||
let filename = payload.filename.and_then(|value| sanitize_filename(&value));
|
||||
let batch = payload.batch && urls.len() >= 2;
|
||||
let batch_name = batch
|
||||
.then(|| payload.batch_name)
|
||||
.then_some(payload.batch_name)
|
||||
.flatten()
|
||||
.and_then(|value| {
|
||||
let value = value.trim().to_string();
|
||||
|
||||
+6
-21
@@ -214,10 +214,11 @@ pub enum Theme {
|
||||
Nord,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, TS)]
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, TS)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
#[ts(export, export_to = "../../src/bindings/")]
|
||||
pub enum FontFamily {
|
||||
#[default]
|
||||
System,
|
||||
Inter,
|
||||
Outfit,
|
||||
@@ -229,16 +230,11 @@ pub enum FontFamily {
|
||||
Monospace,
|
||||
}
|
||||
|
||||
impl Default for FontFamily {
|
||||
fn default() -> Self {
|
||||
Self::System
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, TS)]
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, TS)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[ts(export, export_to = "../../src/bindings/")]
|
||||
pub enum WindowControlStyle {
|
||||
#[default]
|
||||
Auto,
|
||||
Macos,
|
||||
Windows,
|
||||
@@ -246,27 +242,16 @@ pub enum WindowControlStyle {
|
||||
Minimal,
|
||||
}
|
||||
|
||||
impl Default for WindowControlStyle {
|
||||
fn default() -> Self {
|
||||
Self::Auto
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, TS)]
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, TS)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[ts(export, export_to = "../../src/bindings/")]
|
||||
pub enum CalendarPreference {
|
||||
#[default]
|
||||
Gregorian,
|
||||
Persian,
|
||||
Hebrew,
|
||||
}
|
||||
|
||||
impl Default for CalendarPreference {
|
||||
fn default() -> Self {
|
||||
Self::Gregorian
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, TS)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[ts(export, export_to = "../../src/bindings/")]
|
||||
|
||||
@@ -8851,9 +8851,11 @@ fn observe_aria2_connections_with_epoch(
|
||||
now,
|
||||
} = sample;
|
||||
if observation.gid != gid || observation.control_epoch != control_epoch {
|
||||
let preserved_recovery_attempts = (observation.control_epoch == control_epoch)
|
||||
.then_some(observation.recovery_attempts)
|
||||
.unwrap_or_default();
|
||||
let preserved_recovery_attempts = if observation.control_epoch == control_epoch {
|
||||
observation.recovery_attempts
|
||||
} else {
|
||||
Default::default()
|
||||
};
|
||||
*observation = Aria2ConnectionObservation {
|
||||
gid: gid.to_string(),
|
||||
control_epoch,
|
||||
|
||||
+60
-47
@@ -26,17 +26,30 @@ fn stop_is_due(
|
||||
&& last_stop_key != stop_key
|
||||
}
|
||||
|
||||
fn overnight_stop_is_due(
|
||||
struct OvernightStopCheck<'a> {
|
||||
stop_time_enabled: bool,
|
||||
start_minute: Option<u32>,
|
||||
stop_minute: Option<u32>,
|
||||
current_minute: u32,
|
||||
previous_day_allowed: bool,
|
||||
last_start_key: &str,
|
||||
previous_start_key: &str,
|
||||
last_stop_key: &str,
|
||||
stop_key: &str,
|
||||
) -> bool {
|
||||
last_start_key: &'a str,
|
||||
previous_start_key: &'a str,
|
||||
last_stop_key: &'a str,
|
||||
stop_key: &'a str,
|
||||
}
|
||||
|
||||
fn overnight_stop_is_due(check: OvernightStopCheck<'_>) -> bool {
|
||||
let OvernightStopCheck {
|
||||
stop_time_enabled,
|
||||
start_minute,
|
||||
stop_minute,
|
||||
current_minute,
|
||||
previous_day_allowed,
|
||||
last_start_key,
|
||||
previous_start_key,
|
||||
last_stop_key,
|
||||
stop_key,
|
||||
} = check;
|
||||
stop_time_enabled
|
||||
&& previous_day_allowed
|
||||
&& start_minute.zip(stop_minute).is_some_and(|(start, stop)| {
|
||||
@@ -126,17 +139,17 @@ pub fn spawn_scheduler(
|
||||
let previous_start_key = previous_day
|
||||
.map(|day| format!("{}-start", day.format("%Y-%m-%d")))
|
||||
.unwrap_or_default();
|
||||
let overnight_stop_due = overnight_stop_is_due(
|
||||
scheduler.stop_time_enabled,
|
||||
let overnight_stop_due = overnight_stop_is_due(OvernightStopCheck {
|
||||
stop_time_enabled: scheduler.stop_time_enabled,
|
||||
start_minute,
|
||||
stop_minute,
|
||||
current_minute,
|
||||
previous_day_allowed,
|
||||
&scheduler_last_start_key,
|
||||
&previous_start_key,
|
||||
&scheduler_last_stop_key,
|
||||
&stop_key,
|
||||
);
|
||||
last_start_key: &scheduler_last_start_key,
|
||||
previous_start_key: &previous_start_key,
|
||||
last_stop_key: &scheduler_last_stop_key,
|
||||
stop_key: &stop_key,
|
||||
});
|
||||
|
||||
if (same_day_stop_due || overnight_stop_due)
|
||||
&& last_emit
|
||||
@@ -159,7 +172,7 @@ pub fn spawn_scheduler(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{minute_of_day, overnight_stop_is_due, stop_is_due};
|
||||
use super::{minute_of_day, overnight_stop_is_due, stop_is_due, OvernightStopCheck};
|
||||
|
||||
#[test]
|
||||
fn parses_valid_scheduler_times() {
|
||||
@@ -199,38 +212,38 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn overnight_stop_uses_the_previous_day_start() {
|
||||
assert!(overnight_stop_is_due(
|
||||
true,
|
||||
Some(1320),
|
||||
Some(360),
|
||||
420,
|
||||
true,
|
||||
"2026-06-22-start",
|
||||
"2026-06-22-start",
|
||||
"",
|
||||
"2026-06-23-stop",
|
||||
));
|
||||
assert!(!overnight_stop_is_due(
|
||||
true,
|
||||
Some(1320),
|
||||
Some(360),
|
||||
1380,
|
||||
true,
|
||||
"2026-06-22-start",
|
||||
"2026-06-22-start",
|
||||
"",
|
||||
"2026-06-22-stop",
|
||||
));
|
||||
assert!(!overnight_stop_is_due(
|
||||
true,
|
||||
Some(1320),
|
||||
Some(360),
|
||||
420,
|
||||
false,
|
||||
"2026-06-22-start",
|
||||
"2026-06-22-start",
|
||||
"",
|
||||
"2026-06-23-stop",
|
||||
));
|
||||
assert!(overnight_stop_is_due(OvernightStopCheck {
|
||||
stop_time_enabled: true,
|
||||
start_minute: Some(1320),
|
||||
stop_minute: Some(360),
|
||||
current_minute: 420,
|
||||
previous_day_allowed: true,
|
||||
last_start_key: "2026-06-22-start",
|
||||
previous_start_key: "2026-06-22-start",
|
||||
last_stop_key: "",
|
||||
stop_key: "2026-06-23-stop",
|
||||
}));
|
||||
assert!(!overnight_stop_is_due(OvernightStopCheck {
|
||||
stop_time_enabled: true,
|
||||
start_minute: Some(1320),
|
||||
stop_minute: Some(360),
|
||||
current_minute: 1380,
|
||||
previous_day_allowed: true,
|
||||
last_start_key: "2026-06-22-start",
|
||||
previous_start_key: "2026-06-22-start",
|
||||
last_stop_key: "",
|
||||
stop_key: "2026-06-22-stop",
|
||||
}));
|
||||
assert!(!overnight_stop_is_due(OvernightStopCheck {
|
||||
stop_time_enabled: true,
|
||||
start_minute: Some(1320),
|
||||
stop_minute: Some(360),
|
||||
current_minute: 420,
|
||||
previous_day_allowed: false,
|
||||
last_start_key: "2026-06-22-start",
|
||||
previous_start_key: "2026-06-22-start",
|
||||
last_stop_key: "",
|
||||
stop_key: "2026-06-23-stop",
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user