mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-06-01 04:41:36 +02:00
refactor: creation button disaster recovery
This commit is contained in:
@@ -991,6 +991,17 @@ pub async fn save_sync_settings(
|
||||
sync_server_url: Option<String>,
|
||||
sync_token: Option<String>,
|
||||
) -> Result<SyncSettings, String> {
|
||||
// Cloud login and self-hosted sync share the same sync engine and a
|
||||
// profile can't be sync'd to two backends at once. Block any *write*
|
||||
// (non-null URL or token) while the user is signed into their cloud
|
||||
// account — the clearing path (both `None`) is always allowed so logged-
|
||||
// in users can wipe a stale self-hosted config that pre-dates their
|
||||
// sign-in.
|
||||
let is_setting_self_hosted = sync_server_url.is_some() || sync_token.is_some();
|
||||
if is_setting_self_hosted && crate::cloud_auth::CLOUD_AUTH.is_logged_in().await {
|
||||
return Err(serde_json::json!({ "code": "SELF_HOSTED_REQUIRES_LOGOUT" }).to_string());
|
||||
}
|
||||
|
||||
let manager = SettingsManager::instance();
|
||||
|
||||
manager
|
||||
|
||||
Reference in New Issue
Block a user