Skip to content

Commit

Permalink
Remove deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Oct 8, 2022
1 parent 5d13337 commit c2e0d61
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 228 deletions.
121 changes: 0 additions & 121 deletions app/codes/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,113 +21,6 @@ <h5 class="build-content m-0 mx-3 flex flex-row text-center font-bold">You are r
</div>
</div>

<!-- manual update -->
<div class="bg-popup-blue update hidden w-full font-bold text-white">
<div class="container mx-auto flex flex-row items-center justify-between px-6 py-4">
<div class="flex">
<svg xmlns="http://www.w3.org/2000/svg" class="relative top-2 h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 13l-3 3m0 0l-3-3m3 3V8m0 13a9 9 0 110-18 9 9 0 010 18z" />
</svg>

<p class="relative top-3 mx-3 flex flex-row">
New Authme version available. Please update your app!
<button type="button" onclick="manualUpdate()" class="relative -top-2.5 mr-2 ml-3 cursor-pointer rounded-full border-2 border-white bg-white py-1 px-3 text-center text-base font-bold text-black transition duration-200 ease-in hover:bg-transparent hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="relative top-1" height="20" width="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" />
</svg>
Download update
</button>
<button type="button" onclick="releaseNotes()" class="relative -top-2.5 cursor-pointer rounded-full border-2 border-white bg-white py-1 px-3 text-center text-base font-bold text-black transition duration-200 ease-in hover:bg-transparent hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="relative top-1" height="20" width="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z" />
</svg>
Release notes
</button>
</p>
</div>
<a onclick="this.parentElement.style.display='none'" class="transform cursor-pointer rounded-md p-1 transition-colors duration-200 hover:text-gray-800">
<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="M6 18L18 6M6 6l12 12" />
</svg>
</a>
</div>
</div>

<!-- auto update -->
<div class="bg-popup-blue autoupdate hidden w-full font-bold text-white">
<div class="container mx-auto flex flex-row items-center justify-between px-6 py-4">
<div class="flex">
<svg xmlns="http://www.w3.org/2000/svg" class="relative top-2 h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 13l-3 3m0 0l-3-3m3 3V8m0 13a9 9 0 110-18 9 9 0 010 18z" />
</svg>

<div class="relative top-3 mx-3 flex flex-row">
<p id="updateText" class="mr-3" data-loc>New Authme version available. Starting the update...</p>
<button type="button" id="updateButton" onclick="updateRestart()" class="relative -top-2.5 mr-3 hidden cursor-pointer rounded-full border-2 border-white bg-white py-1 px-3 text-center text-base font-bold text-black transition duration-200 ease-in hover:bg-transparent hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="relative top-1" height="20" width="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
</svg>
<span data-loc>Restart</span>
</button>
<button type="button" onclick="releaseNotes()" class="relative -top-2.5 cursor-pointer rounded-full border-2 border-white bg-white py-1 px-3 text-center text-base font-bold text-black transition duration-200 ease-in hover:bg-transparent hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="relative top-1" height="20" width="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z" />
</svg>
<span data-loc>Release notes</span>
</button>
</div>
</div>
<a onclick="this.parentElement.style.display='none'" id="updateClose" class="hidden transform cursor-pointer rounded-md p-1 transition-colors duration-200 hover:text-gray-800">
<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="M6 18L18 6M6 6l12 12" />
</svg>
</a>
</div>
</div>

<!-- rate authme -->
<div class="bg-popup-yellow info hidden w-full font-bold text-white">
<div class="container mx-auto flex flex-row items-center justify-between px-6 py-4">
<div class="flex">
<svg xmlns="http://www.w3.org/2000/svg" class="relative top-2 h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>

<p class="relative top-3 mx-3 flex flex-row">
<span data-loc>Enjoying Authme?</span>
<button type="button" onclick="rateAuthme()" class="relative -top-2.5 ml-3 cursor-pointer rounded-full border-2 border-white bg-white py-1 px-3 text-center text-base font-bold text-black transition duration-200 ease-in hover:bg-transparent hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="relative top-1" height="20" width="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z" />
</svg>
<span data-loc>Rate on Microsoft Store</span>
</button>

<button type="button" onclick="starAuthme()" class="relative -top-2.5 mr-2 ml-3 cursor-pointer rounded-full border-2 border-white bg-white py-1 px-3 text-center text-base font-bold text-black transition duration-200 ease-in hover:bg-transparent hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="relative top-1" height="20" width="20" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z" />
</svg>
<span data-loc>Star on GitHub</span>
</button>

<button type="button" onclick="provideFeedback()" class="relative -top-2.5 cursor-pointer rounded-full border-2 border-white bg-white py-1 px-3 text-center text-base font-bold text-black transition duration-200 ease-in hover:bg-transparent hover:text-white">
<svg xmlns="http://www.w3.org/2000/svg" class="relative top-1" height="20" width="20" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M4 21v-13a3 3 0 0 1 3 -3h10a3 3 0 0 1 3 3v6a3 3 0 0 1 -3 3h-9l-4 4"></path>
<line x1="8" y1="9" x2="16" y2="9"></line>
<line x1="8" y1="13" x2="14" y2="13"></line>
</svg>
<span data-loc>Provide feedback</span>
</button>
</p>
</div>
<a onclick="this.parentElement.style.display='none'" class="transform cursor-pointer rounded-md p-1 transition-colors duration-200 hover:text-gray-800">
<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="M6 18L18 6M6 6l12 12" />
</svg>
</a>
</div>
</div>

<!-- content -->
<div class="content relative mx-auto mt-40 mb-60 rounded-2xl bg-gray-700 pb-5 text-center md:w-9/12 lg:w-3/5">
<h1 class="h1 m-0 p-6">Authme</h1>
Expand Down Expand Up @@ -220,19 +113,5 @@ <h4 data-loc>Save your 2FA codes to your computer for future use.</h4>
</div>
<!-- codes -->
</div>
<!-- info bar -->
<div class="infoBar sticky bottom-5 z-10 mx-auto hidden w-max">
<div class="bg-popup-magenta flex items-center justify-center rounded-2xl p-2 py-3 text-white shadow">
<svg xmlns="http://www.w3.org/2000/svg" class="mx-3 h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<h5 class="m-0 text-center"><span class="bar">Thanks for using Authme!</span> <a class="barLink text-lg font-bold text-white duration-200 ease-in hover:text-black" href="#" onclick="barLink()">Feedback</a></h5>
<a onclick="this.parentElement.style.display='none'" class="relative top-0.5 mx-3 cursor-pointer rounded-md transition-colors duration-200 hover:text-gray-800">
<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="M6 18L18 6M6 6l12 12" />
</svg>
</a>
</div>
</div>
</body>
</html>
71 changes: 10 additions & 61 deletions app/codes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,6 @@ const copyCode = (id) => {
* Search codes
*/
const search = () => {
document.querySelector(".infoBar").style.display = "none"

const search = document.querySelector("#search")
const input = search.value.toLowerCase()
let i = 0
Expand Down Expand Up @@ -569,7 +567,7 @@ const showUpdate = () => {
* Show info popup
*/
const showInfo = () => {
document.querySelector(".info").style.display = "block"
return "Removed"
}

/**
Expand Down Expand Up @@ -851,67 +849,18 @@ const updateRestart = () => {
ipc.send("updateRestart")
}

/* info bar */
const random = Math.floor(Math.random() * 3)

const infoBar = async () => {
const { opens } = await ipc.invoke("statistics")
const bar = document.querySelector(".bar")
const bar_link = document.querySelector(".barLink")
const info_bar = document.querySelector(".infoBar")

if (opens % 4 === 0) {
switch (random) {
case 0:
info_bar.style.display = "flex"
bar.textContent = lang.info_bar.feedback
bar_link.textContent = lang.info_bar.feedback_link
break

case 1:
info_bar.style.display = "flex"
bar.textContent = lang.info_bar.rate
bar_link.textContent = lang.info_bar.rate_link
break

case 2:
info_bar.style.display = "flex"
bar.textContent = lang.info_bar.translate
bar_link.textContent = lang.info_bar.translate_link
break

default:
info_bar.style.display = "flex"
break
}
}
}

infoBar()

const barLink = () => {
switch (random) {
case 0:
provideFeedback()
break

case 1:
rateAuthme()
break

case 2:
shell.openExternal("https://github.com/Levminer/authme/blob/dev/.github/CONTRIBUTING.md#translation")
break

default:
provideFeedback()
break
}
}

/* Focus search with ctrl+k */
document.addEventListener("keypress", (event) => {
if (event.ctrlKey === true && event.code === "KeyK") {
focusSearch()
}
})

/* Deprecation notice */
const date = new Date()
const release = new Date("2021-11-08")

if (date > release) {
document.querySelector(".deprecation").style.display = "block"
document.querySelector(".deprecationNotice").style.display = "none"
}
59 changes: 13 additions & 46 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ let /** @type{Buffer} */ password_buffer = null
let /** @type{Tray} */ tray = null
let /** @type{Menu} */ menu = null
let lang = en
let final = true

/**
* Check if running in development mode
Expand All @@ -81,6 +82,7 @@ if (app.isPackaged === false) {
})

dev = true
final = false
}

/**
Expand Down Expand Up @@ -729,7 +731,7 @@ const createWindows = () => {
}

// Check for manual update
if (update_seen == false && platform !== "windows") {
if (update_seen == false && platform !== "windows" && final === false) {
api()

update_seen = true
Expand All @@ -746,7 +748,7 @@ const createWindows = () => {
/**
* Auto update on Windows
*/
if (dev === false && platform === "windows") {
if (dev === false && platform === "windows" && final === false) {
axios
.get("https://api.levminer.com/api/v1/authme/releases")
.then((res) => {
Expand Down Expand Up @@ -1943,50 +1945,15 @@ const createMenu = () => {
label: lang.menu.update,
accelerator: shortcuts ? "" : settings.shortcuts.update,
click: () => {
if (platform === "windows") {
if (dev === false) {
manual_update = true

autoUpdater.checkForUpdates()
}
} else {
axios
.get("https://api.levminer.com/api/v1/authme/releases")
.then((res) => {
if (res.data.tag_name > authme_version && res.data.tag_name != undefined && res.data.prerelease != true) {
dialog
.showMessageBox({
title: "Authme",
buttons: ["Yes", "No"],
defaultId: 0,
cancelId: 1,
noLink: true,
type: "info",
message: `Update available: Authme ${res.data.tag_name} \n\nDo you want to download it? \n\nYou currently running: Authme ${authme_version}`,
})
.then((result) => {
if (result.response === 0) {
shell.openExternal("https://authme.levminer.com#downloads")
}
})
} else {
dialog.showMessageBox({
title: "Authme",
buttons: [lang.button.close],
defaultId: 0,
cancelId: 1,
noLink: true,
type: "info",
message: `No update available: \n\nYou are running the latest version! \n\nYou are currently running: Authme ${authme_version}`,
})
}
})
.catch((error) => {
dialog.showErrorBox("Authme", "Error getting update manually \n\nTry again later!")

logger.error("Error getting update manually", error.stack)
})
}
dialog.showMessageBox({
title: "Authme",
buttons: [lang.button.close],
defaultId: 0,
cancelId: 1,
noLink: true,
type: "info",
message: `No update available: \n\nYou are running the latest version! \n\nYou are currently running: Authme ${authme_version}`,
})
},
},
{
Expand Down

0 comments on commit c2e0d61

Please sign in to comment.