Skip to content

Commit

Permalink
authme 1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Nov 25, 2020
1 parent 917e5fb commit 0ffa738
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 42 deletions.
73 changes: 50 additions & 23 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ let ipc1 = false
let ipc2 = false

let confirmed = false
let startup = false

let authme_version = "1.4.1"
let authme_version = "1.4.2"

ipc.on("ver", (event, data) => {
event.returnValue = authme_version
Expand All @@ -40,56 +41,74 @@ let to_tray = false
let show_tray = false
let pass_start = false

const file_path = path.join(process.env.APPDATA, "/Levminer/Authme")

let createWindow = () => {
window0 = new BrowserWindow({
show: false,
backgroundColor: "#2A2424",
webPreferences: {
preload: path.join(__dirname, "preload.js"),
nodeIntegration: true,
},
})

window1 = new BrowserWindow({
show: false,
backgroundColor: "#2A2424",
webPreferences: {
preload: path.join(__dirname, "preload.js"),
nodeIntegration: true,
},
})

window2 = new BrowserWindow({
show: false,
backgroundColor: "#2A2424",
webPreferences: {
preload: path.join(__dirname, "preload.js"),
nodeIntegration: true,
},
})

window3 = new BrowserWindow({
show: false,
backgroundColor: "#2A2424",
webPreferences: {
preload: path.join(__dirname, "preload.js"),
nodeIntegration: true,
},
})

window4 = new BrowserWindow({
show: false,
backgroundColor: "#2A2424",
webPreferences: {
preload: path.join(__dirname, "preload.js"),
nodeIntegration: true,
},
})

window5 = new BrowserWindow({
show: false,
backgroundColor: "#2A2424",
webPreferences: {
preload: path.join(__dirname, "preload.js"),
nodeIntegration: true,
},
})

window0.maximize()

window1.hide()
window2.hide()
window3.hide()
window4.hide()
window5.hide()
fs.readFile(path.join(file_path, "pass.md"), "utf-8", (err, data) => {
if (err) {
fs.readFile(path.join(file_path, "nrpw.md"), "utf-8", (err, data) => {
if (err) {
window0.maximize()
}
})
} else {
window0.maximize()
}
})

window0.loadFile("./app/landing/index.html")
window1.loadFile("./app/confirm/index.html")
Expand Down Expand Up @@ -174,19 +193,29 @@ ipc.on("to_confirm", () => {
})

ipc.on("to_application0", () => {
if (ipc1 == false) {
confirmed = true
window2.maximize()
if (ipc1 == false && startup == false) {
window1.hide()

setTimeout(() => {
window2.maximize()
window2.show()
}, 300)

ipc1 = true

confirmed = true
}
})

ipc.on("to_application1", () => {
if (ipc2 == false) {
if (ipc2 == false && startup == false) {
window0.hide()
window2.maximize()
window2.show()

setTimeout(() => {
window2.maximize()
window2.show()
}, 300)

ipc2 = true
}
})
Expand Down Expand Up @@ -231,9 +260,9 @@ ipc.on("after_data", () => {
})

ipc.on("after_startup0", () => {
let file_path = path.join(process.env.APPDATA, "/Microsoft/Windows/Start Menu/Programs/Startup/Authme Launcher.lnk")
let startup_path = path.join(process.env.APPDATA, "/Microsoft/Windows/Start Menu/Programs/Startup/Authme Launcher.lnk")

fs.unlink(file_path, (err) => {
fs.unlink(startup_path, (err) => {
if (err && err.code === "ENOENT") {
return console.log("startup shortcut not deleted")
} else {
Expand Down Expand Up @@ -264,6 +293,7 @@ ipc.on("after_tray1", () => {
ipc.on("startup", () => {
window2.hide()
window1.hide()
startup = true
})

ipc.on("app_path", () => {
Expand All @@ -288,8 +318,11 @@ app.whenReady().then(() => {
splash.show()

setTimeout(() => {
splash.hide()
createWindow()
}, 1000)

setTimeout(() => {
splash.hide()
}, 1500)

// make tray
Expand All @@ -300,8 +333,6 @@ app.whenReady().then(() => {
{
label: "Show app",
click: () => {
const file_path = path.join(process.env.APPDATA, "/Levminer/Authme")

let if_pass = false
let if_nopass = false

Expand Down Expand Up @@ -509,8 +540,6 @@ app.whenReady().then(() => {
{
label: "Import",
click: () => {
const file_path = path.join(process.env.APPDATA, "/Levminer/Authme")

let if_pass = false
let if_nopass = false

Expand Down Expand Up @@ -574,8 +603,6 @@ app.whenReady().then(() => {
{
label: "Export",
click: () => {
const file_path = path.join(process.env.APPDATA, "/Levminer/Authme")

let if_pass = false
let if_nopass = false

Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "authme",
"version": "1.4.1",
"version": "1.4.2",
"description": "A simple 2FA app for desktop built with Electron and Node.js.",
"main": "main.js",
"scripts": {
Expand All @@ -16,12 +16,12 @@
"author": "Levminer",
"license": "MIT",
"devDependencies": {
"electron": "^10.1.4",
"electron": "^11.0.3",
"electron-packager": "^15.0.0"
},
"dependencies": {
"bcrypt": "^5.0.0",
"create-desktop-shortcuts": "^1.1.0",
"create-desktop-shortcuts": "^1.2.0",
"cryptr": "^6.0.2",
"jimp": "^0.16.1",
"qrcode": "^1.4.4",
Expand Down
18 changes: 9 additions & 9 deletions preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ if (!fs.existsSync(file_path)) {
fs.mkdirSync(path.join(process.env.APPDATA, "Levminer", "Authme"))
}

fs.readFile(path.join(file_path, "saos.md"), "utf-8", (err, data) => {
if (err) {
return console.log("The saos.md file dont exist!")
} else {
console.log("The saos.md file exist!")
ipc.send("startup")
}
})

fs.readFile(path.join(file_path, "pass.md"), "utf-8", (err, data) => {
if (err) {
return console.log("The pass.md fle dont exist!")
Expand All @@ -30,12 +39,3 @@ fs.readFile(path.join(file_path, "nrpw.md"), "utf-8", (err, data) => {
ipc.send("to_application1")
}
})

fs.readFile(path.join(file_path, "saos.md"), "utf-8", (err, data) => {
if (err) {
return console.log("The saos.md file dont exist!")
} else {
console.log("The saos.md file exist!")
ipc.send("startup")
}
})

0 comments on commit 0ffa738

Please sign in to comment.