Skip to content

Commit

Permalink
authme 2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer authored Dec 15, 2020
1 parent 41850fb commit 5807cda
Show file tree
Hide file tree
Showing 10 changed files with 272 additions and 165 deletions.
14 changes: 7 additions & 7 deletions app/application/src/js/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const speakeasy = require("speakeasy")
const speakeasy = require("@levminer/speakeasy")
const { app } = require("electron").remote
const fs = require("fs")
const path = require("path")
Expand Down Expand Up @@ -105,15 +105,15 @@ const go = () => {
</div>
<div class="div2">
<h3>Code</h3>
<input type="text" class="input1" id="code${counter}" />
<input type="text" class="input1" id="code${counter}" readonly/>
</div>
<div class="div3">
<h3>Time</h3>
<p class="text2" id="time${counter}">Time</p>
</div>
<div class="div4">
<p class="text3" id="text${counter}">Text</p>
<button class="button11" id="copy${counter}">Copy code</button>
<button class="button11" id="copy${counter}" >Copy code</button>
</div>
</div>
`
Expand All @@ -126,7 +126,7 @@ const go = () => {
</div>
<div class="div2">
<h3>Code</h3>
<input type="text" class="input1" id="code${counter}" />
<input type="text" class="input1" id="code${counter}" readonly/>
</div>
<div class="div3">
<h3>Time</h3>
Expand All @@ -149,7 +149,7 @@ const go = () => {
</div>
<div class="div2">
<h3>Code</h3>
<input type="text" class="input1" id="code${counter}" />
<input type="text" class="input1" id="code${counter}" readonly/>
</div>
<div class="div3">
<h3>Time</h3>
Expand All @@ -169,7 +169,7 @@ const go = () => {
</div>
<div class="div2">
<h3>Code</h3>
<input type="text" class="input1" id="code${counter}" />
<input type="text" class="input1" id="code${counter}" readonly/>
</div>
<div class="div3">
<h3>Time</h3>
Expand Down Expand Up @@ -238,7 +238,7 @@ const go = () => {
time.textContent = remaining

clearInterval(int0)
}, 800)
}, 500)

// copy
const el = copy.addEventListener("click", () => {
Expand Down
2 changes: 1 addition & 1 deletion app/application/src/js/save.js

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

4 changes: 4 additions & 0 deletions app/export/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ <h2 class="h2">Export</h2>
<p class="text3 p0">You can export everything form your saved config.</p>
<button class="button1 but0" onclick="hide()">Close</button>
<div class="before_export">
<h3>Authme Web</h3>
<p class="text3 p1">You can use your exported config in Authme Web.</p>
<button class="button1 but1" id="but0" onclick="aw()">Open</button>
<br />
<h3>Start export</h3>
<p class="text3 p1">If you saved your config you can export the secrects and the QR codes.</p>
<button class="button1 but1" id="but0" onclick="exp()">Export</button>
Expand Down
6 changes: 5 additions & 1 deletion app/export/src/js/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const electron = require("electron")
const { app, dialog } = require("electron").remote
const { app, dialog, shell } = require("electron").remote
const fs = require("fs")
const path = require("path")
const qrcode = require("qrcode")
Expand Down Expand Up @@ -169,3 +169,7 @@ const save_qr_codes = () => {
const hide = () => {
ipc.send("hide2")
}

const aw = () => {
shell.openExternal("https://web.authme.levminer.com")
}
6 changes: 5 additions & 1 deletion app/settings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ <h1>Authme</h1>
<h2>Settings</h2>
<p class="text3">You can configure the app setting here.</p>
<button class="button1" onclick="hide()">Close</button>
<h3>Status</h3>
<p class="text3" id="status">All systems online.</p>
<button class="button1" id="but6" onclick="page()">Status</button>
<br />
<h3>Launch on startup</h3>
<p class="text3">Start the app after the operating system loaded. The app will start on the tray (Windows only).</p>
<button class="button1" id="but0" onclick="startup()">-</button>
<button class="button1" id="but0" onclick="page()">-</button>
<br />
<h3>Close app to tray</h3>
<p class="text3">On closing the app will not quit. You can open the app from the tray menu (Windows only).</p>
Expand Down
7 changes: 6 additions & 1 deletion app/settings/src/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ body {
.center {
top: -50px;
width: 1000px;
height: 1500px;
height: 1700px;
}

.button1 {
Expand Down Expand Up @@ -58,3 +58,8 @@ body {
top: 50px;
color: white !important;
}

#status {
font-size: 28px;
font-weight: bold;
}
33 changes: 33 additions & 0 deletions app/settings/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const fs = require("fs")
const electron = require("electron")
const ipc = electron.ipcRenderer
const path = require("path")
const fetch = require("node-fetch")

const version = ipc.sendSync("ver")

Expand Down Expand Up @@ -191,6 +192,38 @@ const folder1 = () => {
shell.showItemInFolder(file_path)
}

// ? Status API
const status = document.querySelector("#status")

const api = async () => {
try {
await fetch("https://api.levminer.com/api/v1/status/all")
.then((res) => res.json())
.then((data) => {
try {
if (data.state === "up") {
status.style.color = "green"
} else {
status.textContent = "Some systems offline"
status.style.color = "red"
}
} catch (error) {
return console.log(error)
}
})
} catch (error) {
status.textContent = "Can't connect to API"
status.style.color = "red"
}
}

api()

// ? Open Status
const page = () => {
shell.openExternal("https://status.levminer.com")
}

const hide = () => {
ipc.send("hide0")
}
172 changes: 103 additions & 69 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ let ipc_to_application_1 = false
let confirmed = false
let startup = false

const authme_version = "2.1.0"
const tag_name = "2.1.0"
const authme_version = "2.1.1"
const tag_name = "2.1.1"

ipc.on("ver", (event, data) => {
event.returnValue = authme_version
Expand Down Expand Up @@ -401,39 +401,56 @@ const createWindow = () => {

// ? check for auto update
window2.on("show", () => {
const api = () => {
fetch("https://api.github.com/repos/Levminer/authme/releases/latest")
.then((res) => res.json())
.then((data) => {
try {
if (data.tag_name != tag_name && data.tag_name != undefined) {
dialog
.showMessageBox({
title: "Authme",
buttons: ["Yes", "No"],
defaultId: 0,
cancelId: 1,
type: "info",
message: `
Update available: Authme ${data.tag_name}
Do you want to download it?
You currently running: Authme ${tag_name}
`,
})
.then((result) => {
update = true

if (result.response === 0) {
shell.openExternal("https://github.com/Levminer/authme/releases/latest")
}
})
const api = async () => {
try {
await fetch("https://api.github.com/repos/Levminer/authme/releases/latest")
.then((res) => res.json())
.then((data) => {
try {
if (data.tag_name != tag_name && data.tag_name != undefined) {
dialog
.showMessageBox({
title: "Authme",
buttons: ["Yes", "No"],
defaultId: 0,
cancelId: 1,
type: "info",
message: `
Update available: Authme ${data.tag_name}
Do you want to download it?
You currently running: Authme ${tag_name}
`,
})
.then((result) => {
update = true

if (result.response === 0) {
shell.openExternal("https://github.com/Levminer/authme/releases/latest")
}
})
}
} catch (error) {
return console.log(error)
}
} catch (error) {
return console.log(error)
}
})
} catch (error) {
dialog.showMessageBox({
title: "Authme",
buttons: ["Close"],
defaultId: 0,
cancelId: 1,
type: "info",
message: `
No update available:
Can't connect to API!
You currently running: Authme ${tag_name}
`,
})
}
}

if (update_start == false) {
Expand Down Expand Up @@ -781,54 +798,71 @@ app.whenReady().then(() => {
label: "Update",
accelerator: file.shortcuts.update,
click: () => {
const api = () => {
fetch("https://api.github.com/repos/Levminer/authme/releases/latest")
.then((res) => res.json())
.then((data) => {
try {
if (data.tag_name != tag_name && data.tag_name != undefined) {
dialog
.showMessageBox({
const api = async () => {
try {
await fetch("https://api.levminer.com/api/v1/authme/releases")
.then((res) => res.json())
.then((data) => {
try {
if (data.tag_name != tag_name && data.tag_name != undefined) {
dialog
.showMessageBox({
title: "Authme",
buttons: ["Yes", "No"],
defaultId: 0,
cancelId: 1,
type: "info",
message: `
Update available: Authme ${data.tag_name}
Do you want to download it?
You currently running: Authme ${tag_name}
`,
})
.then((result) => {
update = true

if (result.response === 0) {
shell.openExternal("https://github.com/Levminer/authme/releases/latest")
}
})
} else {
dialog.showMessageBox({
title: "Authme",
buttons: ["Yes", "No"],
buttons: ["Close"],
defaultId: 0,
cancelId: 1,
type: "info",
message: `
Update available: Authme ${data.tag_name}
No update available:
Do you want to download it?
You running the latest version!
You currently running: Authme ${tag_name}
`,
})
.then((result) => {
update = true

if (result.response === 0) {
shell.openExternal("https://github.com/Levminer/authme/releases/latest")
}
})
} else {
dialog.showMessageBox({
title: "Authme",
buttons: ["Close"],
defaultId: 0,
cancelId: 1,
type: "info",
message: `
No update available:
You running the latest version!
You currently running: Authme ${tag_name}
`,
})
}
} catch (error) {
return console.log(error)
}
} catch (error) {
return console.log(error)
}
})
} catch (error) {
dialog.showMessageBox({
title: "Authme",
buttons: ["Close"],
defaultId: 0,
cancelId: 1,
type: "info",
message: `
No update available:
Can't connect to API!
You currently running: Authme ${tag_name}
`,
})
}
}

api()
Expand Down
Loading

0 comments on commit 5807cda

Please sign in to comment.