Skip to content

Commit

Permalink
Settings improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Apr 22, 2022
1 parent 9594686 commit 82a50e0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 215 deletions.
23 changes: 0 additions & 23 deletions app/settings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,29 +202,6 @@ <h4 data-loc>Clear password, 2FA codes and all other settings. Be careful.</h4>
<span data-loc>Clear data</span>
</button>
<hr />
<h3 data-loc>Open folders</h3>
<h4 data-loc>You can open the folders Authme uses. Editing or deleting files might cause problems.</h4>
<div class="flex flex-row flex-wrap justify-center gap-3">
<button class="buttoni" onclick="authmeFolder()">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 19a2 2 0 01-2-2V7a2 2 0 012-2h4l2 2h4a2 2 0 012 2v1M5 19h14a2 2 0 002-2v-5a2 2 0 00-2-2H9a2 2 0 00-2 2v5a2 2 0 01-2 2z" />
</svg>
<span data-loc>Authme folder</span>
</button>
<button class="buttoni" onclick="settingsFolder()">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 19a2 2 0 01-2-2V7a2 2 0 012-2h4l2 2h4a2 2 0 012 2v1M5 19h14a2 2 0 002-2v-5a2 2 0 00-2-2H9a2 2 0 00-2 2v5a2 2 0 01-2 2z" />
</svg>
<span data-loc>Settings folder</span>
</button>
<button class="buttoni" onclick="cacheFolder()">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 19a2 2 0 01-2-2V7a2 2 0 012-2h4l2 2h4a2 2 0 012 2v1M5 19h14a2 2 0 002-2v-5a2 2 0 00-2-2H9a2 2 0 00-2 2v5a2 2 0 01-2 2z" />
</svg>
<span data-loc>Cache folder</span>
</button>
</div>
<hr />
<h3 data-loc>Logs</h3>
<h4 data-loc>You can view the logs for debugging. You can view all the logs in the settings folder.</h4>
<div class="flex flex-row flex-wrap justify-center gap-3">
Expand Down
72 changes: 24 additions & 48 deletions app/settings/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const { ipcRenderer: ipc } = require("electron")
const bcrypt = require("bcryptjs")
const path = require("path")
const fs = require("fs")
const { createBackupFile, loadBackupFile, changePassword } = require(path.join(__dirname, "src", "js", "security.js"))

/**
* Send error to main process
Expand All @@ -26,23 +25,6 @@ localization.localize("settings")

const lang = localization.getLang()

/**
* Build number
*/
const buildNumber = async () => {
const info = await ipc.invoke("info")

if (info.build_number.startsWith("alpha")) {
document.querySelector(".build-content").textContent = `You are running an alpha version of Authme - Version ${info.authme_version} - Build ${info.build_number}`
document.querySelector(".build").style.display = "block"
} else if (info.build_number.startsWith("beta")) {
document.querySelector(".build-content").textContent = `You are running a beta version of Authme - Version ${info.authme_version} - Build ${info.build_number}`
document.querySelector(".build").style.display = "block"
}
}

buildNumber()

/**
* If running in development
*/
Expand Down Expand Up @@ -394,7 +376,7 @@ const codesDescription = () => {
}

toggle()
reload()
reloadApplicationWindow()
}

/**
Expand Down Expand Up @@ -424,7 +406,7 @@ const searchHistory = () => {
}

toggle()
reload()
reloadApplicationWindow()
}

/**
Expand Down Expand Up @@ -454,7 +436,7 @@ const resetCopy = () => {
}

toggle()
reload()
reloadApplicationWindow()
}

/**
Expand Down Expand Up @@ -662,8 +644,6 @@ const languageDropdownChoose = (id) => {
})
}

// default

/**
* Save settings to disk
*/
Expand All @@ -678,27 +658,6 @@ const provideFeedback = () => {
ipc.send("provideFeedback")
}

/**
* Open Authme folder
*/
const authmeFolder = () => {
shell.showItemInFolder(app.getPath("exe"))
}

/**
* Open setting folder
*/
const settingsFolder = () => {
shell.openPath(folder_path)
}

/**
* Open cache folder
*/
const cacheFolder = () => {
shell.openPath(path.join(app.getPath("appData"), "Authme"))
}

/*
* Open latest log
*/
Expand All @@ -718,6 +677,11 @@ const logsFolder = () => {
shell.openPath(path.join(folder_path, "logs"))
}

/* Experimental docs */
const githubIssues = () => {
shell.openExternal("https://github.com/Levminer/authme/issues")
}

/**
* Hide window
*/
Expand Down Expand Up @@ -852,7 +816,7 @@ const about = () => {
/**
* Reload application window
*/
const reload = () => {
const reloadApplicationWindow = () => {
ipc.send("reloadApplicationWindow")

/** @type{LibStorage} */ storage = dev ? JSON.parse(localStorage.getItem("dev_storage")) : JSON.parse(localStorage.getItem("storage"))
Expand Down Expand Up @@ -880,7 +844,19 @@ window.addEventListener("click", (event) => {
}
})

/* Experimental docs */
const githubIssues = () => {
shell.openExternal("https://github.com/Levminer/authme/issues")
/**
* Build number
*/
const buildNumber = async () => {
const info = await ipc.invoke("info")

if (info.build_number.startsWith("alpha")) {
document.querySelector(".build-content").textContent = `You are running an alpha version of Authme - Version ${info.authme_version} - Build ${info.build_number}`
document.querySelector(".build").style.display = "block"
} else if (info.build_number.startsWith("beta")) {
document.querySelector(".build-content").textContent = `You are running a beta version of Authme - Version ${info.authme_version} - Build ${info.build_number}`
document.querySelector(".build").style.display = "block"
}
}

buildNumber()
134 changes: 0 additions & 134 deletions app/settings/src/js/security.js

This file was deleted.

5 changes: 0 additions & 5 deletions languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,6 @@ module.exports = {
"Clear data",
"Clear password, 2FA codes and all other settings. Be careful.",
"Clear data",
"Open folders",
"You can open the folders Authme uses. Editing or deleting files might cause problems.",
"Authme folder",
"Settings folder",
"Cache folder",
"Logs",
"You can view the logs for debugging. You can view all the logs in the settings folder.",
"Latest log",
Expand Down
5 changes: 0 additions & 5 deletions languages/hu.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,6 @@ module.exports = {
"Adatok törlése",
"A jelszavak, a 2FA kódjaid, valamint a beállításaid törlődnek. Légy óvatos.",
"Adatok törlése",
"Mappák megnyitása",
"Megnyithatod az Authme álltal használt mappákat. A fájlok törlése vagy szerkesztése problémákat okozhat.",
"Authme mappa",
"Beállítások mappa",
"Cache mappa",
"Logok",
"Megnézheted a logokat ha hibákat tapasztalsz. Az összes logot a log mappába találod.",
"Legújabb log",
Expand Down

0 comments on commit 82a50e0

Please sign in to comment.