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

Patch 2.0.2 (#53)

* Fix for issue #51 - Extension is not working on firefox (#52)

* Fix for issue #51 - Extension is not working on firefox

* Fix for issue #51 - Replaced @types/chrome with webextension-polyfill

* re-Added @types/chrome to allow development tests

* Moved local import after module imports

* Bump @types/node from 18.7.18 to 18.11.0 (#48)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 18.7.18 to 18.11.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

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.183 to 2.0.185 (#50)

Bumps [@fluentui/react-icons](https://github.com/microsoft/fluentui-system-icons) from 2.0.183 to 2.0.185.
- [Release notes](https://github.com/microsoft/fluentui-system-icons/releases)
- [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>

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 typescript from 4.8.3 to 4.8.4 (#47)

Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.8.3 to 4.8.4.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.8.3...v4.8.4)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

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/jest from 29.1.1 to 29.1.2 (#44)

Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 29.1.1 to 29.1.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

---
updated-dependencies:
- dependency-name: "@types/jest"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

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 @fluentui/react-components from 9.3.2 to 9.5.1 (#49)

Bumps [@fluentui/react-components](https://github.com/microsoft/fluentui) from 9.3.2 to 9.5.1.
- [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.3.2...@fluentui/react-components_v9.5.1)

---
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>

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>

* - Updated craco.config.ts to improve extension's stability
- Renamed manifest.firefox.json to manifest.v2.json
- Added fallbacks for invalid password length
- Migrated FluentUI Dialog to stable release
- Updated WebExt compat API

* Updated project formatting

* Feedback button now navigates to webstore page

* Update code style guidelines

* Updated extension version to 2.0.2

* Fixed pipelines

* Fixed AboutSection.tsx

* Fixed CodeQL issues

* Fixed feedback link not working

* Fixed feedback button again

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Andry Herizo RAJOELISON <finalherizo@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Eugene Fox
2022-10-22 15:55:44 +03:00
committed by GitHub
parent 4f578da227
commit 68aace475e
27 changed files with 1221 additions and 1105 deletions
+4 -4
View File
@@ -23,9 +23,9 @@ jobs:
$manifest.version = $package.version;
$manifest | ConvertTo-Json -Depth 10 | Out-File "public/manifest.json"
$manifest = Get-Content "public/manifest.firefox.json" | ConvertFrom-Json;
$manifest = Get-Content "public/manifest.v2.json" | ConvertFrom-Json;
$manifest.version = $package.version;
$manifest | ConvertTo-Json -Depth 10 | Out-File "public/manifest.firefox.json"
$manifest | ConvertTo-Json -Depth 10 | Out-File "public/manifest.v2.json"
- name: Setup Node.js
uses: actions/setup-node@v3
@@ -54,7 +54,7 @@ jobs:
- name: Configure manifest
uses: Amadevus/pwsh-script@v2
with:
script: Remove-Item "manifest.firefox.json"
script: Remove-Item "manifest.v2.json"
- name: Pack extension
uses: TheDoctor0/zip-release@0.6.2
@@ -90,7 +90,7 @@ jobs:
with:
script: |
Remove-Item "manifest.json"
Rename-Item "manifest.firefox.json" "manifest.json"
Rename-Item "manifest.v2.json" "manifest.json"
- name: Pack extension
uses: TheDoctor0/zip-release@0.6.2
+3 -3
View File
@@ -28,9 +28,9 @@ jobs:
[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.firefox.json" | ConvertFrom-Json;
$manifest = Get-Content "public/manifest.v2.json" | ConvertFrom-Json;
$manifest.version = $package.version;
$manifest | ConvertTo-Json -Depth 10 | Out-File "public/manifest.firefox.json"
$manifest | ConvertTo-Json -Depth 10 | Out-File "public/manifest.v2.json"
- name: Setup Node.js
uses: actions/setup-node@v3
@@ -61,7 +61,7 @@ jobs:
with:
script: |
Remove-Item "manifest.json"
Rename-Item "manifest.firefox.json" "manifest.json"
Rename-Item "manifest.v2.json" "manifest.json"
- name: "web-ext lint"
uses: kewisch/action-web-ext@e0ea88d527a8a90bc10d600f80ac667d219e6bf1
+95 -17
View File
@@ -112,7 +112,7 @@ This section represents how contributors should interact with codebase implement
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 webstore, Edge webstore and GitHub releases
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
@@ -121,7 +121,8 @@ 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 `snake_case` for file names
- 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
@@ -131,43 +132,48 @@ Use "double quotes" wherever it's possible
#### Style
- Prefer to use lambda functions
- Put curly braces on new lines
- Always put curly braces on new lines
- Wrong:
```
```js
if (condition) {
...
}
```
- Correct:
```
```js
if (condition)
{
...
}
```
- Put spaces between operators and before braces in methods declarations, conditionals and loops
- Wrong:
- `y=k*x+b`
- `function FunctionName()`
- Correct:
- `y = k * x + b`
- `function FunctionName ()`
- Use ternary conditionals wherever it's possible
> **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"
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!");
@@ -178,12 +184,84 @@ Use "double quotes" wherever it's possible
}
```
- 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:
+49 -18
View File
@@ -1,35 +1,66 @@
import { CracoConfig, CracoContext } from "@craco/craco";
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
export default
const cracoConfig: CracoConfig =
{
webpack:
{
configure: (webpackConfig : any, { env, paths } : IEnvironment) =>
configure: (webpackConfig: Configuration, { env, paths }: CracoContext): Configuration =>
{
const isProduction: boolean = env === "production";
const config: Configuration =
{
return {
...webpackConfig,
entry:
{
main: [ env === "development" && require.resolve("react-dev-utils/webpackHotDevClient"), paths.appIndexJs ].filter(Boolean),
main: paths.appIndexJs,
background: "./src/Services/BackgroundService.ts",
contentScript: "./src/Services/ContentService.ts"
contentScript: "./src/Services/ContentService.ts",
},
output:
{
...webpackConfig.output,
filename: "static/js/[name].js",
}
}
}
}
}
interface IEnvironment
filename: "static/js/[name].js"
},
optimization:
{
env: string;
paths:
{
[key: string]: string | string[]
...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;
+19 -25
View File
@@ -1,54 +1,48 @@
{
"name": "password-generator",
"version": "2.0.1",
"version": "2.0.2",
"private": true,
"dependencies":
{
"dependencies": {
"@craco/craco": "^6.4.5",
"@fluentui/react-components": "^9.3.2",
"@fluentui/react-icons": "^2.0.183",
"@fluentui/react-components": "^9.5.1",
"@fluentui/react-icons": "^2.0.185",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass": "^1.55.0",
"typescript": "^4.8.3"
"typescript": "^4.8.4",
"webextension-polyfill": "^0.10.0"
},
"devDependencies":
{
"devDependencies": {
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/chrome": "^0.0.197",
"@types/jest": "^29.1.1",
"@types/node": "^18.7.18",
"@types/craco__craco": "^6.4.0",
"@types/jest": "^29.1.2",
"@types/node": "^18.11.0",
"@types/react": "^18.0.21",
"@types/react-dom": "^18.0.0",
"@types/webextension-polyfill": "^0.9.1",
"react-scripts": "5.0.1"
},
"scripts":
{
"start": "react-scripts start",
"build": "INLINE_RUNTIME_CHUNK=false craco build",
"scripts": {
"start": "craco start",
"build": "craco build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig":
{
"extends":
[
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist":
{
"production":
[
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development":
[
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
+43 -86
View File
@@ -1,216 +1,173 @@
{
"name":
{
"name": {
"message": "Password Generator",
"description": "manifest.json"
},
"description":
{
"description": {
"message": "Password generator extension allows you to easily generate long and secure password in one click",
"description": "manifest.json"
},
"author":
{
"author": {
"message": "Eugene Fox",
"description": "manifest.json"
},
"Password_generator":
{
"Password_generator": {
"message": "Password generator",
"description": "App.tsx"
},
"Copy":
{
"Copy": {
"message": "Copy",
"description": "PasswordView.tsx"
},
"Generate_new":
{
"Generate_new": {
"message": "Generate new",
"description": "PasswordView.tsx"
},
"Exclude_special_symbols_one_time":
{
"Exclude_special_symbols_one_time": {
"message": "Generate password without special symbols",
"description": "PasswordView.tsx"
},
"Include_special_symbols_one_time":
{
"Include_special_symbols_one_time": {
"message": "Generate password with special symbols",
"description": "PasswordView.tsx"
},
"Settings":
{
"Settings": {
"message": "Settings",
"description": "SettingsSection.tsx"
},
"Password_length":
{
"Password_length": {
"message": "Password length",
"description": "SettingsSection.tsx"
},
"Recommended_password_length":
{
"Recommended_password_length": {
"message": "Recommended password length",
"description": "SettingsSection.tsx"
},
"Character_options":
{
"Character_options": {
"message": "Character options",
"description": "SettingsSection.tsx"
},
"Include":
{
"Include": {
"message": "Include",
"description": "SettingsSection.tsx"
},
"Special_symbols":
{
"Special_symbols": {
"message": "Special symbols",
"description": "SettingsSection.tsx"
},
"Numeric":
{
"Numeric": {
"message": "Numeric",
"description": "SettingsSection.tsx"
},
"Uppercase":
{
"Uppercase": {
"message": "Uppercase",
"description": "SettingsSection.tsx"
},
"Lowercase":
{
"Lowercase": {
"message": "Lowercase",
"description": "SettingsSection.tsx"
},
"Exclude":
{
"Exclude": {
"message": "Exclude",
"description": "SettingsSection.tsx"
},
"Similar":
{
"Similar": {
"message": "Similar",
"description": "SettingsSection.tsx"
},
"Ambiguous":
{
"Ambiguous": {
"message": "Ambiguous",
"description": "SettingsSection.tsx"
},
"Repeating":
{
"Repeating": {
"message": "Repeating",
"description": "SettingsSection.tsx"
},
"Add_shortcut_to_context_menu":
{
"Add_shortcut_to_context_menu": {
"message": "Add shortcut to context menu",
"description": "SettingsSection.tsx"
},
"Right_click_password_field_to_quickly_generate_password":
{
"Right_click_password_field_to_quickly_generate_password": {
"message": "Right-click password field to quickly generate password",
"description": "SettingsSection.tsx"
},
"Automatically_copy_to_clipboard":
{
"Automatically_copy_to_clipboard": {
"message": "Automatically copy to clipboard",
"description": "SettingsSection.tsx"
},
"About":
{
"About": {
"message": "About",
"description": "AboutSection.tsx"
},
"Developed_by_Eugene_Fox":
{
"Developed_by_Eugene_Fox": {
"message": "Developed by Eugene Fox",
"description": "AboutSection.tsx"
},
"Licensed_under":
{
"Licensed_under": {
"message": "Licensed under",
"description": "AboutSection.tsx"
},
"MIT_license":
{
"MIT_license": {
"message": "MIT license",
"description": "AboutSection.tsx"
},
"Want_to_contribute_translation_for_your_language_":
{
"Want_to_contribute_translation_for_your_language_": {
"message": "Want to contribute translation for your language?",
"description": "AboutSection.tsx"
},
"Read_this_to_get_started":
{
"Read_this_to_get_started": {
"message": "Read this to get started",
"description": "AboutSection.tsx"
},
"My_website":
{
"My_website": {
"message": "My website",
"description": "AboutSection.tsx"
},
"Source_code":
{
"Source_code": {
"message": "Source code",
"description": "AboutSection.tsx"
},
"Changelog":
{
"Changelog": {
"message": "Changelog",
"description": "AboutSection.tsx"
},
"Leave_feedback":
{
"Leave_feedback": {
"message": "Leave feedback",
"description": "AboutSection.tsx"
},
"Buy_me_a_coffee":
{
"Buy_me_a_coffee": {
"message": "Buy me a coffee",
"description": "AboutSection.tsx"
},
"Set_name":
{
"Set_name": {
"message": "Name",
"description": "CharacterHelpDialog.tsx"
},
"Characters":
{
"Characters": {
"message": "Characters",
"description": "CharacterHelpDialog.tsx"
},
"__etc_":
{
"__etc_": {
"message": ", etc.",
"description": "CharacterHelpDialog.tsx"
},
"OK":
{
"OK": {
"message": "OK",
"description": "CharacterHelpDialog.tsx"
},
"Either_lowercase_or_uppercase_characters_must_be_included":
{
"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":
{
"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":
{
"Quick_generator_is_only_available_on_password_fields": {
"message": "Quick generator is only available on password fields",
"description": "ContentService.tsx"
},
"Quick_generate_password":
{
"Quick_generate_password": {
"message": "Quick generate password",
"description": "BackgroundService.tsx"
}
+43 -86
View File
@@ -1,216 +1,173 @@
{
"name":
{
"name": {
"message": "Generator haseł",
"description": "manifest.json"
},
"description":
{
"description": {
"message": "Rozszerzenie, które pozwala na łatwe generowanie trudnych i bezpiecznych haseł w jednym kliknięciu",
"description": "manifest.json"
},
"author":
{
"author": {
"message": "Jewgienij Lis",
"description": "manifest.json"
},
"Password_generator":
{
"Password_generator": {
"message": "Generator haseł",
"description": "App.tsx"
},
"Copy":
{
"Copy": {
"message": "Kopiuj",
"description": "PasswordView.tsx"
},
"Generate_new":
{
"Generate_new": {
"message": "Utwórz nowy",
"description": "PasswordView.tsx"
},
"Exclude_special_symbols_one_time":
{
"Exclude_special_symbols_one_time": {
"message": "Wygeneruj hasło bez znaków specjalnych",
"description": "PasswordView.tsx"
},
"Include_special_symbols_one_time":
{
"Include_special_symbols_one_time": {
"message": "Wygeneruj hasło z znakami specjalnymi",
"description": "PasswordView.tsx"
},
"Settings":
{
"Settings": {
"message": "Ustawienia",
"description": "SettingsSection.tsx"
},
"Password_length":
{
"Password_length": {
"message": "Długość hasła",
"description": "SettingsSection.tsx"
},
"Recommended_password_length":
{
"Recommended_password_length": {
"message": "Zalecana długość hasła",
"description": "SettingsSection.tsx"
},
"Character_options":
{
"Character_options": {
"message": "Ustawienia symboli",
"description": "SettingsSection.tsx"
},
"Include":
{
"Include": {
"message": "Włącz",
"description": "SettingsSection.tsx"
},
"Special_symbols":
{
"Special_symbols": {
"message": "Znaki specjalne",
"description": "SettingsSection.tsx"
},
"Numeric":
{
"Numeric": {
"message": "Liczby",
"description": "SettingsSection.tsx"
},
"Uppercase":
{
"Uppercase": {
"message": "Wielkie litery",
"description": "SettingsSection.tsx"
},
"Lowercase":
{
"Lowercase": {
"message": "Małe litery",
"description": "SettingsSection.tsx"
},
"Exclude":
{
"Exclude": {
"message": "Wyłącz",
"description": "SettingsSection.tsx"
},
"Similar":
{
"Similar": {
"message": "Podobne",
"description": "SettingsSection.tsx"
},
"Ambiguous":
{
"Ambiguous": {
"message": "Niebezpieczne",
"description": "SettingsSection.tsx"
},
"Repeating":
{
"Repeating": {
"message": "Powtarzające się",
"description": "SettingsSection.tsx"
},
"Add_shortcut_to_context_menu":
{
"Add_shortcut_to_context_menu": {
"message": "Dodaj rozszerzenie do menu kontekstowego",
"description": "SettingsSection.tsx"
},
"Right_click_password_field_to_quickly_generate_password":
{
"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":
{
"Automatically_copy_to_clipboard": {
"message": "Automatycznie kopiuj do schowka",
"description": "SettingsSection.tsx"
},
"About":
{
"About": {
"message": "O rozszerzeniu",
"description": "AboutSection.tsx"
},
"Developed_by_Eugene_Fox":
{
"Developed_by_Eugene_Fox": {
"message": "Autor: Jewgienij Lis",
"description": "AboutSection.tsx"
},
"Licensed_under":
{
"Licensed_under": {
"message": "Licencja",
"description": "AboutSection.tsx"
},
"MIT_license":
{
"MIT_license": {
"message": "MIT",
"description": "AboutSection.tsx"
},
"Want_to_contribute_translation_for_your_language_":
{
"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":
{
"Read_this_to_get_started": {
"message": "Przeczytaj ten artykuł",
"description": "AboutSection.tsx"
},
"My_website":
{
"My_website": {
"message": "Moja strona internetowa",
"description": "AboutSection.tsx"
},
"Source_code":
{
"Source_code": {
"message": "Kod źródłowy",
"description": "AboutSection.tsx"
},
"Changelog":
{
"Changelog": {
"message": "Lista zmian",
"description": "AboutSection.tsx"
},
"Leave_feedback":
{
"Leave_feedback": {
"message": "Zostaw opinię",
"description": "AboutSection.tsx"
},
"Buy_me_a_coffee":
{
"Buy_me_a_coffee": {
"message": "Wesprzyj",
"description": "AboutSection.tsx"
},
"Set_name":
{
"Set_name": {
"message": "Nazwa",
"description": "CharacterHelpDialog.tsx"
},
"Characters":
{
"Characters": {
"message": "Znaki",
"description": "CharacterHelpDialog.tsx"
},
"__etc_":
{
"__etc_": {
"message": " itp.",
"description": "CharacterHelpDialog.tsx"
},
"OK":
{
"OK": {
"message": "OK",
"description": "CharacterHelpDialog.tsx"
},
"Either_lowercase_or_uppercase_characters_must_be_included":
{
"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":
{
"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":
{
"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":
{
"Quick_generate_password": {
"message": "Wygeneruj hasło",
"description": "BackgroundService.tsx"
}
+43 -86
View File
@@ -1,216 +1,173 @@
{
"name":
{
"name": {
"message": "Генератор паролей",
"description": "manifest.json"
},
"description":
{
"description": {
"message": "Расширение, позволяющее легко генерировать сложные и надежные пароли в один клик",
"description": "manifest.json"
},
"author":
{
"author": {
"message": "Евгений Лис",
"description": "manifest.json"
},
"Password_generator":
{
"Password_generator": {
"message": "Генератор паролей",
"description": "App.tsx"
},
"Copy":
{
"Copy": {
"message": "Копировать",
"description": "PasswordView.tsx"
},
"Generate_new":
{
"Generate_new": {
"message": "Создать новый",
"description": "PasswordView.tsx"
},
"Exclude_special_symbols_one_time":
{
"Exclude_special_symbols_one_time": {
"message": "Сгенерировать пароль без спецсимволов",
"description": "PasswordView.tsx"
},
"Include_special_symbols_one_time":
{
"Include_special_symbols_one_time": {
"message": "Сгенерировать пароль со спецсимволами",
"description": "PasswordView.tsx"
},
"Settings":
{
"Settings": {
"message": "Настройки",
"description": "SettingsSection.tsx"
},
"Password_length":
{
"Password_length": {
"message": "Длина пароля",
"description": "SettingsSection.tsx"
},
"Recommended_password_length":
{
"Recommended_password_length": {
"message": "Рекомендуемая длина пароля",
"description": "SettingsSection.tsx"
},
"Character_options":
{
"Character_options": {
"message": "Настройки символов",
"description": "SettingsSection.tsx"
},
"Include":
{
"Include": {
"message": "Включить",
"description": "SettingsSection.tsx"
},
"Special_symbols":
{
"Special_symbols": {
"message": "Специальные символы",
"description": "SettingsSection.tsx"
},
"Numeric":
{
"Numeric": {
"message": "Цифры",
"description": "SettingsSection.tsx"
},
"Uppercase":
{
"Uppercase": {
"message": "Прописные буквы",
"description": "SettingsSection.tsx"
},
"Lowercase":
{
"Lowercase": {
"message": "Строчные буквы",
"description": "SettingsSection.tsx"
},
"Exclude":
{
"Exclude": {
"message": "Исключить",
"description": "SettingsSection.tsx"
},
"Similar":
{
"Similar": {
"message": "Похожие",
"description": "SettingsSection.tsx"
},
"Ambiguous":
{
"Ambiguous": {
"message": "Особые",
"description": "SettingsSection.tsx"
},
"Repeating":
{
"Repeating": {
"message": "Повторяющиеся",
"description": "SettingsSection.tsx"
},
"Add_shortcut_to_context_menu":
{
"Add_shortcut_to_context_menu": {
"message": "Добавить расширение в контекстное меню",
"description": "SettingsSection.tsx"
},
"Right_click_password_field_to_quickly_generate_password":
{
"Right_click_password_field_to_quickly_generate_password": {
"message": "Щелкните правой кнопкой мыши по полю ввода пароля, чтобы быстро сгенерировать пароль",
"description": "SettingsSection.tsx"
},
"Automatically_copy_to_clipboard":
{
"Automatically_copy_to_clipboard": {
"message": "Автоматически копировать в буфер обмена",
"description": "SettingsSection.tsx"
},
"About":
{
"About": {
"message": "О расширении",
"description": "AboutSection.tsx"
},
"Developed_by_Eugene_Fox":
{
"Developed_by_Eugene_Fox": {
"message": "Разработчик Евгений Лис",
"description": "AboutSection.tsx"
},
"Licensed_under":
{
"Licensed_under": {
"message": "Лицензия",
"description": "AboutSection.tsx"
},
"MIT_license":
{
"MIT_license": {
"message": "MIT",
"description": "AboutSection.tsx"
},
"Want_to_contribute_translation_for_your_language_":
{
"Want_to_contribute_translation_for_your_language_": {
"message": "Хотите помочь с переводом на свой язык?",
"description": "AboutSection.tsx"
},
"Read_this_to_get_started":
{
"Read_this_to_get_started": {
"message": "Прочтите эту статью",
"description": "AboutSection.tsx"
},
"My_website":
{
"My_website": {
"message": "Мой сайт",
"description": "AboutSection.tsx"
},
"Source_code":
{
"Source_code": {
"message": "Исходный код",
"description": "AboutSection.tsx"
},
"Changelog":
{
"Changelog": {
"message": "Список изменений",
"description": "AboutSection.tsx"
},
"Leave_feedback":
{
"Leave_feedback": {
"message": "Оставить отзыв",
"description": "AboutSection.tsx"
},
"Buy_me_a_coffee":
{
"Buy_me_a_coffee": {
"message": "Спонсировать",
"description": "AboutSection.tsx"
},
"Set_name":
{
"Set_name": {
"message": "Название",
"description": "CharacterHelpDialog.tsx"
},
"Characters":
{
"Characters": {
"message": "Символы",
"description": "CharacterHelpDialog.tsx"
},
"__etc_":
{
"__etc_": {
"message": " и т.д.",
"description": "CharacterHelpDialog.tsx"
},
"OK":
{
"OK": {
"message": "ОК",
"description": "CharacterHelpDialog.tsx"
},
"Either_lowercase_or_uppercase_characters_must_be_included":
{
"Either_lowercase_or_uppercase_characters_must_be_included": {
"message": "Должны быть включены строчные или прописные буквы",
"description": "Generator.tsx"
},
"Selected_length_is_too_long_to_exclude_repeating_characters":
{
"Selected_length_is_too_long_to_exclude_repeating_characters": {
"message": "Выбранная длина слишком велика для исключения повторяющихся символов",
"description": "Generator.tsx"
},
"Quick_generator_is_only_available_on_password_fields":
{
"Quick_generator_is_only_available_on_password_fields": {
"message": "Быстрый генератор доступен только для полей ввода пароля",
"description": "ContentService.tsx"
},
"Quick_generate_password":
{
"Quick_generate_password": {
"message": "Сгенерировать пароль",
"description": "BackgroundService.tsx"
}
+43 -86
View File
@@ -1,216 +1,173 @@
{
"name":
{
"name": {
"message": "Генератор паролів",
"description": "manifest.json"
},
"description":
{
"description": {
"message": "Розширення, яке дозволяє легко генерувати складні та надійні паролі в один клік",
"description": "manifest.json"
},
"author":
{
"author": {
"message": "Євген Лис",
"description": "manifest.json"
},
"Password_generator":
{
"Password_generator": {
"message": "Генератор паролів",
"description": "App.tsx"
},
"Copy":
{
"Copy": {
"message": "Копіювати",
"description": "PasswordView.tsx"
},
"Generate_new":
{
"Generate_new": {
"message": "Генерувати новий",
"description": "PasswordView.tsx"
},
"Exclude_special_symbols_one_time":
{
"Exclude_special_symbols_one_time": {
"message": "Генерувати пароль без спеціальних символів",
"description": "PasswordView.tsx"
},
"Include_special_symbols_one_time":
{
"Include_special_symbols_one_time": {
"message": "Генерувати пароль з спеціальними символами",
"description": "PasswordView.tsx"
},
"Settings":
{
"Settings": {
"message": "Налаштування",
"description": "SettingsSection.tsx"
},
"Password_length":
{
"Password_length": {
"message": "Довжина паролю",
"description": "SettingsSection.tsx"
},
"Recommended_password_length":
{
"Recommended_password_length": {
"message": "Рекомендована довжина паролю",
"description": "SettingsSection.tsx"
},
"Character_options":
{
"Character_options": {
"message": "Параметри символів",
"description": "SettingsSection.tsx"
},
"Include":
{
"Include": {
"message": "Включити",
"description": "SettingsSection.tsx"
},
"Special_symbols":
{
"Special_symbols": {
"message": "Спеціальні символи",
"description": "SettingsSection.tsx"
},
"Numeric":
{
"Numeric": {
"message": "Цифри",
"description": "SettingsSection.tsx"
},
"Uppercase":
{
"Uppercase": {
"message": "Великі літери",
"description": "SettingsSection.tsx"
},
"Lowercase":
{
"Lowercase": {
"message": "Малі літери",
"description": "SettingsSection.tsx"
},
"Exclude":
{
"Exclude": {
"message": "Виключити",
"description": "SettingsSection.tsx"
},
"Similar":
{
"Similar": {
"message": "Схожі",
"description": "SettingsSection.tsx"
},
"Ambiguous":
{
"Ambiguous": {
"message": "Особливі",
"description": "SettingsSection.tsx"
},
"Repeating":
{
"Repeating": {
"message": "Повторювані",
"description": "SettingsSection.tsx"
},
"Add_shortcut_to_context_menu":
{
"Add_shortcut_to_context_menu": {
"message": "Додати розширення до контекстного меню",
"description": "SettingsSection.tsx"
},
"Right_click_password_field_to_quickly_generate_password":
{
"Right_click_password_field_to_quickly_generate_password": {
"message": "Правий клік на поле вводу паролю для швидкого генерування паролю",
"description": "SettingsSection.tsx"
},
"Automatically_copy_to_clipboard":
{
"Automatically_copy_to_clipboard": {
"message": "Автоматично копіювати в буфер обміну",
"description": "SettingsSection.tsx"
},
"About":
{
"About": {
"message": "Про розширення",
"description": "AboutSection.tsx"
},
"Developed_by_Eugene_Fox":
{
"Developed_by_Eugene_Fox": {
"message": "Розроблено Євгеном Лисом",
"description": "AboutSection.tsx"
},
"Licensed_under":
{
"Licensed_under": {
"message": "Ліцензовано під",
"description": "AboutSection.tsx"
},
"MIT_license":
{
"MIT_license": {
"message": "MIT",
"description": "AboutSection.tsx"
},
"Want_to_contribute_translation_for_your_language_":
{
"Want_to_contribute_translation_for_your_language_": {
"message": "Хочете допомогти перекласти розширення на свою мову?",
"description": "AboutSection.tsx"
},
"Read_this_to_get_started":
{
"Read_this_to_get_started": {
"message": "Прочитайте цю статтю",
"description": "AboutSection.tsx"
},
"My_website":
{
"My_website": {
"message": "Моя веб-сторінка",
"description": "AboutSection.tsx"
},
"Source_code":
{
"Source_code": {
"message": "Вихідний код",
"description": "AboutSection.tsx"
},
"Changelog":
{
"Changelog": {
"message": "Список змін",
"description": "AboutSection.tsx"
},
"Leave_feedback":
{
"Leave_feedback": {
"message": "Залишити відгук",
"description": "AboutSection.tsx"
},
"Buy_me_a_coffee":
{
"Buy_me_a_coffee": {
"message": "Підтримати",
"description": "AboutSection.tsx"
},
"Set_name":
{
"Set_name": {
"message": "Назва",
"description": "CharacterHelpDialog.tsx"
},
"Characters":
{
"Characters": {
"message": "Символи",
"description": "CharacterHelpDialog.tsx"
},
"__etc_":
{
"__etc_": {
"message": " і т.д.",
"description": "CharacterHelpDialog.tsx"
},
"OK":
{
"OK": {
"message": "OK",
"description": "CharacterHelpDialog.tsx"
},
"Either_lowercase_or_uppercase_characters_must_be_included":
{
"Either_lowercase_or_uppercase_characters_must_be_included": {
"message": "Повинні бути включені малі або великі літери",
"description": "Generator.tsx"
},
"Selected_length_is_too_long_to_exclude_repeating_characters":
{
"Selected_length_is_too_long_to_exclude_repeating_characters": {
"message": "Вибрана довжина занадто велика для виключення повторюваних символів",
"description": "Generator.tsx"
},
"Quick_generator_is_only_available_on_password_fields":
{
"Quick_generator_is_only_available_on_password_fields": {
"message": "Швидкий генератор доступний тільки для полів вводу паролів",
"description": "ContentService.tsx"
},
"Quick_generate_password":
{
"Quick_generate_password": {
"message": "Згенерувати пароль",
"description": "BackgroundService.tsx"
}
+5 -2
View File
@@ -2,9 +2,12 @@
<html lang="en">
<head>
<title>Password Generator</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="utf-8" />
<title>Password Generator</title>
<meta
name="viewport"
content="width=device-width, initial-scale=1"
/>
</head>
<body>
+11 -28
View File
@@ -1,56 +1,39 @@
{
"$schema": "https://json.schemastore.org/chrome-manifest.json",
"manifest_version": 3,
"name": "__MSG_name__",
"description": "__MSG_description__",
"author": "__MSG_author__",
"version": "2.0.0",
"default_locale": "en",
"permissions":
[
"permissions": [
"storage",
"contextMenus",
"clipboardWrite"
],
"background":
{
"background": {
"service_worker": "./static/js/background.js",
"type": "module"
},
"content_scripts":
[
"content_scripts": [
{
"matches": [ "<all_urls>" ],
"js": [ "./static/js/contentScript.js" ],
"matches": [
"<all_urls>"
],
"js": [
"./static/js/contentScript.js"
],
"run_at": "document_idle",
"all_frames": true
}
],
"action":
{
"action": {
"default_popup": "index.html",
"default_title": "__MSG_name__"
},
"icons":
{
"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"
}
}
}
@@ -1,54 +1,45 @@
{
"$schema": "https://json.schemastore.org/chrome-manifest.json",
"manifest_version": 2,
"name": "__MSG_name__",
"description": "__MSG_description__",
"author": "__MSG_author__",
"version": "2.0.0",
"default_locale": "en",
"permissions":
[
"permissions": [
"storage",
"contextMenus",
"clipboardWrite"
],
"background":
{
"scripts": [ "./static/js/background.js" ],
"background": {
"scripts": [
"./static/js/background.js"
],
"persistent": true
},
"content_scripts":
[
"content_scripts": [
{
"matches": [ "<all_urls>" ],
"js": [ "./static/js/contentScript.js" ],
"matches": [
"<all_urls>"
],
"js": [
"./static/js/contentScript.js"
],
"run_at": "document_idle",
"all_frames": true
}
],
"browser_action":
{
"browser_action": {
"default_popup": "index.html",
"default_title": "__MSG_name__"
},
"icons":
{
"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":
{
"browser_specific_settings": {
"gecko": {
"id": "passwordgenerator@xfox111.net",
"strict_min_version": "58.0"
}
+6
View File
@@ -49,6 +49,7 @@ main
animation-timing-function: var(--curveEasyEaseMax);
animation-duration: .5s;
}
@keyframes scaleUpInAnim
{
from
@@ -56,6 +57,7 @@ main
transform: scale(.5);
opacity: 0;
}
to
{
transform: scale(1);
@@ -69,12 +71,14 @@ main
animation-timing-function: var(--curveEasyEaseMax);
animation-duration: .5s;
}
@keyframes spinAnim
{
from
{
transform: rotate(0deg);
}
to
{
transform: rotate(360deg);
@@ -87,12 +91,14 @@ main
animation-timing-function: var(--curveDecelerateMin);
animation-duration: .5s;
}
@keyframes fadeInAnim
{
from
{
opacity: 0;
}
to
{
opacity: 1;
-1
View File
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg SYSTEM "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-flat-20110816.dtd">
<svg id="BuyMeACoffee" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 884 1279" width="16" height="16">
<defs>
<style type="text/css">

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

+26 -1
View File
@@ -3,6 +3,7 @@ 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 browser from "../Utils/Browser";
export default class AboutSection extends React.Component
{
@@ -32,7 +33,7 @@ export default class AboutSection extends React.Component
<div className="stack horizontal gap">
<Button
as="a" target="_blank"
href="mailto:feedback@xfox111.net"
href={ this.GetFeedbackLink() }
appearance="primary" icon={ <PersonFeedbackRegular /> }>
{ loc("Leave feedback") }
@@ -51,4 +52,28 @@ export default class AboutSection extends React.Component
</AccordionItem>
);
}
private GetFeedbackLink(): string
{
let manifest: { [key: string]: string | any } = browser?.runtime?.getManifest();
if (!manifest)
return "mailto:feedback@xfox111.net";
else
{
if (manifest.update_url)
{
let host: string = new URL(manifest.update_url).host;
if (host.endsWith("edge.microsoft.com"))
return "https://microsoftedge.microsoft.com/addons/detail/password-generator/manimdhobjbkfpeeehlhhneookiokpbj";
else if (host.endsWith("google.com"))
return "https://chrome.google.com/webstore/detail/password-generator/jnjobgjobffgmgfnkpkjfjkkfhfikmfl";
else
return "mailto:feedback@xfox111.net";
}
else
return "mailto:feedback@xfox111.net";
}
}
}
+6 -4
View File
@@ -1,5 +1,5 @@
import { Button, Text } from "@fluentui/react-components";
import { Dialog, DialogTrigger, DialogSurface, DialogTitle, DialogBody, Table, TableHeader, TableRow, TableHeaderCell, TableBody, TableCell, DialogActions } from "@fluentui/react-components/unstable";
import { Button, Text, Dialog, DialogTrigger, DialogSurface, DialogTitle, DialogBody, DialogActions, DialogContent } from "@fluentui/react-components";
import { Table, TableHeader, TableRow, TableHeaderCell, TableBody, TableCell } from "@fluentui/react-components/unstable";
import { QuestionCircleRegular } from "@fluentui/react-icons";
import React from "react";
import Generator from "../Utils/Generator";
@@ -15,8 +15,9 @@ export default class CharacterHelpDialog extends React.Component
<Button appearance="subtle" style={ { marginLeft: 5 } } icon={ <QuestionCircleRegular /> } />
</DialogTrigger>
<DialogSurface aria-label="label">
<DialogTitle>{ loc("Character options") }</DialogTitle>
<DialogBody>
<DialogTitle>{ loc("Character options") }</DialogTitle>
<DialogContent>
<Table>
<TableHeader>
<TableRow>
@@ -63,12 +64,13 @@ export default class CharacterHelpDialog extends React.Component
</TableRow>
</TableBody>
</Table>
</DialogBody>
</DialogContent>
<DialogActions>
<DialogTrigger>
<Button appearance="secondary">{ loc("OK") }</Button>
</DialogTrigger>
</DialogActions>
</DialogBody>
</DialogSurface>
</Dialog>
);
+2 -2
View File
@@ -28,9 +28,9 @@ export default class SettingsSection extends React.Component<IProps>
<div className="stack">
<Input
id="pwd-length"
value={ options.Length.toString() }
value={ options.Length?.toString() }
onChange={ (_, e) => GeneratorOptions.Update({ Length: parseInt(e.value) }) }
type="number" min={ 4 } />
type="number" min={ 4 } minLength={ 1 } />
<Text size={ 200 }>{ loc("Recommended password length") } <b>16-32</b></Text>
</div>
<Divider />
+24 -20
View File
@@ -1,32 +1,31 @@
// 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);
chrome.contextMenus.update("generatePassword", { visible: isEnabled });
browser.contextMenus.update("generatePassword", { visible: isEnabled });
}
async function OnContextClick(info : chrome.contextMenus.OnClickData) : Promise<void>
async function OnContextClick(info: Menus.OnClickData): Promise<void>
{
console.log("BackgroundService.OnContextClick", info);
let tabInfo : chrome.tabs.Tab[] = await chrome.tabs.query({ active: true, currentWindow: true });
let tabInfo: Tabs.Tab[] = await browser.tabs.query({ active: true, currentWindow: true });
console.log("BackgroundService.OnContextClick", tabInfo);
chrome.tabs.sendMessage<string>(tabInfo[0].id, info.menuItemId as string);
browser.tabs.sendMessage(tabInfo[0].id, info.menuItemId as string);
}
if (!chrome.runtime.onInstalled.hasListeners())
chrome.runtime.onInstalled.addListener(async () =>
async function OnInstalled(): Promise<void>
{
console.log("[BackgroundService] chrome.runtime.onInstalled");
chrome.contextMenus.removeAll();
console.log("[BackgroundService] browser.runtime.onInstalled");
browser.contextMenus.removeAll();
chrome.contextMenus.create(
browser.contextMenus.create(
{
title: loc("Quick generate password"),
contexts: ["editable"],
@@ -34,18 +33,23 @@ if (!chrome.runtime.onInstalled.hasListeners())
}
);
let settings : { [key : string]: any } = await chrome.storage.sync.get({ AddContext: true });
let settings: { [key: string]: any; } = await browser.storage.sync.get({ AddContext: true });
UpdateContextMenu(settings.AddContext);
});
}
if (!chrome.contextMenus.onClicked.hasListeners())
chrome.contextMenus.onClicked.addListener(OnContextClick);
if (!chrome.storage.sync.onChanged.hasListeners())
chrome.storage.sync.onChanged.addListener(changes =>
async function OnStorageChanged(changes: any): Promise<void>
{
console.log("[BackgroundService] chrome.storage.sync.onChanged", changes);
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);
+8 -5
View File
@@ -1,14 +1,14 @@
// 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";
if (!chrome.runtime.onMessage.hasListeners())
chrome.runtime.onMessage.addListener(async message =>
async function OnMessage(message: any): Promise<void>
{
console.log("[ContentService] chrome.runtime.onMessage", message);
console.log("[ContentService] browser.runtime.onMessage", message);
if (message === "generatePassword")
{
@@ -20,7 +20,7 @@ if (!chrome.runtime.onMessage.hasListeners())
if (!["INPUT", "TEXTAREA"].includes(input.tagName))
return;
console.log("[ContentService] chrome.runtime.onMessage", input);
console.log("[ContentService] browser.runtime.onMessage", input);
if (input.tagName !== "INPUT" || input.readOnly || !["text", "password"].includes(input.type))
{
@@ -32,6 +32,9 @@ if (!chrome.runtime.onMessage.hasListeners())
input.value = password;
window.navigator.clipboard.writeText(password);
}
});
}
if (!browser.runtime.onMessage.hasListener(OnMessage))
browser.runtime.onMessage.addListener(OnMessage);
console.log("[ContentService] Loaded");
+4
View File
@@ -0,0 +1,4 @@
import Browser from "webextension-polyfill";
const browser: typeof Browser = (process.env.NODE_ENV !== "development") ? require("webextension-polyfill") : null;
export default browser;
+6
View File
@@ -12,6 +12,9 @@ export default class Generator
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 "";
@@ -45,6 +48,9 @@ export default class Generator
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");
+10 -7
View File
@@ -1,3 +1,6 @@
import { Storage } from "webextension-polyfill";
import browser from "../Utils/Browser";
export default class GeneratorOptions
{
public Length: number = 16;
@@ -17,28 +20,28 @@ export default class GeneratorOptions
{
let fallbackOptions: GeneratorOptions = new GeneratorOptions();
if (!chrome?.storage?.sync) // Extension is running as a standalone app
if (!browser?.storage?.sync) // Extension is running as a standalone app
return fallbackOptions;
let props : { [key: string]: any } = await chrome.storage.sync.get(fallbackOptions);
let props: { [key: string]: any; } = await browser.storage.sync.get(fallbackOptions);
chrome.storage.sync.onChanged.addListener(GeneratorOptions.OnStorageChanged);
browser.storage.sync.onChanged.addListener(GeneratorOptions.OnStorageChanged);
return props as GeneratorOptions;
}
public static async Update(changes: Partial<GeneratorOptions>): Promise<void>
{
if (chrome?.storage?.sync)
await chrome?.storage?.sync?.set(changes);
if (browser?.storage?.sync)
await browser?.storage?.sync?.set(changes);
else
GeneratorOptions.OnChanged(changes);
}
private static OnStorageChanged(changes : { [key: string]: chrome.storage.StorageChange }) : void
private static OnStorageChanged(changes: { [key: string]: Storage.StorageChange; }): void
{
let propsList: string[] = Object.keys(new GeneratorOptions());
let options : { [key: string]: any } = { };
let options: { [key: string]: any; } = {};
Object.entries(changes)
.filter(i => propsList.includes(i[0]))
+3 -1
View File
@@ -1,3 +1,5 @@
import browser from "../Utils/Browser";
export default class Localization
{
public static GetString(key: string): string
@@ -10,7 +12,7 @@ export default class Localization
.replaceAll("?", "_")
.replaceAll("!", "_");
let str : string = chrome?.i18n?.getMessage(sanitizedKey);
let str: string = browser?.i18n?.getMessage(sanitizedKey);
return str ?? key;
}
+10 -7
View File
@@ -1,3 +1,6 @@
import { Storage } from "webextension-polyfill";
import browser from "../Utils/Browser";
export default class Settings
{
public AddContext: boolean = true;
@@ -9,28 +12,28 @@ export default class Settings
{
let fallbackOptions = new Settings();
if (!chrome?.storage?.sync)
if (!browser?.storage?.sync)
return fallbackOptions;
let props : { [key: string]: any } = await chrome.storage.sync.get(fallbackOptions);
let props: { [key: string]: any; } = await browser.storage.sync.get(fallbackOptions);
chrome.storage.sync.onChanged.addListener(Settings.OnStorageChanged);
browser.storage.sync.onChanged.addListener(Settings.OnStorageChanged);
return props as Settings;
}
public static async Update(changes: Partial<Settings>): Promise<void>
{
if (chrome?.storage?.sync)
await chrome?.storage?.sync?.set(changes);
if (browser?.storage?.sync)
await browser?.storage?.sync?.set(changes);
else
Settings.OnChanged(changes);
}
private static OnStorageChanged(changes : { [key: string]: chrome.storage.StorageChange }) : void
private static OnStorageChanged(changes: { [key: string]: Storage.StorageChange; }): void
{
let propsList: string[] = Object.keys(new Settings());
let settings : { [key: string]: any } = { };
let settings: { [key: string]: any; } = {};
Object.entries(changes)
.filter(i => propsList.includes(i[0]))
+5 -5
View File
@@ -1,9 +1,7 @@
{
"compilerOptions":
{
"compilerOptions": {
"target": "es5",
"lib":
[
"lib": [
"dom",
"dom.iterable",
"esnext"
@@ -23,5 +21,7 @@
"noEmit": true,
"jsx": "react-jsx"
},
"include": [ "src" ]
"include": [
"src"
]
}
+618 -467
View File
File diff suppressed because it is too large Load Diff