1
0
mirror of https://github.com/XFox111/PasswordGeneratorExtension.git synced 2026-04-22 08:08:01 +03:00

Major 3.0: Complete overhaul of the codebase, new features, bugfixes … (#224)

* 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 491afd58ab.

* 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] <support@github.com>
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] <support@github.com>
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] <support@github.com>
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] <support@github.com>
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] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eugene Fox <eugene.xfox@outlook.com>

* 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] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eugene Fox <eugene.xfox@outlook.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
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] <support@github.com>
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] <support@github.com>
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] <support@github.com>
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] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Eugene Fox
2023-11-12 19:49:35 +03:00
committed by GitHub
parent 3e137f6955
commit 7e7b6f71a4
79 changed files with 6563 additions and 10587 deletions
+19
View File
@@ -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
+25
View File
@@ -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"
}
+52
View File
@@ -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"
}
};
-34
View File
@@ -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?
+112
View File
@@ -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
+5
View File
@@ -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.
-21
View File
@@ -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?
@@ -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
+5 -5
View File
@@ -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
-->
+2 -2
View File
@@ -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
<!-- - Dependency updates and security patches -->
<!-- - Dependency updates and security patches (#) -->
<!-->### 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
+117 -161
View File
@@ -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 }}
+3 -3
View File
@@ -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
+30
View File
@@ -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
+33 -59
View File
@@ -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
+23 -23
View File
@@ -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.*
+15
View File
@@ -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"
]
}
+52
View File
@@ -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
}
+80
View File
@@ -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"
}
]
}
+1 -292
View File
@@ -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
<HelloWorld attribute1="value" attribute2={ value } attribute3="value">My content here</HelloWorld>
<HelloWorld attribute1="value"
attribute2={ value }
attribute3="value">My content here</HelloWorld>
<HelloWorld attribute1="value"
attribute2={ value }
attribute3="value">
My content here
</HelloWorld>
<HelloWorld
attribute1="value"
attribute2={ value }
attribute3="value">
My content here
</HelloWorld>
```
- Correct:
```tsx
<HelloWorld
attribute1="value"
attribute2={ value }
attribute3="value">
My content here
</HelloWorld>
```
- If JSX component doesn't have content, put space before closing tag
- Wrong:
```tsx
<HelloWorld attribute1="value" attribute2={ value } attribute3="value"/>
```
- Correct:
```tsx
<HelloWorld attribute1="value" attribute2={ value } attribute3="value" />
```
### 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)
+1 -1
View File
@@ -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
+5 -4
View File
@@ -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.
+13 -20
View File
@@ -1,12 +1,13 @@
# Password generator
<!-- # 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)
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.xfox111.net/projects/pwdgen/PasswordGeneratorExtension-dark.webp">
<source media="(prefers-color-scheme: light)" srcset="https://cdn.xfox111.net/projects/pwdgen/PasswordGeneratorExtension-light.webp">
<img alt="Password generator">
</picture>
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)
<img width="1136" alt="Password generator v2.0" src="https://user-images.githubusercontent.com/28831743/188680034-a673b1b4-3153-4054-bb0d-949568de1748.png">
## 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)
+3 -13
View File
@@ -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)
-67
View File
@@ -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;
+29 -50
View File
@@ -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"
}
}
-174
View File
@@ -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"
}
}
-174
View File
@@ -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"
}
}
-174
View File
@@ -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"
}
}
-174
View File
@@ -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"
}
}
-174
View File
@@ -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"
}
}
-18
View File
@@ -1,18 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Password Generator</title>
<meta
name="viewport"
content="width=device-width, initial-scale=1"
/>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
-39
View File
@@ -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": [
"<all_urls>"
],
"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"
}
}
-47
View File
@@ -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": [
"<all_urls>"
],
"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"
}
}
}
-138
View File
@@ -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;
}
}
+30
View File
@@ -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,
}
},
});
+22 -79
View File
@@ -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<IProps, IStates>
{
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<void>
{
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 (
<FluentProvider theme={ this.state.theme }>
<main className="stack gap">
<Snow />
<header className="stack horizontal gap">
<Title2 as="h1">{ loc("Password generator") }</Title2>
<Text as="span">v{ Package.version }</Text>
</header>
<PasswordView settings={ this.state.settings } generatorOptions={ this.state.generatorOptions } />
<Accordion collapsible>
<SettingsSection
generatorOptions={ this.state.generatorOptions }
settings={ this.state.settings } />
return (
<FluentProvider theme={ theme }>
<main className={ cls.root }>
<StorageProvider loader={ <Spinner size="large" className={ cls.spinner } /> }>
<GeneratorView />
<Accordion collapsible className={ cls.accordionAnimation }>
<SettingsSection />
<AboutSection />
</Accordion>
</main>
</FluentProvider>
);
}
</StorageProvider>
<Specials />
</main>
</FluentProvider>
);
}
+16
View File
@@ -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),
},
});
+57 -58
View File
@@ -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 (
<AccordionItem value="about">
<AccordionHeader as="h2" icon={ <InfoRegular /> }>{ loc("About") }</AccordionHeader>
<AccordionPanel>
<section className="stack gap fadeIn">
<Text as="p">
{ loc("Developed by Eugene Fox") } (<Link href="https://twitter.com/xfox111" target="_blank">@xfox111</Link>)
<br />
{ loc("Licensed under") } <Link href="https://github.com/XFox111/PasswordGeneratorExtension/blob/master/LICENSE" target="_blank">{ loc("MIT license") }</Link>
</Text>
<Text as="p">
{ loc("Want to contribute translation for your language?") } <Link href="https://github.com/XFox111/PasswordGeneratorExtension/blob/master/CONTRIBUTING.md" target="_blank">{ loc("Read this to get started") }</Link>
</Text>
<Text as="p">
<Link href="https://xfox111.net/" target="_blank">{ loc("My website") }</Link>
<br />
<Link href="https://github.com/xfox111/PasswordGeneratorExtension" target="_blank">{ loc("Source code") }</Link>
<br />
<Link href="https://github.com/XFox111/PasswordGeneratorExtension/releases/latest" target="_blank">{ loc("Changelog") }</Link>
</Text>
const theme = useTheme(bmcLightTheme, bmcDarkTheme);
const cls = useStyles();
<div className="stack horizontal gap">
<Button
as="a" target="_blank"
href={ this.GetFeedbackLink() }
appearance="primary" icon={ <PersonFeedbackRegular /> }>
const link = (text: string, href: string): JSX.Element => (
<fui.Link target="_blank" href={ href }>{ text }</fui.Link>
);
{ loc("Leave feedback") }
</Button>
const buttonProps = (href: string, icon: JSX.Element): fui.ButtonProps => (
{
as: "a", target: "_blank", href,
appearance: "primary", icon
}
);
<Button
as="a" target="_blank"
href="https://buymeacoffee.com/xfox111"
className="bmc" appearance="primary" icon={ <BuyMeACoffee /> }>
return (
<fui.AccordionItem value="about">
<fui.AccordionHeader as="h2" icon={ <InfoRegular /> }>{ loc("about@title") }</fui.AccordionHeader>
<fui.AccordionPanel className={ cls.root }>
<header className={ cls.horizontalContainer }>
<fui.Subtitle1 as="h1">{ loc("name") }</fui.Subtitle1>
<fui.Caption1 as="span">v{ Package.version }</fui.Caption1>
</header>
{ loc("Buy me a coffee") }
</Button>
</div>
</section>
</AccordionPanel>
</AccordionItem>
);
}
<fui.Text as="p">
{ loc("about@developedBy") } ({ link("@xfox111", PersonalLink.Twitter) })
<br />
{ loc("about@licensedUnder") } { link(loc("about@mitLicense"), GithubLink.License) }
</fui.Text>
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";
}
<fui.Text as="p">
{ loc("about@translationCta") }<br />
{ link(loc("about@translationCtaButton"), GithubLink.TranslationGuide) }
</fui.Text>
<fui.Text as="p">
{ link(loc("about@website"), PersonalLink.Website) } <br />
{ link(loc("about@sourceCode"), GithubLink.Repository) } <br />
{ link(loc("about@changelog"), GithubLink.Changelog) }
</fui.Text>
<div className={ cls.horizontalContainer }>
<fui.Button { ...buttonProps(GetFeedbackLink(), <PersonFeedbackRegular />) }>
{ loc("about@feedback") }
</fui.Button>
<fui.FluentProvider theme={ theme }>
<fui.Button { ...buttonProps(PersonalLink.BuyMeACoffee, <BuyMeACoffee />) }>
{ loc("about@sponsor") }
</fui.Button>
</fui.FluentProvider>
</div>
</fui.AccordionPanel>
</fui.AccordionItem>
);
}
-77
View File
@@ -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 (
<Dialog>
<DialogTrigger>
<Button appearance="subtle" style={ { marginLeft: 5 } } icon={ <QuestionCircleRegular /> } />
</DialogTrigger>
<DialogSurface aria-label="label">
<DialogBody>
<DialogTitle>{ loc("Character options") }</DialogTitle>
<DialogContent>
<Table>
<TableHeader>
<TableRow>
<TableHeaderCell>{ loc("Set_name") }</TableHeaderCell>
<TableHeaderCell>{ loc("Characters") }</TableHeaderCell>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell>{ loc("Lowercase") }</TableCell>
<TableCell>
<Text font="monospace">{ Generator.Lowercase.substring(0, 10) }{ loc(", etc.") }</Text>
</TableCell>
</TableRow>
<TableRow>
<TableCell>{ loc("Uppercase") }</TableCell>
<TableCell>
<Text font="monospace">{ Generator.Uppercase.substring(0, 10) }{ loc(", etc.") }</Text>
</TableCell>
</TableRow>
<TableRow>
<TableCell>{ loc("Numeric") }</TableCell>
<TableCell>
<Text font="monospace">{ Generator.Numeric }</Text>
</TableCell>
</TableRow>
<TableRow>
<TableCell>{ loc("Special symbols") }</TableCell>
<TableCell>
<Text font="monospace">{ Generator.SpecialCharacters }</Text>
</TableCell>
</TableRow>
<TableRow>
<TableCell>{ loc("Ambiguous") }</TableCell>
<TableCell>
<Text font="monospace">{ Generator.AmbiguousCharacters }</Text>
</TableCell>
</TableRow>
<TableRow>
<TableCell>{ loc("Similar") }</TableCell>
<TableCell>
<Text font="monospace">{ Generator.SimilarCharacters }</Text>
</TableCell>
</TableRow>
</TableBody>
</Table>
</DialogContent>
<DialogActions>
<DialogTrigger>
<Button appearance="secondary">{ loc("OK") }</Button>
</DialogTrigger>
</DialogActions>
</DialogBody>
</DialogSurface>
</Dialog>
);
}
}
+43
View File
@@ -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,
}
});
+105
View File
@@ -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<GeneratorOptions, "Length" | "Special" | "ExcludeAmbiguous">;
export default function GeneratorView(): JSX.Element
{
const { generatorOptions } = useStorage();
const [password, setPassword] = useState<string>("");
const [quickOpts, _setOpts] = useState<QuickOptions>(generatorOptions);
const [error, setError] = useState<string | null>(null);
const [refreshTimer, copyTimer] = [useTimeout(310), useTimeout(1000)];
const cls = useStyles();
const resetOptions = (): void =>
_setOpts(generatorOptions);
const setOptions = (opts: Partial<QuickOptions>) =>
_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<void>
{
await window.navigator.clipboard.writeText(password);
copyTimer.trigger();
}
useEffect(resetOptions, [generatorOptions]);
useEffect(RefreshPassword, [generatorOptions, quickOpts]);
useEffect(refreshTimer.trigger, [password]);
const actionButtons: JSX.Element = <>
<Tooltip content={ loc("generator@copy") } relationship="label">
<Button
appearance="subtle" onClick={ CopyPassword }
icon={
copyTimer.isActive ?
<CheckmarkRegular className={ cls.copyIcon } /> :
<CopyRegular className={ cls.copyIcon } />
} />
</Tooltip>
<Tooltip content={ loc("generator@refresh") } relationship="label">
<Button
appearance="subtle" onClick={ RefreshPassword }
icon={
<ArrowClockwiseRegular className={ mergeClasses(refreshTimer.isActive && cls.refreshIcon) } />
} />
</Tooltip>
</>;
return (
<section className={ cls.root }>
{ error ?
<Alert intent="warning">{ error }</Alert> :
<Input readOnly contentAfter={ actionButtons } value={ password } className={ cls.input } />
}
<div className={ mergeClasses(cls.root, cls.optionsSpacing) }>
<InfoLabel info={ loc("generator@quickOptions__hint") } className={ cls.optionsLabel }>
{ loc("generator@quickOptions") }
</InfoLabel>
<div className={ cls.lengthContainer }>
<Slider
min={ 6 } max={ Math.max(32, generatorOptions.Length) }
value={ quickOpts.Length } onChange={ (_, e) => setOptions({ Length: e.value }) } />
<Text>{ quickOpts.Length }</Text>
</div>
<div>
<Checkbox
label={ loc("settings@special") }
checked={ quickOpts.Special }
onChange={ (_, e) => setOptions({ Special: e.checked as boolean }) } />
<Checkbox
label={ loc("settings@ambiguous") } disabled={ !quickOpts.Special }
checked={ !quickOpts.ExcludeAmbiguous }
onChange={ (_, e) => setOptions({ ExcludeAmbiguous: !e.checked }) } />
<Tooltip content={ loc("generator@reset") } relationship="label">
<Button appearance="subtle" icon={ <ArrowUndoRegular /> } onClick={ resetOptions } />
</Tooltip>
</div>
</div>
</section>
);
}
-129
View File
@@ -1,129 +0,0 @@
import { Input, Button, Link, Text, Tooltip } from "@fluentui/react-components";
import { Alert } from "@fluentui/react-components/unstable";
import { ArrowClockwiseRegular, CheckmarkRegular, CopyRegular } from "@fluentui/react-icons";
import React from "react";
import Generator from "../Utils/Generator";
import GeneratorOptions from "../Utils/GeneratorOptions";
import { loc } from "../Utils/Localization";
import Settings from "../Utils/Settings";
interface IStates
{
password: string;
error?: string;
copyIcon: JSX.Element;
}
interface IProps
{
generatorOptions: GeneratorOptions;
settings: Settings;
}
export default class PasswordView extends React.Component<IProps, IStates>
{
constructor(props: IProps)
{
super(props);
this.state =
{
password: Generator.GeneratePassword(props.generatorOptions),
error: Generator.ValidateProps(props.generatorOptions),
copyIcon: <CopyRegular className="scaleUpIn" />,
};
}
private OnCopyPassword(password: string): void
{
console.log("PasswordView.OnCopyPassword");
if (!document.hasFocus())
return;
window.navigator.clipboard.writeText(password);
this.setState({ copyIcon: <CheckmarkRegular className="scaleUpIn" /> });
setTimeout(() => this.setState({ copyIcon: <CopyRegular className="scaleUpIn" /> }), 3000);
}
private OnRefreshPassword(): void
{
console.log("PasswordView.OnRefreshPassword");
let password: string = Generator.GeneratePassword(this.props.generatorOptions);
this.setState({ password });
document.querySelector("svg#refresh-btn")?.classList.add("spin");
setTimeout(() => document.querySelector("svg#refresh-btn")?.classList.remove("spin"), 600);
if (this.props.settings.Autocopy)
this.OnCopyPassword(password);
}
public componentDidUpdate(prevProps: Readonly<IProps>): void
{
console.log("PasswordView.componentDidUpdate");
// Converting to JSON is the easiest way to compare objects
if (JSON.stringify(prevProps.generatorOptions) === JSON.stringify(this.props.generatorOptions))
return;
let error: string = Generator.ValidateProps(this.props.generatorOptions);
let password = Generator.GeneratePassword(this.props.generatorOptions);
this.setState({ password, error });
if (!error && this.props.settings.Autocopy)
this.OnCopyPassword(password);
}
private AlterSpecialsOnce(useSpecials: boolean): void
{
console.log("PasswordView.AlterSpecialsOnce", `useSpecials: ${useSpecials}`);
let options: GeneratorOptions = { ...this.props.generatorOptions, Special: useSpecials, ExcludeAmbiguous: true };
let error: string = Generator.ValidateProps(options);
let password: string = Generator.GeneratePassword(options);
this.setState({ password, error });
if (error)
setTimeout(() => this.OnRefreshPassword(), 3000);
}
public render(): JSX.Element
{
return this.state.error ?
<Alert intent="error" className="fadeIn">{ this.state.error }</Alert>
:
<section className="stack fadeIn">
<Input
value={ this.state.password } readOnly
contentAfter={
<>
<Tooltip content={ loc("Copy") } relationship="label">
<Button onClick={ () => this.OnCopyPassword(this.state.password) } appearance="subtle" icon={ this.state.copyIcon } />
</Tooltip>
<Tooltip content={ loc("Generate new") } relationship="label">
<Button onClick={ () => this.OnRefreshPassword() } appearance="subtle" icon={ <ArrowClockwiseRegular id="refresh-btn" /> } />
</Tooltip>
</>
} />
<Text>
{ this.props.generatorOptions.Special ?
<Link onClick={ () => this.AlterSpecialsOnce(false) }>
{ loc("Exclude special symbols one time") }
</Link>
:
<Link onClick={ () => this.AlterSpecialsOnce(true) }>
{ loc("Include special symbols one time") }
</Link>
}
</Text>
</section>
;
}
}
+15
View File
@@ -0,0 +1,15 @@
import { makeStyles, shorthands, tokens } from "@fluentui/react-components";
export const useStyles = makeStyles({
root:
{
display: "flex",
flexDirection: "column",
...shorthands.gap(tokens.spacingVerticalS),
},
checkboxContainer:
{
display: "flex",
flexWrap: "wrap",
},
});
+84 -80
View File
@@ -1,83 +1,87 @@
import { AccordionItem, AccordionHeader, AccordionPanel, Label, Text, Input, Divider, Checkbox, Tooltip } from "@fluentui/react-components";
import { QuestionCircleRegular, SettingsRegular } from "@fluentui/react-icons";
import React from "react";
import GeneratorOptions from "../Utils/GeneratorOptions";
import { loc } from "../Utils/Localization";
import Settings from "../Utils/Settings";
import CharacterHelpDialog from "./CharacterHelpDialog";
import * as fui from "@fluentui/react-components";
import { InfoLabel } from "@fluentui/react-components/unstable";
import { SettingsRegular } from "@fluentui/react-icons";
import ExtensionOptions from "../Models/ExtensionOptions";
import GeneratorOptions from "../Models/GeneratorOptions";
import { GetLocaleString as loc } from "../Utils/Localization";
import { CharacterHints } from "../Utils/PasswordGenerator";
import { useStorage } from "../Utils/Storage";
import { useStyles } from "./SettingsSection.styles";
interface IProps
// FIXME: Remove ts-ignore comments once slots override fix is released
// Tracker: https://github.com/microsoft/fluentui/issues/27090
export default function SettingsSection(): JSX.Element
{
generatorOptions: GeneratorOptions;
settings: Settings;
}
export default class SettingsSection extends React.Component<IProps>
{
public render(): JSX.Element
{
let options: GeneratorOptions = this.props.generatorOptions;
let settings: Settings = this.props.settings;
return (
<AccordionItem value="settings">
<AccordionHeader as="h2" icon={ <SettingsRegular /> }>{ loc("Settings") }</AccordionHeader>
<AccordionPanel>
<section className="stack gap fadeIn">
<Label weight="semibold" htmlFor="pwd-length">{ loc("Password length") }</Label>
<div className="stack">
<Input
id="pwd-length"
value={ options.Length?.toString() }
onChange={ (_, e) => GeneratorOptions.Update({ Length: parseInt(e.value) }) }
type="number" min={ 4 } minLength={ 1 } />
<Text size={ 200 }>{ loc("Recommended password length") } <b>16-32</b></Text>
</div>
<Divider />
<div className="stack">
<Text as="h3" weight="semibold">
{ loc("Character options") }
<CharacterHelpDialog />
</Text>
<Text as="h4">{ loc("Include") }</Text>
<div className="stack horizontal">
<Checkbox label={ loc("Special symbols") }
checked={ options.Special } onChange={ (_, e) => GeneratorOptions.Update({ Special: e.checked as boolean }) } />
<Checkbox label={ loc("Numeric") }
checked={ options.Numeric } onChange={ (_, e) => GeneratorOptions.Update({ Numeric: e.checked as boolean }) } />
<Checkbox label={ loc("Uppercase") }
checked={ options.Uppercase } onChange={ (_, e) => GeneratorOptions.Update({ Uppercase: e.checked as boolean }) } />
<Checkbox label={ loc("Lowercase") }
checked={ options.Lowercase } onChange={ (_, e) => GeneratorOptions.Update({ Lowercase: e.checked as boolean }) } />
</div>
<Text as="h4">{ loc("Exclude") }</Text>
<div className="stack horizontal">
<Checkbox label={ loc("Similar") }
checked={ options.ExcludeSimilar } onChange={ (_, e) => GeneratorOptions.Update({ ExcludeSimilar: e.checked as boolean }) } />
<Checkbox label={ loc("Ambiguous") }
checked={ options.ExcludeAmbiguous } onChange={ (_, e) => GeneratorOptions.Update({ ExcludeAmbiguous: e.checked as boolean }) } />
<Checkbox label={ loc("Repeating") }
checked={ options.ExcludeRepeating } onChange={ (_, e) => GeneratorOptions.Update({ ExcludeRepeating: e.checked as boolean }) } />
</div>
</div>
<Divider />
<div className="stack">
<Checkbox
checked={ settings.AddContext }
onChange={ (_, e) => Settings.Update({ AddContext: e.checked as boolean }) }
label={
<Tooltip content={ loc("Right-click password field to quickly generate password") } relationship="description">
<Text>{ loc("Add shortcut to context menu") } <QuestionCircleRegular /></Text>
</Tooltip>
} />
<Checkbox label={ loc("Automatically copy to clipboard") }
checked={ settings.Autocopy } onChange={ (_, e) => Settings.Update({ Autocopy: e.checked as boolean }) } />
</div>
</section>
</AccordionPanel>
</AccordionItem>
);
}
const { generatorOptions, updateStorage } = useStorage();
const cls = useStyles();
const infoLabel = (content: string, hint: string) => ({
children: (_: unknown, slotProps: fui.LabelProps) => (
<InfoLabel { ...slotProps } info={ hint }>{ content }</InfoLabel>
)
});
const setOption = (option: keyof (GeneratorOptions & ExtensionOptions)) =>
(_: unknown, args: fui.CheckboxOnChangeData) =>
updateStorage({ [option]: args.checked } );
return (
<fui.AccordionItem value="settings">
<fui.AccordionHeader as="h2" icon={ <SettingsRegular /> }>{ loc("settings@title") }</fui.AccordionHeader>
<fui.AccordionPanel className={ cls.root }>
<fui.Field label={ loc("settings@length") } hint={ loc("settings@length__hint") }>
<fui.Input
type="number" min={ 6 }
value={ generatorOptions.Length.toString() }
onChange={ (_, e) => updateStorage({ Length: parseInt(e.value) }) } />
</fui.Field>
<fui.Divider />
<fui.Text>{ loc("settings@include") }</fui.Text>
<div className={ cls.checkboxContainer }>
<fui.Checkbox label={ loc("settings@uppercase") }
checked={ generatorOptions.Uppercase }
onChange={ setOption("Uppercase") } />
<fui.Checkbox
label={ loc("settings@lowercase") }
checked={ generatorOptions.Lowercase }
onChange={ setOption("Lowercase") } />
<fui.Checkbox
label={ loc("settings@numeric") }
checked={ generatorOptions.Numeric }
onChange={ setOption("Numeric") } />
<fui.Checkbox
label={ loc("settings@special") }
checked={ generatorOptions.Special }
onChange={ setOption("Special") } />
</div>
<fui.Text>{ loc("settings@exclude") }</fui.Text>
<div className={ cls.checkboxContainer }>
<fui.Checkbox
// @ts-expect-error See line 11
label={ infoLabel(loc("settings@similar"), CharacterHints.Similar) }
checked={ generatorOptions.ExcludeSimilar }
onChange={ setOption("ExcludeSimilar") } />
<fui.Checkbox
// @ts-expect-error See line 11
label={ infoLabel(loc("settings@ambiguous"), CharacterHints.Ambiguous) }
disabled={ !generatorOptions.Special }
checked={ generatorOptions.ExcludeAmbiguous }
onChange={ setOption("ExcludeAmbiguous") } />
<fui.Checkbox
// @ts-expect-error See line 11
label={ infoLabel(loc("settings@repeating"), loc("settings@repeating__hint")) }
checked={ generatorOptions.ExcludeRepeating }
onChange={ setOption("ExcludeRepeating") } />
</div>
</fui.AccordionPanel>
</fui.AccordionItem>
);
}
+35
View File
@@ -0,0 +1,35 @@
import { BrandVariants, Theme, createDarkTheme, createLightTheme } from "@fluentui/react-components";
const bmcBrandRamp: BrandVariants =
{
"10": "#050201",
"20": "#20140C",
"30": "#372014",
"40": "#492918",
"50": "#5C321D",
"60": "#6F3C21",
"70": "#834525",
"80": "#984F2A",
"90": "#AD5A2E",
"100": "#C36433",
"110": "#D96E37",
"120": "#EF793C",
"130": "#FF884A",
"140": "#FFA170",
"150": "#FFB792",
"160": "#FFCCB3"
};
export const bmcLightTheme: Theme =
{
...createLightTheme(bmcBrandRamp),
colorBrandBackground: bmcBrandRamp[110],
};
export const bmcDarkTheme: Theme =
{
...createDarkTheme(bmcBrandRamp),
colorBrandBackground: bmcBrandRamp[120],
colorBrandForeground1: bmcBrandRamp[110],
colorBrandForeground2: bmcBrandRamp[120]
};
+43
View File
@@ -0,0 +1,43 @@
import browser, { Manifest } from "webextension-polyfill";
export const PersonalLink =
{
Website: "https://xfox111.net",
Twitter: "https://twitter.com/xfox111",
BuyMeACoffee: "https://buymeacoffee.com/xfox111"
};
export const WebstoreLink =
{
Chrome: "https://chrome.google.com/webstore/detail/password-generator/jnjobgjobffgmgfnkpkjfjkkfhfikmfl",
Edge: "https://microsoftedge.microsoft.com/addons/detail/password-generator/manimdhobjbkfpeeehlhhneookiokpbj",
Firefox: "https://addons.mozilla.org/firefox/addon/easy-password-generator"
};
const getGithub = (path?: string): string =>
`https://github.com/xfox111/PasswordGeneratorExtension${path}`;
export const GithubLink =
{
Repository: getGithub(),
Changelog: getGithub("/releases/latest"),
TranslationGuide: getGithub("/blob/main/CONTRIBUTING.md#contributing-to-translations"),
License: getGithub("/blob/main/LICENSE")
};
export const GetFeedbackLink = () =>
{
if (__BROWSER__ === "firefox")
return WebstoreLink.Firefox;
const manifest: Manifest.WebExtensionManifest = browser.runtime.getManifest();
const updateUrl: URL = new URL((manifest as unknown as Record<string, unknown>).update_url as string ?? "about:blank");
if (updateUrl.host === "edge.microsoft.com")
return WebstoreLink.Edge;
if (updateUrl.host === "clients2.google.com")
return WebstoreLink.Chrome;
return "mailto:feedback@xfox111.net";
};
+171
View File
@@ -0,0 +1,171 @@
{
"name": {
"message": "Password Generator",
"description": "Extension name"
},
"description": {
"message": "Password generator extension allows you to easily generate long and secure password in one click",
"description": "Extension description"
},
"author": {
"message": "Eugene Fox",
"description": "Extension author"
},
"error@moreCharacters": {
"message": "Password length must be at least 4 characters",
"description": "Error message when password length is less than 4 characters"
},
"error@noCharacters": {
"message": "At least one set of characters must be selected",
"description": "Error message when no character set is selected"
},
"error@tooLong": {
"message": "Length is too long to generate password with unique characters",
"description": "Error message when password length is too long to generate password with unique characters"
},
"about@title":
{
"message": "About",
"description": "About section title"
},
"about@developedBy":
{
"message": "Developed by Eugene Fox",
"description": "Developer credits in about section"
},
"about@licensedUnder":
{
"message": "Licensed under",
"description": "License info in about section"
},
"about@mitLicense":
{
"message": "MIT License",
"description": "License name"
},
"about@translationCta":
{
"message": "Found a typo or want a translation for your language?",
"description": "Translation CTA in about section"
},
"about@translationCtaButton":
{
"message": "Get started here",
"description": "Translation CTA button in about section"
},
"about@website":
{
"message": "My website",
"description": "Website link in about section"
},
"about@sourceCode":
{
"message": "Source code",
"description": "Source code link in about section"
},
"about@changelog":
{
"message": "Changelog",
"description": "Changelog link in about section"
},
"about@feedback":
{
"message": "Leave feedback",
"description": "Feedback link in about section"
},
"about@sponsor":
{
"message": "Buy me a coffee",
"description": "Buy me a coffee donation link in about section"
},
"settings@title":
{
"message": "Settings",
"description": "Settings section title"
},
"settings@length":
{
"message": "Password length",
"description": "Password length label in settings section"
},
"settings@length__hint":
{
"message": "Recommended length: 8—16",
"description": "Password length recommendatin in settings section"
},
"settings@include":
{
"message": "Include symbols",
"description": "Include character sets section"
},
"settings@uppercase":
{
"message": "Uppercase",
"description": "Uppercase character set label in settings section"
},
"settings@lowercase":
{
"message": "Lowercase",
"description": "Lowercase character set label in settings section"
},
"settings@numeric":
{
"message": "Numeric",
"description": "Numbers character set label in settings section"
},
"settings@special":
{
"message": "Special",
"description": "Special characters character set label in settings section"
},
"settings@exclude":
{
"message": "Exclude symbols",
"description": "Exclude character sets section"
},
"settings@similar":
{
"message": "Similar",
"description": "Similar characters character set label in settings section"
},
"settings@ambiguous":
{
"message": "Ambiguous",
"description": "Ambiguous characters character set label in settings section"
},
"settings@repeating":
{
"message": "Repeating",
"description": "Repeating characters character set label in settings section"
},
"settings@repeating__hint":
{
"message": "Each character in the password will be unique",
"description": "Repeating characters character set hint in settings section"
},
"generator@copy":
{
"message": "Copy",
"description": "Copy button label"
},
"generator@reset":
{
"message": "Reset",
"description": "Reset button label"
},
"generator@refresh":
{
"message": "Generate new",
"description": "Generate new password button label"
},
"generator@quickOptions":
{
"message": "Quick adjustments",
"description": "Quick options section title"
},
"generator@quickOptions__hint":
{
"message": "These adjustments will not be saved",
"description": "Quick options hint"
}
}
+171
View File
@@ -0,0 +1,171 @@
{
"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"
},
"error@moreCharacters": {
"message": "Minimalna długość hasła to 4 znaki",
"description": "Error message when password length is less than 4 characters"
},
"error@noCharacters": {
"message": "Musisz wybrać przynajmniej jeden rodzaj znaków",
"description": "Error message when no character set is selected"
},
"error@tooLong": {
"message": "Wybrana długość jest zbyt duża, aby wygenerować unikalne znaki",
"description": "Error message when password length is too long to generate password with unique characters"
},
"about@title":
{
"message": "O rozszerzeniu",
"description": "About section title"
},
"about@developedBy":
{
"message": "Autor: Jewgienij Lis",
"description": "Developer credits in about section"
},
"about@licensedUnder":
{
"message": "",
"description": "License info in about section"
},
"about@mitLicense":
{
"message": "Licencja MIT",
"description": "License name"
},
"about@translationCta":
{
"message": "Znalazłeś błąd lub potrzebujesz tłumaczenia na swój język?",
"description": "Translation CTA in about section"
},
"about@translationCtaButton":
{
"message": "Zacznij tutaj",
"description": "Translation CTA button in about section"
},
"about@website":
{
"message": "Moja strona internetowa",
"description": "Website link in about section"
},
"about@sourceCode":
{
"message": "Kod źródłowy",
"description": "Source code link in about section"
},
"about@changelog":
{
"message": "Lista zmian",
"description": "Changelog link in about section"
},
"about@feedback":
{
"message": "Zostaw opinię",
"description": "Feedback link in about section"
},
"about@sponsor":
{
"message": "Wesprzyj",
"description": "Buy me a coffee donation link in about section"
},
"settings@title":
{
"message": "Ustawienia",
"description": "Settings section title"
},
"settings@length":
{
"message": "Długość hasła",
"description": "Password length label in settings section"
},
"settings@length__hint":
{
"message": "Zalecana długość: 8—16",
"description": "Password length recommendatin in settings section"
},
"settings@include":
{
"message": "Dodaj znaki",
"description": "Include character sets section"
},
"settings@uppercase":
{
"message": "Wielkie",
"description": "Uppercase character set label in settings section"
},
"settings@lowercase":
{
"message": "Małe",
"description": "Lowercase character set label in settings section"
},
"settings@numeric":
{
"message": "Cyfry",
"description": "Numbers character set label in settings section"
},
"settings@special":
{
"message": "Specjalne",
"description": "Special characters character set label in settings section"
},
"settings@exclude":
{
"message": "Wyklucz znaki",
"description": "Exclude character sets section"
},
"settings@similar":
{
"message": "Podobne",
"description": "Similar characters character set label in settings section"
},
"settings@ambiguous":
{
"message": "Niebezpieczne",
"description": "Ambiguous characters character set label in settings section"
},
"settings@repeating":
{
"message": "Powtarzające się",
"description": "Repeating characters character set label in settings section"
},
"settings@repeating__hint":
{
"message": "Każdy znak hasła będzie unikalny",
"description": "Repeating characters character set hint in settings section"
},
"generator@copy":
{
"message": "Kopiuj",
"description": "Copy button label"
},
"generator@reset":
{
"message": "Resetuj",
"description": "Reset button label"
},
"generator@refresh":
{
"message": "Wygeneruj nowe",
"description": "Generate new password button label"
},
"generator@quickOptions":
{
"message": "Szybkie ustawienia",
"description": "Quick options section title"
},
"generator@quickOptions__hint":
{
"message": "Te ustawienia nie zostaną zapisane",
"description": "Quick options hint"
}
}
+171
View File
@@ -0,0 +1,171 @@
{
"name": {
"message": "Gerador de Senhas",
"description": "Extension name"
},
"description": {
"message": "A extensão do gerador de senhas permite gerar facilmente uma senha longa e segura em um clique",
"description": "Extension description"
},
"author": {
"message": "Eugênio Fox",
"description": "Extension author"
},
"error@moreCharacters": {
"message": "O comprimento da senha deve ter pelo menos 4 caracteres",
"description": "Error message when password length is less than 4 characters"
},
"error@noCharacters": {
"message": "Pelo menos um conjunto de caracteres deve ser selecionado",
"description": "Error message when no character set is selected"
},
"error@tooLong": {
"message": "O comprimento é muito longo para gerar uma senha com caracteres exclusivos",
"description": "Error message when password length is too long to generate password with unique characters"
},
"about@title":
{
"message": "Sobre",
"description": "About section title"
},
"about@developedBy":
{
"message": "Desenvolvido por Eugênio Fox",
"description": "Developer credits in about section"
},
"about@licensedUnder":
{
"message": "Licenciado sob",
"description": "License info in about section"
},
"about@mitLicense":
{
"message": "Licença MIT",
"description": "License name"
},
"about@translationCta":
{
"message": "Encontrou um erro de digitação ou deseja uma tradução para o seu idioma?",
"description": "Translation CTA in about section"
},
"about@translationCtaButton":
{
"message": "Comece aqui",
"description": "Translation CTA button in about section"
},
"about@website":
{
"message": "Meu website",
"description": "Website link in about section"
},
"about@sourceCode":
{
"message": "Código fonte",
"description": "Source code link in about section"
},
"about@changelog":
{
"message": "Registro de alterações",
"description": "Changelog link in about section"
},
"about@feedback":
{
"message": "Deixe um comentário",
"description": "Feedback link in about section"
},
"about@sponsor":
{
"message": "Doar",
"description": "Buy me a coffee donation link in about section"
},
"settings@title":
{
"message": "Configurações",
"description": "Settings section title"
},
"settings@length":
{
"message": "Comprimento da senha",
"description": "Password length label in settings section"
},
"settings@length__hint":
{
"message": "Comprimento recomendado: 8—16",
"description": "Password length recommendatin in settings section"
},
"settings@include":
{
"message": "Incluir símbolos",
"description": "Include character sets section"
},
"settings@uppercase":
{
"message": "Maiúsculos",
"description": "Uppercase character set label in settings section"
},
"settings@lowercase":
{
"message": "Minúsculos",
"description": "Lowercase character set label in settings section"
},
"settings@numeric":
{
"message": "Numéricos",
"description": "Numbers character set label in settings section"
},
"settings@special":
{
"message": "Especiais",
"description": "Special characters character set label in settings section"
},
"settings@exclude":
{
"message": "Excluir símbolos",
"description": "Exclude character sets section"
},
"settings@similar":
{
"message": "Semelhantes",
"description": "Similar characters character set label in settings section"
},
"settings@ambiguous":
{
"message": "Ambíguos",
"description": "Ambiguous characters character set label in settings section"
},
"settings@repeating":
{
"message": "Repetidos",
"description": "Repeating characters character set label in settings section"
},
"settings@repeating__hint":
{
"message": "Cada caractere na senha será único",
"description": "Repeating characters character set hint in settings section"
},
"generator@copy":
{
"message": "Copiar",
"description": "Copy button label"
},
"generator@reset":
{
"message": "Redefinir",
"description": "Reset button label"
},
"generator@refresh":
{
"message": "Gerar nova",
"description": "Generate new password button label"
},
"generator@quickOptions":
{
"message": "Ajustes rápidos",
"description": "Quick options section title"
},
"generator@quickOptions__hint":
{
"message": "Esses ajustes não serão salvos",
"description": "Quick options hint"
}
}
+171
View File
@@ -0,0 +1,171 @@
{
"name": {
"message": "Генератор паролей",
"description": "Extension name"
},
"description": {
"message": "Расширение, позволяющее легко генерировать сложные и надежные пароли в один клик",
"description": "Extension description"
},
"author": {
"message": "Евгений Лис",
"description": "Extension author"
},
"error@moreCharacters": {
"message": "Минимальная длина пароля — 4 символа",
"description": "Error message when password length is less than 4 characters"
},
"error@noCharacters": {
"message": "Необходимо выбрать хотя бы один вид символов",
"description": "Error message when no character set is selected"
},
"error@tooLong": {
"message": "Выбранная длина слишком большая, для генерации уникальных символов",
"description": "Error message when password length is too long to generate password with unique characters"
},
"about@title":
{
"message": "О расширении",
"description": "About section title"
},
"about@developedBy":
{
"message": "Разработчк: Евгений Лис",
"description": "Developer credits in about section"
},
"about@licensedUnder":
{
"message": "",
"description": "License info in about section"
},
"about@mitLicense":
{
"message": "Лицензия MIT",
"description": "License name"
},
"about@translationCta":
{
"message": "Нашли опечатку или хотите перевод на ваш язык?",
"description": "Translation CTA in about section"
},
"about@translationCtaButton":
{
"message": "Начните здесь",
"description": "Translation CTA button in about section"
},
"about@website":
{
"message": "Мой веб-сайт",
"description": "Website link in about section"
},
"about@sourceCode":
{
"message": "Исходный код",
"description": "Source code link in about section"
},
"about@changelog":
{
"message": "Список изменений",
"description": "Changelog link in about section"
},
"about@feedback":
{
"message": "Оставить отзыв",
"description": "Feedback link in about section"
},
"about@sponsor":
{
"message": "Поддержать",
"description": "Buy me a coffee donation link in about section"
},
"settings@title":
{
"message": "Настройки",
"description": "Settings section title"
},
"settings@length":
{
"message": "Длина пароля",
"description": "Password length label in settings section"
},
"settings@length__hint":
{
"message": "Рекомендованная длина: 8—16",
"description": "Password length recommendatin in settings section"
},
"settings@include":
{
"message": "Добавить символы",
"description": "Include character sets section"
},
"settings@uppercase":
{
"message": "Прописные",
"description": "Uppercase character set label in settings section"
},
"settings@lowercase":
{
"message": "Строчные",
"description": "Lowercase character set label in settings section"
},
"settings@numeric":
{
"message": "Числовые",
"description": "Numbers character set label in settings section"
},
"settings@special":
{
"message": "Специальные",
"description": "Special characters character set label in settings section"
},
"settings@exclude":
{
"message": "Исключить символы",
"description": "Exclude character sets section"
},
"settings@similar":
{
"message": "Похожие",
"description": "Similar characters character set label in settings section"
},
"settings@ambiguous":
{
"message": "Особые",
"description": "Ambiguous characters character set label in settings section"
},
"settings@repeating":
{
"message": "Повторяющиеся",
"description": "Repeating characters character set label in settings section"
},
"settings@repeating__hint":
{
"message": "Каждый символ пароля будет уникальным",
"description": "Repeating characters character set hint in settings section"
},
"generator@copy":
{
"message": "Копировать",
"description": "Copy button label"
},
"generator@reset":
{
"message": "Сбросить",
"description": "Reset button label"
},
"generator@refresh":
{
"message": "Сгенерировать новый",
"description": "Generate new password button label"
},
"generator@quickOptions":
{
"message": "Быстрые настройки",
"description": "Quick options section title"
},
"generator@quickOptions__hint":
{
"message": "Эти настройки не будут сохранены",
"description": "Quick options hint"
}
}
+171
View File
@@ -0,0 +1,171 @@
{
"name": {
"message": "Генератор паролів",
"description": "Extension name"
},
"description": {
"message": "Розширення, яке дозволяє легко генерувати складні та надійні паролі в один клік",
"description": "Extension description"
},
"author": {
"message": "Євген Лис",
"description": "Extension author"
},
"error@moreCharacters": {
"message": "Мінімальна довжина пароля — 4 символи",
"description": "Error message when password length is less than 4 characters"
},
"error@noCharacters": {
"message": "Необхідно вибрати хоча б один вид символів",
"description": "Error message when no character set is selected"
},
"error@tooLong": {
"message": "Вибрана довжина занадто велика, для генерації унікальних символів",
"description": "Error message when password length is too long to generate password with unique characters"
},
"about@title":
{
"message": "Про розширення",
"description": "About section title"
},
"about@developedBy":
{
"message": "Розробник: Євген Лис",
"description": "Developer credits in about section"
},
"about@licensedUnder":
{
"message": "",
"description": "License info in about section"
},
"about@mitLicense":
{
"message": "Ліцензія MIT",
"description": "License name"
},
"about@translationCta":
{
"message": "Знайшли помилку або хочете переклад на вашу мову?",
"description": "Translation CTA in about section"
},
"about@translationCtaButton":
{
"message": "Почніть тут",
"description": "Translation CTA button in about section"
},
"about@website":
{
"message": "Мій веб-сайт",
"description": "Website link in about section"
},
"about@sourceCode":
{
"message": "Вихідний код",
"description": "Source code link in about section"
},
"about@changelog":
{
"message": "Список змін",
"description": "Changelog link in about section"
},
"about@feedback":
{
"message": "Залишити відгук",
"description": "Feedback link in about section"
},
"about@sponsor":
{
"message": "Підтримати",
"description": "Buy me a coffee donation link in about section"
},
"settings@title":
{
"message": "Налаштування",
"description": "Settings section title"
},
"settings@length":
{
"message": "Довжина пароля",
"description": "Password length label in settings section"
},
"settings@length__hint":
{
"message": "Рекомендована довжина: 8—16",
"description": "Password length recommendatin in settings section"
},
"settings@include":
{
"message": "Додати символи",
"description": "Include character sets section"
},
"settings@uppercase":
{
"message": "Великі",
"description": "Uppercase character set label in settings section"
},
"settings@lowercase":
{
"message": "Малі",
"description": "Lowercase character set label in settings section"
},
"settings@numeric":
{
"message": "Числові",
"description": "Numbers character set label in settings section"
},
"settings@special":
{
"message": "Спеціальні",
"description": "Special characters character set label in settings section"
},
"settings@exclude":
{
"message": "Виключити символи",
"description": "Exclude character sets section"
},
"settings@similar":
{
"message": "Схожі",
"description": "Similar characters character set label in settings section"
},
"settings@ambiguous":
{
"message": "Особливі",
"description": "Ambiguous characters character set label in settings section"
},
"settings@repeating":
{
"message": "Повторювані",
"description": "Repeating characters character set label in settings section"
},
"settings@repeating__hint":
{
"message": "Кожен символ пароля буде унікальним",
"description": "Repeating characters character set hint in settings section"
},
"generator@copy":
{
"message": "Копіювати",
"description": "Copy button label"
},
"generator@reset":
{
"message": "Скинути",
"description": "Reset button label"
},
"generator@refresh":
{
"message": "Згенерувати новий",
"description": "Generate new password button label"
},
"generator@quickOptions":
{
"message": "Швидкі налаштування",
"description": "Quick options section title"
},
"generator@quickOptions__hint":
{
"message": "Ці налаштування не будуть збережені",
"description": "Quick options hint"
}
}
-23
View File
@@ -1,23 +0,0 @@
import React from "react";
import "./Snow.scss";
export default class Snow extends React.Component
{
public render(): JSX.Element
{
// Show snowflakes only from 15th of December till 10th of January
let now = new Date();
if (
(now.getMonth() !== 11 || now.getDate() < 15) &&
(now.getMonth() !== 0 || now.getDate() > 10)
)
return <></>;
return (
<div className="snowflakeContainer">
{ [...Array(50)].map((_, i) => <div key={i} className="snowflake" />) }
</div>
);
}
}
+1
View File
@@ -0,0 +1 @@
export default class ExtensionOptions { }
+14
View File
@@ -0,0 +1,14 @@
export default class GeneratorOptions
{
public Length: number = 8;
public Special: boolean = true;
public Numeric: boolean = true;
public Lowercase: boolean = true;
public Uppercase: boolean = true;
public ExcludeSimilar: boolean = true;
public ExcludeAmbiguous: boolean = true;
public ExcludeRepeating: boolean = false;
}
-55
View File
@@ -1,55 +0,0 @@
// BackgroundService.ts
// Background script that handles the context menu visibility
import { Tabs, Menus } from "webextension-polyfill";
import browser from "../Utils/Browser";
import { loc } from "../Utils/Localization";
function UpdateContextMenu(isEnabled: boolean): void
{
console.log("BackgroundService.UpdateContextMenu", isEnabled);
browser.contextMenus.update("generatePassword", { visible: isEnabled });
}
async function OnContextClick(info: Menus.OnClickData): Promise<void>
{
console.log("BackgroundService.OnContextClick", info);
let tabInfo: Tabs.Tab[] = await browser.tabs.query({ active: true, currentWindow: true });
console.log("BackgroundService.OnContextClick", tabInfo);
browser.tabs.sendMessage(tabInfo[0].id, info.menuItemId as string);
}
async function OnInstalled(): Promise<void>
{
console.log("[BackgroundService] browser.runtime.onInstalled");
browser.contextMenus.removeAll();
browser.contextMenus.create(
{
title: loc("Quick generate password"),
contexts: ["editable"],
id: "generatePassword"
}
);
let settings: { [key: string]: any; } = await browser.storage.sync.get({ AddContext: true });
UpdateContextMenu(settings.AddContext);
}
async function OnStorageChanged(changes: any): Promise<void>
{
console.log("[BackgroundService] browser.storage.sync.onChanged", changes);
if (changes.AddContext?.newValue !== undefined)
UpdateContextMenu(changes.AddContext.newValue);
}
if (!browser.runtime.onInstalled.hasListener(OnInstalled))
browser.runtime.onInstalled.addListener(OnInstalled);
if (!browser.contextMenus.onClicked.hasListener(OnContextClick))
browser.contextMenus.onClicked.addListener(OnContextClick);
if (!browser.storage.sync.onChanged.hasListener(OnStorageChanged))
browser.storage.sync.onChanged.addListener(OnStorageChanged);
-40
View File
@@ -1,40 +0,0 @@
// ContentService.ts
// Content script that handles quick password generation through context menu
import browser from "../Utils/Browser";
import Generator from "../Utils/Generator";
import GeneratorOptions from "../Utils/GeneratorOptions";
import { loc } from "../Utils/Localization";
async function OnMessage(message: any): Promise<void>
{
console.log("[ContentService] browser.runtime.onMessage", message);
if (message === "generatePassword")
{
let generatorOptions: GeneratorOptions = await GeneratorOptions.Init();
let password: string = Generator.GeneratePassword(generatorOptions);
let input: HTMLInputElement = document.activeElement as HTMLInputElement;
if (!["INPUT", "TEXTAREA"].includes(input.tagName))
return;
console.log("[ContentService] browser.runtime.onMessage", input);
if (input.tagName !== "INPUT" || input.readOnly || !["text", "password"].includes(input.type))
{
window.alert(loc("Quick generator is only available on password fields"));
return;
}
input.focus();
input.value = password;
window.navigator.clipboard.writeText(password);
}
}
if (!browser.runtime.onMessage.hasListener(OnMessage))
browser.runtime.onMessage.addListener(OnMessage);
console.log("[ContentService] Loaded");
@@ -1,4 +1,4 @@
.snowflakeContainer
.snow
{
position: absolute;
overflow: hidden;
+11
View File
@@ -0,0 +1,11 @@
import "./Snow.scss";
const Snow = (): JSX.Element => (
![0, 11].includes(new Date().getMonth()) ? <></> : // Only shows in December and January
<div className="snow">
{ [...Array(50)].map((_, i) => <div key={ i } className="snowflake" />) }
</div>
);
export default Snow;
+7
View File
@@ -0,0 +1,7 @@
import Snow from "./Snow";
const Specials = (): JSX.Element => <>
<Snow />
</>;
export default Specials;
-4
View File
@@ -1,4 +0,0 @@
import Browser from "webextension-polyfill";
const browser: typeof Browser = (process.env.NODE_ENV !== "development") ? require("webextension-polyfill") : null;
export default browser;
-121
View File
@@ -1,121 +0,0 @@
import GeneratorOptions from "./GeneratorOptions";
import { loc } from "./Localization";
export default class Generator
{
public static Uppercase = "ABCDEFGHJKMNPQRSTUVWXYZ";
public static Lowercase = this.Uppercase.toLowerCase();
public static Numeric = "23456789";
public static SpecialCharacters = "!#$%&*+-=?@^_";
public static AmbiguousCharacters = "{}[]()/\\'\"`~,;:.<>";
public static SimilarCharacters = "il1Lo0O";
public static GeneratePassword(props: GeneratorOptions): string
{
if (!props.Length || isNaN(props.Length) || props.Length < 4)
props.Length = 4;
// Validating parameters
if (this.ValidateProps(props))
return "";
// Generating password
let availableCharacters: string = this.GetAvailableCharacters(props);
let requiredCharacters: string = this.GetRequiredCharacters(props);
let password: string = "";
for (let i = 0; i < props.Length; i++)
{
let char: string = this.PickRandomFromArray(availableCharacters);
if (props.ExcludeRepeating && password.includes(char))
i--;
else
password += char;
}
for (let i = 0; i < requiredCharacters.length; i++)
{
if (props.ExcludeRepeating && password.includes(requiredCharacters[i]))
continue;
password = password.replace(this.PickRandomFromArray(password), requiredCharacters[i]);
}
return password;
}
public static ValidateProps(props: GeneratorOptions): string
{
if (!props.Length || isNaN(props.Length) || props.Length < 4)
props.Length = 4;
if (!props.Lowercase && !props.Uppercase)
return loc("Either lowercase or uppercase characters must be included");
let availableCharacters: string = this.GetAvailableCharacters(props);
if (props.ExcludeRepeating && availableCharacters.length < props.Length)
return loc("Selected length is too long to exclude repeating characters");
return "";
}
private static GetAvailableCharacters(props: GeneratorOptions): string
{
let availableCharacters: string = "";
if (props.Special)
availableCharacters += this.SpecialCharacters;
if (props.Numeric)
availableCharacters += this.Numeric;
if (props.Lowercase)
availableCharacters += this.Lowercase;
if (props.Uppercase)
availableCharacters += this.Uppercase;
if (!props.ExcludeAmbiguous)
availableCharacters += this.AmbiguousCharacters;
if (!props.ExcludeSimilar)
availableCharacters += this.SimilarCharacters;
return availableCharacters;
}
private static GetRequiredCharacters(props: GeneratorOptions): string
{
let requiredCharacters: string = "";
if (props.Special)
requiredCharacters += this.PickRandomFromArray(this.SpecialCharacters);
if (props.Numeric)
requiredCharacters += this.PickRandomFromArray(this.Numeric);
if (props.Lowercase)
requiredCharacters += this.PickRandomFromArray(this.Lowercase);
if (props.Uppercase)
requiredCharacters += this.PickRandomFromArray(this.Uppercase);
if (!props.ExcludeAmbiguous)
requiredCharacters += this.PickRandomFromArray(this.AmbiguousCharacters);
if (!props.ExcludeSimilar)
requiredCharacters += this.PickRandomFromArray(this.SimilarCharacters);
return requiredCharacters;
}
// See https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Math/random
// min is inclusive, max is exclusive
private static GetRandomInt(min: number, max: number): number
{
let arr = new Uint8Array(1);
crypto.getRandomValues(arr);
return Math.floor((arr[0] / 255) * (max - min)) + min;
}
private static PickRandomFromArray(array: string): string
{
return array[this.GetRandomInt(0, array.length)];
}
}
-53
View File
@@ -1,53 +0,0 @@
import { Storage } from "webextension-polyfill";
import browser from "../Utils/Browser";
export default class GeneratorOptions
{
public Length: number = 16;
public Special: boolean = true;
public Numeric: boolean = true;
public Lowercase: boolean = true;
public Uppercase: boolean = true;
public ExcludeSimilar: boolean = true;
public ExcludeAmbiguous: boolean = true;
public ExcludeRepeating: boolean = false;
public static OnChanged: (changes: Partial<GeneratorOptions>) => void;
public static async Init(): Promise<GeneratorOptions>
{
let fallbackOptions: GeneratorOptions = new GeneratorOptions();
if (!browser?.storage?.sync) // Extension is running as a standalone app
return fallbackOptions;
let props: { [key: string]: any; } = await browser.storage.sync.get(fallbackOptions);
browser.storage.sync.onChanged.addListener(GeneratorOptions.OnStorageChanged);
return props as GeneratorOptions;
}
public static async Update(changes: Partial<GeneratorOptions>): Promise<void>
{
if (browser?.storage?.sync)
await browser?.storage?.sync?.set(changes);
else
GeneratorOptions.OnChanged(changes);
}
private static OnStorageChanged(changes: { [key: string]: Storage.StorageChange; }): void
{
let propsList: string[] = Object.keys(new GeneratorOptions());
let options: { [key: string]: any; } = {};
Object.entries(changes)
.filter(i => propsList.includes(i[0]))
.map(i => options[i[0]] = i[1].newValue);
if (GeneratorOptions.OnChanged)
GeneratorOptions.OnChanged(options as Partial<GeneratorOptions>);
}
}
+10 -23
View File
@@ -1,24 +1,11 @@
import browser from "../Utils/Browser";
import browser from "webextension-polyfill";
import messages from "../Data/Locales/en/messages.json";
export default class Localization
{
public static GetString(key: string): string
{
let sanitizedKey: string = key
.replaceAll(".", "_")
.replaceAll(",", "_")
.replaceAll(" ", "_")
.replaceAll("-", "_")
.replaceAll("?", "_")
.replaceAll("!", "_");
let str: string = browser?.i18n?.getMessage(sanitizedKey);
return str ?? key;
}
}
export function loc(key: string): string
{
return Localization.GetString(key);
}
/**
* Gets the localized string for the specified message. If the message is missing, this method returns an empty string (''). If the format of the call is wrong — for example, messageName is not a string or the substitutions array has more than 9 elements — this method returns .
* @param key The name of the message, as specified in the file.
* @param subustitutions Optional. Substitution strings, if the message requires any.
* @returns Message localized for current locale.
*/
export const GetLocaleString = (key: keyof typeof messages, ...subustitutions: string[]): string =>
browser.i18n.getMessage(key, subustitutions) ?? key;
+129
View File
@@ -0,0 +1,129 @@
import GeneratorOptions from "../Models/GeneratorOptions";
import { GetLocaleString as loc } from "./Localization";
const Characters =
{
Uppercase: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
Lowercase: "abcdefghijklmnopqrstuvwxyz",
Numeric: "1234567890",
Special: "!#$%&*+-=?@^_"
};
const Similar: string = "iIl1Lo0O";
const Ambiguous: string = "{}[]()/\\'\"`~,;:.<>";
export const CharacterHints = { ...Characters, Similar, Ambiguous };
/**
* Generates a random password
* @param options Options for password generation
* @returns Randomly generated password
* @throws Error if options are invalid
*/
export function GeneratePassword(options: GeneratorOptions): string
{
ValidateOptions(options);
let password: string = GetRequiredCharacters(options);
const availableCharacters: string = GetAvailableCharacters(options);
for (let i = password.length; i < options.Length; i++)
{
const character: string = PickRandomFromArray(availableCharacters);
if (options.ExcludeRepeating && password.includes(character))
i--;
else
password += character;
}
password = ShuffleString(password);
return password;
}
/**
* Validates options for password generation
* @param options Options for password generation
* @throws Error if options are invalid
*/
export function ValidateOptions(options: GeneratorOptions): void
{
if (options.Length < 4)
throw new Error(loc("error@moreCharacters"));
const availableCharacters: string = GetAvailableCharacters(options);
if (availableCharacters.length < 1)
throw new Error(loc("error@noCharacters"));
if (options.ExcludeRepeating && options.Length > availableCharacters.length)
throw new Error(loc("error@tooLong"));
}
// Returns a string containing all characters that are available for password generation
function GetAvailableCharacters(options: GeneratorOptions): string
{
let availableCharacters: string = "";
for (const [key, value] of Object.entries(Characters))
if (options[key as keyof GeneratorOptions])
availableCharacters += value;
if (options.ExcludeSimilar)
availableCharacters = availableCharacters.replace(new RegExp(`[${Similar}]`, "g"), "");
if (options.Special && !options.ExcludeAmbiguous)
availableCharacters += Ambiguous;
return availableCharacters;
}
// Returns a string containing all characters from every available set that are required for password generation
function GetRequiredCharacters(options: GeneratorOptions): string
{
let result: string = "";
const characters: Record<string, string> = Object.assign({}, Characters);
if (!options.ExcludeAmbiguous)
characters.Special += Ambiguous;
if (options.ExcludeSimilar)
for (const key of Object.keys(characters))
characters[key] = characters[key].replace(new RegExp(`[${Similar}]`, "g"), "");
for (const [key, value] of Object.entries(characters))
if (options[key as keyof GeneratorOptions])
result += PickRandomFromArray(value);
return result;
}
// Picks a random character from a string
function PickRandomFromArray(array: string): string
{
return array[GetRandomInt(0, array.length)];
}
// See https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Math/random
// min is inclusive, max is exclusive
function GetRandomInt(min: number, max: number): number
{
const arr = new Uint16Array(1);
crypto.getRandomValues(arr); // Using crypto instead of Math.random() as a CSPRNG
return Math.floor((arr[0] / 65_536) * (max - min)) + min;
}
// Shuffles a string using Fisher-Yates algorithm and CSPRNG
// See https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
function ShuffleString(str: string): string
{
const arr = str.split("");
for (let i = arr.length - 1; i > 0; i--)
{
const j = GetRandomInt(0, i + 1);
[arr[i], arr[j]] = [arr[j], arr[i]];
}
return arr.join("");
}
-45
View File
@@ -1,45 +0,0 @@
import { Storage } from "webextension-polyfill";
import browser from "../Utils/Browser";
export default class Settings
{
public AddContext: boolean = true;
public Autocopy: boolean = true;
public static OnChanged: (changes: Partial<Settings>) => void;
public static async Init(): Promise<Settings>
{
let fallbackOptions = new Settings();
if (!browser?.storage?.sync)
return fallbackOptions;
let props: { [key: string]: any; } = await browser.storage.sync.get(fallbackOptions);
browser.storage.sync.onChanged.addListener(Settings.OnStorageChanged);
return props as Settings;
}
public static async Update(changes: Partial<Settings>): Promise<void>
{
if (browser?.storage?.sync)
await browser?.storage?.sync?.set(changes);
else
Settings.OnChanged(changes);
}
private static OnStorageChanged(changes: { [key: string]: Storage.StorageChange; }): void
{
let propsList: string[] = Object.keys(new Settings());
let settings: { [key: string]: any; } = {};
Object.entries(changes)
.filter(i => propsList.includes(i[0]))
.map(i => settings[i[0]] = i[1].newValue);
if (Settings.OnChanged)
Settings.OnChanged(settings as Partial<Settings>);
}
}
+54
View File
@@ -0,0 +1,54 @@
import React, { createContext, useContext, useEffect, useState } from "react";
import browser from "webextension-polyfill";
import ExtensionOptions from "../Models/ExtensionOptions";
import GeneratorOptions from "../Models/GeneratorOptions";
const defaultOptions: IStorage =
{
generatorOptions: new GeneratorOptions(),
extOptions: new ExtensionOptions(),
updateStorage: async () => { }
};
const Storage = createContext<IStorage>(defaultOptions);
export const useStorage = () => useContext<IStorage>(Storage);
export function StorageProvider(props: IStorageProviderProps): JSX.Element
{
const [storage, setStorage] = useState<IStorage | null>(null);
const getStorage = async () =>
setStorage({
extOptions: await browser.storage.sync.get(defaultOptions.extOptions) as ExtensionOptions,
generatorOptions: await browser.storage.sync.get(defaultOptions.generatorOptions) as GeneratorOptions,
updateStorage: async (options) => await browser.storage.sync.set(options)
});
useEffect(() =>
{
getStorage();
browser.storage.sync.onChanged.addListener(getStorage);
return () => browser.storage.sync.onChanged.removeListener(getStorage);
}, []);
return (
<Storage.Provider value={ storage ?? defaultOptions }>
{ storage ? props.children : props.loader }
</Storage.Provider>
);
}
// #region Types
interface IStorage
{
generatorOptions: GeneratorOptions;
extOptions: ExtensionOptions;
updateStorage: (options: Partial<GeneratorOptions | ExtensionOptions>) => Promise<void>;
}
interface IStorageProviderProps extends React.PropsWithChildren
{
loader?: JSX.Element;
}
// #endregion
+21
View File
@@ -0,0 +1,21 @@
import { useState, useEffect } from "react";
import { Theme, webDarkTheme, webLightTheme } from "@fluentui/react-components";
export function useTheme(lightTheme?: Theme, darkTheme?: Theme): Theme
{
const media = window.matchMedia("(prefers-color-scheme: dark)");
const getTheme = (isDark: boolean) =>
isDark ? (darkTheme ?? webDarkTheme) : (lightTheme ?? webLightTheme);
const [theme, setTheme] = useState<Theme>(getTheme(media.matches));
useEffect(() =>
{
const updateTheme = (args: MediaQueryListEvent) => setTheme(getTheme(args.matches));
media.addEventListener("change", updateTheme);
return () => media.removeEventListener("change", updateTheme);
}, []);
return theme;
}
+14
View File
@@ -0,0 +1,14 @@
import { useState } from "react";
export function useTimeout(timeout: number)
{
const [isActive, setActive] = useState<boolean>(false);
const trigger = () =>
{
setActive(true);
setTimeout(() => setActive(false), timeout);
};
return { isActive, trigger };
}
-8
View File
@@ -1,8 +0,0 @@
import ReactDOM from "react-dom/client";
import App from "./App";
import Settings from "./Utils/Settings";
Settings.Init().then(settings =>
ReactDOM
.createRoot(document.querySelector("#root") as HTMLElement)
.render(<App settings={ settings } />));
+32
View File
@@ -0,0 +1,32 @@
{
"manifest_version": 3,
"name": "__MSG_name__",
"description": "__MSG_description__",
"author": "__MSG_author__",
"homepage_url": "https://github.com/xfox111/PasswordGeneratorExtension",
"default_locale": "en",
"icons": {
"16": "icons/icon-16.png",
"32": "icons/icon-32.png",
"48": "icons/icon-48.png",
"128": "icons/icon-128.png"
},
"permissions": [
"storage"
],
"action": {
"default_popup": "src/popup.html"
},
"{{firefox}}.browser_specific_settings": {
"gecko": {
"id": "passwordgenerator@xfox111.net",
"strict_min_version": "109.0"
}
}
}
+45
View File
@@ -0,0 +1,45 @@
html,
body
{
width: 400px;
min-width: 400px;
padding: 0;
margin: 0;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
}
h1, h2, h3, h4, h5, h6,
p, ul, ol, li
{
margin: 0;
}
@keyframes scaleUpIn
{
from
{
transform: scale(0.5);
opacity: 0;
}
to
{
transform: scale(1);
opacity: 1;
}
}
@keyframes spin
{
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
@keyframes fadeIn
{
from { opacity: 0; }
to { opacity: 1; }
}
+17
View File
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Password generator</title>
</head>
<body>
<div id="root"></div>
</body>
<script type="module" src="./popup.tsx"></script>
</html>
+10
View File
@@ -0,0 +1,10 @@
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import "./popup.css";
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<App />
</React.StrictMode>
);
-1
View File
@@ -1 +0,0 @@
/// <reference types="react-scripts" />
+5
View File
@@ -0,0 +1,5 @@
/// <reference types="vite/client" />
/// <reference types="vite-plugin-svgr/client" />
type SupportedBrowser = "chrome" | "firefox";
declare const __BROWSER__: SupportedBrowser;
+23 -14
View File
@@ -1,27 +1,36 @@
{
"compilerOptions": {
"target": "es5",
"target": "ESNext",
"useDefineForClassFields": true,
"lib": [
"dom",
"dom.iterable",
"esnext"
"DOM",
"DOM.Iterable",
"ESNext"
],
"allowJs": true,
"module": "ESNext",
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"strictNullChecks": false,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
/* Bundler mode */
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"allowJs": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
},
"include": [
"src"
],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}
+11
View File
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": [
"vite.config.ts"
]
}
+57
View File
@@ -0,0 +1,57 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import webExtension, { readJsonFile } from "vite-plugin-web-extension";
import path from "node:path";
import svgr from "vite-plugin-svgr";
import { viteStaticCopy } from "vite-plugin-static-copy";
const target: string = process.env.TARGET || "chrome";
function generateManifest()
{
const manifest = readJsonFile("src/manifest.json");
const pkg = readJsonFile("package.json");
return {
version: pkg.version,
...manifest,
};
}
// https://vitejs.dev/config/
export default defineConfig({
define:
{
__BROWSER__: JSON.stringify(target)
},
plugins:
[
react(),
svgr(),
viteStaticCopy({
targets: [
{
src: "src/Data/Locales",
dest: ".",
rename: "_locales"
}
]
}),
webExtension({
manifest: generateManifest,
browser: target,
/* webExtConfig: {
args: target === "firefox" ? [ ] : [ "--no-sandbox" ]
} */
}),
],
resolve:
{
alias:
{
// In dev mode, make sure fast refresh works
"/@react-refresh": path.resolve(
"node_modules/@vitejs/plugin-react-swc/refresh-runtime.js"
),
},
},
});
+4105 -7909
View File
File diff suppressed because it is too large Load Diff