Connected Devices: Added sync feature

This commit is contained in:
Ultradesu
2026-07-24 00:54:27 +03:00
parent 7fe6ddfe05
commit adbb76b031
13 changed files with 3095 additions and 16 deletions
+52
View File
@@ -49,6 +49,16 @@ pub enum Effect {
FedSyncNow,
/// Fetch this peer's ticket and show it in a popup.
FedShowTicket,
/// Generate a personal-device invite and show it in a popup.
DeviceShowInvite,
/// Connect this client to a trusted device by opaque frid invite.
DeviceConnectInvite(String),
/// Force an immediate personal-device sync.
DeviceSyncNow,
/// Persist and publish this device's display name.
DeviceSetName(String),
/// Revoke a trusted device.
DeviceRevoke(String),
/// Assemble the federated artist card (fan-out to the owning peers).
FedOpenArtist(String),
/// Download federated tracks into the local library, one by one.
@@ -2333,6 +2343,48 @@ fn federation_select(state: &mut AppState) -> Option<Effect> {
});
None
}
SettingsRow::DeviceName => {
let name = state
.federation
.devices
.as_ref()
.map(|status| status.this_device_name.clone())
.unwrap_or_default();
state.popup = Some(Popup::FedInput {
field: FedInputField::DeviceName,
input: crate::app::input::LineEdit::new(name),
});
None
}
SettingsRow::DeviceInvite => Some(Effect::DeviceShowInvite),
SettingsRow::DeviceConnect => {
state.popup = Some(Popup::FedInput {
field: FedInputField::ConnectInvite,
input: crate::app::input::LineEdit::default(),
});
None
}
SettingsRow::DeviceSyncNow => Some(Effect::DeviceSyncNow),
SettingsRow::Device(index) => {
let Some(device) = state
.federation
.devices
.as_ref()
.and_then(|status| status.devices.get(index))
.cloned()
else {
return None;
};
if device.is_self || device.revoked {
state.status_message = Some("this device cannot be revoked here".to_string());
return None;
}
state.popup = Some(Popup::ConfirmDeviceRevoke {
device_id: device.device_id,
name: device.name,
});
None
}
SettingsRow::VisualizationClock => {
match state.visualizer.toggle_clock() {
Ok(()) => {