From 7e7b6f71a4c321eac40c657a9388a81c875e645f Mon Sep 17 00:00:00 2001 From: Eugene Fox Date: Sun, 12 Nov 2023 19:49:35 +0300 Subject: [PATCH] =?UTF-8?q?Major=203.0:=20Complete=20overhaul=20of=20the?= =?UTF-8?q?=20codebase,=20new=20features,=20bugfixes=20=E2=80=A6=20(#224)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Major 3.0: Complete overhaul of the codebase, new features, bugfixes and more (#223) Complete overhaul for v3.0 (see related PR) * Fix for workflows matrix * Reverted PR workflow to manual node setup * Revert "Reverted PR workflow to manual node setup" This reverts commit 491afd58ab8cf0e5f610bb169b7667543402ab2d. * Replaced web-ext lint action * Workflow fix * Deprecated autocopy feature * Zero-day patch: Batch 1 (#231) * Bump @types/react-dom from 18.2.8 to 18.2.15 (#230) Bumps [@types/react-dom](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-dom) from 18.2.8 to 18.2.15. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-dom) --- updated-dependencies: - dependency-name: "@types/react-dom" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump typescript from 4.9.5 to 5.2.2 (#228) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.9.5 to 5.2.2. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.9.5...v5.2.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump @fluentui/react-icons from 2.0.218 to 2.0.222 (#227) Bumps [@fluentui/react-icons](https://github.com/microsoft/fluentui-system-icons) from 2.0.218 to 2.0.222. - [Commits](https://github.com/microsoft/fluentui-system-icons/commits) --- updated-dependencies: - dependency-name: "@fluentui/react-icons" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump dev-build-deploy/release-me from 0.14.0 to 0.15.0 (#225) Bumps [dev-build-deploy/release-me](https://github.com/dev-build-deploy/release-me) from 0.14.0 to 0.15.0. - [Release notes](https://github.com/dev-build-deploy/release-me/releases) - [Changelog](https://github.com/dev-build-deploy/release-me/blob/main/docs/get-release.md) - [Commits](https://github.com/dev-build-deploy/release-me/compare/v0.14.0...v0.15.0) --- updated-dependencies: - dependency-name: dev-build-deploy/release-me dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump sass from 1.69.0 to 1.69.5 (#229) Bumps [sass](https://github.com/sass/dart-sass) from 1.69.0 to 1.69.5. - [Release notes](https://github.com/sass/dart-sass/releases) - [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md) - [Commits](https://github.com/sass/dart-sass/compare/1.69.0...1.69.5) --- updated-dependencies: - dependency-name: sass dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Eugene Fox * Bump @types/webextension-polyfill from 0.10.4 to 0.10.6 (#226) Bumps [@types/webextension-polyfill](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/webextension-polyfill) from 0.10.4 to 0.10.6. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/webextension-polyfill) --- updated-dependencies: - dependency-name: "@types/webextension-polyfill" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Eugene Fox --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Zero-day patch: Batch 2 (#236) * Bump @fluentui/react-components from 9.34.0 to 9.39.0 (#235) Bumps [@fluentui/react-components](https://github.com/microsoft/fluentui) from 9.34.0 to 9.39.0. - [Release notes](https://github.com/microsoft/fluentui/releases) - [Changelog](https://github.com/microsoft/fluentui/blob/master/azure-pipelines.release-fluentui.yml) - [Commits](https://github.com/microsoft/fluentui/compare/@fluentui/react-components_v9.34.0...@fluentui/react-components_v9.39.0) --- updated-dependencies: - dependency-name: "@fluentui/react-components" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump @vitejs/plugin-react-swc from 3.4.0 to 3.4.1 (#234) Bumps [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) from 3.4.0 to 3.4.1. - [Release notes](https://github.com/vitejs/vite-plugin-react-swc/releases) - [Changelog](https://github.com/vitejs/vite-plugin-react-swc/blob/main/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite-plugin-react-swc/compare/v3.4.0...v3.4.1) --- updated-dependencies: - dependency-name: "@vitejs/plugin-react-swc" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump @types/react from 18.2.24 to 18.2.37 (#233) Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.2.24 to 18.2.37. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) --- updated-dependencies: - dependency-name: "@types/react" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump vite from 4.4.10 to 4.5.0 (#232) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.4.10 to 4.5.0. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v4.5.0/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .devcontainer/Dockerfile | 19 + .devcontainer/devcontainer.json | 25 + .eslintrc.cjs | 52 + .github/ISSUE_TEMPLATE/bug_report.md | 34 - .github/ISSUE_TEMPLATE/bug_report.yml | 112 + .github/ISSUE_TEMPLATE/config.yml | 5 + .github/ISSUE_TEMPLATE/feature_request.md | 21 - .github/ISSUE_TEMPLATE/feature_request.yml | 66 + .github/pull_request_template.md | 10 +- .github/release_description_template.md | 4 +- .github/workflows/cd_pipeline.yaml | 278 +- .github/workflows/codeql-analysis.yml | 6 +- .github/workflows/pr_next.yaml | 30 + .github/workflows/pr_pipeline.yaml | 92 +- .gitignore | 46 +- .vscode/extensions.json | 15 + .vscode/settings.json | 52 + .vscode/tasks.json | 80 + CONTRIBUTING.md | 293 +- LICENSE | 2 +- PRIVACY.md | 9 +- README.md | 33 +- SECURITY.md | 16 +- craco.config.ts | 67 - package.json | 79 +- public/_locales/en/messages.json | 174 - public/_locales/pl/messages.json | 174 - public/_locales/pt_BR/messages.json | 174 - public/_locales/ru/messages.json | 174 - public/_locales/uk/messages.json | 174 - public/index.html | 18 - public/manifest.json | 39 - public/manifest.v2.json | 47 - src/App.scss | 138 - src/App.styles.ts | 30 + src/App.tsx | 101 +- src/Components/AboutSection.styles.ts | 16 + src/Components/AboutSection.tsx | 115 +- src/Components/CharacterHelpDialog.tsx | 77 - src/Components/GeneratorView.styles.ts | 43 + src/Components/GeneratorView.tsx | 105 + src/Components/PasswordView.tsx | 129 - src/Components/SettingsSection.styles.ts | 15 + src/Components/SettingsSection.tsx | 164 +- src/Data/BmcTheme.ts | 35 + src/Data/Links.ts | 43 + src/Data/Locales/en/messages.json | 171 + src/Data/Locales/pl/messages.json | 171 + src/Data/Locales/pt_BR/messages.json | 171 + src/Data/Locales/ru/messages.json | 171 + src/Data/Locales/uk/messages.json | 171 + src/Holidays/Snow.tsx | 23 - src/Models/ExtensionOptions.ts | 1 + src/Models/GeneratorOptions.ts | 14 + src/Services/BackgroundService.ts | 55 - src/Services/ContentService.ts | 40 - src/{Holidays => Specials}/Snow.scss | 2 +- src/Specials/Snow.tsx | 11 + src/Specials/Specials.tsx | 7 + src/Utils/Browser.ts | 4 - src/Utils/Generator.ts | 121 - src/Utils/GeneratorOptions.ts | 53 - src/Utils/Localization.ts | 33 +- src/Utils/PasswordGenerator.ts | 129 + src/Utils/Settings.ts | 45 - src/Utils/Storage.tsx | 54 + src/Utils/Theme.ts | 21 + src/Utils/Timeout.ts | 14 + src/index.tsx | 8 - src/manifest.json | 32 + src/popup.css | 45 + src/popup.html | 17 + src/popup.tsx | 10 + src/react-app-env.d.ts | 1 - src/vite-env.d.ts | 5 + tsconfig.json | 37 +- tsconfig.node.json | 11 + vite.config.ts | 57 + yarn.lock | 12014 +++++++------------ 79 files changed, 6563 insertions(+), 10587 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .eslintrc.cjs delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/workflows/pr_next.yaml create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json delete mode 100644 craco.config.ts delete mode 100644 public/_locales/en/messages.json delete mode 100644 public/_locales/pl/messages.json delete mode 100644 public/_locales/pt_BR/messages.json delete mode 100644 public/_locales/ru/messages.json delete mode 100644 public/_locales/uk/messages.json delete mode 100644 public/index.html delete mode 100644 public/manifest.json delete mode 100644 public/manifest.v2.json delete mode 100644 src/App.scss create mode 100644 src/App.styles.ts create mode 100644 src/Components/AboutSection.styles.ts delete mode 100644 src/Components/CharacterHelpDialog.tsx create mode 100644 src/Components/GeneratorView.styles.ts create mode 100644 src/Components/GeneratorView.tsx delete mode 100644 src/Components/PasswordView.tsx create mode 100644 src/Components/SettingsSection.styles.ts create mode 100644 src/Data/BmcTheme.ts create mode 100644 src/Data/Links.ts create mode 100644 src/Data/Locales/en/messages.json create mode 100644 src/Data/Locales/pl/messages.json create mode 100644 src/Data/Locales/pt_BR/messages.json create mode 100644 src/Data/Locales/ru/messages.json create mode 100644 src/Data/Locales/uk/messages.json delete mode 100644 src/Holidays/Snow.tsx create mode 100644 src/Models/ExtensionOptions.ts create mode 100644 src/Models/GeneratorOptions.ts delete mode 100644 src/Services/BackgroundService.ts delete mode 100644 src/Services/ContentService.ts rename src/{Holidays => Specials}/Snow.scss (97%) create mode 100644 src/Specials/Snow.tsx create mode 100644 src/Specials/Specials.tsx delete mode 100644 src/Utils/Browser.ts delete mode 100644 src/Utils/Generator.ts delete mode 100644 src/Utils/GeneratorOptions.ts create mode 100644 src/Utils/PasswordGenerator.ts delete mode 100644 src/Utils/Settings.ts create mode 100644 src/Utils/Storage.tsx create mode 100644 src/Utils/Theme.ts create mode 100644 src/Utils/Timeout.ts delete mode 100644 src/index.tsx create mode 100644 src/manifest.json create mode 100644 src/popup.css create mode 100644 src/popup.html create mode 100644 src/popup.tsx delete mode 100644 src/react-app-env.d.ts create mode 100644 src/vite-env.d.ts create mode 100644 tsconfig.node.json create mode 100644 vite.config.ts diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..258cc99 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,19 @@ +FROM mcr.microsoft.com/devcontainers/base:focal + +RUN apt update && apt upgrade -y + +RUN apt install -y software-properties-common apt-transport-https ca-certificates curl gnupg + +RUN mkdir -p /etc/apt/keyrings +RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg + +RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list +RUN apt update && apt install -y nodejs + +RUN corepack enable + +RUN echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list +RUN curl -fSsL https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor | sudo tee /usr/share/keyrings/google-chrome.gpg >> /dev/null +RUN echo deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main | sudo tee /etc/apt/sources.list.d/google-chrome.list + +RUN apt update && apt install -y google-chrome-stable firefox diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..5797982 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node +{ + "name": "PasswordGeneratorExtension", + "build": { + "dockerfile": "Dockerfile" + }, + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "dbaeumer.vscode-eslint", + "github.vscode-github-actions", + "GitHub.vscode-pull-request-github", + "bierner.github-markdown-preview", + "mrmlnc.vscode-scss", + "Gruntfuggly.todo-tree", + "redhat.vscode-yaml" + ] + } + }, + + "postCreateCommand": "yarn install" +} diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..9dd9b36 --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,52 @@ +module.exports = { + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:react/recommended" + ], + "overrides": [ + { + "env": { + "node": true + }, + "files": [ + ".eslintrc.{js,cjs}" + ], + "parserOptions": { + "sourceType": "script" + } + } + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint", + "react" + ], + "rules": { + "indent": [ + "error", + "tab" + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "double" + ], + "semi": [ + "error", + "always" + ], + "react/react-in-jsx-scope": "off" + } +}; diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index a9e1db9..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve the extension -title: '' -labels: bug -assignees: xfox111 ---- - -### Description -A clear and concise description of what the bug is. - -### Reproduction steps -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '...' -3. Scroll down to '...' -4. See error - -### Expected behavior -A clear and concise description of what you expected to happen. - -### Screenshots -If applicable, add screenshots to help explain your problem. - -### Environment -Please provide the following information: - - Operating System: [e.g. Windows 10 Pro 1909 (10.0.18363)] - - Browser: [e.g. Microsoft Edge 83.0.478.56] - - Extension version: [e.g. 1.5] - -### Additional context -Add any other context about the problem here. - -- [ ] Are you willing to submit a pull request to implement this feature yourself? diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..182d6ee --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,112 @@ +name: "🐞 Bug Report" +description: Create a report to help us improve the extension +title: "[Bug]: " +labels: ["bug", "needs-triage"] +assignees: + - xfox111 +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + + - type: textarea + id: desc + attributes: + label: Description + description: A clear and concise description of what the bug is. + placeholder: e.g. Sometimes when generating a password not all character sets are included + render: Markdown + validations: + required: true + + - type: textarea + attributes: + label: Reproduction steps + description: Precisely describe minimal number of steps that make the bug to appear + placeholder: | + 1. Go to '...' + 2. Click on '...' + 3. Scroll down to '...' + 4. See '...' + render: Markdown + validations: + required: true + + - type: textarea + attributes: + label: Expected behavior + description: A clear and concise description of what you expected to happen. + placeholder: e.g. Generated password should include at least one character from every enabled character set + render: Markdown + validations: + required: true + + - type: textarea + attributes: + label: Screenshot + description: If applicable, add screenshots to help explain your problem. + render: Markdown + validations: + required: false + + - type: dropdown + id: os + attributes: + label: Operating system + options: + - "Windows 10+" + - "Windows 8/8.1" + - "Windows 7 and older" + - "MacOS" + - "Debian or Debian-based" + - "Other" + validations: + required: true + + - type: input + id: browser + attributes: + label: Browser name and version + placeholder: e.g. Microsoft Edge 119.0.2151.58 + description: Put here your browser's name and version + validations: + required: true + + - type: input + id: version + attributes: + label: Extension version + placeholder: e.g. 3.0.0 + validations: + required: true + + - type: textarea + id: context + attributes: + label: Additional context + description: Add any other context about the problem here. + render: Markdown + validations: + required: false + + - type: dropdown + id: requested-help + attributes: + label: Are you willing to submit a PR for this issue? + options: + - "yes" + - "no" + validations: + required: true + + - type: checkboxes + id: checkboxes + attributes: + label: Validations + description: Before submitting the issue, please make sure you do the following + options: + - label: Check that there isn't already an issue that reports the same bug to avoid creating a duplicate. + required: true + - label: The provided reproduction is a minimal reproducible example of the bug. + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..6b89dc2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: + - name: Questions & Discussions + url: https://github.com/XFox111/PasswordGeneratorExtension/discussions + about: Use GitHub discussions for message-board style questions and discussions. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bca0308..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: enhancement -assignees: xfox111 ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when '...' - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. - -- [ ] Are you willing to submit a pull request to implement this feature yourself? diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..1b1fcb6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,66 @@ +name: "🚀 New feature proposal" +description: Suggest a feature idea for this project +title: "[Feature]: " +labels: ["feature", "needs-triage"] +assignees: + - xfox111 +body: + - type: markdown + attributes: + value: | + Thanks for your interest in the project and taking the time to fill out this feature report! + + - type: textarea + id: proposition + attributes: + label: Proposed solution + description: Describe the solution you'd like + render: Markdown + validations: + required: true + + - type: textarea + id: justification + attributes: + label: Justification + description: Is your feature request related to a problem? Please describe. + render: Markdown + validations: + required: true + + - type: textarea + id: alts + attributes: + label: Alternatives + description: Describe alternatives you've considered. + render: Markdown + validations: + required: true + + - type: textarea + id: context + attributes: + label: Additional context + description: Add any other context or screenshots about the feature request here. + render: Markdown + validations: + required: false + + - type: dropdown + id: requested-help + attributes: + label: Are you willing to submit a PR for this issue? + options: + - "yes" + - "no" + validations: + required: true + + - type: checkboxes + id: checkboxes + attributes: + label: Validations + description: Before submitting the issue, please make sure you do the following + options: + - label: Check that there isn't already an issue that request the same feature to avoid creating a duplicate. + required: true diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index cb95627..0366a9e 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -16,14 +16,14 @@ From now on we are starting to roll out updates on every first Tuesday of the mo Dependencies update and security fixes ## Changelog -### Dependencies bump +### Dependency bumps - # ### Fixed security vulnerabilities -- +- [CWE-20](https://cwe.mitre.org/data/definitions/20.html) (#) +- CVE-2022-25883 (#) ## PR Checklist -- [ ] Update extension version in `package.json` -- [ ] Create a release draft -- [ ] [Post-merge] Create a release to publish the new version +- [ ] Update version in `package.json` +- [ ] [Post-merge] Review and publish GitHub release - [ ] [Post-deploy] Update changelog for Firefox webstore --> diff --git a/.github/release_description_template.md b/.github/release_description_template.md index 28f20e5..9484252 100644 --- a/.github/release_description_template.md +++ b/.github/release_description_template.md @@ -3,11 +3,11 @@ From now on we are starting to roll out updates on every first Tuesday of the month, which will include bugfixes, security and dependency updates to keep the project's security and stability up to date! --> ## What's new - + ### Fixed security issues in this update - [CWE-20](https://cwe.mitre.org/data/definitions/20.html) - CVE-2022-25883 --> -Refer to [Download section of README.md](https://github.com/XFox111/PasswordGeneratorExtension#download) for instructions and download links +Refer to [Download section of the README.md](https://github.com/XFox111/PasswordGeneratorExtension#download) for sideloading instructions and download links diff --git a/.github/workflows/cd_pipeline.yaml b/.github/workflows/cd_pipeline.yaml index a8fecc6..9bd07a4 100644 --- a/.github/workflows/cd_pipeline.yaml +++ b/.github/workflows/cd_pipeline.yaml @@ -5,189 +5,145 @@ on: types: [ released ] workflow_dispatch: inputs: + targets: + description: Targets + required: true + default: '["chrome","firefox"]' + type: choice + options: + - '["chrome","firefox"]' + - '["chrome"]' + - '["firefox"]' firefox: - description: Mozilla Firefox + description: Deploy Firefox type: boolean default: true chrome: - description: Google Chrome + description: Deploy Chrome type: boolean default: true edge: - description: Microsoft Edge + description: Deploy Edge + type: boolean + default: true + gh-release: + description: Attach to GitHub release type: boolean default: true jobs: - Build: + build: + runs-on: ubuntu-latest + container: node:20 + strategy: + fail-fast: false + matrix: + target: ${{ fromJSON(github.event.inputs.targets || '["chrome","firefox"]') }} + + steps: + - uses: actions/checkout@main + + - run: yarn install + - run: yarn lint + - run: TARGET=${{ matrix.target }} yarn build + + - name: Drop build artifacts (${{ matrix.target }}) + uses: actions/upload-artifact@main + with: + name: ${{ matrix.target }} + path: dist + + - name: web-ext lint + if: ${{ matrix.target == 'firefox' }} + uses: freaktechnik/web-ext-lint@main + with: + extension-root: dist + self-hosted: false + + - uses: TheDoctor0/zip-release@main + with: + filename: packed-${{ matrix.target }}.zip + path: dist + + - name: Drop packed artifacts (${{ matrix.target }}) + uses: actions/upload-artifact@main + with: + name: packed-${{ matrix.target }} + path: packed-${{ matrix.target }}.zip + + publish-github: + needs: build + if: ${{ github.event_name == 'release' || github.event.inputs.gh-release == 'true' }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: ${{ fromJSON(github.event.inputs.targets || '["chrome","firefox"]') }} + + steps: + - uses: actions/download-artifact@main + with: + name: packed-${{ matrix.target }} + + - name: Attach build to release + uses: xresloader/upload-to-github-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + file: PasswordGenerator-${{ matrix.target }}.zip + draft: false + overwrite: true + update_latest_release: true + + publish-chrome: + needs: build + if: ${{ github.event_name == 'release' || (github.event.inputs.chrome == 'true' && contains(github.event.inputs.targets, 'chrome')) }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/download-artifact@main + with: + name: packed-chrome - - name: Configure manifest - uses: Amadevus/pwsh-script@v2 - with: - script: | - [PSCustomObject] $package = Get-Content "package.json" | ConvertFrom-Json; + - uses: wdzeng/chrome-extension@main + with: + extension-id: jnjobgjobffgmgfnkpkjfjkkfhfikmfl + zip-path: packed-chrome.zip + client-id: ${{ secrets.CHROME_CLIENT_ID }} + client-secret: ${{ secrets.CHROME_CLIENT_SECRET }} + refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }} - [PSCustomObject] $manifest = Get-Content "public/manifest.json" | ConvertFrom-Json; - $manifest.version = $package.version; - $manifest | ConvertTo-Json -Depth 10 | Out-File "public/manifest.json" - - $manifest = Get-Content "public/manifest.v2.json" | ConvertFrom-Json; - $manifest.version = $package.version; - $manifest | ConvertTo-Json -Depth 10 | Out-File "public/manifest.v2.json" - - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: '16.x' - cache: yarn - - - run: yarn install - - run: yarn build - - - name: Drop artifacts (build) - uses: actions/upload-artifact@v3.1.2 - with: - name: build - path: build - - Pack-Chromium: - if: ${{ github.event_name == 'release' || github.event.inputs.chrome == 'true' || github.event.inputs.edge == 'true' }} - needs: Build + publish-edge: + needs: build + if: ${{ github.event_name == 'release' || (github.event.inputs.edge == 'true' && contains(github.event.inputs.targets, 'chrome')) }} runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v3 - with: - name: build + - uses: actions/download-artifact@main + with: + name: packed-chrome - - name: Configure manifest - uses: Amadevus/pwsh-script@v2 - with: - script: Remove-Item "manifest.v2.json" + - uses: wdzeng/edge-addon@main + with: + product-id: ${{ secrets.EDGE_PRODUCT_ID }} + zip-path: packed-chrome.zip + client-id: ${{ secrets.EDGE_CLIENT_ID }} + client-secret: ${{ secrets.EDGE_CLIENT_SECRET }} + access-token-url: ${{ secrets.EDGE_ACCESS_TOKEN_URL }} - - name: Pack extension - uses: TheDoctor0/zip-release@0.7.1 - with: - filename: PasswordGenerator-Chromium.zip - - - name: Drop artifacts (Chromium) - uses: actions/upload-artifact@v3.1.2 - with: - name: Chromium - path: PasswordGenerator-Chromium.zip - - - name: Attach build to release - uses: xresloader/upload-to-github-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - file: PasswordGenerator-Chromium.zip - draft: false - update_latest_release: true - - Pack-Firefox: - if: ${{ github.event_name == 'release' || github.event.inputs.firefox == 'true' }} - needs: Build + publish-firefox: + needs: build + if: ${{ github.event_name == 'release' || (github.event.inputs.firefox == 'true' && contains(github.event.inputs.targets, 'firefox')) }} runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v3 - with: - name: build + - uses: actions/download-artifact@main + with: + name: packed-firefox - - name: Configure manifest - uses: Amadevus/pwsh-script@v2 - with: - script: | - Remove-Item "manifest.json" - Rename-Item "manifest.v2.json" "manifest.json" - - - name: "web-ext lint" - uses: kewisch/action-web-ext@e0ea88d527a8a90bc10d600f80ac667d219e6bf1 - with: - cmd: lint - source: . - channel: listed - - - name: Pack extension - uses: TheDoctor0/zip-release@0.7.1 - with: - filename: PasswordGenerator-Firefox.zip - - - name: Drop artifacts (Firefox) - uses: actions/upload-artifact@v3.1.2 - with: - name: Firefox - path: PasswordGenerator-Firefox.zip - - - name: Attach build to release - uses: xresloader/upload-to-github-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - file: PasswordGenerator-Firefox.zip - draft: false - update_latest_release: true - - Chrome: - if: ${{ github.event_name == 'release' || github.event.inputs.chrome == 'true' }} - needs: Pack-Chromium - runs-on: ubuntu-latest - - steps: - - name: Download artifacts (Chromium) - uses: actions/download-artifact@v3 - with: - name: Chromium - - - name: Publish to Chrome Web Store - uses: wdzeng/chrome-extension@v1.1.1 - with: - extension-id: jnjobgjobffgmgfnkpkjfjkkfhfikmfl - zip-path: PasswordGenerator-Chromium.zip - client-id: ${{ secrets.CHROME_CLIENT_ID }} - client-secret: ${{ secrets.CHROME_CLIENT_SECRET }} - refresh-token: ${{ secrets.CHROME_REFRESH_TOKEN }} - - Edge: - if: ${{ github.event_name == 'release' || github.event.inputs.edge == 'true' }} - needs: Pack-Chromium - runs-on: ubuntu-latest - - steps: - - name: Download artifacts (Chromium) - uses: actions/download-artifact@v3 - with: - name: Chromium - - - name: Publish to Edge Addons - uses: wdzeng/edge-addon@v1.1.0 - with: - product-id: ${{ secrets.EDGE_PRODUCT_ID }} - zip-path: PasswordGenerator-Chromium.zip - client-id: ${{ secrets.EDGE_CLIENT_ID }} - client-secret: ${{ secrets.EDGE_CLIENT_SECRET }} - access-token-url: ${{ secrets.EDGE_ACCESS_TOKEN_URL }} - - Firefox: - if: ${{ github.event_name == 'release' || github.event.inputs.firefox == 'true' }} - needs: Pack-Firefox - runs-on: ubuntu-latest - - steps: - - name: Download artifacts (Firefox) - uses: actions/download-artifact@v3 - with: - name: Firefox - - - name: Publish to Firefox - uses: wdzeng/firefox-addon@v1 - with: - addon-guid: ${{ secrets.FIREFOX_EXT_UUID }} - xpi-path: PasswordGenerator-Firefox.zip - jwt-issuer: ${{ secrets.FIREFOX_API_KEY }} - jwt-secret: ${{ secrets.FIREFOX_CLIENT_SECRET }} + - uses: wdzeng/firefox-addon@main + with: + addon-guid: ${{ secrets.FIREFOX_EXT_UUID }} + xpi-path: packed-firefox.zip + jwt-issuer: ${{ secrets.FIREFOX_API_KEY }} + jwt-secret: ${{ secrets.FIREFOX_CLIENT_SECRET }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7da5d0e..874f513 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -17,20 +17,20 @@ on: paths-ignore: - '**.md' - 'LICENSE' - - 'PRIVACY' - '**/cd_pipeline.yaml' - '**/dependabot.yml' - '**/pr_pipeline.yaml' + - '.vscode/*' pull_request: # The branches below must be a subset of the branches above branches: [ "main", "next" ] paths-ignore: - '**.md' - 'LICENSE' - - 'PRIVACY' - '**/cd_pipeline.yaml' - '**/dependabot.yml' - '**/pr_pipeline.yaml' + - '.vscode/*' schedule: - cron: '24 7 * * 3' @@ -46,7 +46,7 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript', 'typescript' ] + language: [ 'typescript' ] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support diff --git a/.github/workflows/pr_next.yaml b/.github/workflows/pr_next.yaml new file mode 100644 index 0000000..f0208e8 --- /dev/null +++ b/.github/workflows/pr_next.yaml @@ -0,0 +1,30 @@ +name: PR next workflow + +on: + push: + branches: [ master ] + paths: + - 'package.json' + +permissions: + contents: write + +jobs: + create-release-draft: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@main + + - name: Get version from package.json + id: get_manifest + run: | + content=`cat ./package.json` + echo "::set-output name=manifest::${content}" + + - uses: dev-build-deploy/release-me@v0.15.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + prefix: v + draft: true + version: ${{ fromJson(steps.get_manifest.outputs.manifest).version }} + release-notes: .github/release_description_template.md diff --git a/.github/workflows/pr_pipeline.yaml b/.github/workflows/pr_pipeline.yaml index 7aa4aae..7f7c001 100644 --- a/.github/workflows/pr_pipeline.yaml +++ b/.github/workflows/pr_pipeline.yaml @@ -10,72 +10,46 @@ on: - '**/cd_pipeline.yaml' - '**/dependabot.yml' - '**/codeql-analysis.yml' + - '**/pr_next.yaml' + - '.vscode/*' + - '.devcontainer/*' workflow_dispatch: + inputs: + targets: + description: Targets + required: true + default: '["chrome","firefox"]' + type: choice + options: + - '["chrome","firefox"]' + - '["chrome"]' + - '["firefox"]' jobs: build: runs-on: ubuntu-latest + container: node:20 + strategy: + fail-fast: false + matrix: + target: ${{ fromJSON(github.event.inputs.targets || '["chrome","firefox"]') }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@main - - name: Configure manifest - uses: Amadevus/pwsh-script@v2 - with: - script: | - [PSCustomObject] $package = Get-Content "package.json" | ConvertFrom-Json; - [PSCustomObject] $manifest = Get-Content "public/manifest.json" | ConvertFrom-Json; - $manifest.version = $package.version; - $manifest | ConvertTo-Json -Depth 10 | Out-File "public/manifest.json" - $manifest = Get-Content "public/manifest.v2.json" | ConvertFrom-Json; - $manifest.version = $package.version; - $manifest | ConvertTo-Json -Depth 10 | Out-File "public/manifest.v2.json" + - run: yarn install + - run: yarn lint + - run: TARGET=${{ matrix.target }} yarn build - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: '16.x' - cache: yarn + - name: Drop artifacts (${{ matrix.target }}) + uses: actions/upload-artifact@main + with: + name: ${{ matrix.target }} + path: dist - - run: yarn install - - run: yarn build - - - name: Drop artifacts (build) - uses: actions/upload-artifact@v3.1.2 - with: - name: build - path: build - - firefox-check: - needs: build - runs-on: ubuntu-latest - - steps: - - uses: actions/download-artifact@v3 - with: - name: build - - - name: Configure manifest - uses: Amadevus/pwsh-script@v2 - with: - script: | - Remove-Item "manifest.json" - Rename-Item "manifest.v2.json" "manifest.json" - - - name: "web-ext lint" - uses: kewisch/action-web-ext@e0ea88d527a8a90bc10d600f80ac667d219e6bf1 - with: - cmd: lint - source: . - channel: listed - - - name: Pack extension - uses: TheDoctor0/zip-release@0.7.1 - with: - filename: PasswordGenerator-Firefox.zip - - - name: Drop artifacts (Firefox) - uses: actions/upload-artifact@v3.1.2 - with: - name: Firefox - path: PasswordGenerator-Firefox.zip + - name: web-ext lint + if: ${{ matrix.target == 'firefox' }} + uses: freaktechnik/web-ext-lint@main + with: + extension-root: dist + self-hosted: false diff --git a/.gitignore b/.gitignore index 5545d4f..0e20185 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,26 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# IDE files -.vscode - -# dependencies -/node_modules -/.pnp -.pnp.js - -# testing -/coverage - -# production -/build - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - +# Logs +logs +*.log npm-debug.log* yarn-debug.log* yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +# Config files +.webextrc +.webextrc.* diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..8859641 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,15 @@ +{ + "recommendations": [ + "DNEK.auto-region-folder", + "eamodio.gitlens", + "jock.svg", + "firefox-devtools.vscode-firefox-debug", + "dbaeumer.vscode-eslint", + "github.vscode-github-actions", + "GitHub.vscode-pull-request-github", + "bierner.github-markdown-preview", + "mrmlnc.vscode-scss", + "Gruntfuggly.todo-tree", + "redhat.vscode-yaml" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..71ed60d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,52 @@ +{ + "json.schemas": [ + { + "fileMatch": [ + "/messages.json" + ], + "url": "https://gist.github.com/XFox111/9528b76f9f02704d620d4edbf421e06b/raw/e77197276f0aa2994cceae4ddf4dcfcabdce9dcb/webext-locale-schema.json" + } + ], + "editor.rulers": [ + { + "column": 120 + } + ], + "editor.insertSpaces": false, + "files.insertFinalNewline": true, + "editor.codeActionsOnSave": { + "source.organizeImports": true + }, + "files.eol": "\n", + "files.trimFinalNewlines": true, + "files.trimTrailingWhitespace": true, + "css.format.braceStyle": "expand", + "css.format.maxPreserveNewLines": 3, + "css.format.spaceAroundSelectorSeparator": true, + "css.format.newlineBetweenSelectors": false, + "css.lint.compatibleVendorPrefixes": "warning", + "css.lint.duplicateProperties": "warning", + "css.lint.float": "warning", + "css.lint.unknownVendorSpecificProperties": "warning", + "css.lint.zeroUnits": "warning", + "scss.format.braceStyle": "expand", + "scss.format.maxPreserveNewLines": 3, + "scss.format.spaceAroundSelectorSeparator": true, + "scss.lint.compatibleVendorPrefixes": "warning", + "scss.lint.duplicateProperties": "warning", + "scss.lint.float": "warning", + "scss.lint.unknownVendorSpecificProperties": "warning", + "scss.lint.zeroUnits": "warning", + "html.format.maxPreserveNewLines": 3, + "html.format.wrapAttributes": "preserve", + "javascript.format.placeOpenBraceOnNewLineForControlBlocks": true, + "javascript.format.placeOpenBraceOnNewLineForFunctions": true, + "javascript.format.semicolons": "insert", + "javascript.preferences.quoteStyle": "double", + "javascript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": true, + "typescript.format.placeOpenBraceOnNewLineForControlBlocks": true, + "typescript.format.placeOpenBraceOnNewLineForFunctions": true, + "typescript.format.semicolons": "insert", + "typescript.preferences.quoteStyle": "double", + "typescript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": true +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..efcebe9 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,80 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "shell", + "command": "yarn build", + "group": + { + "kind": "build", + "isDefault": true + }, + "label": "Build: Chromium" + }, + { + "type": "shell", + "command": "yarn build", + "group": + { + "kind": "build", + "isDefault": false + }, + "label": "Build: Firefox", + "options": { + "env": { + "TARGET": "firefox" + } + } + }, + { + "type": "shell", + "command": "yarn build", + "args": [ + "--watch", + "--mode", + "development" + ], + "group": "test", + "label": "Watch: Chromium" + }, + { + "type": "shell", + "command": "yarn build", + "args": [ + "--watch", + "--mode", + "development" + ], + "group": "test", + "label": "Watch: Firefox", + "options": { + "env": { + "TARGET": "firefox" + } + } + }, + { + "type": "shell", + "command": "yarn dev", + "group": "test", + "label": "Dev: Chromium" + }, + { + "type": "shell", + "command": "yarn dev", + "group": "test", + "label": "Dev: Firefox", + "options": { + "env": { + "TARGET": "firefox" + } + } + }, + { + "type": "shell", + "command": "yarn install", + "label": "Restore dependencies", + "group": "build" + } + ] +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1b94ae9..ae9f582 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,293 +1,2 @@ # Contribution Guidelines -Welcome, and thank you for your interest in contributing to my project! - -There are many ways in which you can contribute, beyond writing code. The goal of this document is to provide a high-level overview of how you can get involved. - -## Table of Contents -- [Contribution Guidelines](#contribution-guidelines) - - [Table of Contents](#table-of-contents) - - [Asking Questions](#asking-questions) - - [Providing Feedback](#providing-feedback) - - [Reporting Issues](#reporting-issues) - - [Look For an Existing Issue](#look-for-an-existing-issue) - - [Writing Good Bug Reports and Feature Requests](#writing-good-bug-reports-and-feature-requests) - - [Final Checklist](#final-checklist) - - [Follow Your Issue](#follow-your-issue) - - [Contributing to codebase](#contributing-to-codebase) - - [Deploy test version on your browser](#deploy-test-version-on-your-browser) - - [Development workflow](#development-workflow) - - [Release](#release) - - [Coding guidelines](#coding-guidelines) - - [Indentation](#indentation) - - [Names](#names) - - [Comments](#comments) - - [Strings](#strings) - - [Style](#style) - - [Finding an issue to work on](#finding-an-issue-to-work-on) - - [Contributing to translations](#contributing-to-translations) - - [Submitting pull requests](#submitting-pull-requests) - - [Spell check errors](#spell-check-errors) - - [Thank You!](#thank-you) - - [Attribution](#attribution) - -## Asking Questions -Have a question? Rather than opening an issue, please ask me directly on opensource@xfox111.net. - -## Providing Feedback -Your comments and feedback are welcome. -You can leave your feedbak on feedback@xfox111.net or do it on [Microsoft Edge Add-ons Webstore](https://microsoftedge.microsoft.com/addons/detail/manimdhobjbkfpeeehlhhneookiokpbj), [Chrome Extensions Webstore](https://chrome.google.com/webstore/detail/jnjobgjobffgmgfnkpkjfjkkfhfikmfl) or [Mozilla Add-ons Webstore](https://addons.mozilla.org/en-US/firefox/addon/easy-password-generator/) - -## Reporting Issues -Have you identified a reproducible problem in the extension? Have a feature request? I'd like to hear it! Here's how you can make reporting your issue as effective as possible. - -### Look For an Existing Issue -Before you create a new issue, please do a search in [open issues](https://github.com/xfox111/PasswordGeneratorExtension/issues) to see if the issue or feature request has already been filed. - -Be sure to scan through the [feature requests](https://github.com/XFox111/PasswordGeneratorExtension/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement). - -If you find your issue already exists, make relevant comments and add your [reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). Use a reaction in place of a "+1" comment: - -* 👍 - upvote -* 👎 - downvote - -If you cannot find an existing issue that describes your bug or feature, create a new issue using the guidelines below. - -### Writing Good Bug Reports and Feature Requests -File a single issue per problem and feature request. Do not enumerate multiple bugs or feature requests in the same issue. - -Do not add your issue as a comment to an existing issue unless they are the same ones. Many issues look similar, but have different causes. - -The more information you can provide, the more likely someone will be successful at reproducing the issue and finding a solution. - -Please include the following with each issue: -- Current version of the extension -- Your current browser and OS name -- Reproducible steps (1... 2... 3...) that cause the issue -- What you expected to see, versus what you actually saw -- Images, animations, or a link to a video showing the issue occurring - -### Final Checklist -Please remember to do the following: -- [*] Search the issue repository to ensure your report is a new issue -- [*] Separate issues reports -- [*] Include as much information as you can to your report - -Don't feel bad if the developers can't reproduce the issue right away. They will simply ask for more information! - -### Follow Your Issue -Once your report is submitted, be sure to stay in touch with the devs in case they need more help from you. - -## Contributing to codebase -If you are interested in writing code to fix issues or implement new awesome features you can follow this guidelines to get a better result - -### Deploy test version on your browser -1. Clone repository to local storage using [Git](https://guides.github.com/introduction/git-handbook/) - ``` - git clone https://github.com/xfox111/PasswordGeneratorExtension.git - ``` -2. Install [Node.js](https://nodejs.org/en/) and [Yarn](https://yarnpkg.com/) -3. Open terminal in project directory and run - ```bash - yarn install - ``` -4. Build project - ```bash - yarn build - ``` -2. Enable Developers mode on your browser extensions page -3. Click "Load unpacked" button and navigate to the `build` folder of the repo (contains `manifest.json`) -4. Done! - -To run extension as standalone web application you can use `yarn start` command - -Next time you make any changes to the codebase, rebuild extension with `yarn build` and reload extension by toggling it off and on or by pressing "Reload" button on extensions list page - -### Development workflow -This section represents how contributors should interact with codebase implementing features and fixing bugs -1. Getting assigned to the issue -2. Creating a repository fork -3. Making changes to codebase -5. Creating a pull request to `main` -6. Reviewing & completing PR -7. Done - -#### Release -Next stage is release. Release performs on every push to main (which makes functional changes to the source code). Release performs manually by @XFox111 into: Chrome, Firefox, Edge webstores as well as GitHub releases - -### Coding guidelines -#### Indentation -We use tabs, not spaces. - -#### Names -The project naming rules inherit [.NET Naming Guidelines](https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/naming-guidelines). Nevertheless there'is some distinction with the guidelines as well as additions to the one: -- Use `camelCase` for variables instead of `CamelCase` stated in [Capitalization Conventions](https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/capitalization-conventions#capitalization-rules-for-identifiers) -- Use `camelCase` for files in `public` directory -- Use `PascalCase` for files in `src` directory - -#### Comments -Leave as more comments as you can. Remember: the more detailed documentation your code has the less programmers will curse you in the future - -#### Strings -Use "double quotes" wherever it's possible - -#### Style -- Prefer to use lambda functions -- Always put curly braces on new lines - - Wrong: - ```js - if (condition) { - ... - } - ``` - - Correct: - ```js - if (condition) - { - ... - } - ``` - > **Note:** For JSON files put opening brace on the same line as the key -- Put spaces between operators, conditionals and loops - - Wrong: - ```js - y=k*x+b; - if(condition) { ... } - ``` - - Correct: - ```js - y = k * x + b; - if (condition) { ... } - ``` -- Use ternary conditionals wherever it's possible, unless it's too long - - Wrong: - ```js - var s; - if (condition) - s = "Life"; - else - s = "Death"; - ``` - - Correct: - ```js - var s = condition ? "Life" : "Death"; - ``` -- Do not surround loop and conditional bodies with curly braces if they can be avoided - - Wrong: - ```js - if (condition) - { - console.log("Hello, World!"); - } - else - { - return; - } - ``` - - Correct - ```js - if (condition) - console.log("Hello, World!"); - else - return; - ``` -- Prefer export modules as default - - Wrong: - ```js - export class MyClass { ... } - ``` - - Correct: - ```js - export default class MyClass { ... } - ``` -- Prefer export modules as classes unless it is excessive - - Wrong: - ```ts - export function MyFunction1() { ... } - export function MyFunction2() { ... } - export default class MyClass2() - { - public static GetDate(timestamp: number): Date - { - return new Date(timestamp); - } - } - ``` - - Correct: - ```js - export default class MyClass1 - { - public static MyFunction1() { ... } - public static MyFunction2() { ... } - } - export default GetDate(timestamp: number): Date - { - return new Date(timestamp); - } - ``` -- When JSX attributes take too much space, put each attribute on a new line and put additional line before component's content - - Wrong: - ```tsx - My content here - My content here - - My content here - - - My content here - - ``` - - Correct: - ```tsx - - - My content here - - ``` -- If JSX component doesn't have content, put space before closing tag - - Wrong: - ```tsx - - ``` - - Correct: - ```tsx - - ``` - -### Finding an issue to work on -Check out the [full issues list](https://github.com/XFox111/PasswordGeneratorExtension/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue) for a list of all potential areas for contributions. **Note** that just because an issue exists in the repository does not mean we will accept a contribution. There are several reasons we may not accept a pull request like: - -- Performance - One of project's core values is to deliver a lightweight extension, that means it should perform well in both real and test environments. -- User experience - Since we want to deliver a lightweight extension, the UX should feel lightweight as well and not be cluttered. Most changes to the UI should go through the issue owner and project owner (@XFox111). -- Architectural - Project owner needs to agree with any architectural impact a change may make. Such things must be discussed with and agreed upon by the project owner. - -To improve the chances to get a pull request merged you should select an issue that is labelled with the `help-wanted` or `bug` labels. If the issue you want to work on is not labelled with `help-wanted` or `bug`, you can start a conversation with the project owner asking whether an external contribution will be considered. - -To avoid multiple pull requests resolving the same issue, let others know you are working on it by saying so in a comment. - -### Contributing to translations -If you want to help us to translate this extension into other languages, please read [this article](https://developer.chrome.com/extensions/i18n) - -**Note** that whatever you want to contribute to the codebase, you should do it only after you got assigned on an issue - -### Submitting pull requests -To enable us to quickly review and accept your pull requests, always create one pull request per issue and [link the issue in the pull request](https://github.com/blog/957-introducing-issue-mentions). Never merge multiple requests in one unless they have the same root cause. Be sure to follow our [Coding Guidelines](#coding-guidelines) and keep code changes as small as possible. Avoid pure formatting changes to code that has not been modified otherwise. Pull requests should contain tests whenever possible. Fill pull request content according to its template. Deviations from template are not recommended - -#### Spell check errors -Pull requests that fix typos are welcomed but please make sure it doesn't touch multiple feature areas, otherwise it will be difficult to review. Pull requests only fixing spell check errors in source code are not recommended. - -## Thank You! - -Your contributions to open source, large or small, make great projects like this possible. Thank you for taking the time to contribute. - -## Attribution -This Contribution Guidelines are adapted from the [Contributing to VS Code](https://github.com/microsoft/vscode/blob/master/CONTRIBUTING.md) +This article has been moved to the [project's Wiki section](https://github.com/XFox111/PasswordGeneratorExtension/wiki/Contribution-Guidelines) diff --git a/LICENSE b/LICENSE index faa3947..8befceb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 Eugene Fox +Copyright (c) 2023 Eugene Fox Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/PRIVACY.md b/PRIVACY.md index 722a439..728c51a 100644 --- a/PRIVACY.md +++ b/PRIVACY.md @@ -1,4 +1,5 @@ -# Password Generator Extension Privacy Policy -1. Developers of the extension don't affiliate with Google LLC, Mozilla Foundation or Microsoft Corporation in any way -2. This extension doesn't store any personal data (data which may be used to track your location or reveal your identity) -3. This extension uses build-in cloud storage of your browser to store extension settings +# Password generator extension Privacy policy +1. Developers of the extension don't affiliate with Google LLC, Mozilla Foundation or Microsoft Corporation in any way. +2. This extension doesn't store any personal data (data which may be used to track your location or reveal your identity). +3. This extension uses cloud storage built into your browser to store its settings. +4. Refer to your browser's developer regarding the privacy policy of the cloud storage used by your browser. diff --git a/README.md b/README.md index 55e4620..aa816b8 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,13 @@ -# Password generator + + [![GitHub release (latest by date)](https://img.shields.io/github/v/release/xfox111/PasswordGeneratorExtension)](https://github.com/xfox111/PasswordGeneratorExtension/releases/latest) [![GitHub last commit](https://img.shields.io/github/last-commit/xfox111/PasswordGeneratorExtension?label=Last+update)](https://github.com/XFox111/PasswordGeneratorExtension/commits/main) -[![Twitter Follow](https://img.shields.io/twitter/follow/xfox111?style=social)](https://twitter.com/xfox111) -[![GitHub followers](https://img.shields.io/github/followers/xfox111?label=Follow%20@xfox111&style=social)](https://github.com/xfox111) -[![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-%40xfox111-orange)](https://buymeacoffee.com/xfox111) - -![Password generator](https://img1.teletype.in/files/4d/93/4d935519-814b-41b7-a3c0-54503eb4eac7.png) + + + + Password generator + Extension for web browsers which helps you to easily generate strong passwords in one click @@ -23,8 +24,6 @@ Extension for web browsers which helps you to easily generate strong passwords i - Russian - Portuguese (Brazil) -Password generator v2.0 - ## Download [![Chrome Web Store](https://img.shields.io/chrome-web-store/users/jnjobgjobffgmgfnkpkjfjkkfhfikmfl?label=Chrome%20Webstore%20downloads)](https://chrome.google.com/webstore/detail/jnjobgjobffgmgfnkpkjfjkkfhfikmfl) [![Mozilla Add-on](https://img.shields.io/amo/users/easy-password-generator?label=Firefox%20Webstore%20downloads)](https://addons.mozilla.org/firefox/addon/easy-password-generator/) @@ -83,18 +82,12 @@ There are many ways in which you can participate in the project, for example: - Review [source code changes](https://github.com/xfox111/PasswordGeneratorExtension/pulls) - Review documentation and make pull requests for anything from typos to new content -If you are interested in fixing issues and contributing directly to the code base, please see the [Contribution Guidelines](https://github.com/XFox111/PasswordGeneratorExtension/blob/master/CONTRIBUTING.md), which covers the following: -- [How to deploy the extension on your browser](https://github.com/XFox111/PasswordGeneratorExtension/blob/master/CONTRIBUTING.md#deploy-test-version-on-your-browser) -- [The development workflow](https://github.com/XFox111/PasswordGeneratorExtension/blob/master/CONTRIBUTING.md#development-workflow), including debugging and running tests -- [Coding guidelines](https://github.com/XFox111/PasswordGeneratorExtension/blob/master/CONTRIBUTING.md#coding-guidelines) -- [Submitting pull requests](https://github.com/XFox111/PasswordGeneratorExtension/blob/master/CONTRIBUTING.md#submitting-pull-requests) -- [Finding an issue to work on](https://github.com/XFox111/PasswordGeneratorExtension/blob/master/CONTRIBUTING.md#finding-an-issue-to-work-on) -- [Contributing to translations](https://github.com/XFox111/PasswordGeneratorExtension/blob/master/CONTRIBUTING.md#contributing-to-translations) +If you are interested in fixing issues and contributing directly to the code base, please refer to the [Contribution Guidelines](https://github.com/XFox111/PasswordGeneratorExtension/wiki/Contribution-Guidelines) -## Code of Conduct -This project has adopted the Contributor Covenant. For more information see the [Code of Conduct](https://github.com/XFox111/PasswordGeneratorExtension/blob/master/CODE_OF_CONDUCT.md) +--- + +[![Twitter Follow](https://img.shields.io/twitter/follow/xfox111?style=social)](https://twitter.com/xfox111) +[![GitHub followers](https://img.shields.io/github/followers/xfox111?label=Follow%20@xfox111&style=social)](https://github.com/xfox111) +[![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-%40xfox111-orange)](https://buymeacoffee.com/xfox111) -## Copyrights > ©2023 Eugene Fox - -[![MIT License](https://img.shields.io/github/license/xfox111/PasswordGeneratorExtension)](https://opensource.org/licenses/MIT) diff --git a/SECURITY.md b/SECURITY.md index 0f80ecd..0abe308 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,21 +1,11 @@ # Security Policy ## Supported Versions -Password generator extension has a linear versioning system. The latest version is always the most secure one. If you are using an older version, please update it to the latest one. +Password generator extension has a linear versioning system. The latest version is always the most secure one. This is applied to major versions as well. If you are using an older version, please update it to the latest one. We regularly run security audits and fix any security issues that are found. If you find a security issue, please report it to us as described below. -### 1.x EoL -With 2.0 release bringing substantial changes to the extension, 1.x versions are no longer supported. Please update to the latest version. - -If you are willing to continue using 1.x version, you can sideload it from the [releases page](https://github.com/XFox111/PasswordGeneratorExtension/releases/tag/v1.3). Use outdated versions at your own risk. - - -| Version | Supported | -| ------- | ------------------ | -| 2.x.x | :white_check_mark: | -| < 2.0.0 | :x: | +If you are willing to continue using an older version, you can sideload it from the [releases page](https://github.com/XFox111/PasswordGeneratorExtension/releases). Use outdated versions at your own risk. ## Reporting a Vulnerability - -In case you find a security issue, please report it to us by [creating an issue](https://github.com/XFox111/PasswordGeneratorExtension/issues/new?assignees=xfox111&labels=security+vulnerability&template=bug_report.md&title=) +You can report a security issue by clicking "Report a vulnerabilty" button at the top-right of this page, or by going through [this link](https://github.com/XFox111/PasswordGeneratorExtension/security/advisories/new) diff --git a/craco.config.ts b/craco.config.ts deleted file mode 100644 index a044d5a..0000000 --- a/craco.config.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { CracoConfig, WebpackContext } from "@craco/types"; -import { Configuration as WebpackConfig } from "webpack"; -import HtmlWebapckPlugin, { MinifyOptions } from "html-webpack-plugin"; -import { Configuration } from "webpack"; - -// Craco config file -// Craco is used to separate content and background scripts from the main JS bundle -const cracoConfig: CracoConfig = -{ - webpack: - { - configure: ((webpackConfig: WebpackConfig, { env, paths }: WebpackContext): WebpackConfig => - { - const isProduction: boolean = env === "production"; - - const config: WebpackConfig = - { - ...webpackConfig, - entry: - { - main: paths!.appIndexJs, - background: "./src/Services/BackgroundService.ts", - contentScript: "./src/Services/ContentService.ts", - }, - output: - { - ...webpackConfig.output, - filename: "static/js/[name].js" - }, - optimization: - { - ...webpackConfig.optimization, - splitChunks: { cacheGroups: { default: false } }, - runtimeChunk: false - } - }; - - const minifyOptions: MinifyOptions = - { - removeComments: true, - collapseWhitespace: true, - removeRedundantAttributes: true, - useShortDoctype: true, - removeEmptyAttributes: true, - removeStyleLinkTypeAttributes: true, - keepClosingSlash: true, - minifyJS: true, - minifyCSS: true, - minifyURLs: true - }; - - config.plugins = config.plugins?.filter((plugin: any) => plugin.constructor.name !== "HtmlWebpackPlugin") ?? []; - - config.plugins.push(new HtmlWebapckPlugin({ - inject: true, - chunks: ["main"], - template: paths!.appHtml, - filename: "index.html", - minify: isProduction && minifyOptions - })); - - return config; - }) - } -}; - -export default cracoConfig; diff --git a/package.json b/package.json index bdb4cfa..ff39046 100644 --- a/package.json +++ b/package.json @@ -1,61 +1,40 @@ { "name": "password-generator", - "version": "2.2.8", + "version": "3.0.0", "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0" + }, "dependencies": { - "@craco/craco": "^7.1.0", - "@fluentui/react-components": "^9.19.1", - "@fluentui/react-icons": "^2.0.209", + "@fluentui/react-components": "^9.39.0", + "@fluentui/react-icons": "^2.0.222", "react": "^18.2.0", - "react-device-detect": "^2.2.3", - "react-dom": "^18.2.0", - "sass": "^1.66.1", - "typescript": "^5.1.6", - "webextension-polyfill": "^0.10.0" + "react-dom": "^18.2.0" }, "devDependencies": { - "@craco/types": "^7.1.0", - "@testing-library/jest-dom": "^5.14.1", - "@testing-library/react": "^14.0.0", - "@testing-library/user-event": "^14.4.3", - "@types/jest": "^29.5.4", - "@types/node": "^20.4.5", - "@types/react": "^18.2.21", - "@types/react-dom": "^18.2.7", - "@types/webextension-polyfill": "^0.10.2", - "html-webpack-plugin": "^5.5.3", - "react-scripts": "5.0.1", - "webpack": "^5.88.2" - }, - "scripts": { - "start": "craco start", - "build": "craco build", - "test": "react-scripts test", - "eject": "react-scripts eject" - }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ] - }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] + "@types/react": "^18.2.37", + "@types/react-dom": "^18.2.15", + "@types/webextension-polyfill": "^0.10.6", + "@typescript-eslint/eslint-plugin": "^6.10.0", + "@typescript-eslint/parser": "^6.10.0", + "@vitejs/plugin-react-swc": "^3.4.1", + "eslint": "^8.53.0", + "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-refresh": "^0.4.4", + "sass": "^1.69.5", + "typescript": "^5.2.2", + "vite": "^4.5.0", + "vite-plugin-static-copy": "^0.17.0", + "vite-plugin-svgr": "^4.1.0", + "vite-plugin-web-extension": "^3.0.1", + "webextension-polyfill": "^0.10.0" }, "resolutions": { - "json5": "1.0.2", - "loader-utils": "2.0.4", - "minimatch": "3.0.5", - "nth-check": "2.0.1", - "semver": "^7.5.2" + "postcss": "^8.4.31", + "tough-cookie": "^4.1.3" } } diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json deleted file mode 100644 index a67fc33..0000000 --- a/public/_locales/en/messages.json +++ /dev/null @@ -1,174 +0,0 @@ -{ - "name": { - "message": "Password Generator", - "description": "manifest.json" - }, - "description": { - "message": "Password generator extension allows you to easily generate long and secure password in one click", - "description": "manifest.json" - }, - "author": { - "message": "Eugene Fox", - "description": "manifest.json" - }, - "Password_generator": { - "message": "Password generator", - "description": "App.tsx" - }, - "Copy": { - "message": "Copy", - "description": "PasswordView.tsx" - }, - "Generate_new": { - "message": "Generate new", - "description": "PasswordView.tsx" - }, - "Exclude_special_symbols_one_time": { - "message": "Generate password without special symbols", - "description": "PasswordView.tsx" - }, - "Include_special_symbols_one_time": { - "message": "Generate password with special symbols", - "description": "PasswordView.tsx" - }, - "Settings": { - "message": "Settings", - "description": "SettingsSection.tsx" - }, - "Password_length": { - "message": "Password length", - "description": "SettingsSection.tsx" - }, - "Recommended_password_length": { - "message": "Recommended password length", - "description": "SettingsSection.tsx" - }, - "Character_options": { - "message": "Character options", - "description": "SettingsSection.tsx" - }, - "Include": { - "message": "Include", - "description": "SettingsSection.tsx" - }, - "Special_symbols": { - "message": "Special symbols", - "description": "SettingsSection.tsx" - }, - "Numeric": { - "message": "Numeric", - "description": "SettingsSection.tsx" - }, - "Uppercase": { - "message": "Uppercase", - "description": "SettingsSection.tsx" - }, - "Lowercase": { - "message": "Lowercase", - "description": "SettingsSection.tsx" - }, - "Exclude": { - "message": "Exclude", - "description": "SettingsSection.tsx" - }, - "Similar": { - "message": "Similar", - "description": "SettingsSection.tsx" - }, - "Ambiguous": { - "message": "Ambiguous", - "description": "SettingsSection.tsx" - }, - "Repeating": { - "message": "Repeating", - "description": "SettingsSection.tsx" - }, - "Add_shortcut_to_context_menu": { - "message": "Add shortcut to context menu", - "description": "SettingsSection.tsx" - }, - "Right_click_password_field_to_quickly_generate_password": { - "message": "Right-click password field to quickly generate password", - "description": "SettingsSection.tsx" - }, - "Automatically_copy_to_clipboard": { - "message": "Automatically copy to clipboard", - "description": "SettingsSection.tsx" - }, - "About": { - "message": "About", - "description": "AboutSection.tsx" - }, - "Developed_by_Eugene_Fox": { - "message": "Developed by Eugene Fox", - "description": "AboutSection.tsx" - }, - "Licensed_under": { - "message": "Licensed under", - "description": "AboutSection.tsx" - }, - "MIT_license": { - "message": "MIT license", - "description": "AboutSection.tsx" - }, - "Want_to_contribute_translation_for_your_language_": { - "message": "Want to contribute translation for your language?", - "description": "AboutSection.tsx" - }, - "Read_this_to_get_started": { - "message": "Read this to get started", - "description": "AboutSection.tsx" - }, - "My_website": { - "message": "My website", - "description": "AboutSection.tsx" - }, - "Source_code": { - "message": "Source code", - "description": "AboutSection.tsx" - }, - "Changelog": { - "message": "Changelog", - "description": "AboutSection.tsx" - }, - "Leave_feedback": { - "message": "Leave feedback", - "description": "AboutSection.tsx" - }, - "Buy_me_a_coffee": { - "message": "Buy me a coffee", - "description": "AboutSection.tsx" - }, - "Set_name": { - "message": "Name", - "description": "CharacterHelpDialog.tsx" - }, - "Characters": { - "message": "Characters", - "description": "CharacterHelpDialog.tsx" - }, - "__etc_": { - "message": ", etc.", - "description": "CharacterHelpDialog.tsx" - }, - "OK": { - "message": "OK", - "description": "CharacterHelpDialog.tsx" - }, - "Either_lowercase_or_uppercase_characters_must_be_included": { - "message": "Either lowercase or uppercase characters must be included", - "description": "Generator.tsx" - }, - "Selected_length_is_too_long_to_exclude_repeating_characters": { - "message": "Selected length is too long to exclude repeating characters", - "description": "Generator.tsx" - }, - "Quick_generator_is_only_available_on_password_fields": { - "message": "Quick generator is only available on password fields", - "description": "ContentService.tsx" - }, - "Quick_generate_password": { - "message": "Quick generate password", - "description": "BackgroundService.tsx" - } -} diff --git a/public/_locales/pl/messages.json b/public/_locales/pl/messages.json deleted file mode 100644 index b892782..0000000 --- a/public/_locales/pl/messages.json +++ /dev/null @@ -1,174 +0,0 @@ -{ - "name": { - "message": "Generator haseł", - "description": "manifest.json" - }, - "description": { - "message": "Rozszerzenie, które pozwala na łatwe generowanie trudnych i bezpiecznych haseł w jednym kliknięciu", - "description": "manifest.json" - }, - "author": { - "message": "Jewgienij Lis", - "description": "manifest.json" - }, - "Password_generator": { - "message": "Generator haseł", - "description": "App.tsx" - }, - "Copy": { - "message": "Kopiuj", - "description": "PasswordView.tsx" - }, - "Generate_new": { - "message": "Utwórz nowy", - "description": "PasswordView.tsx" - }, - "Exclude_special_symbols_one_time": { - "message": "Wygeneruj hasło bez znaków specjalnych", - "description": "PasswordView.tsx" - }, - "Include_special_symbols_one_time": { - "message": "Wygeneruj hasło z znakami specjalnymi", - "description": "PasswordView.tsx" - }, - "Settings": { - "message": "Ustawienia", - "description": "SettingsSection.tsx" - }, - "Password_length": { - "message": "Długość hasła", - "description": "SettingsSection.tsx" - }, - "Recommended_password_length": { - "message": "Zalecana długość hasła", - "description": "SettingsSection.tsx" - }, - "Character_options": { - "message": "Ustawienia symboli", - "description": "SettingsSection.tsx" - }, - "Include": { - "message": "Włącz", - "description": "SettingsSection.tsx" - }, - "Special_symbols": { - "message": "Znaki specjalne", - "description": "SettingsSection.tsx" - }, - "Numeric": { - "message": "Liczby", - "description": "SettingsSection.tsx" - }, - "Uppercase": { - "message": "Wielkie litery", - "description": "SettingsSection.tsx" - }, - "Lowercase": { - "message": "Małe litery", - "description": "SettingsSection.tsx" - }, - "Exclude": { - "message": "Wyłącz", - "description": "SettingsSection.tsx" - }, - "Similar": { - "message": "Podobne", - "description": "SettingsSection.tsx" - }, - "Ambiguous": { - "message": "Niebezpieczne", - "description": "SettingsSection.tsx" - }, - "Repeating": { - "message": "Powtarzające się", - "description": "SettingsSection.tsx" - }, - "Add_shortcut_to_context_menu": { - "message": "Dodaj rozszerzenie do menu kontekstowego", - "description": "SettingsSection.tsx" - }, - "Right_click_password_field_to_quickly_generate_password": { - "message": "Kliknij prawym przyciskiem myszy w pole hasła, aby szybko wygenerować hasło", - "description": "SettingsSection.tsx" - }, - "Automatically_copy_to_clipboard": { - "message": "Automatycznie kopiuj do schowka", - "description": "SettingsSection.tsx" - }, - "About": { - "message": "O rozszerzeniu", - "description": "AboutSection.tsx" - }, - "Developed_by_Eugene_Fox": { - "message": "Autor: Jewgienij Lis", - "description": "AboutSection.tsx" - }, - "Licensed_under": { - "message": "Licencja", - "description": "AboutSection.tsx" - }, - "MIT_license": { - "message": "MIT", - "description": "AboutSection.tsx" - }, - "Want_to_contribute_translation_for_your_language_": { - "message": "Chcesz pomóc z tłumaczeniem na swój język?", - "description": "AboutSection.tsx" - }, - "Read_this_to_get_started": { - "message": "Przeczytaj ten artykuł", - "description": "AboutSection.tsx" - }, - "My_website": { - "message": "Moja strona internetowa", - "description": "AboutSection.tsx" - }, - "Source_code": { - "message": "Kod źródłowy", - "description": "AboutSection.tsx" - }, - "Changelog": { - "message": "Lista zmian", - "description": "AboutSection.tsx" - }, - "Leave_feedback": { - "message": "Zostaw opinię", - "description": "AboutSection.tsx" - }, - "Buy_me_a_coffee": { - "message": "Wesprzyj", - "description": "AboutSection.tsx" - }, - "Set_name": { - "message": "Nazwa", - "description": "CharacterHelpDialog.tsx" - }, - "Characters": { - "message": "Znaki", - "description": "CharacterHelpDialog.tsx" - }, - "__etc_": { - "message": " itp.", - "description": "CharacterHelpDialog.tsx" - }, - "OK": { - "message": "OK", - "description": "CharacterHelpDialog.tsx" - }, - "Either_lowercase_or_uppercase_characters_must_be_included": { - "message": "Muszą być uwzględnione małe lub wielkie litery", - "description": "Generator.tsx" - }, - "Selected_length_is_too_long_to_exclude_repeating_characters": { - "message": "Wybrana długość jest zbyt długa, aby wykluczyć powtarzające się znaki", - "description": "Generator.tsx" - }, - "Quick_generator_is_only_available_on_password_fields": { - "message": "Szybki generator jest dostępny tylko dla pól hasła", - "description": "ContentService.tsx" - }, - "Quick_generate_password": { - "message": "Wygeneruj hasło", - "description": "BackgroundService.tsx" - } -} diff --git a/public/_locales/pt_BR/messages.json b/public/_locales/pt_BR/messages.json deleted file mode 100644 index 2b272d8..0000000 --- a/public/_locales/pt_BR/messages.json +++ /dev/null @@ -1,174 +0,0 @@ -{ - "name": { - "message": "Gerador de Senhas", - "description": "manifest.json" - }, - "description": { - "message": "A extensão do gerador de senhas permite gerar facilmente uma senha longa e segura em um clique", - "description": "manifest.json" - }, - "author": { - "message": "Eugene Fox", - "description": "manifest.json" - }, - "Password_generator": { - "message": "Gerador de senhas", - "description": "App.tsx" - }, - "Copy": { - "message": "Copiar", - "description": "PasswordView.tsx" - }, - "Generate_new": { - "message": "Gerar nova", - "description": "PasswordView.tsx" - }, - "Exclude_special_symbols_one_time": { - "message": "Gerar senha sem símbolos especiais", - "description": "PasswordView.tsx" - }, - "Include_special_symbols_one_time": { - "message": "Gerar senha com símbolos especiais", - "description": "PasswordView.tsx" - }, - "Settings": { - "message": "Configurações", - "description": "SettingsSection.tsx" - }, - "Password_length": { - "message": "Comprimento da senha", - "description": "SettingsSection.tsx" - }, - "Recommended_password_length": { - "message": "Comprimento recomendado da senha", - "description": "SettingsSection.tsx" - }, - "Character_options": { - "message": "Opções de caracteres", - "description": "SettingsSection.tsx" - }, - "Include": { - "message": "Incluir", - "description": "SettingsSection.tsx" - }, - "Special_symbols": { - "message": "Símbolos especiais", - "description": "SettingsSection.tsx" - }, - "Numeric": { - "message": "Numérico", - "description": "SettingsSection.tsx" - }, - "Uppercase": { - "message": "Maiúsculas", - "description": "SettingsSection.tsx" - }, - "Lowercase": { - "message": "Minúsculas", - "description": "SettingsSection.tsx" - }, - "Exclude": { - "message": "Excluir", - "description": "SettingsSection.tsx" - }, - "Similar": { - "message": "Semelhante", - "description": "SettingsSection.tsx" - }, - "Ambiguous": { - "message": "Ambíguo", - "description": "SettingsSection.tsx" - }, - "Repeating": { - "message": "Repetido", - "description": "SettingsSection.tsx" - }, - "Add_shortcut_to_context_menu": { - "message": "Adicionar atalho ao menu de contexto", - "description": "SettingsSection.tsx" - }, - "Right_click_password_field_to_quickly_generate_password": { - "message": "Clique com o botão direito do mouse no campo de senha para gerar a senha rapidamente", - "description": "SettingsSection.tsx" - }, - "Automatically_copy_to_clipboard": { - "message": "Copiar automaticamente para a área de transferência", - "description": "SettingsSection.tsx" - }, - "About": { - "message": "Sobre", - "description": "AboutSection.tsx" - }, - "Developed_by_Eugene_Fox": { - "message": "Desenvolvido por Eugene Fox", - "description": "AboutSection.tsx" - }, - "Licensed_under": { - "message": "Licenciado sob", - "description": "AboutSection.tsx" - }, - "MIT_license": { - "message": "Licença MIT", - "description": "AboutSection.tsx" - }, - "Want_to_contribute_translation_for_your_language_": { - "message": "Quer contribuir com a tradução para o seu idioma?", - "description": "AboutSection.tsx" - }, - "Read_this_to_get_started": { - "message": "Leia isto para começar", - "description": "AboutSection.tsx" - }, - "My_website": { - "message": "Meu website", - "description": "AboutSection.tsx" - }, - "Source_code": { - "message": "Código fonte", - "description": "AboutSection.tsx" - }, - "Changelog": { - "message": "Registro de alterações", - "description": "AboutSection.tsx" - }, - "Leave_feedback": { - "message": "Deixar feedback", - "description": "AboutSection.tsx" - }, - "Buy_me_a_coffee": { - "message": "Compre-me um café", - "description": "AboutSection.tsx" - }, - "Set_name": { - "message": "Nome", - "description": "CharacterHelpDialog.tsx" - }, - "Characters": { - "message": "Caracteres", - "description": "CharacterHelpDialog.tsx" - }, - "__etc_": { - "message": ", etc.", - "description": "CharacterHelpDialog.tsx" - }, - "OK": { - "message": "OK", - "description": "CharacterHelpDialog.tsx" - }, - "Either_lowercase_or_uppercase_characters_must_be_included": { - "message": "Caracteres minúsculos ou maiúsculos devem ser incluídos", - "description": "Generator.tsx" - }, - "Selected_length_is_too_long_to_exclude_repeating_characters": { - "message": "O comprimento selecionado é muito longo para excluir caracteres repetidos", - "description": "Generator.tsx" - }, - "Quick_generator_is_only_available_on_password_fields": { - "message": "O gerador rápido está disponível apenas em campos de senha", - "description": "ContentService.tsx" - }, - "Quick_generate_password": { - "message": "Gerar senha rápida", - "description": "BackgroundService.tsx" - } -} diff --git a/public/_locales/ru/messages.json b/public/_locales/ru/messages.json deleted file mode 100644 index 2170e3c..0000000 --- a/public/_locales/ru/messages.json +++ /dev/null @@ -1,174 +0,0 @@ -{ - "name": { - "message": "Генератор паролей", - "description": "manifest.json" - }, - "description": { - "message": "Расширение, позволяющее легко генерировать сложные и надежные пароли в один клик", - "description": "manifest.json" - }, - "author": { - "message": "Евгений Лис", - "description": "manifest.json" - }, - "Password_generator": { - "message": "Генератор паролей", - "description": "App.tsx" - }, - "Copy": { - "message": "Копировать", - "description": "PasswordView.tsx" - }, - "Generate_new": { - "message": "Создать новый", - "description": "PasswordView.tsx" - }, - "Exclude_special_symbols_one_time": { - "message": "Сгенерировать пароль без спецсимволов", - "description": "PasswordView.tsx" - }, - "Include_special_symbols_one_time": { - "message": "Сгенерировать пароль со спецсимволами", - "description": "PasswordView.tsx" - }, - "Settings": { - "message": "Настройки", - "description": "SettingsSection.tsx" - }, - "Password_length": { - "message": "Длина пароля", - "description": "SettingsSection.tsx" - }, - "Recommended_password_length": { - "message": "Рекомендуемая длина пароля", - "description": "SettingsSection.tsx" - }, - "Character_options": { - "message": "Настройки символов", - "description": "SettingsSection.tsx" - }, - "Include": { - "message": "Включить", - "description": "SettingsSection.tsx" - }, - "Special_symbols": { - "message": "Специальные символы", - "description": "SettingsSection.tsx" - }, - "Numeric": { - "message": "Цифры", - "description": "SettingsSection.tsx" - }, - "Uppercase": { - "message": "Прописные буквы", - "description": "SettingsSection.tsx" - }, - "Lowercase": { - "message": "Строчные буквы", - "description": "SettingsSection.tsx" - }, - "Exclude": { - "message": "Исключить", - "description": "SettingsSection.tsx" - }, - "Similar": { - "message": "Похожие", - "description": "SettingsSection.tsx" - }, - "Ambiguous": { - "message": "Особые", - "description": "SettingsSection.tsx" - }, - "Repeating": { - "message": "Повторяющиеся", - "description": "SettingsSection.tsx" - }, - "Add_shortcut_to_context_menu": { - "message": "Добавить расширение в контекстное меню", - "description": "SettingsSection.tsx" - }, - "Right_click_password_field_to_quickly_generate_password": { - "message": "Щелкните правой кнопкой мыши по полю ввода пароля, чтобы быстро сгенерировать пароль", - "description": "SettingsSection.tsx" - }, - "Automatically_copy_to_clipboard": { - "message": "Автоматически копировать в буфер обмена", - "description": "SettingsSection.tsx" - }, - "About": { - "message": "О расширении", - "description": "AboutSection.tsx" - }, - "Developed_by_Eugene_Fox": { - "message": "Разработчик Евгений Лис", - "description": "AboutSection.tsx" - }, - "Licensed_under": { - "message": "Лицензия", - "description": "AboutSection.tsx" - }, - "MIT_license": { - "message": "MIT", - "description": "AboutSection.tsx" - }, - "Want_to_contribute_translation_for_your_language_": { - "message": "Хотите помочь с переводом на свой язык?", - "description": "AboutSection.tsx" - }, - "Read_this_to_get_started": { - "message": "Прочтите эту статью", - "description": "AboutSection.tsx" - }, - "My_website": { - "message": "Мой сайт", - "description": "AboutSection.tsx" - }, - "Source_code": { - "message": "Исходный код", - "description": "AboutSection.tsx" - }, - "Changelog": { - "message": "Список изменений", - "description": "AboutSection.tsx" - }, - "Leave_feedback": { - "message": "Оставить отзыв", - "description": "AboutSection.tsx" - }, - "Buy_me_a_coffee": { - "message": "Спонсировать", - "description": "AboutSection.tsx" - }, - "Set_name": { - "message": "Название", - "description": "CharacterHelpDialog.tsx" - }, - "Characters": { - "message": "Символы", - "description": "CharacterHelpDialog.tsx" - }, - "__etc_": { - "message": " и т.д.", - "description": "CharacterHelpDialog.tsx" - }, - "OK": { - "message": "ОК", - "description": "CharacterHelpDialog.tsx" - }, - "Either_lowercase_or_uppercase_characters_must_be_included": { - "message": "Должны быть включены строчные или прописные буквы", - "description": "Generator.tsx" - }, - "Selected_length_is_too_long_to_exclude_repeating_characters": { - "message": "Выбранная длина слишком велика для исключения повторяющихся символов", - "description": "Generator.tsx" - }, - "Quick_generator_is_only_available_on_password_fields": { - "message": "Быстрый генератор доступен только для полей ввода пароля", - "description": "ContentService.tsx" - }, - "Quick_generate_password": { - "message": "Сгенерировать пароль", - "description": "BackgroundService.tsx" - } -} diff --git a/public/_locales/uk/messages.json b/public/_locales/uk/messages.json deleted file mode 100644 index d5993d1..0000000 --- a/public/_locales/uk/messages.json +++ /dev/null @@ -1,174 +0,0 @@ -{ - "name": { - "message": "Генератор паролів", - "description": "manifest.json" - }, - "description": { - "message": "Розширення, яке дозволяє легко генерувати складні та надійні паролі в один клік", - "description": "manifest.json" - }, - "author": { - "message": "Євген Лис", - "description": "manifest.json" - }, - "Password_generator": { - "message": "Генератор паролів", - "description": "App.tsx" - }, - "Copy": { - "message": "Копіювати", - "description": "PasswordView.tsx" - }, - "Generate_new": { - "message": "Генерувати новий", - "description": "PasswordView.tsx" - }, - "Exclude_special_symbols_one_time": { - "message": "Генерувати пароль без спеціальних символів", - "description": "PasswordView.tsx" - }, - "Include_special_symbols_one_time": { - "message": "Генерувати пароль з спеціальними символами", - "description": "PasswordView.tsx" - }, - "Settings": { - "message": "Налаштування", - "description": "SettingsSection.tsx" - }, - "Password_length": { - "message": "Довжина паролю", - "description": "SettingsSection.tsx" - }, - "Recommended_password_length": { - "message": "Рекомендована довжина паролю", - "description": "SettingsSection.tsx" - }, - "Character_options": { - "message": "Параметри символів", - "description": "SettingsSection.tsx" - }, - "Include": { - "message": "Включити", - "description": "SettingsSection.tsx" - }, - "Special_symbols": { - "message": "Спеціальні символи", - "description": "SettingsSection.tsx" - }, - "Numeric": { - "message": "Цифри", - "description": "SettingsSection.tsx" - }, - "Uppercase": { - "message": "Великі літери", - "description": "SettingsSection.tsx" - }, - "Lowercase": { - "message": "Малі літери", - "description": "SettingsSection.tsx" - }, - "Exclude": { - "message": "Виключити", - "description": "SettingsSection.tsx" - }, - "Similar": { - "message": "Схожі", - "description": "SettingsSection.tsx" - }, - "Ambiguous": { - "message": "Особливі", - "description": "SettingsSection.tsx" - }, - "Repeating": { - "message": "Повторювані", - "description": "SettingsSection.tsx" - }, - "Add_shortcut_to_context_menu": { - "message": "Додати розширення до контекстного меню", - "description": "SettingsSection.tsx" - }, - "Right_click_password_field_to_quickly_generate_password": { - "message": "Правий клік на поле вводу паролю для швидкого генерування паролю", - "description": "SettingsSection.tsx" - }, - "Automatically_copy_to_clipboard": { - "message": "Автоматично копіювати в буфер обміну", - "description": "SettingsSection.tsx" - }, - "About": { - "message": "Про розширення", - "description": "AboutSection.tsx" - }, - "Developed_by_Eugene_Fox": { - "message": "Розроблено Євгеном Лисом", - "description": "AboutSection.tsx" - }, - "Licensed_under": { - "message": "Ліцензовано під", - "description": "AboutSection.tsx" - }, - "MIT_license": { - "message": "MIT", - "description": "AboutSection.tsx" - }, - "Want_to_contribute_translation_for_your_language_": { - "message": "Хочете допомогти перекласти розширення на свою мову?", - "description": "AboutSection.tsx" - }, - "Read_this_to_get_started": { - "message": "Прочитайте цю статтю", - "description": "AboutSection.tsx" - }, - "My_website": { - "message": "Моя веб-сторінка", - "description": "AboutSection.tsx" - }, - "Source_code": { - "message": "Вихідний код", - "description": "AboutSection.tsx" - }, - "Changelog": { - "message": "Список змін", - "description": "AboutSection.tsx" - }, - "Leave_feedback": { - "message": "Залишити відгук", - "description": "AboutSection.tsx" - }, - "Buy_me_a_coffee": { - "message": "Підтримати", - "description": "AboutSection.tsx" - }, - "Set_name": { - "message": "Назва", - "description": "CharacterHelpDialog.tsx" - }, - "Characters": { - "message": "Символи", - "description": "CharacterHelpDialog.tsx" - }, - "__etc_": { - "message": " і т.д.", - "description": "CharacterHelpDialog.tsx" - }, - "OK": { - "message": "OK", - "description": "CharacterHelpDialog.tsx" - }, - "Either_lowercase_or_uppercase_characters_must_be_included": { - "message": "Повинні бути включені малі або великі літери", - "description": "Generator.tsx" - }, - "Selected_length_is_too_long_to_exclude_repeating_characters": { - "message": "Вибрана довжина занадто велика для виключення повторюваних символів", - "description": "Generator.tsx" - }, - "Quick_generator_is_only_available_on_password_fields": { - "message": "Швидкий генератор доступний тільки для полів вводу паролів", - "description": "ContentService.tsx" - }, - "Quick_generate_password": { - "message": "Згенерувати пароль", - "description": "BackgroundService.tsx" - } -} diff --git a/public/index.html b/public/index.html deleted file mode 100644 index 810899c..0000000 --- a/public/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - Password Generator - - - - - -
- - - diff --git a/public/manifest.json b/public/manifest.json deleted file mode 100644 index d1242be..0000000 --- a/public/manifest.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "manifest_version": 3, - "name": "__MSG_name__", - "description": "__MSG_description__", - "author": "__MSG_author__", - "version": "2.0.0", - "default_locale": "en", - "permissions": [ - "storage", - "contextMenus", - "clipboardWrite" - ], - "background": { - "service_worker": "./static/js/background.js", - "type": "module" - }, - "content_scripts": [ - { - "matches": [ - "" - ], - "js": [ - "./static/js/contentScript.js" - ], - "run_at": "document_idle", - "all_frames": true - } - ], - "action": { - "default_popup": "index.html", - "default_title": "__MSG_name__" - }, - "icons": { - "128": "icons/icon-128.png", - "48": "icons/icon-48.png", - "32": "icons/icon-32.png", - "16": "icons/icon-16.png" - } -} diff --git a/public/manifest.v2.json b/public/manifest.v2.json deleted file mode 100644 index db95634..0000000 --- a/public/manifest.v2.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "manifest_version": 2, - "name": "__MSG_name__", - "description": "__MSG_description__", - "author": "__MSG_author__", - "version": "2.0.0", - "default_locale": "en", - "permissions": [ - "storage", - "contextMenus", - "clipboardWrite" - ], - "background": { - "scripts": [ - "./static/js/background.js" - ], - "persistent": true - }, - "content_scripts": [ - { - "matches": [ - "" - ], - "js": [ - "./static/js/contentScript.js" - ], - "run_at": "document_idle", - "all_frames": true - } - ], - "browser_action": { - "default_popup": "index.html", - "default_title": "__MSG_name__" - }, - "icons": { - "128": "icons/icon-128.png", - "48": "icons/icon-48.png", - "32": "icons/icon-32.png", - "16": "icons/icon-16.png" - }, - "browser_specific_settings": { - "gecko": { - "id": "passwordgenerator@xfox111.net", - "strict_min_version": "58.0" - } - } -} diff --git a/src/App.scss b/src/App.scss deleted file mode 100644 index d17aab9..0000000 --- a/src/App.scss +++ /dev/null @@ -1,138 +0,0 @@ -body -{ - margin: 0; -} - -main -{ - width: 400px; - padding: 8px; - -webkit-user-select: none; - user-select: none; - - h1, h2, h3, h4, h5, h6, p - { - margin: 0; - } - - // Buy me a coffee button style - .fui-Button.bmc - { - background-color: var(--colorPaletteDarkOrangeBorder2) !important; - - &:hover - { - background-color: var(--colorPaletteDarkOrangeForeground1) !important; - } - - &:active - { - background-color: var(--colorPaletteDarkOrangeBackground2) !important; - } - } - - // Overrides for default FluentUI styles - a.fui-Button - { - text-decoration: none; - } - - .fui-Accordion - { - section - { - margin-bottom: 10px; - } - - .fui-AccordionHeader__expandIcon > svg - { - transition-duration: .5s; - transition-timing-function: var(--curveDecelerateMax); - } - } - - button.fui-Link - { - -webkit-user-select: none; - user-select: none; - } - - .scaleUpIn - { - animation-name: scaleUpInAnim; - animation-timing-function: var(--curveEasyEaseMax); - animation-duration: .5s; - } - - @keyframes scaleUpInAnim - { - from - { - transform: scale(.5); - opacity: 0; - } - - to - { - transform: scale(1); - opacity: 1; - } - } - - .spin - { - animation-name: spinAnim; - animation-timing-function: var(--curveEasyEaseMax); - animation-duration: .5s; - } - - @keyframes spinAnim - { - from - { - transform: rotate(0deg); - } - - to - { - transform: rotate(360deg); - } - } - - .fadeIn - { - animation-name: fadeInAnim; - animation-timing-function: var(--curveDecelerateMin); - animation-duration: .5s; - } - - @keyframes fadeInAnim - { - from - { - opacity: 0; - } - - to - { - opacity: 1; - } - } -} - -.stack -{ - display: flex; - flex-direction: column; - - &.horizontal - { - flex-direction: row; - flex-wrap: wrap; - } - - &.gap - { - gap: 10px; - } -} diff --git a/src/App.styles.ts b/src/App.styles.ts new file mode 100644 index 0000000..d3cd411 --- /dev/null +++ b/src/App.styles.ts @@ -0,0 +1,30 @@ +import { makeStyles, shorthands, tokens } from "@fluentui/react-components"; + +export const useStyles = makeStyles({ + root: + { + display: "flex", + flexDirection: "column", + ...shorthands.padding(tokens.spacingVerticalM, tokens.spacingHorizontalS), + }, + spinner: + { + alignSelf: "center", + ...shorthands.margin(tokens.spacingVerticalXXXL, 0), + }, + accordionAnimation: + { + "> .fui-AccordionItem .fui-AccordionHeader__expandIcon > svg": + { + transitionProperty: "transform", + transitionDuration: tokens.durationNormal, + transitionTimingFunction: tokens.curveDecelerateMax, + }, + "> .fui-AccordionItem > .fui-AccordionPanel": + { + animationName: "fadeIn", + animationDuration: tokens.durationSlow, + animationTimingFunction: tokens.curveDecelerateMin, + } + }, +}); diff --git a/src/App.tsx b/src/App.tsx index da74588..c5b622a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,86 +1,29 @@ -import React from "react"; -import { Accordion, FluentProvider, Text, Theme, Title2, webDarkTheme, webLightTheme } from "@fluentui/react-components"; -import "./App.scss"; -import SettingsSection from "./Components/SettingsSection"; +import { Accordion, FluentProvider, Spinner } from "@fluentui/react-components"; +import { useStyles } from "./App.styles"; import AboutSection from "./Components/AboutSection"; -import Package from "../package.json"; -import PasswordView from "./Components/PasswordView"; -import Settings from "./Utils/Settings"; -import GeneratorOptions from "./Utils/GeneratorOptions"; -import { loc } from "./Utils/Localization"; -import Snow from "./Holidays/Snow"; +import GeneratorView from "./Components/GeneratorView"; +import SettingsSection from "./Components/SettingsSection"; +import Specials from "./Specials/Specials"; +import { StorageProvider } from "./Utils/Storage"; +import { useTheme } from "./Utils/Theme"; -interface IStates +export default function App(): JSX.Element { - theme: Theme; - generatorOptions: GeneratorOptions; - settings: Settings; -} + const theme = useTheme(); + const cls = useStyles(); -interface IProps -{ - settings: Settings; -} - -export default class App extends React.Component -{ - constructor(props: IProps) - { - super(props); - - this.state = - { - theme: this.UpdateTheme(), - generatorOptions: new GeneratorOptions(), - settings: props.settings - }; - - Settings.OnChanged = (changes) => this.setState({ settings: { ...this.state.settings, ...changes } }); - GeneratorOptions.OnChanged = (changes) => this.setState({ generatorOptions: { ...this.state.generatorOptions, ...changes } }); - } - - public async componentDidMount(): Promise - { - window - .matchMedia("(prefers-color-scheme: dark)") - .addEventListener("change", - (arg: MediaQueryListEvent) => - this.setState({ theme: this.UpdateTheme(arg.matches) }) - ); - - this.setState({ generatorOptions: await GeneratorOptions.Init() }); - } - - private UpdateTheme(isDark?: boolean): Theme - { - let theme: Theme = (isDark ?? window.matchMedia("(prefers-color-scheme: dark)").matches) ? webDarkTheme : webLightTheme; - document.body.style.backgroundColor = theme.colorNeutralBackground1; - - return theme; - } - - public render(): JSX.Element - { - return ( - -
- - -
- { loc("Password generator") } - v{ Package.version } -
- - - - - + return ( + +
+ }> + + + -
-
- ); - } + + +
+
+ ); } diff --git a/src/Components/AboutSection.styles.ts b/src/Components/AboutSection.styles.ts new file mode 100644 index 0000000..880eb60 --- /dev/null +++ b/src/Components/AboutSection.styles.ts @@ -0,0 +1,16 @@ +import { makeStyles, shorthands, tokens } from "@fluentui/react-components"; + +export const useStyles = makeStyles({ + root: + { + display: "flex", + flexDirection: "column", + ...shorthands.gap(tokens.spacingVerticalM), + paddingBottom: tokens.spacingVerticalS, + }, + horizontalContainer: + { + display: "flex", + ...shorthands.gap(tokens.spacingHorizontalSNudge), + }, +}); diff --git a/src/Components/AboutSection.tsx b/src/Components/AboutSection.tsx index 5fcfc19..def8b2e 100644 --- a/src/Components/AboutSection.tsx +++ b/src/Components/AboutSection.tsx @@ -1,67 +1,66 @@ -import { AccordionItem, AccordionHeader, AccordionPanel, Link, Text, Button } from "@fluentui/react-components"; +import * as fui from "@fluentui/react-components"; import { InfoRegular, PersonFeedbackRegular } from "@fluentui/react-icons"; -import { ReactComponent as BuyMeACoffee } from "../Assets/BuyMeACoffee.svg"; -import React from "react"; -import { loc } from "../Utils/Localization"; -import * as Platform from "react-device-detect"; +import Package from "../../package.json"; +import BuyMeACoffee from "../Assets/BuyMeACoffee.svg?react"; +import { bmcDarkTheme, bmcLightTheme } from "../Data/BmcTheme"; +import { GetFeedbackLink, GithubLink, PersonalLink } from "../Data/Links"; +import { GetLocaleString as loc } from "../Utils/Localization"; +import { useTheme } from "../Utils/Theme"; +import { useStyles } from "./AboutSection.styles"; -export default class AboutSection extends React.Component +export default function AboutSection(): JSX.Element { - public render(): JSX.Element - { - return ( - - }>{ loc("About") } - -
- - { loc("Developed by Eugene Fox") } (@xfox111) -
- { loc("Licensed under") } { loc("MIT license") } -
- - { loc("Want to contribute translation for your language?") } { loc("Read this to get started") } - - - { loc("My website") } -
- { loc("Source code") } -
- { loc("Changelog") } -
+ const theme = useTheme(bmcLightTheme, bmcDarkTheme); + const cls = useStyles(); -
- + const buttonProps = (href: string, icon: JSX.Element): fui.ButtonProps => ( + { + as: "a", target: "_blank", href, + appearance: "primary", icon + } + ); - -
-
-
-
- ); - } + + { loc("about@developedBy") } ({ link("@xfox111", PersonalLink.Twitter) }) +
+ { loc("about@licensedUnder") } { link(loc("about@mitLicense"), GithubLink.License) } +
- private GetFeedbackLink(): string - { - if (Platform.isEdgeChromium) - return "https://microsoftedge.microsoft.com/addons/detail/password-generator/manimdhobjbkfpeeehlhhneookiokpbj"; - else if (Platform.isChrome) - return "https://chrome.google.com/webstore/detail/password-generator/jnjobgjobffgmgfnkpkjfjkkfhfikmfl"; - else if (Platform.isFirefox) - return "https://addons.mozilla.org/en-US/firefox/addon/easy-password-generator"; - else - return "mailto:feedback@xfox111.net"; - } + + { loc("about@translationCta") }
+ { link(loc("about@translationCtaButton"), GithubLink.TranslationGuide) } +
+ + + { link(loc("about@website"), PersonalLink.Website) }
+ { link(loc("about@sourceCode"), GithubLink.Repository) }
+ { link(loc("about@changelog"), GithubLink.Changelog) } +
+ +
+ ) }> + { loc("about@feedback") } + + + ) }> + { loc("about@sponsor") } + + +
+ + + ); } diff --git a/src/Components/CharacterHelpDialog.tsx b/src/Components/CharacterHelpDialog.tsx deleted file mode 100644 index d215e9f..0000000 --- a/src/Components/CharacterHelpDialog.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import { Button, Text, Dialog, DialogTrigger, DialogSurface, DialogTitle, DialogBody, DialogActions, DialogContent, Table, TableHeader, TableRow, TableHeaderCell, TableBody, TableCell } from "@fluentui/react-components"; -import { QuestionCircleRegular } from "@fluentui/react-icons"; -import React from "react"; -import Generator from "../Utils/Generator"; -import { loc } from "../Utils/Localization"; - -export default class CharacterHelpDialog extends React.Component -{ - public render(): JSX.Element - { - return ( - - - - - - - - - ); - } -} diff --git a/src/Components/GeneratorView.styles.ts b/src/Components/GeneratorView.styles.ts new file mode 100644 index 0000000..02d0ede --- /dev/null +++ b/src/Components/GeneratorView.styles.ts @@ -0,0 +1,43 @@ +import { makeStyles, shorthands, tokens } from "@fluentui/react-components"; + +export const useStyles = makeStyles({ + root: + { + display: "flex", + flexDirection: "column", + }, + input: + { + fontFamily: tokens.fontFamilyMonospace, + }, + lengthContainer: + { + display: "grid", + gridTemplateColumns: "1fr auto", + alignItems: "center", + paddingRight: tokens.spacingHorizontalM, + }, + optionsSpacing: + { + ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS), + }, + optionsLabel: + { + "> div[role=note].fui-InfoButton__info": + { + zIndex: 1, + }, + }, + copyIcon: + { + animationName: "scaleUpIn", + animationDuration: tokens.durationSlow, + animationTimingFunction: tokens.curveEasyEaseMax, + }, + refreshIcon: + { + animationName: "spin", + animationDuration: tokens.durationSlow, + animationTimingFunction: tokens.curveEasyEaseMax, + } +}); diff --git a/src/Components/GeneratorView.tsx b/src/Components/GeneratorView.tsx new file mode 100644 index 0000000..eb23563 --- /dev/null +++ b/src/Components/GeneratorView.tsx @@ -0,0 +1,105 @@ +import { Button, Checkbox, Input, Slider, Text, Tooltip, mergeClasses } from "@fluentui/react-components"; +import { Alert, InfoLabel } from "@fluentui/react-components/unstable"; +import { ArrowClockwiseRegular, ArrowUndoRegular, CheckmarkRegular, CopyRegular } from "@fluentui/react-icons"; +import { useEffect, useState } from "react"; +import GeneratorOptions from "../Models/GeneratorOptions"; +import { GetLocaleString as loc } from "../Utils/Localization"; +import { GeneratePassword } from "../Utils/PasswordGenerator"; +import { useStorage } from "../Utils/Storage"; +import { useTimeout } from "../Utils/Timeout"; +import { useStyles } from "./GeneratorView.styles"; + +type QuickOptions = Pick; + +export default function GeneratorView(): JSX.Element +{ + const { generatorOptions } = useStorage(); + const [password, setPassword] = useState(""); + const [quickOpts, _setOpts] = useState(generatorOptions); + const [error, setError] = useState(null); + + const [refreshTimer, copyTimer] = [useTimeout(310), useTimeout(1000)]; + const cls = useStyles(); + + const resetOptions = (): void => + _setOpts(generatorOptions); + + const setOptions = (opts: Partial) => + _setOpts({ ...quickOpts, ...opts }); + + function RefreshPassword(): void + { + setError(null); + const options: GeneratorOptions = { ...generatorOptions, ...quickOpts }; + + try { setPassword(GeneratePassword(options)); } + catch (e) { setError((e as Error).message); } + } + + async function CopyPassword(): Promise + { + await window.navigator.clipboard.writeText(password); + copyTimer.trigger(); + } + + useEffect(resetOptions, [generatorOptions]); + useEffect(RefreshPassword, [generatorOptions, quickOpts]); + useEffect(refreshTimer.trigger, [password]); + + const actionButtons: JSX.Element = <> + +