chore: upgrade snjs deps

This commit is contained in:
Mo
2022-03-31 14:07:21 -05:00
parent ba0d00c32d
commit 90fcac61e0
6 changed files with 146 additions and 193 deletions

View File

@@ -39,17 +39,18 @@ export class ArchiveManager {
}
public async downloadBackup(encrypted: boolean): Promise<void> {
const intent = encrypted
? EncryptionIntent.FileEncrypted
: EncryptionIntent.FileDecrypted;
const data = encrypted
? await this.application.createEncryptedBackupFile(true)
: await this.application.createDecryptedBackupFile();
const data = await this.application.createBackupFile(intent, true);
if (!data) {
return;
}
const blobData = new Blob([JSON.stringify(data, null, 2)], {
type: 'text/json',
});
if (encrypted) {
this.downloadData(
blobData,

View File

@@ -3,14 +3,14 @@ import {
SNComponent,
ComponentMutator,
AppDataField,
EncryptionIntent,
ApplicationService,
ApplicationEvent,
removeFromArray,
DesktopManagerInterface,
PayloadSource,
EncryptionIntent,
CreateIntentPayloadFromObject,
} from '@standardnotes/snjs';
import { WebAppEvent, WebApplication } from '@/ui_models/application';
import { isDesktopApplication } from '@/utils';
import { Bridge, ElectronDesktopCallbacks } from './bridge';
@@ -68,7 +68,7 @@ export class DesktopManager
* Keys are not passed into ItemParams, so the result is not encrypted
*/
convertComponentForTransmission(component: SNComponent) {
return this.application.protocolService.payloadByEncryptingPayload(
return CreateIntentPayloadFromObject(
component.payloadRepresentation(),
EncryptionIntent.FileDecrypted
);
@@ -158,11 +158,11 @@ export class DesktopManager
}
async desktop_requestBackupFile(): Promise<string | undefined> {
const data = await this.application.createBackupFile(
this.application.hasProtectionSources()
? EncryptionIntent.FileEncrypted
: EncryptionIntent.FileDecrypted
);
const encrypted = this.application.hasProtectionSources();
const data = encrypted
? await this.application.createEncryptedBackupFile(false)
: await this.application.createDecryptedBackupFile();
if (data) {
return JSON.stringify(data, null, 2);
}

View File

@@ -11,6 +11,7 @@ import {
FeatureStatus,
PayloadSource,
PrefKey,
CreateIntentPayloadFromObject,
} from '@standardnotes/snjs';
import { InternalEventBus } from '@standardnotes/services';
@@ -271,17 +272,15 @@ export class ThemeManager extends ApplicationService {
const themes = this.application.items.findItems(
this.activeThemes
) as SNTheme[];
const mapped = await Promise.all(
themes.map(async (theme) => {
const payload = theme.payloadRepresentation();
const processedPayload =
await this.application.protocolService.payloadByEncryptingPayload(
payload,
EncryptionIntent.LocalStorageDecrypted
);
return processedPayload;
})
);
const mapped = themes.map((theme) => {
const payload = theme.payloadRepresentation();
return CreateIntentPayloadFromObject(
payload,
EncryptionIntent.LocalStorageDecrypted
);
});
return this.application.setValue(
CACHED_THEMES_KEY,
mapped,

View File

@@ -15,8 +15,7 @@
"baseUrl": ".",
"jsx": "react-jsx",
"jsxImportSource": "preact",
"typeRoots": ["./@types"],
"types": ["@types/jest"],
"typeRoots": ["./@types", "../../../node_modules/@types"],
"paths": {
"%/*": ["../templates/*"],
"@/*": ["./*"],