From b10d73678f60510c637fe75ec274c382a023380f Mon Sep 17 00:00:00 2001 From: Ziga Date: Sun, 25 Sep 2022 10:34:42 +0200 Subject: [PATCH 1/6] Improved Authenticator --- website/js/default-functions.js | 9 ++++++++- website/js/export.js | 29 +++++++++++++---------------- website/js/passwords.js | 7 ++----- website/js/settings.js | 5 +---- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/website/js/default-functions.js b/website/js/default-functions.js index 0aceb7a..6cdfaba 100644 --- a/website/js/default-functions.js +++ b/website/js/default-functions.js @@ -91,7 +91,7 @@ function randRange(min, max) { var range = max - min; var requestBytes = Math.ceil(Math.log2(range) / 8); if (!requestBytes) return min; - + var maxNum = Math.pow(256, requestBytes); var ar = new Uint8Array(requestBytes); @@ -148,4 +148,11 @@ function isSessionValid(){ function logout(){ clearStorage(); window.location.href = 'index.html'; +} + +function startAuthenticator(){ + if (!isSessionValid()) logout(); + window.setInterval(function() { + if (!isSessionValid()) logout(); + }, 1500); } \ No newline at end of file diff --git a/website/js/export.js b/website/js/export.js index e364035..d0e3731 100644 --- a/website/js/export.js +++ b/website/js/export.js @@ -1,29 +1,26 @@ initStorageCache.then(() => { + startAuthenticator(); document.getElementById("passwords-link").innerText = lang[readData('lang')]["passwords"]; document.getElementById("import-export-link").innerText = lang[readData('lang')]["import_export"]; document.getElementById("settings-link").innerText = lang[readData('lang')]["settings"]; document.getElementById("signout-link").innerText = lang[readData('lang')]["signout"]; - + document.getElementById("passwords-link-mobile").innerText = lang[readData('lang')]["passwords"]; document.getElementById("import-export-link-mobile").innerText = lang[readData('lang')]["import_export"]; document.getElementById("settings-link-mobile").innerText = lang[readData('lang')]["settings"]; document.getElementById("signout-link-mobile").innerText = lang[readData('lang')]["signout"]; - + document.getElementById("passky-backup-btn-text").innerText = lang[readData('lang')]["backup"]; - + document.getElementById("passky-import-btn-text").innerText = lang[readData('lang')]["import"]; document.getElementById("lastpass-import-btn-text").innerText = lang[readData('lang')]["import"]; document.getElementById("bitwarden-import-btn-text").innerText = lang[readData('lang')]["import"]; - + document.getElementById("passky-export-btn-text").innerText = lang[readData('lang')]["export"]; document.getElementById("lastpass-export-btn-text").innerText = lang[readData('lang')]["export"]; - - document.getElementById("dialog-button-cancel").innerText = lang[readData('lang')]["cancel"]; - window.setInterval(function(){ - if(!isSessionValid()) logout(); - }, 2000); + document.getElementById("dialog-button-cancel").innerText = lang[readData('lang')]["cancel"]; }); function import_passky(){ @@ -146,7 +143,7 @@ function export_keepassxc(){ exportedPasswords[i]["Created"] = new Date().toISOString(); } - downloadTxt($.csv.fromObjects(exportedPasswords), "keepassxc_" + getDate(new Date()) + ".csv"); + downloadTxt($.csv.fromObjects(exportedPasswords), "keepassxc_" + getDate(new Date()) + ".csv"); } function export_nordpass(){ @@ -475,10 +472,10 @@ function changeDialog(style, text, text2){ //Import Error document.getElementById('dialog-icon').className = "mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10"; document.getElementById('dialog-icon').innerHTML = ""; - + document.getElementById('dialog-title').innerText = lang[readData('lang')]["error"]; document.getElementById('dialog-text').innerText = lang[readData('lang')]["import_invalid"]; - + document.getElementById('dialog-button').className = "dangerButton inline-flex justify-center w-full rounded-md border border-transparent shadow-sm px-4 py-2 text-base font-medium focus:outline-none sm:w-auto sm:text-sm"; document.getElementById('dialog-button').innerText = lang[readData('lang')]["try_again"]; document.getElementById('dialog-button').onclick = () => changeDialog(text, text2); @@ -487,10 +484,10 @@ function changeDialog(style, text, text2){ //Import Success document.getElementById('dialog-icon').className = "mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-green-100 sm:mx-0 sm:h-10 sm:w-10"; document.getElementById('dialog-icon').innerHTML = ""; - + document.getElementById('dialog-title').innerText = lang[readData('lang')]["success"]; document.getElementById('dialog-text').innerText = text; - + document.getElementById('dialog-button').className = "successButton inline-flex justify-center w-full rounded-md border border-transparent shadow-sm px-4 py-2 text-base font-medium focus:outline-none sm:w-auto sm:text-sm"; document.getElementById('dialog-button').innerText = lang[readData('lang')]["okay"]; document.getElementById('dialog-button').onclick = () => refreshPasswords(); @@ -499,10 +496,10 @@ function changeDialog(style, text, text2){ //Error document.getElementById('dialog-icon').className = "mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10"; document.getElementById('dialog-icon').innerHTML = ""; - + document.getElementById('dialog-title').innerText = lang[readData('lang')]["error"]; document.getElementById('dialog-text').innerText = text; - + document.getElementById('dialog-button').className = "dangerButton inline-flex justify-center w-full rounded-md border border-transparent shadow-sm px-4 py-2 text-base font-medium focus:outline-none sm:w-auto sm:text-sm"; document.getElementById('dialog-button').innerText = lang[readData('lang')]["okay"]; document.getElementById('dialog-button').onclick = () => hide('dialog'); diff --git a/website/js/passwords.js b/website/js/passwords.js index 1a04b7c..3965c2e 100644 --- a/website/js/passwords.js +++ b/website/js/passwords.js @@ -1,4 +1,5 @@ initStorageCache.then(() => { + startAuthenticator(); document.getElementById("passwords-link").innerText = lang[readData('lang')]["passwords"]; document.getElementById("import-export-link").innerText = lang[readData('lang')]["import_export"]; @@ -16,7 +17,7 @@ initStorageCache.then(() => { document.getElementById("dialog-button-cancel").innerText = lang[readData('lang')]["cancel"]; function displayPasswords() { - + let start = new Date().getTime(); if (readData('passwords') !== null && typeof(readData('passwords')) !== 'undefined') { const passwords = JSON.parse(readData('passwords')); @@ -77,10 +78,6 @@ initStorageCache.then(() => { }); } catch {} } - - window.setInterval(function() { - if (!isSessionValid()) logout(); - }, 2000); }); document.getElementById("search").addEventListener("keyup", () => { diff --git a/website/js/settings.js b/website/js/settings.js index 0915e68..7280257 100644 --- a/website/js/settings.js +++ b/website/js/settings.js @@ -1,4 +1,5 @@ initStorageCache.then(() => { + startAuthenticator(); document.getElementById("passwords-link").innerText = lang[readData('lang')]["passwords"]; document.getElementById("import-export-link").innerText = lang[readData('lang')]["import_export"]; @@ -69,10 +70,6 @@ initStorageCache.then(() => { let minutes = document.getElementsByClassName("addMinutes"); for (let i = 0; i < minutes.length; i++) minutes[i].innerText = minutes[i].innerText + " " + lang[readData('lang')]["minutes"]; - - window.setInterval(function() { - if (!isSessionValid()) logout(); - }, 2000); }); function deleteAccount() { From 3e8bc9601588c069a79040b95ee29fa286428850 Mon Sep 17 00:00:00 2001 From: Ziga Date: Sun, 25 Sep 2022 11:13:41 +0200 Subject: [PATCH 2/6] Autodetect the language, when you open the application for the first time. --- website/js/header.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/website/js/header.js b/website/js/header.js index 5e27a7b..c72c8b2 100644 --- a/website/js/header.js +++ b/website/js/header.js @@ -48,9 +48,19 @@ function getAllStorageData() { }); } +function detectLanguage(){ + for(const language of navigator.languages){ + if(Object.keys(lang).includes(language)){ + writeData('lang', language); + break; + } + } + if(readData('lang') == null || typeof(readData('lang')) == 'undefined') writeData('lang', 'en'); +} + function setTheme(){ if(readData('theme') == null || typeof(readData('theme')) == 'undefined') writeData('theme', 'dark'); - if(readData('lang') == null || typeof(readData('lang')) == 'undefined') writeData('lang', 'en'); + if(readData('lang') == null || typeof(readData('lang')) == 'undefined') detectLanguage(); if(readData('sessionDuration') == null || typeof(readData('sessionDuration')) == 'undefined') writeData('sessionDuration', '20'); if(!(["dark", "tokyoNight", "monokai", "solarizedDark", "light", "blue", "nord", "dracula", "gray"].includes(readData('theme')))) writeData('theme', 'dark'); From 177d03ca17ee22fbef7a255b78daa3f5ffe4ca20 Mon Sep 17 00:00:00 2001 From: Ziga Date: Sun, 25 Sep 2022 14:38:48 +0200 Subject: [PATCH 3/6] Passwords can now be refreshed by clicking on the logo. --- package-lock.json | 58 ++++++++++++++++----------------- package.json | 4 +-- website/css/tailwind.min.css | 35 ++++++++++---------- website/export.html | 3 +- website/js/default-functions.js | 6 ++-- website/js/passwords.js | 4 +++ website/passwords.html | 7 ++-- website/settings.html | 3 +- 8 files changed, 61 insertions(+), 59 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8962a2d..c807f48 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "passky-website", - "version": "7.0.0", + "version": "7.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "passky-website", - "version": "7.0.0", + "version": "7.1.0", "license": "GPL-3.0", "devDependencies": { - "tailwindcss": "^3.1.6" + "tailwindcss": "^3.1.8" } }, "node_modules/@nodelib/fs.scandir": { @@ -221,9 +221,9 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -326,9 +326,9 @@ } }, "node_modules/is-core-module": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", - "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", + "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", "dev": true, "dependencies": { "has": "^1.0.3" @@ -468,9 +468,9 @@ } }, "node_modules/postcss": { - "version": "8.4.14", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", - "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", + "version": "8.4.16", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.16.tgz", + "integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==", "dev": true, "funding": [ { @@ -719,9 +719,9 @@ } }, "node_modules/tailwindcss": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.1.6.tgz", - "integrity": "sha512-7skAOY56erZAFQssT1xkpk+kWt2NrO45kORlxFPXUt3CiGsVPhH1smuH5XoDH6sGPXLyBv+zgCKA2HWBsgCytg==", + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.1.8.tgz", + "integrity": "sha512-YSneUCZSFDYMwk+TGq8qYFdCA3yfBRdBlS7txSq0LUmzyeqRe3a8fBQzbz9M3WS/iFT4BNf/nmw9mEzrnSaC0g==", "dev": true, "dependencies": { "arg": "^5.0.2", @@ -733,7 +733,7 @@ "fast-glob": "^3.2.11", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", - "lilconfig": "^2.0.5", + "lilconfig": "^2.0.6", "normalize-path": "^3.0.0", "object-hash": "^3.0.0", "picocolors": "^1.0.0", @@ -951,9 +951,9 @@ "dev": true }, "fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -1033,9 +1033,9 @@ } }, "is-core-module": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", - "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", + "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", "dev": true, "requires": { "has": "^1.0.3" @@ -1133,9 +1133,9 @@ "dev": true }, "postcss": { - "version": "8.4.14", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz", - "integrity": "sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==", + "version": "8.4.16", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.16.tgz", + "integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==", "dev": true, "requires": { "nanoid": "^3.3.4", @@ -1267,9 +1267,9 @@ "dev": true }, "tailwindcss": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.1.6.tgz", - "integrity": "sha512-7skAOY56erZAFQssT1xkpk+kWt2NrO45kORlxFPXUt3CiGsVPhH1smuH5XoDH6sGPXLyBv+zgCKA2HWBsgCytg==", + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.1.8.tgz", + "integrity": "sha512-YSneUCZSFDYMwk+TGq8qYFdCA3yfBRdBlS7txSq0LUmzyeqRe3a8fBQzbz9M3WS/iFT4BNf/nmw9mEzrnSaC0g==", "dev": true, "requires": { "arg": "^5.0.2", @@ -1281,7 +1281,7 @@ "fast-glob": "^3.2.11", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", - "lilconfig": "^2.0.5", + "lilconfig": "^2.0.6", "normalize-path": "^3.0.0", "object-hash": "^3.0.0", "picocolors": "^1.0.0", diff --git a/package.json b/package.json index 8279912..a5cd769 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "passky-website", "description": "Website for Passky (password manager)", - "version": "7.0.0", + "version": "7.1.0", "main": "tailwind.config.js", "scripts": { "build": "npx tailwindcss -i ./tailwind.css -o ./website/css/tailwind.min.css" @@ -17,6 +17,6 @@ }, "homepage": "https://github.com/Rabbit-Company/Passky-Website#readme", "devDependencies": { - "tailwindcss": "^3.1.6" + "tailwindcss": "^3.1.8" } } \ No newline at end of file diff --git a/website/css/tailwind.min.css b/website/css/tailwind.min.css index e65dfc7..8e104c9 100644 --- a/website/css/tailwind.min.css +++ b/website/css/tailwind.min.css @@ -1,5 +1,5 @@ /* -! tailwindcss v3.1.6 | MIT License | https://tailwindcss.com +! tailwindcss v3.1.8 | MIT License | https://tailwindcss.com */ /* @@ -355,13 +355,6 @@ input::-moz-placeholder, textarea::-moz-placeholder { /* 2 */ } -input:-ms-input-placeholder, textarea:-ms-input-placeholder { - opacity: 1; - /* 1 */ - color: #9ca3af; - /* 2 */ -} - input::placeholder, textarea::placeholder { opacity: 1; @@ -865,6 +858,23 @@ video { transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); } +@-webkit-keyframes spin { + to { + transform: rotate(360deg); + } +} + +@keyframes spin { + to { + transform: rotate(360deg); + } +} + +.animate-\[spin_0\.7s_ease-in-out\] { + -webkit-animation: spin 0.7s ease-in-out; + animation: spin 0.7s ease-in-out; +} + .cursor-pointer { cursor: pointer; } @@ -1269,11 +1279,6 @@ video { color: rgb(107 114 128 / var(--tw-placeholder-opacity)); } -.placeholder-gray-500:-ms-input-placeholder { - --tw-placeholder-opacity: 1; - color: rgb(107 114 128 / var(--tw-placeholder-opacity)); -} - .placeholder-gray-500::placeholder { --tw-placeholder-opacity: 1; color: rgb(107 114 128 / var(--tw-placeholder-opacity)); @@ -1554,10 +1559,6 @@ video { margin-left: 1.5rem; } - .lg\:block { - display: block; - } - .lg\:flex { display: flex; } diff --git a/website/export.html b/website/export.html index 9540b91..7d1e026 100644 --- a/website/export.html +++ b/website/export.html @@ -33,8 +33,7 @@
- Passky - +