Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: fix app asking password on auto backups with encryption off

Abdullah Attae5795bcbb215
diff --git a/apps/web/src/common/index.ts b/apps/web/src/common/index.ts
index e0d140c71..d01c20f16 100644
--- a/apps/web/src/common/index.ts
+++ b/apps/web/src/common/index.ts
@@ -77,12 +77,19 @@ export async function introduceFeatures() {
export const DEFAULT_CONTEXT = { colors: [], tags: [], notebook: {} };
-export async function createBackup(rescueMode = false) {
+export async function createBackup(
+ options: {
+ rescueMode?: boolean;
+ noVerify?: boolean;
+ } = {}
+) {
+ const { rescueMode, noVerify } = options;
const { isLoggedIn } = useUserStore.getState();
const { encryptBackups, toggleEncryptBackups } = useSettingStore.getState();
if (!isLoggedIn && encryptBackups) toggleEncryptBackups();
- const verified = rescueMode || encryptBackups || (await verifyAccount());
+ const verified =
+ rescueMode || encryptBackups || noVerify || (await verifyAccount());
if (!verified) {
showToast("error", "Could not create a backup: user verification failed.");
return false;
diff --git a/apps/web/src/common/notices.ts b/apps/web/src/common/notices.ts
index 6bbf46cab..5f541b12c 100644
--- a/apps/web/src/common/notices.ts
+++ b/apps/web/src/common/notices.ts
@@ -177,7 +177,7 @@ function isIgnored(key: keyof typeof NoticesData) {
let openedToast: { hide: () => void } | null = null;
async function saveBackup() {
if (IS_DESKTOP_APP) {
- await createBackup();
+ await createBackup({ noVerify: true });
} else if (isUserPremium() && !IS_TESTING) {
if (openedToast !== null) return;
openedToast = showToast(
diff --git a/apps/web/src/components/announcements/body.jsx b/apps/web/src/components/announcements/body.jsx
index fc7906c44..80952eae4 100644
--- a/apps/web/src/components/announcements/body.jsx
+++ b/apps/web/src/components/announcements/body.jsx
@@ -307,7 +307,7 @@ function CalltoAction({ action, variant, sx, dismissAnnouncement }) {
break;
}
case "backup": {
- await createBackup(true);
+ await createBackup();
break;
}
default: {
diff --git a/apps/web/src/views/recovery.tsx b/apps/web/src/views/recovery.tsx
index 62b8b2214..629512df8 100644
--- a/apps/web/src/views/recovery.tsx
+++ b/apps/web/src/views/recovery.tsx
@@ -458,7 +458,7 @@ function BackupData(props: BaseRecoveryComponentProps<"backup">) {
"Please wait while we create a backup file for you to download."
}}
onSubmit={async () => {
- await createBackup(true);
+ await createBackup({ rescueMode: true });
navigate("new");
}}
>