Skip to content

Commit

Permalink
Clear data delete startup entry #98
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed May 3, 2021
1 parent d2fe077 commit e2fe79d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion app/export/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const save_qr_codes = () => {

// ? hide
const hide = () => {
ipc.send("hide2")
ipc.send("hide_export")
}

// ? authme web
Expand Down
2 changes: 1 addition & 1 deletion app/import/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ const link0 = () => {

// ? hide
const hide = () => {
ipc.send("hide1")
ipc.send("hide_import")
}
22 changes: 8 additions & 14 deletions app/settings/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const startup = () => {
but0.textContent = "Off"
startup_state = false

ipc.send("after_startup0")
ipc.send("disable_startup")
} else {
file.settings.launch_on_startup = true

Expand All @@ -144,7 +144,7 @@ const startup = () => {
but0.textContent = "On"
startup_state = true

ipc.send("after_startup1")
ipc.send("enable_startup")
}
}

Expand Down Expand Up @@ -214,21 +214,15 @@ const reset = () => {
})

// remove start shortcut
const file_path2 = path.join(process.env.APPDATA, "/Microsoft/Windows/Start Menu/Programs/Startup/Authme Launcher.lnk")

if (dev !== true) {
fs.unlink(file_path2, (err) => {
if (err && err.code === "ENOENT") {
return console.warn(`Authme - Error deleting shortcut - ${err}`)
} else {
console.warn("Authme - File shortcut deleted")
}
})
ipc.send("disable_startup")
}

// clear localstorage
localStorage.clear()
sessionStorage.clear()
if (dev !== true) {
localStorage.clear()
sessionStorage.clear()
}

// restarting
but1.textContent = "Restarting app"
Expand Down Expand Up @@ -514,7 +508,7 @@ const link2 = () => {
}

const hide = () => {
ipc.send("hide0")
ipc.send("hide_settings")
}

document.querySelector(".settings").disabled = true
Expand Down
19 changes: 9 additions & 10 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,6 @@ const authme_launcher = new AutoLaunch({
})

// ? ipcs

ipc.on("to_confirm", () => {
if (ipc_to_confirm == false) {
window_confirm.maximize()
Expand Down Expand Up @@ -616,7 +615,7 @@ ipc.on("to_application1", () => {
}
})

ipc.on("hide0", () => {
ipc.on("hide_settings", () => {
if (settings_shown == false) {
window_settings.maximize()
window_settings.show()
Expand All @@ -627,7 +626,7 @@ ipc.on("hide0", () => {
}
})

ipc.on("hide1", () => {
ipc.on("hide_import", () => {
if (import_shown == false) {
window_import.maximize()
window_import.show()
Expand All @@ -638,7 +637,7 @@ ipc.on("hide1", () => {
}
})

ipc.on("hide2", () => {
ipc.on("hide_export", () => {
if (export_shown == false) {
window_export.maximize()
window_export.show()
Expand All @@ -649,13 +648,13 @@ ipc.on("hide2", () => {
}
})

ipc.on("after_startup0", () => {
ipc.on("disable_startup", () => {
authme_launcher.disable()

console.log("Authme - Startup disabled")
})

ipc.on("after_startup1", () => {
ipc.on("enable_startup", () => {
authme_launcher.enable()

console.log("Authme - Startup enabled")
Expand Down Expand Up @@ -693,10 +692,10 @@ ipc.on("abort", () => {
cancelId: 1,
noLink: true,
message: `
Failed to check the integrity of the files.
You or someone messed with the settings file, shutting down for security reasons!
`,
Failed to check the integrity of the files.
You or someone messed with the settings file, shutting down for security reasons!
`,
})
.then((result) => {
if (result.response === 0) {
Expand Down

0 comments on commit e2fe79d

Please sign in to comment.