feat: file backups (#1024)
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
import { DeviceInterface, Environment } from '@standardnotes/snjs'
|
||||
import { WebClientRequiresDesktopMethods } from './DesktopWebCommunication'
|
||||
import { WebOrDesktopDeviceInterface } from './WebOrDesktopDeviceInterface'
|
||||
|
||||
export function isDesktopDevice(x: DeviceInterface): x is DesktopDeviceInterface {
|
||||
return x.environment === Environment.Desktop
|
||||
}
|
||||
|
||||
export interface DesktopDeviceInterface extends WebOrDesktopDeviceInterface, WebClientRequiresDesktopMethods {
|
||||
environment: Environment.Desktop
|
||||
}
|
||||
@@ -1 +1,9 @@
|
||||
export { Environment, RawKeychainValue } from '@standardnotes/snjs'
|
||||
export {
|
||||
Environment,
|
||||
RawKeychainValue,
|
||||
DesktopDeviceInterface,
|
||||
WebOrDesktopDeviceInterface,
|
||||
DesktopClientRequiresWebMethods,
|
||||
FileBackupsMapping,
|
||||
FileBackupsDevice,
|
||||
} from '@standardnotes/snjs'
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import { DecryptedTransferPayload } from '@standardnotes/snjs'
|
||||
|
||||
export interface WebClientRequiresDesktopMethods {
|
||||
localBackupsCount(): Promise<number>
|
||||
|
||||
viewlocalBackups(): void
|
||||
|
||||
deleteLocalBackups(): Promise<void>
|
||||
|
||||
syncComponents(payloads: unknown[]): void
|
||||
|
||||
onMajorDataChange(): void
|
||||
|
||||
onInitialDataLoad(): void
|
||||
|
||||
/**
|
||||
* Destroys all sensitive storage data, such as localStorage, IndexedDB, and other log files.
|
||||
*/
|
||||
destroyAllData(): void
|
||||
|
||||
onSearch(text?: string): void
|
||||
|
||||
downloadBackup(): void | Promise<void>
|
||||
|
||||
get extensionsServerHost(): string
|
||||
}
|
||||
|
||||
export interface DesktopClientRequiresWebMethods {
|
||||
updateAvailable(): void
|
||||
|
||||
windowGainedFocus(): void
|
||||
|
||||
windowLostFocus(): void
|
||||
|
||||
onComponentInstallationComplete(componentData: DecryptedTransferPayload, error: unknown): Promise<void>
|
||||
|
||||
requestBackupFile(): Promise<string | undefined>
|
||||
|
||||
didBeginBackup(): void
|
||||
|
||||
didFinishBackup(success: boolean): void
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Environment, RawKeychainValue } from '@standardnotes/snjs'
|
||||
import { WebOrDesktopDevice } from '@/Device/WebOrDesktopDevice'
|
||||
import { WebOrDesktopDevice } from './WebOrDesktopDevice'
|
||||
|
||||
const KEYCHAIN_STORAGE_KEY = 'keychain'
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ import {
|
||||
TransferPayload,
|
||||
NamespacedRootKeyInKeychain,
|
||||
extendArray,
|
||||
WebOrDesktopDeviceInterface,
|
||||
} from '@standardnotes/snjs'
|
||||
import { Database } from '../Database'
|
||||
import { WebOrDesktopDeviceInterface } from './WebOrDesktopDeviceInterface'
|
||||
|
||||
export abstract class WebOrDesktopDevice implements WebOrDesktopDeviceInterface {
|
||||
constructor(public appVersion: string) {}
|
||||
@@ -18,7 +18,7 @@ export abstract class WebOrDesktopDevice implements WebOrDesktopDeviceInterface
|
||||
|
||||
abstract environment: Environment
|
||||
|
||||
setApplication(application: SNApplication) {
|
||||
setApplication(application: SNApplication): void {
|
||||
const database = new Database(application.identifier, application.alertService)
|
||||
|
||||
this.databases.push(database)
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { DeviceInterface, RawKeychainValue } from '@standardnotes/snjs'
|
||||
|
||||
export interface WebOrDesktopDeviceInterface extends DeviceInterface {
|
||||
readonly appVersion: string
|
||||
|
||||
getKeychainValue(): Promise<RawKeychainValue>
|
||||
|
||||
setKeychainValue(value: RawKeychainValue): Promise<void>
|
||||
}
|
||||
Reference in New Issue
Block a user