uncomment out electron
This commit is contained in:
parent
9eb793d606
commit
78183874b4
4 changed files with 33 additions and 28 deletions
|
@ -6,7 +6,8 @@
|
|||
"build": "yarn lint && tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ente/shared": "*"
|
||||
"@ente/shared": "*",
|
||||
"is-electron": "^2.2.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ente/eslint-config": "*",
|
||||
|
|
|
@ -37,8 +37,7 @@ import FormPaper from '@ente/shared/components/Form/FormPaper';
|
|||
import FormPaperTitle from '@ente/shared/components/Form/FormPaper/Title';
|
||||
import FormPaperFooter from '@ente/shared/components/Form/FormPaper/Footer';
|
||||
import LinkButton from '@ente/shared/components/LinkButton';
|
||||
// import isElectron from 'is-electron';
|
||||
// import safeStorageService from 'services/electron/safeStorage';
|
||||
import isElectron from 'is-electron';
|
||||
import { VerticallyCentered } from '@ente/shared/components/Container';
|
||||
import EnteSpinner from '@ente/shared/components/EnteSpinner';
|
||||
import VerifyMasterPasswordForm, {
|
||||
|
@ -53,6 +52,7 @@ import InMemoryStore, { MS_KEYS } from '@ente/shared/storage/InMemoryStore';
|
|||
import { PageProps } from '@ente/shared/apps/types';
|
||||
import { APPS } from '@ente/shared/apps/constants';
|
||||
import { logError } from '@ente/shared/sentry';
|
||||
import ElectronAPIs from '@ente/shared/electron';
|
||||
|
||||
export default function Credentials({
|
||||
appContext,
|
||||
|
@ -78,17 +78,17 @@ export default function Credentials({
|
|||
return;
|
||||
}
|
||||
setUser(user);
|
||||
const key = getKey(SESSION_KEYS.ENCRYPTION_KEY);
|
||||
// if (!key && isElectron()) {
|
||||
// key = await safeStorageService.getEncryptionKey();
|
||||
// if (key) {
|
||||
// await saveKeyInSessionStore(
|
||||
// SESSION_KEYS.ENCRYPTION_KEY,
|
||||
// key,
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
let key = getKey(SESSION_KEYS.ENCRYPTION_KEY);
|
||||
if (!key && isElectron()) {
|
||||
key = await ElectronAPIs.getEncryptionKey();
|
||||
if (key) {
|
||||
await saveKeyInSessionStore(
|
||||
SESSION_KEYS.ENCRYPTION_KEY,
|
||||
key,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
if (key) {
|
||||
router.push(PAGES.GALLERY);
|
||||
return;
|
||||
|
|
|
@ -6,6 +6,8 @@ import { clearData } from '@ente/shared/storage/localStorage';
|
|||
import { logError } from '@ente/shared/sentry';
|
||||
import { clearFiles } from '@ente/shared/storage/localForage/helpers';
|
||||
import router from 'next/router';
|
||||
import ElectronAPIs from '@ente/shared/electron';
|
||||
import isElectron from 'is-electron';
|
||||
|
||||
export const logoutUser = async () => {
|
||||
try {
|
||||
|
@ -41,13 +43,13 @@ export const logoutUser = async () => {
|
|||
} catch (e) {
|
||||
logError(e, 'clearFiles failed');
|
||||
}
|
||||
// if (isElectron()) {
|
||||
// try {
|
||||
// safeStorageService.clearElectronStore();
|
||||
// } catch (e) {
|
||||
// logError(e, 'clearElectronStore failed');
|
||||
// }
|
||||
// }
|
||||
if (isElectron()) {
|
||||
try {
|
||||
ElectronAPIs.clearElectronStore();
|
||||
} catch (e) {
|
||||
logError(e, 'clearElectronStore failed');
|
||||
}
|
||||
}
|
||||
// try {
|
||||
// eventBus.emit(Events.LOGOUT);
|
||||
// } catch (e) {
|
||||
|
|
|
@ -6,6 +6,8 @@ import { getActualKey } from '@ente/shared/user';
|
|||
import { KeyAttributes } from '@ente/shared/user/types';
|
||||
import { setRecoveryKey } from '@ente/accounts/api/user';
|
||||
import { logError } from '@ente/shared/sentry';
|
||||
import isElectron from 'is-electron';
|
||||
import ElectronAPIs from '../electron';
|
||||
|
||||
const LOGIN_SUB_KEY_LENGTH = 32;
|
||||
const LOGIN_SUB_KEY_ID = 1;
|
||||
|
@ -103,13 +105,13 @@ export const saveKeyInSessionStore = async (
|
|||
);
|
||||
setKey(keyType, sessionKeyAttributes);
|
||||
console.log('fromDesktop', fromDesktop);
|
||||
// if (
|
||||
// isElectron() &&
|
||||
// !fromDesktop &&
|
||||
// keyType === SESSION_KEYS.ENCRYPTION_KEY
|
||||
// ) {
|
||||
// safeStorageService.setEncryptionKey(key);
|
||||
// }
|
||||
if (
|
||||
isElectron() &&
|
||||
!fromDesktop &&
|
||||
keyType === SESSION_KEYS.ENCRYPTION_KEY
|
||||
) {
|
||||
ElectronAPIs.setEncryptionKey(key);
|
||||
}
|
||||
};
|
||||
|
||||
export async function encryptWithRecoveryKey(key: string) {
|
||||
|
|
Loading…
Add table
Reference in a new issue