From 888631bc48dd749c7f8c1769c652500476919050 Mon Sep 17 00:00:00 2001 From: zhom <2717306+zhom@users.noreply.github.com> Date: Tue, 24 Mar 2026 00:55:51 +0400 Subject: [PATCH] refactor: anyone can use e2ee except non-owner team members --- src-tauri/src/sync/engine.rs | 9 +-------- src-tauri/src/sync/manifest.rs | 1 - src/components/profile-sync-dialog.tsx | 7 ++++--- src/components/settings-dialog.tsx | 9 ++++----- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src-tauri/src/sync/engine.rs b/src-tauri/src/sync/engine.rs index 3b1933b..d33a951 100644 --- a/src-tauri/src/sync/engine.rs +++ b/src-tauri/src/sync/engine.rs @@ -2908,15 +2908,8 @@ pub async fn set_profile_sync_mode( } } - // If switching to Encrypted, verify eligibility, password, and generate salt + // If switching to Encrypted, verify password is set and generate salt if new_mode == SyncMode::Encrypted { - // Only pro users and team owners can enable encryption - if let Some(state) = crate::cloud_auth::CLOUD_AUTH.get_user().await { - if state.user.plan == "team" && state.user.team_role.as_deref() != Some("owner") { - return Err("Profile encryption is available for Pro users and team owners.".to_string()); - } - } - if !encryption::has_e2e_password() { return Err("E2E password not set. Please set a password in Settings first.".to_string()); } diff --git a/src-tauri/src/sync/manifest.rs b/src-tauri/src/sync/manifest.rs index fac9400..21833db 100644 --- a/src-tauri/src/sync/manifest.rs +++ b/src-tauri/src/sync/manifest.rs @@ -36,7 +36,6 @@ pub const DEFAULT_EXCLUDE_PATTERNS: &[&str] = &[ "**/storage/temporary/**", "**/crashes/**", "**/minidumps/**", - "*.log", "*.tmp", "**/LOG", "**/LOG.old", diff --git a/src/components/profile-sync-dialog.tsx b/src/components/profile-sync-dialog.tsx index 3c351b2..4863492 100644 --- a/src/components/profile-sync-dialog.tsx +++ b/src/components/profile-sync-dialog.tsx @@ -41,10 +41,11 @@ export function ProfileSyncDialog({ cloudUser.plan !== "free" && (cloudUser.subscriptionStatus === "active" || cloudUser.planPeriod === "lifetime"); + // Encryption available to everyone except team members who aren't owners const canUseEncryption = - isCloudSyncEligible && - cloudUser != null && - (cloudUser.plan !== "team" || cloudUser.teamRole === "owner"); + cloudUser == null || + cloudUser.plan !== "team" || + cloudUser.teamRole === "owner"; const [isSaving, setIsSaving] = useState(false); const [isSyncing, setIsSyncing] = useState(false); const [syncMode, setSyncMode] = useState( diff --git a/src/components/settings-dialog.tsx b/src/components/settings-dialog.tsx index 31405ca..8b26958 100644 --- a/src/components/settings-dialog.tsx +++ b/src/components/settings-dialog.tsx @@ -134,12 +134,11 @@ export function SettingsDialog({ } = usePermissions(); const { trialStatus } = useCommercialTrial(); const { user: cloudUser } = useCloudAuth(); + // Encryption is available to everyone except team members who aren't owners const canUseEncryption = - cloudUser != null && - cloudUser.plan !== "free" && - (cloudUser.subscriptionStatus === "active" || - cloudUser.planPeriod === "lifetime") && - (cloudUser.plan !== "team" || cloudUser.teamRole === "owner"); + cloudUser == null || + cloudUser.plan !== "team" || + cloudUser.teamRole === "owner"; const { currentLanguage, changeLanguage,