Skip to content

Commit

Permalink
fix app start delete db when passowrd error
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilb committed Sep 14, 2021
1 parent 537d7c4 commit deaeb27
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 20 deletions.
1 change: 1 addition & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@ function getDefaultSQLKey() {
}

async function removeDB() {
// this don't remove attachments and stuff like that...
const userDir = await getRealPath(app.getPath('userData'));
await sql.removeDB(userDir);

Expand Down
15 changes: 1 addition & 14 deletions password_preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ window.getEnvironment = () => config.environment;
window.getVersion = () => config.version;
window.getAppInstance = () => config.appInstance;

const electron = require('electron');

const ipc = electron.ipcRenderer;
const { SessionPasswordPrompt } = require('./ts/components/session/SessionPasswordPrompt');

window.Signal = {
Expand All @@ -34,21 +31,11 @@ window.Signal = {

window.Signal.Logs = require('./js/modules/logs');

window.resetDatabase = () => {
window.clearLocalData = async () => {
window.log.info('reset database');
ipcRenderer.send('resetDatabase');
};

window.restart = () => {
window.log.info('restart');
ipc.send('restart');
};

window.clearLocalData = async () => {
window.resetDatabase();
window.restart();
};

window.onLogin = passPhrase =>
new Promise((resolve, reject) => {
ipcRenderer.once('password-window-login-response', (event, error) => {
Expand Down
5 changes: 0 additions & 5 deletions preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,6 @@ window.restart = () => {
ipc.send('restart');
};

window.resetDatabase = () => {
window.log.info('reset database');
ipc.send('resetDatabase');
};

ipc.on('mediaPermissionsChanged', () => {
Whisper.events.trigger('mediaPermissionsChanged');
});
Expand Down
1 change: 0 additions & 1 deletion ts/window.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ declare global {
lokiSnodeAPI: LokiSnodeAPI;
onLogin: any;
persistStore?: Persistor;
resetDatabase: any;
restart: any;
getSeedNodeList: () => Array<any> | undefined;
setPassword: any;
Expand Down

0 comments on commit deaeb27

Please sign in to comment.