Skip to content

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

feat: export file storage clear function

thecodrr1ddbbcdc89af
diff --git a/apps/web/packages/streamablefs/index.ts b/apps/web/packages/streamablefs/index.ts
index acc2a2b4e..c995e650a 100644
--- a/apps/web/packages/streamablefs/index.ts
+++ b/apps/web/packages/streamablefs/index.ts
@@ -50,4 +50,8 @@ export class StreamableFS implements IStreamableFS {
await handle.delete();
return true;
}
+
+ async clear(): Promise<void> {
+ await this.storage.clear();
+ }
}
diff --git a/apps/web/packages/streamablefs/src/interfaces.ts b/apps/web/packages/streamablefs/src/interfaces.ts
index 8e15e01a1..e5a43dc99 100644
--- a/apps/web/packages/streamablefs/src/interfaces.ts
+++ b/apps/web/packages/streamablefs/src/interfaces.ts
@@ -5,4 +5,5 @@ export interface IStreamableFS {
readFile(filename: string): Promise<FileHandle | undefined>;
exists(filename: string): Promise<boolean>;
deleteFile(filename: string): Promise<boolean>;
+ clear(): Promise<void>;
}
diff --git a/apps/web/src/interfaces/fs.js b/apps/web/src/interfaces/fs.js
index 49bb9d121..4c28f526f 100644
--- a/apps/web/src/interfaces/fs.js
+++ b/apps/web/src/interfaces/fs.js
@@ -351,6 +351,10 @@ async function deleteFile(filename, requestOptions) {
return result;
}
+function clearFileStorage() {
+ return streamablefs.clear();
+}
+
const FS = {
writeEncrypted,
readEncrypted,
@@ -362,6 +366,7 @@ const FS = {
hashBuffer,
hashStream,
writeEncryptedFile,
+ clearFileStorage,
};
export default FS;
diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.js
index f503b5b15..23d04f83b 100644
--- a/apps/web/src/views/settings.js
+++ b/apps/web/src/views/settings.js
@@ -801,15 +801,15 @@ function AccountStatus(props) {
mt={2}
>
{remainingDays > 0 && isPro
- ? `Subscribed to Notesnook Pro.`
+ ? `Subscribed to Notesnook Pro`
: remainingDays > 0 && isTrial
- ? "Your free trial has started."
+ ? "Your free trial has started"
: isBeta
- ? "Your beta subscription has ended."
+ ? "Your beta subscription has ended"
: isTrial
- ? "Your trial has ended."
+ ? "Your trial has ended"
: isPro
- ? "Your Notesnook Pro subscription has ended."
+ ? "Your Notesnook Pro subscription has ended"
: ""}
</Text>
{subtitle && <Text variant="subBody">{subtitle}</Text>}