diff --git a/.github/release_description_template.md b/.github/release_description_template.md index cadcc3e..2c29b5e 100644 --- a/.github/release_description_template.md +++ b/.github/release_description_template.md @@ -1,6 +1,15 @@ ## What's new +- -## How to install +## Installation +### From extension webstore (recommended) +- [Google Chrome Webstore](https://chrome.google.com/webstore/detail/jnjobgjobffgmgfnkpkjfjkkfhfikmfl) +- [Microsoft Edge Add-ons Webstore](https://microsoftedge.microsoft.com/addons/detail/manimdhobjbkfpeeehlhhneookiokpbj) +- [Firefox Add-ons](https://addons.mozilla.org/en-US/firefox/addon/easy-password-generator/) +- [GitHub Releases](https://github.com/xfox111/PasswordGeneratorExtension/releases/latest) + +Note that version published on these webstores can differ from this release +### Sideloading (for testing purposes only) 1. Download attached archive and unpack it 2. Enable Developers mode on your browser extensions page 3. Click "Load unpacked" button and navigate to the extension root folder (contains `manifest.json`) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f1c916b..c052d5e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,12 +1,8 @@ name: CI on: - workflow_dispatch: - push: - branches: [ master ] - paths: - # Trigger deploy on manifest change - - 'manifest.json' + release: + types: [published] jobs: Firefox: @@ -35,7 +31,7 @@ jobs: uses: actions/upload-artifact@v2 with: name: 'Firefox Artefacts' - path: ${{ steps.web-ext-sign.outputs.target }} + path: ${{ steps.web-ext-build.outputs.target }} Chrome: runs-on: ubuntu-latest @@ -58,6 +54,15 @@ jobs: client-secret: ${{ secrets.CHROME_CLIENT_SECRET }} refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }} + - name: Upload artifact + uses: xresloader/upload-to-github-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + file: ./PasswordGenerator.zip + tags: true + draft: true + - name: Drop artifacts uses: actions/upload-artifact@v2 with: diff --git a/_locales/en/messages.json b/_locales/en/messages.json index fef694e..fe8d556 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -29,6 +29,11 @@ "message": "Invalid generator settings. No password was generated", "description": "Message which is shown after a creation of password failed" }, + "notEnoughChars": + { + "message": "With your current settings, your password length should not exceed %MIN_CHARS% characters", + "description": "Message which is shown if there's no enough characters to create a password" + }, "lengthPrompt": { "message": "Set password length. Press OK to use default password length (%LEN% characters)", @@ -80,6 +85,11 @@ "message": "Exclude ambiguous characters (e.g.", "description": "Option checkbox label" }, + "dontRepeatChars": + { + "message": "Do not repeat characters", + "description": "Option checkbox label" + }, "extOptions": { diff --git a/_locales/ru/messages.json b/_locales/ru/messages.json index d504eb5..9408cd8 100644 --- a/_locales/ru/messages.json +++ b/_locales/ru/messages.json @@ -29,6 +29,11 @@ "message": "Установлены неправильные настройки генератора. Ничего не было сгенерировано", "description": "Message which is shown after a creation of password failed" }, + "notEnoughChars": + { + "message": "При текущих параметрах длина создаваемого пароля должна быть не больше %MIN_CHARS% знаков", + "description": "Message which is shown if there's no enough characters to create a password" + }, "lengthPrompt": { "message": "Укажите длину пароля. Нажмите ОК чтобы использовать длину по умолчанию (%LEN% символов)", @@ -80,6 +85,11 @@ "message": "Исключить специальные символы (например:", "description": "Option checkbox label" }, + "dontRepeatChars": + { + "message": "Не повторять символы", + "description": "Option checkbox label" + }, "extOptions": { diff --git a/js/options.js b/js/options.js index f9651a6..16cbec1 100644 --- a/js/options.js +++ b/js/options.js @@ -10,6 +10,7 @@ chrome.storage.sync.get( includeUppercase: true, excludeSimilar: true, excludeSpecial: true, + dontRepeatChars: false, // Extension settings showButton: true, @@ -32,6 +33,7 @@ chrome.storage.sync.get( "includeUppercase", "excludeSimilar", "excludeSpecial", + "dontRepeatChars", "showButton", "showContext", @@ -47,8 +49,11 @@ chrome.storage.sync.get( function SetupEventHandlers() { document.querySelectorAll("input").forEach(i => - i.addEventListener("input", - () => chrome.storage.sync.set(JSON.parse("{ \"" + i.id + "\": " + (i.type == "checkbox" ? i.checked : i.value) + " }")))); + i.addEventListener( + "input", + () => chrome.storage.sync.set(JSON.parse("{ \"" + i.id + "\": " + (i.type == "checkbox" ? i.checked : i.value) + " }")) + ) + ); document.querySelector("#generate").addEventListener("click", () => GeneratePassword(null, true)); document.querySelector("#more").addEventListener("click", (s) => @@ -57,12 +62,12 @@ function SetupEventHandlers() if (group.hasAttribute("hidden")) { group.removeAttribute("hidden"); - s.currentTarget.querySelector("i").textContent = ""; + s.currentTarget.querySelector("i").textContent = "\uE010"; } else { group.setAttribute("hidden", ""); - s.currentTarget.querySelector("i").textContent = ""; + s.currentTarget.querySelector("i").textContent = "\uE011"; } }); } \ No newline at end of file diff --git a/js/script.js b/js/script.js index 659e8a0..36b8dfa 100644 --- a/js/script.js +++ b/js/script.js @@ -49,7 +49,8 @@ function GeneratePassword(e, useDefaultLength = false) excludeSimilar: true, excludeSpecial: true, hideAlert: false, - promptForLength: false + promptForLength: false, + dontRepeatChars: false, }, (settings) => { @@ -82,7 +83,7 @@ function GeneratePassword(e, useDefaultLength = false) if (response === null) // If user clicked 'Cancel' return; - if (parseInt(response)) + if (parseInt(response) && response > 1) { pwdLength = response; break; @@ -91,6 +92,12 @@ function GeneratePassword(e, useDefaultLength = false) break; } + if (settings.dontRepeatChars && availableCharacters.length < pwdLength) + { + alert(chrome.i18n.getMessage("notEnoughChars").replace("%MIN_CHARS%", availableCharacters.length)); + return; + } + for (k = 0; k < pwdLength; k++) password += availableCharacters[GetRandomInt(0, availableCharacters.length)]; // Picking random characters diff --git a/manifest.json b/manifest.json index 305d673..a498d0a 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "__MSG_name__", - "version": "1.1", + "version": "1.2", "manifest_version": 2, "description": "__MSG_description__", "author": "__MSG_author__", diff --git a/options.html b/options.html index ddbc0d0..cf4ec59 100644 --- a/options.html +++ b/options.html @@ -20,7 +20,7 @@