feat: Automatic plaintext backup option in Preferences > Backups will backup your notes and tags into plaintext, unencrypted folders on your computer. In addition, automatic encrypted text backups preference management has moved from the top-level menu in the desktop app to Preferences > Backups. (#2322)
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
export type DesktopWatchedDirectoriesChange = {
|
||||
itemUuid: string
|
||||
path: string
|
||||
type: 'rename' | 'change'
|
||||
content: string
|
||||
}
|
||||
|
||||
export type DesktopWatchedDirectoriesChanges = DesktopWatchedDirectoriesChange[]
|
||||
@@ -1,12 +1,44 @@
|
||||
import { FileDownloadProgress } from '../Types/FileDownloadProgress'
|
||||
import { FileBackupRecord, FileBackupsMapping } from './FileBackupsMapping'
|
||||
import { FileBackupsMapping } from './FileBackupsMapping'
|
||||
|
||||
type PlaintextNoteRecord = {
|
||||
tag?: string
|
||||
path: string
|
||||
}
|
||||
|
||||
type UuidString = string
|
||||
export type PlaintextBackupsMapping = {
|
||||
version: string
|
||||
files: Record<UuidString, PlaintextNoteRecord[]>
|
||||
}
|
||||
|
||||
export interface FileBackupsDevice
|
||||
extends FileBackupsMethods,
|
||||
LegacyBackupsMethods,
|
||||
PlaintextBackupsMethods,
|
||||
TextBackupsMethods {
|
||||
openLocation(path: string): Promise<void>
|
||||
|
||||
/**
|
||||
* The reason we combine presenting a directory picker and transfering old files to the new location
|
||||
* in one function is so we don't have to expose a general `transferDirectories` function to the web app,
|
||||
* which would give it too much power.
|
||||
* @param appendPath The path to append to the selected directory.
|
||||
*/
|
||||
presentDirectoryPickerForLocationChangeAndTransferOld(
|
||||
appendPath: string,
|
||||
oldLocation?: string,
|
||||
): Promise<string | undefined>
|
||||
|
||||
monitorPlaintextBackupsLocationForChanges(backupsDirectory: string): Promise<void>
|
||||
}
|
||||
|
||||
export type FileBackupReadToken = string
|
||||
export type FileBackupReadChunkResponse = { chunk: Uint8Array; isLast: boolean; progress: FileDownloadProgress }
|
||||
|
||||
export interface FileBackupsDevice {
|
||||
getFilesBackupsMappingFile(): Promise<FileBackupsMapping>
|
||||
interface FileBackupsMethods {
|
||||
getFilesBackupsMappingFile(location: string): Promise<FileBackupsMapping>
|
||||
saveFilesBackupsFile(
|
||||
location: string,
|
||||
uuid: string,
|
||||
metaFile: string,
|
||||
downloadRequest: {
|
||||
@@ -15,13 +47,26 @@ export interface FileBackupsDevice {
|
||||
url: string
|
||||
},
|
||||
): Promise<'success' | 'failed'>
|
||||
getFileBackupReadToken(record: FileBackupRecord): Promise<FileBackupReadToken>
|
||||
getFileBackupReadToken(filePath: string): Promise<FileBackupReadToken>
|
||||
readNextChunk(token: string): Promise<FileBackupReadChunkResponse>
|
||||
isFilesBackupsEnabled(): Promise<boolean>
|
||||
enableFilesBackups(): Promise<void>
|
||||
disableFilesBackups(): Promise<void>
|
||||
changeFilesBackupsLocation(): Promise<string | undefined>
|
||||
getFilesBackupsLocation(): Promise<string>
|
||||
openFilesBackupsLocation(): Promise<void>
|
||||
openFileBackup(record: FileBackupRecord): Promise<void>
|
||||
}
|
||||
|
||||
interface PlaintextBackupsMethods {
|
||||
getPlaintextBackupsMappingFile(location: string): Promise<PlaintextBackupsMapping>
|
||||
persistPlaintextBackupsMappingFile(location: string): Promise<void>
|
||||
savePlaintextNoteBackup(location: string, uuid: string, name: string, tags: string[], data: string): Promise<void>
|
||||
}
|
||||
|
||||
interface TextBackupsMethods {
|
||||
getTextBackupsCount(location: string): Promise<number>
|
||||
saveTextBackupData(location: string, data: string): Promise<void>
|
||||
getUserDocumentsDirectory(): Promise<string>
|
||||
}
|
||||
|
||||
interface LegacyBackupsMethods {
|
||||
migrateLegacyFileBackupsToNewStructure(newPath: string): Promise<void>
|
||||
isLegacyFilesBackupsEnabled(): Promise<boolean>
|
||||
getLegacyFilesBackupsLocation(): Promise<string | undefined>
|
||||
wasLegacyTextBackupsExplicitlyDisabled(): Promise<boolean>
|
||||
getLegacyTextBackupsLocation(): Promise<string | undefined>
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { FileBackupsConstantsV1 } from './FileBackupsConstantsV1'
|
||||
|
||||
export type FileBackupRecord = {
|
||||
backedUpOn: Date
|
||||
absolutePath: string
|
||||
relativePath: string
|
||||
metadataFileName: typeof FileBackupsConstantsV1.MetadataFileName
|
||||
binaryFileName: typeof FileBackupsConstantsV1.BinaryFileName
|
||||
|
||||
@@ -1,14 +1,35 @@
|
||||
import { OnChunkCallback } from '../Chunker/OnChunkCallback'
|
||||
import { DesktopWatchedDirectoriesChanges } from '../Device/DesktopWatchedChanges'
|
||||
import { FileBackupRecord } from '../Device/FileBackupsMapping'
|
||||
|
||||
export interface BackupServiceInterface {
|
||||
openAllDirectoriesContainingBackupFiles(): void
|
||||
prependWorkspacePathForPath(path: string): string
|
||||
importWatchedDirectoryChanges(changes: DesktopWatchedDirectoriesChanges): Promise<void>
|
||||
|
||||
getFileBackupInfo(file: { uuid: string }): Promise<FileBackupRecord | undefined>
|
||||
readEncryptedFileFromBackup(uuid: string, onChunk: OnChunkCallback): Promise<'success' | 'failed' | 'aborted'>
|
||||
isFilesBackupsEnabled(): Promise<boolean>
|
||||
isFilesBackupsEnabled(): boolean
|
||||
enableFilesBackups(): Promise<void>
|
||||
disableFilesBackups(): Promise<void>
|
||||
disableFilesBackups(): void
|
||||
changeFilesBackupsLocation(): Promise<string | undefined>
|
||||
getFilesBackupsLocation(): Promise<string>
|
||||
getFilesBackupsLocation(): string | undefined
|
||||
openFilesBackupsLocation(): Promise<void>
|
||||
openFileBackup(record: FileBackupRecord): Promise<void>
|
||||
getFileBackupAbsolutePath(record: FileBackupRecord): string
|
||||
|
||||
isTextBackupsEnabled(): boolean
|
||||
enableTextBackups(): Promise<void>
|
||||
disableTextBackups(): void
|
||||
getTextBackupsLocation(): string | undefined
|
||||
openTextBackupsLocation(): Promise<void>
|
||||
changeTextBackupsLocation(): Promise<string | undefined>
|
||||
saveTextBackupData(data: string): Promise<void>
|
||||
|
||||
isPlaintextBackupsEnabled(): boolean
|
||||
enablePlaintextBackups(): Promise<void>
|
||||
disablePlaintextBackups(): void
|
||||
getPlaintextBackupsLocation(): string | undefined
|
||||
openPlaintextBackupsLocation(): Promise<void>
|
||||
changePlaintextBackupsLocation(): Promise<string | undefined>
|
||||
}
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
export * from './Api/DirectoryHandle'
|
||||
export * from './Api/FileHandleRead'
|
||||
export * from './Api/FileHandleReadWrite'
|
||||
export * from './Api/FilesApiInterface'
|
||||
export * from './Api/FileSystemApi'
|
||||
export * from './Api/FileSystemNoSelection'
|
||||
export * from './Api/FileSystemResult'
|
||||
export * from './Api/FilesApiInterface'
|
||||
export * from './Cache/FileMemoryCache'
|
||||
export * from './Chunker/ByteChunker'
|
||||
export * from './Chunker/OnChunkCallback'
|
||||
export * from './Chunker/OrderedByteChunker'
|
||||
export * from './Device/DesktopWatchedChanges'
|
||||
export * from './Device/FileBackupMetadataFile'
|
||||
export * from './Device/FileBackupsConstantsV1'
|
||||
export * from './Device/FileBackupsDevice'
|
||||
export * from './Device/FileBackupsMapping'
|
||||
export * from './Operations/DownloadAndDecrypt'
|
||||
export * from './Operations/EncryptAndUpload'
|
||||
export * from './Service/BackupServiceInterface'
|
||||
export * from './Service/FilesClientInterface'
|
||||
export * from './Service/ReadAndDecryptBackupFileFileSystemAPI'
|
||||
export * from './Service/ReadAndDecryptBackupFileUsingBackupService'
|
||||
export * from './Operations/DownloadAndDecrypt'
|
||||
export * from './Operations/EncryptAndUpload'
|
||||
export * from './UseCase/FileDecryptor'
|
||||
export * from './UseCase/FileUploader'
|
||||
export * from './UseCase/FileEncryptor'
|
||||
export * from './UseCase/FileDownloader'
|
||||
export * from './Types/DecryptedBytes'
|
||||
export * from './Types/EncryptedBytes'
|
||||
export * from './Types/FileDownloadProgress'
|
||||
export * from './Types/FileUploadProgress'
|
||||
export * from './Types/FileUploadResult'
|
||||
export * from './UseCase/FileDecryptor'
|
||||
export * from './UseCase/FileDownloader'
|
||||
export * from './UseCase/FileEncryptor'
|
||||
export * from './UseCase/FileUploader'
|
||||
|
||||
Reference in New Issue
Block a user