Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
439cd303ff | ||
|
|
ec0c972d34 | ||
|
|
2a08855e5d | ||
|
|
1c6b3057ea | ||
|
|
ea5f9ec27d | ||
|
|
f2935e4008 | ||
|
|
487001af48 | ||
|
|
71e70e50c5 | ||
|
|
0a857aa09e | ||
|
|
b976b92031 | ||
|
|
db62ed7f3a | ||
|
|
36f0805590 | ||
|
|
49600c5f37 | ||
|
|
eb9ac35a92 | ||
|
|
77148980e0 | ||
|
|
b3d2e82025 |
32
.github/ISSUE_TEMPLATE/1-bug-report-scripts.md
vendored
32
.github/ISSUE_TEMPLATE/1-bug-report-scripts.md
vendored
@@ -11,9 +11,11 @@ Please fill in as much of the template below as you're able.
|
||||
As a small open source project with small community, it can sometimes take a long time for issues to be addressed so please be patient.
|
||||
-->
|
||||
|
||||
### Describe the bug
|
||||
### Description
|
||||
|
||||
<!-- A clear and concise description of what the bug is. -->
|
||||
<!--
|
||||
A clear and concise description of what the bug is.
|
||||
-->
|
||||
|
||||
### OS
|
||||
|
||||
@@ -23,14 +25,32 @@ On Windows you can find it using "Start button" > "Settings" > "System" > "About
|
||||
On macOS you can find it using "Apple menu (top left corner)" > "About This Mac".
|
||||
-->
|
||||
|
||||
### Screenshots
|
||||
### Reproduction steps
|
||||
|
||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||
<!--
|
||||
How can the bug be recreated?
|
||||
It's the most important information in the bug report. Bugs that cannot be reproduced cannot be fixed and verified.
|
||||
E.g.
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
-->
|
||||
|
||||
### Scripts
|
||||
|
||||
<!-- Which scripts did you execute? If applicable, please paste the executed scripts or attach the generated privacy.sexy file . -->
|
||||
<!--
|
||||
If applicable, please attach the generated privacy.sexy file instead of copy pasting which becomes too long.
|
||||
-->
|
||||
|
||||
### Screenshots
|
||||
|
||||
<!--
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
-->
|
||||
|
||||
### Additional information
|
||||
|
||||
<!-- Add any other context about the problem here. -->
|
||||
<!--
|
||||
If applicable, add any other context about the problem here.
|
||||
-->
|
||||
|
||||
17
.github/ISSUE_TEMPLATE/2-bug-report-generic.md
vendored
17
.github/ISSUE_TEMPLATE/2-bug-report-generic.md
vendored
@@ -11,13 +11,16 @@ Please fill in as much of the template below as you're able.
|
||||
As a small open source project with small community, it can sometimes take a long time for issues to be addressed so please be patient.
|
||||
-->
|
||||
|
||||
### Describe the bug
|
||||
### Description
|
||||
|
||||
<!-- A clear and concise description of what the bug is. -->
|
||||
<!--
|
||||
A clear and concise description of what the bug is.
|
||||
-->
|
||||
|
||||
### To Reproduce
|
||||
### Reproduction steps
|
||||
|
||||
<!--
|
||||
<!--
|
||||
It's the most important information in the bug report. Bugs that cannot be reproduced cannot be fixed and verified.
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
@@ -41,12 +44,12 @@ If applicable, add screenshots to help explain your problem.
|
||||
|
||||
<!--
|
||||
If applicable, mention how you were using privacy.sexy when the bug was encountered:
|
||||
- Web (on Desktop or mobile?)
|
||||
- Or desktop (Windows, macOS or Linux?)
|
||||
- Web (on Desktop or mobile?)
|
||||
- Or desktop (Windows, macOS or Linux?)
|
||||
-->
|
||||
|
||||
### Additional context
|
||||
|
||||
<!--
|
||||
Add any other context about the problem here.
|
||||
If applicable, add any other context about the problem here.
|
||||
-->
|
||||
|
||||
36
.github/ISSUE_TEMPLATE/3-feature-request.md
vendored
Normal file
36
.github/ISSUE_TEMPLATE/3-feature-request.md
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for privacy.sexy
|
||||
labels: enhancement
|
||||
---
|
||||
|
||||
<!--
|
||||
Thank you for suggesting an idea to improve privacy better 🤗.
|
||||
Please fill in as much of the template below as you're able.
|
||||
-->
|
||||
|
||||
### Problem description
|
||||
|
||||
<!--
|
||||
What are we trying to solve?
|
||||
Please add a clear and concise description of the problem you are seeking to solve with this feature request.
|
||||
E.g. I'm always frustrated when [...]
|
||||
-->
|
||||
|
||||
### Proposed solution
|
||||
|
||||
<!--
|
||||
Describe the solution you'd like in a clear and concise manner.
|
||||
-->
|
||||
|
||||
### Alternatives considered
|
||||
|
||||
<!--
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
-->
|
||||
|
||||
### Additional information
|
||||
|
||||
<!--
|
||||
If applicable, add any other context or screenshots about the feature request here.
|
||||
-->
|
||||
27
.github/ISSUE_TEMPLATE/3-feature_request.md
vendored
27
.github/ISSUE_TEMPLATE/3-feature_request.md
vendored
@@ -1,27 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for privacy.sexy
|
||||
labels: enhancement
|
||||
---
|
||||
|
||||
<!--
|
||||
Thank you for suggesting an idea to make privacy better. 🤗
|
||||
|
||||
Please fill in as much of the template below as you're able.
|
||||
-->
|
||||
|
||||
### Problem Description
|
||||
|
||||
<!-- Please add a clear and concise description of the problem you are seeking to solve with this feature request. Ex. I'm always frustrated when [...] -->
|
||||
|
||||
### Proposed solution
|
||||
|
||||
<!-- Describe the solution you'd like in a clear and concise manner. -->
|
||||
|
||||
### Alternatives considered
|
||||
|
||||
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
|
||||
|
||||
### Additional information
|
||||
|
||||
<!-- Add any other context or screenshots about the feature request here. -->
|
||||
73
.github/ISSUE_TEMPLATE/4-new-script-suggestion.md
vendored
Normal file
73
.github/ISSUE_TEMPLATE/4-new-script-suggestion.md
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
---
|
||||
name: New script suggestion
|
||||
about: Suggest a new script for privacy.sexy
|
||||
labels: enhancement
|
||||
---
|
||||
|
||||
<!--
|
||||
Thank you for suggesting an script to make privacy better. 🤗
|
||||
Please fill in as much of the template below as you're able.
|
||||
You could alternatively send a PR directly (see CONTRIBUTING.md).
|
||||
-->
|
||||
|
||||
### OS
|
||||
|
||||
<!--
|
||||
Which OS will the new script configure?
|
||||
Either "Windows" or "macOS".
|
||||
-->
|
||||
|
||||
### Name
|
||||
|
||||
<!--
|
||||
The name of the script.
|
||||
It should start with an imperative noun such as "disable", "turn off" , "clear"...
|
||||
E.g. "Disable webcam telemetry"
|
||||
-->
|
||||
|
||||
### Script code
|
||||
|
||||
<!--
|
||||
Code that will be executed when script is selected.
|
||||
Try to keep it as simple and backwards-compatible as possible.
|
||||
Allowed languages:
|
||||
- macOS: bash (sh)
|
||||
- Windows: PowerShell (ps1) or batchfile
|
||||
- 💡 Prioritize the one that's simpler, batchfile if similar.
|
||||
-->
|
||||
|
||||
### Revert code
|
||||
|
||||
<!--
|
||||
If applicable, add code that will revert the script code to its original (OS default) state.
|
||||
It may require additional time, but it's much appreciated by the community.
|
||||
Leave blank if the script is nonreversible (e.g. when clearing data without backup).
|
||||
-->
|
||||
|
||||
### Suggested category
|
||||
|
||||
<!--
|
||||
If applicable, suggest one more multiple suitable parent category of script.
|
||||
A category is the item where the script will be presented under.
|
||||
Most likely there already is a category for the script, so check the existing categories.
|
||||
If you're unsure, leave blank and maintainer(s) will choose one.
|
||||
-->
|
||||
|
||||
### Suggested recommendation level
|
||||
|
||||
<!--
|
||||
If applicable, suggest recommending the script or not recommending at all.
|
||||
A script should be only recommended if it'll be safe for your grandmother to run.
|
||||
So you have three options here:
|
||||
STANDARD: Non-breaking scripts that does not limit any functionality.
|
||||
STRICT: Scripts that can break certain functionality but not intrusive to common daily OS usage.
|
||||
NONE: Script is not recommended for newbies at all, only those who knows what's going on should select it.
|
||||
If you're unsure, leave blank and maintainer(s) will choose one.
|
||||
-->
|
||||
|
||||
### Additional documentation/references
|
||||
|
||||
<!--
|
||||
If applicable, refer to documentation that should show up on the script description.
|
||||
Sources (URLs) should be as high quality as possible e.g. vendor documentation is favored over user forums.
|
||||
-->
|
||||
4
.github/workflows/deploy-desktop.yaml
vendored
4
.github/workflows/deploy-desktop.yaml
vendored
@@ -26,7 +26,9 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Run tests
|
||||
run: npm run test:unit
|
||||
run: |
|
||||
npm run test:unit
|
||||
npm run test:integration
|
||||
- name: Publish desktop app
|
||||
run: npm run electron:build -- -p always # https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/recipes.html#upload-release-to-github
|
||||
env:
|
||||
|
||||
4
.github/workflows/deploy-site.yaml
vendored
4
.github/workflows/deploy-site.yaml
vendored
@@ -90,7 +90,9 @@ jobs:
|
||||
working-directory: site
|
||||
-
|
||||
name: "App: Run tests"
|
||||
run: npm run test:unit
|
||||
run: |
|
||||
npm run test:unit
|
||||
npm run test:integration
|
||||
working-directory: site
|
||||
-
|
||||
name: "App: Build"
|
||||
|
||||
2
.github/workflows/security-checks.yaml
vendored
2
.github/workflows/security-checks.yaml
vendored
@@ -5,7 +5,7 @@ on:
|
||||
pull_request:
|
||||
paths: [ '/package.json', '/package-lock.json' ] # Allow PRs to be green if they do not introduce dependency change
|
||||
schedule:
|
||||
- cron: '0 0 * * 0'
|
||||
- cron: '0 0 * * 0' # at 00:00 on every Sunday
|
||||
|
||||
jobs:
|
||||
npm-audit:
|
||||
|
||||
11
.github/workflows/test.yaml
vendored
11
.github/workflows/test.yaml
vendored
@@ -1,6 +1,10 @@
|
||||
name: Test
|
||||
|
||||
on: [ push, pull_request ]
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
schedule: # for integration tests
|
||||
- cron: '0 0 * * 0' # at 00:00 on every Sunday
|
||||
|
||||
jobs:
|
||||
run-tests:
|
||||
@@ -22,5 +26,8 @@ jobs:
|
||||
name: Install dependencies
|
||||
run: npm ci
|
||||
-
|
||||
name: Run tests
|
||||
name: Run unit tests
|
||||
run: npm run test:unit
|
||||
-
|
||||
name: Run integration tests
|
||||
run: npm run test:integration
|
||||
|
||||
15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,5 +1,20 @@
|
||||
# Changelog
|
||||
|
||||
## 0.10.2 (2021-04-19)
|
||||
|
||||
* in CI/CD, run other tests/check even if one of them fails | [5c43965](https://github.com/undergroundwires/privacy.sexy/commit/5c43965f0bc44f991ada7d3bad68937a80665dc3)
|
||||
* fix desktop initial window size being bigger than current display size on smaller Linux/Windows screens | [02bdc4c](https://github.com/undergroundwires/privacy.sexy/commit/02bdc4cf0426c452f3fc9af52b819ca9b0757290)
|
||||
* refactor extra code, duplicates, complexity | [00d8e55](https://github.com/undergroundwires/privacy.sexy/commit/00d8e551db001247fadfb6f6af7a4c5ce19a9e64)
|
||||
* improve disabling ads and marketing #65 | [040ed27](https://github.com/undergroundwires/privacy.sexy/commit/040ed2701c4a468749901f4c5369b221bc0973c4)
|
||||
* document breaking behavior in script name #64 | [b1ed3ce](https://github.com/undergroundwires/privacy.sexy/commit/b1ed3ce55f2d003cad1ead23e674aa66d4eb5802)
|
||||
* add module alias '@tests/' | [60c8061](https://github.com/undergroundwires/privacy.sexy/commit/60c80611eab227791fabb883caf93418cef5fd00)
|
||||
* document chromium warning for policy changes | [aea04e5](https://github.com/undergroundwires/privacy.sexy/commit/aea04e5f7cd48fbb9b407b68ade75575a6064c82)
|
||||
* fix script revert activating recommendation level | [a2f1085](https://github.com/undergroundwires/privacy.sexy/commit/a2f10857e2a8debb3ce01f79b0dfbe8649ea9a17)
|
||||
* fix typo and dead URL in Windows scripts (#70) | [8141a01](https://github.com/undergroundwires/privacy.sexy/commit/8141a01ef798331b4d82f5ca95f7b18df4f6f912)
|
||||
* fix vue warning for undefined property during render | [b25b8cc](https://github.com/undergroundwires/privacy.sexy/commit/b25b8cc8052655af70b0695c6c3085974d783bb6)
|
||||
|
||||
[compare](https://github.com/undergroundwires/privacy.sexy/compare/0.10.1...0.10.2)
|
||||
|
||||
## 0.10.1 (2021-03-25)
|
||||
|
||||
* refactor script compilation to make it easy to add new expressions #41 #53 | [646db90](https://github.com/undergroundwires/privacy.sexy/commit/646db9058541cebd0af437554de04fdc6bb63a6e)
|
||||
|
||||
19
README.md
19
README.md
@@ -16,7 +16,7 @@
|
||||
|
||||
- Online version at [https://privacy.sexy](https://privacy.sexy)
|
||||
- 💡 No need to run any compiled software on your computer.
|
||||
- Alternatively download offline version for [Windows](https://github.com/undergroundwires/privacy.sexy/releases/download/0.10.1/privacy.sexy-Setup-0.10.1.exe), [macOS](https://github.com/undergroundwires/privacy.sexy/releases/download/0.10.1/privacy.sexy-0.10.1.dmg) or [Linux](https://github.com/undergroundwires/privacy.sexy/releases/download/0.10.1/privacy.sexy-0.10.1.AppImage).
|
||||
- Alternatively download offline version for [Windows](https://github.com/undergroundwires/privacy.sexy/releases/download/0.10.2/privacy.sexy-Setup-0.10.2.exe), [macOS](https://github.com/undergroundwires/privacy.sexy/releases/download/0.10.2/privacy.sexy-0.10.2.dmg) or [Linux](https://github.com/undergroundwires/privacy.sexy/releases/download/0.10.2/privacy.sexy-0.10.2.AppImage).
|
||||
- 💡 Single click to execute your script.
|
||||
- ❗ Come back regularly to apply latest version for stronger privacy and security.
|
||||
|
||||
@@ -34,17 +34,20 @@
|
||||
|
||||
## Extend scripts
|
||||
|
||||
1. Fork the repository
|
||||
2. Add more scripts in respective script collection in [collections](src/application/collections/) folder.
|
||||
- 📖 If you're unsure about the syntax you can refer to the [collection files | documentation](docs/collection-files.md).
|
||||
- 🙏 For any new script, please add `revertCode` and `docs` values if possible.
|
||||
3. Send a pull request 👌
|
||||
- You can either [create an issue](https://github.com/undergroundwires/privacy.sexy/issues/new/choose)
|
||||
- Or send a PR:
|
||||
1. Fork the repository
|
||||
2. Add more scripts in respective script collection in [collections](src/application/collections/) folder.
|
||||
- 📖 If you're unsure about the syntax you can refer to the [collection files | documentation](docs/collection-files.md).
|
||||
- 🙏 For any new script, please add `revertCode` and `docs` values if possible.
|
||||
3. Send a pull request 👌
|
||||
|
||||
## Commands
|
||||
|
||||
- Project setup: `npm install`
|
||||
- Testing
|
||||
- Run unit tests: `npm run test:unit`
|
||||
- Run integration tests: `npm run test:integration`
|
||||
- Lint: `npm run lint`
|
||||
- **Desktop app**
|
||||
- Development: `npm run electron:serve`
|
||||
@@ -53,8 +56,8 @@
|
||||
- Development: `npm run serve` to compile & hot-reload for development.
|
||||
- Production: `npm run build` to prepare files for distribution.
|
||||
- Or run using Docker:
|
||||
1. Build: `docker build -t undergroundwires/privacy.sexy:0.10.1 .`
|
||||
2. Run: `docker run -it -p 8080:80 --rm --name privacy.sexy-0.10.1 undergroundwires/privacy.sexy:0.10.1`
|
||||
1. Build: `docker build -t undergroundwires/privacy.sexy:0.10.2 .`
|
||||
2. Run: `docker run -it -p 8080:80 --rm --name privacy.sexy-0.10.2 undergroundwires/privacy.sexy:0.10.2`
|
||||
|
||||
## Architecture overview
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Tests
|
||||
|
||||
- There are two different types of tests executed:
|
||||
1. [Unit tests](#unit-tests)
|
||||
2. [Integration tests](#integration-tests)
|
||||
- 💡 You can use path/module alias `@/tests` in import statements.
|
||||
|
||||
## Unit tests
|
||||
|
||||
- Unit tests are defined in [`./tests`](./../tests)
|
||||
- Tests each component in isolation
|
||||
- Defined in [`./tests/unit`](./../tests/unit)
|
||||
- They follow same folder structure as [`./src`](./../src)
|
||||
|
||||
### Naming
|
||||
@@ -31,3 +35,9 @@
|
||||
|
||||
- Stubs are defined in [`./tests/stubs`](./../tests/unit/stubs)
|
||||
- They implement dummy behavior to be functional
|
||||
|
||||
## Integration tests
|
||||
|
||||
- Tests functionality of a component in combination with others (not isolated)
|
||||
- Ensure dependencies to third parties work as expected
|
||||
- Defined in [`./tests/integration`](./../tests/integration)
|
||||
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 483 KiB After Width: | Height: | Size: 579 KiB |
21834
package-lock.json
generated
21834
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
54
package.json
54
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "privacy.sexy",
|
||||
"version": "0.10.1",
|
||||
"version": "0.10.2",
|
||||
"private": true,
|
||||
"description": "Enforce privacy & security best-practices on Windows and macOS, because privacy is sexy 🍑🍆",
|
||||
"author": "undergroundwires",
|
||||
@@ -8,6 +8,7 @@
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"test:unit": "vue-cli-service test:unit",
|
||||
"test:integration": "vue-cli-service test:unit \"tests/integration/**/*.spec.ts\"",
|
||||
"lint": "npm run lint:vue && npm run lint:yaml && npm run lint:md && npm run lint:md:relative-urls && npm run lint:md:consistency",
|
||||
"electron:build": "vue-cli-service electron:build",
|
||||
"electron:serve": "vue-cli-service electron:serve",
|
||||
@@ -21,18 +22,19 @@
|
||||
},
|
||||
"main": "background.js",
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.34",
|
||||
"@fortawesome/free-brands-svg-icons": "^5.15.2",
|
||||
"@fortawesome/free-regular-svg-icons": "^5.15.2",
|
||||
"@fortawesome/free-solid-svg-icons": "^5.15.2",
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.35",
|
||||
"@fortawesome/free-brands-svg-icons": "^5.15.3",
|
||||
"@fortawesome/free-regular-svg-icons": "^5.15.3",
|
||||
"@fortawesome/free-solid-svg-icons": "^5.15.3",
|
||||
"@fortawesome/vue-fontawesome": "^2.0.2",
|
||||
"@juggle/resize-observer": "^3.3.0",
|
||||
"@juggle/resize-observer": "^3.3.1",
|
||||
"ace-builds": "^1.4.12",
|
||||
"core-js": "^3.9.1",
|
||||
"core-js": "^3.12.1",
|
||||
"cross-fetch": "^3.1.4",
|
||||
"file-saver": "^2.0.5",
|
||||
"inversify": "^5.0.5",
|
||||
"inversify": "^5.1.1",
|
||||
"liquor-tree": "^0.2.70",
|
||||
"v-tooltip": "2.1.2",
|
||||
"v-tooltip": "2.1.3",
|
||||
"vue": "^2.6.12",
|
||||
"vue-class-component": "^7.2.6",
|
||||
"vue-js-modal": "^2.0.0-rc.6",
|
||||
@@ -40,29 +42,29 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/ace": "0.0.45",
|
||||
"@types/chai": "^4.2.15",
|
||||
"@types/file-saver": "^2.0.1",
|
||||
"@types/mocha": "^8.2.1",
|
||||
"@vue/cli-plugin-babel": "^4.5.11",
|
||||
"@vue/cli-plugin-typescript": "^4.5.11",
|
||||
"@vue/cli-plugin-unit-mocha": "^4.5.11",
|
||||
"@vue/cli-service": "^4.5.11",
|
||||
"@vue/test-utils": "1.1.3",
|
||||
"chai": "^4.3.3",
|
||||
"electron": "^12.0.1",
|
||||
"electron-devtools-installer": "^3.1.1",
|
||||
"electron-log": "^4.3.2",
|
||||
"@types/chai": "^4.2.18",
|
||||
"@types/file-saver": "^2.0.2",
|
||||
"@types/mocha": "^8.2.2",
|
||||
"@vue/cli-plugin-babel": "^4.5.13",
|
||||
"@vue/cli-plugin-typescript": "^4.5.13",
|
||||
"@vue/cli-plugin-unit-mocha": "^4.5.13",
|
||||
"@vue/cli-service": "^4.5.13",
|
||||
"@vue/test-utils": "1.2.0",
|
||||
"chai": "^4.3.4",
|
||||
"electron": "^12.0.7",
|
||||
"electron-devtools-installer": "^3.2.0",
|
||||
"electron-log": "^4.3.5",
|
||||
"electron-updater": "^4.3.8",
|
||||
"js-yaml-loader": "^1.2.2",
|
||||
"markdownlint-cli": "^0.27.1",
|
||||
"remark-cli": "^9.0.0",
|
||||
"remark-lint-no-dead-urls": "^1.1.0",
|
||||
"remark-preset-lint-consistent": "^4.0.0",
|
||||
"remark-validate-links": "^10.0.3",
|
||||
"sass": "^1.32.8",
|
||||
"sass-loader": "^10.1.1",
|
||||
"tslib": "^2.1.0",
|
||||
"typescript": "^4.2.3",
|
||||
"remark-validate-links": "^10.0.4",
|
||||
"sass": "^1.32.12",
|
||||
"sass-loader": "^10.0.1",
|
||||
"tslib": "^2.2.0",
|
||||
"typescript": "^4.2.4",
|
||||
"vue-cli-plugin-electron-builder": "^2.0.0-rc.6",
|
||||
"vue-template-compiler": "^2.6.12",
|
||||
"yaml-lint": "^1.2.4"
|
||||
|
||||
@@ -185,7 +185,7 @@ actions:
|
||||
rm -fv ~/Library/Application\ Support/Firefox/Profiles/*/sessionstore-backups/upgrade.js*-20*
|
||||
-
|
||||
name: Delete Firefox passwords
|
||||
docs: http://kb.mozillazine.org/Password_Manager
|
||||
docs: https://web.archive.org/web/20210425202923/http://kb.mozillazine.org/Password_Manager
|
||||
code: |-
|
||||
rm -fv ~/Library/Application\ Support/Firefox/Profiles/*/signons.txt
|
||||
rm -fv ~/Library/Application\ Support/Firefox/Profiles/*/signons2.txt
|
||||
@@ -437,7 +437,7 @@ actions:
|
||||
-
|
||||
name: Disable PowerShell Core telemetry
|
||||
recommend: standard
|
||||
docs: https://github.com/PowerShell/PowerShell/tree/release/v7.1.1#telemetry
|
||||
docs: https://github.com/PowerShell/PowerShell/blob/v7.1.0/README.md#telemetry
|
||||
call:
|
||||
-
|
||||
function: PersistUserEnvironmentConfiguration
|
||||
|
||||
@@ -600,7 +600,7 @@ actions:
|
||||
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Device Metadata" /v "PreventDeviceMetadataFromNetwork" /t REG_DWORD /d 0 /f
|
||||
-
|
||||
name: Do not include drivers with Windows Updates
|
||||
docs: https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.WindowsUpdate::ExcludeWUDriversInQualityUpdate
|
||||
docs: https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.WindowsUpdate::ExcludeWUDriversInQualityUpdate
|
||||
recommend: strict
|
||||
code: reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "ExcludeWUDriversInQualityUpdate" /t REG_DWORD /d 1 /f
|
||||
revertCode: reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /v "ExcludeWUDriversInQualityUpdate" /t REG_DWORD /d 0 /f
|
||||
@@ -613,7 +613,7 @@ actions:
|
||||
-
|
||||
name: Disable cloud speech recognition
|
||||
recommend: standard
|
||||
docs: https://www.tenforums.com/tutorials/101902-turn-off-online-speech-recognition-windows-10-a.html
|
||||
docs: https://docs.microsoft.com/en-us/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#186-speech
|
||||
code: reg add "HKCU\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy" /v "HasAccepted" /t "REG_DWORD" /d 0 /f
|
||||
revertCode: reg add "HKCU\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy" /v "HasAccepted" /t "REG_DWORD" /d 1 /f
|
||||
-
|
||||
@@ -629,7 +629,7 @@ actions:
|
||||
-
|
||||
name: Disable Windows feedback
|
||||
recommend: standard
|
||||
docs: https://www.tenforums.com/tutorials/2441-change-feedback-frequency-windows-10-a.html
|
||||
docs: https://docs.microsoft.com/en-us/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#1816-feedback--diagnostics
|
||||
code: |-
|
||||
reg add "HKCU\SOFTWARE\Microsoft\Siuf\Rules" /v "NumberOfSIUFInPeriod" /t REG_DWORD /d 0 /f
|
||||
reg delete "HKCU\SOFTWARE\Microsoft\Siuf\Rules" /v "PeriodInNanoSeconds" /f
|
||||
@@ -656,8 +656,9 @@ actions:
|
||||
name: Deny app access to location
|
||||
recommend: standard
|
||||
docs:
|
||||
- https://r-pufky.github.io/docs/operating-systems/windows/10/securing-installation/privacy/location.html
|
||||
- https://docs.microsoft.com/en-us/windows/client-management/mdm/policy-csp-privacy#privacy-letappsaccesslocation
|
||||
- https://docs.microsoft.com/en-us/windows/client-management/mdm/policy-csp-privacy#privacy-letappsaccesslocation # LetAppsAccessLocation
|
||||
- https://www.joseespitia.com/2019/07/24/registry-keys-for-windows-10-application-privacy-settings/ # ConsentStore\location
|
||||
- https://social.technet.microsoft.com/Forums/en-US/63904312-04af-41e5-8b57-1dd446ea45c5/ # lfsvc\Service\Configuration
|
||||
code: |-
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location" /v "Value" /d "Deny" /f
|
||||
:: For older Windows (before 1903)
|
||||
@@ -1039,7 +1040,6 @@ actions:
|
||||
revertCode: reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\bluetoothSync" /v "Value" /d "Allow" /t REG_SZ /f
|
||||
-
|
||||
category: Disable app access to voice activation
|
||||
docs: https://www.tenforums.com/tutorials/130122-allow-deny-apps-access-use-voice-activation-windows-10-a.html
|
||||
children:
|
||||
-
|
||||
name: Disable apps and Cortana to activate with voice
|
||||
@@ -1284,7 +1284,9 @@ actions:
|
||||
-
|
||||
name: Turn Off Suggested Content in Settings app
|
||||
recommend: standard
|
||||
docs: https://www.tenforums.com/tutorials/100541-turn-off-suggested-content-settings-app-windows-10-a.html
|
||||
docs:
|
||||
- https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/rds-vdi-recommendations-2004
|
||||
- https://www.blogsdna.com/28017/how-to-disable-turn-off-suggested-content-on-windows-10-setting-app.htm
|
||||
code: |-
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-338393Enabled" /d "0" /t REG_DWORD /f
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" /v "SubscribedContent-353694Enabled" /d "0" /t REG_DWORD /f
|
||||
@@ -1299,21 +1301,19 @@ actions:
|
||||
-
|
||||
name: Do not allow the use of biometrics
|
||||
recommend: strict
|
||||
docs: https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.Biometrics::Biometrics_EnableBio
|
||||
docs: https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.Biometrics::Biometrics_EnableBio
|
||||
code: reg add "HKLM\SOFTWARE\Policies\Microsoft\Biometrics" /v "Enabled" /t REG_DWORD /d "0" /f
|
||||
revertCode: reg add "HKLM\SOFTWARE\Policies\Microsoft\Biometrics" /v "Enabled" /t REG_DWORD /d "1" /f
|
||||
-
|
||||
name: Do not allow users to log on using biometrics
|
||||
recommend: strict
|
||||
docs: https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.Biometrics::Biometrics_EnableCredProv
|
||||
docs: https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.Biometrics::Biometrics_EnableCredProv
|
||||
code: reg add "HKLM\SOFTWARE\Policies\Microsoft\Biometrics\Credential Provider" /v "Enabled" /t "REG_DWORD" /d "0" /f
|
||||
revertCode: reg add "HKLM\SOFTWARE\Policies\Microsoft\Biometrics\Credential Provider" /v "Enabled" /t "REG_DWORD" /d "1" /f
|
||||
-
|
||||
name: Do not start Windows Biometric Service
|
||||
recommend: strict
|
||||
docs:
|
||||
- http://batcmd.com/windows/10/services/wbiosrvc/
|
||||
- http://revertservice.com/10/wbiosrvc/
|
||||
docs: https://docs.microsoft.com/en-us/windows-server/security/windows-services/security-guidelines-for-disabling-system-services-in-windows-server#windows-biometric-service
|
||||
code: |-
|
||||
reg add "HKLM\SYSTEM\CurrentControlSet\Services\WbioSrvc" /v "Start" /t REG_DWORD /d 4 /f
|
||||
sc stop "WbioSrvc" & sc config "WbioSrvc" start=disabled
|
||||
@@ -1341,7 +1341,7 @@ actions:
|
||||
-
|
||||
name: Disable Website Access of Language List
|
||||
recommend: standard
|
||||
docs: https://www.tenforums.com/tutorials/82980-turn-off-website-access-language-list-windows-10-a.html
|
||||
docs: https://docs.microsoft.com/en-us/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#181-general
|
||||
code: reg add "HKCU\Control Panel\International\User Profile" /v "HttpAcceptLanguageOptOut" /t REG_DWORD /d 1 /f
|
||||
revertCode: reg add "HKCU\Control Panel\International\User Profile" /v "HttpAcceptLanguageOptOut" /t REG_DWORD /d 0 /f
|
||||
-
|
||||
@@ -1362,7 +1362,7 @@ actions:
|
||||
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\GameDVR" /v "AllowGameDVR" /t REG_DWORD /d 0 /f
|
||||
-
|
||||
name: Disable Windows DRM internet access
|
||||
docs: https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.DigitalRights2::DisableOnline
|
||||
docs: https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.DigitalRights2::DisableOnline
|
||||
recommend: standard
|
||||
code: reg add "HKLM\SOFTWARE\Policies\Microsoft\WMDRM" /v "DisableOnline" /t REG_DWORD /d 1 /f
|
||||
-
|
||||
@@ -1380,13 +1380,13 @@ actions:
|
||||
children:
|
||||
-
|
||||
name: Disable Windows Insider Service
|
||||
docs: http://revertservice.com/10/wisvc/
|
||||
docs: https://docs.microsoft.com/en-us/windows-server/security/windows-services/security-guidelines-for-disabling-system-services-in-windows-server#windows-insider-service
|
||||
recommend: standard
|
||||
code: sc stop "wisvc" & sc config "wisvc" start=disabled
|
||||
revertCode: sc config "wisvc" start=demand
|
||||
-
|
||||
name: Do not let Microsoft try features on this build
|
||||
docs: https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.DataCollection::EnableExperimentation
|
||||
docs: https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.DataCollection::EnableExperimentation
|
||||
recommend: standard
|
||||
code: |-
|
||||
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\PreviewBuilds" /v "EnableExperimentation" /t REG_DWORD /d 0 /f
|
||||
@@ -1398,13 +1398,13 @@ actions:
|
||||
reg delete "HKLM\SOFTWARE\Microsoft\PolicyManager\default\System\AllowExperimentation" /v "value" /f
|
||||
-
|
||||
name: Disable getting preview builds of Windows
|
||||
docs: https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.AllowBuildPreview::AllowBuildPreview
|
||||
docs: https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.AllowBuildPreview::AllowBuildPreview
|
||||
recommend: standard
|
||||
code: reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\PreviewBuilds" /v "AllowBuildPreview" /t REG_DWORD /d 0 /f
|
||||
revertCode: reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\PreviewBuilds" /v "AllowBuildPreview" /f
|
||||
-
|
||||
name: Remove "Windows Insider Program" from Settings
|
||||
docs: https://www.askvg.com/windows-10-tip-remove-windows-insider-program-section-from-settings-page/
|
||||
docs: https://winaero.com/how-to-hide-the-windows-insider-program-page-from-the-settings-app-in-windows-10/
|
||||
code: reg add "HKLM\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility" /v "HideInsiderPage" /t "REG_DWORD" /d "1" /f
|
||||
revertCode: reg delete "HKLM\SOFTWARE\Microsoft\WindowsSelfHost\UI\Visibility" /v "HideInsiderPage" /f
|
||||
-
|
||||
@@ -1472,7 +1472,10 @@ actions:
|
||||
-
|
||||
name: Disable Language Setting Sync
|
||||
recommend: standard
|
||||
docs: https://www.tenforums.com/tutorials/4077-turn-off-sync-settings-microsoft-account-windows-10-a.html
|
||||
docs:
|
||||
- https://winaero.com/turn-on-off-sync-settings-windows-10/
|
||||
- https://www.thewindowsclub.com/how-to-configure-windows-10-sync-settings-using-registry-editor
|
||||
- https://tuxicoman.jesuislibre.net/blog/wp-content/uploads/Windows10_Telemetrie_1709.pdf # from guide on confidentiality and privacy with Windows 10 distributed to the French police, previous version of guide: https://www.pmenier.net/dotclear/docext/win10/.Windows10-Presentation.pdf
|
||||
code: reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Language" /t REG_DWORD /v "Enabled" /d 0 /f
|
||||
revertCode: reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\SettingSync\Groups\Language" /t REG_DWORD /v "Enabled" /d 1 /f
|
||||
-
|
||||
@@ -1542,7 +1545,7 @@ actions:
|
||||
-
|
||||
name: Do not send Watson events
|
||||
recommend: standard
|
||||
docs: https://getadmx.com/?Category=SystemCenterEndpointProtection&Policy=Microsoft.Policies.Antimalware::reporting_disablegenericreports
|
||||
docs: https://admx.help/?Category=SystemCenterEndpointProtection&Policy=Microsoft.Policies.Antimalware::reporting_disablegenericreports
|
||||
code: reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "DisableGenericReports" /t REG_DWORD /d 1 /f
|
||||
revertCode: reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Reporting" /v "DisableGenericReports" /t REG_DWORD /d 0 /f
|
||||
-
|
||||
@@ -1553,7 +1556,7 @@ actions:
|
||||
recommend: standard
|
||||
docs:
|
||||
- https://www.stigviewer.com/stig/windows_defender_antivirus/2017-12-27/finding/V-75161
|
||||
- https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.WindowsDefender::Spynet_LocalSettingOverrideSpynetReporting
|
||||
- https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.WindowsDefender::Spynet_LocalSettingOverrideSpynetReporting
|
||||
code: reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "LocalSettingOverrideSpynetReporting" /t REG_DWORD /d 0 /f
|
||||
revertCode: reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "LocalSettingOverrideSpynetReporting" /t REG_DWORD /d 1 /f
|
||||
-
|
||||
@@ -1561,7 +1564,7 @@ actions:
|
||||
recommend: standard
|
||||
docs:
|
||||
- https://www.stigviewer.com/stig/windows_7/2012-07-02/finding/V-15713
|
||||
- https://getadmx.com/?Category=Windows_7_2008R2&Policy=Microsoft.Policies.WindowsDefender::SpyNetReporting
|
||||
- https://admx.help/?Category=Windows_7_2008R2&Policy=Microsoft.Policies.WindowsDefender::SpyNetReporting
|
||||
- https://docs.microsoft.com/en-us/windows/client-management/mdm/policy-csp-defender#defender-allowcloudprotection
|
||||
code: reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SpynetReporting" /t REG_DWORD /d 0 /f
|
||||
revertCode: reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" /v "SpynetReporting" /t REG_DWORD /d 1 /f
|
||||
@@ -1575,7 +1578,7 @@ actions:
|
||||
-
|
||||
name: Disable Malicious Software Reporting tool diagnostic data
|
||||
recommend: standard
|
||||
docs: https://getadmx.com/?Category=Windows10_Telemetry&Policy=Microsoft.Policies.Win10Privacy::DontReportInfection
|
||||
docs: https://admx.help/?Category=Windows10_Telemetry&Policy=Microsoft.Policies.Win10Privacy::DontReportInfection
|
||||
code: reg add "HKLM\SOFTWARE\Policies\Microsoft\MRT" /v "DontReportInfectionInformation" /t REG_DWORD /d 1 /f
|
||||
revertCode: reg add "HKLM\SOFTWARE\Policies\Microsoft\MRT" /v "DontReportInfectionInformation" /t REG_DWORD /d 0 /f
|
||||
-
|
||||
@@ -1832,7 +1835,9 @@ actions:
|
||||
revertCode: reg delete "HKLM\SOFTWARE\Policies\Microsoft\Edge" /v "SendSiteInfoToImproveServices" /f
|
||||
-
|
||||
name: Disable Automatic Installation of Microsoft Edge Chromium
|
||||
docs: https://docs.microsoft.com/en-us/deployedge/microsoft-edge-blocker-toolkit
|
||||
docs:
|
||||
- https://admx.help/?Category=EdgeChromium_Blocker&Policy=Microsoft.Policies.EdgeUpdate::NoUpdate
|
||||
- https://web.archive.org/web/20210118230052/https://docs.microsoft.com/en-us/deployedge/microsoft-edge-blocker-toolkit
|
||||
code: reg add "HKLM\SOFTWARE\Microsoft\EdgeUpdate" /v "DoNotUpdateToEdgeWithChromium" /t REG_DWORD /d 1 /f
|
||||
revertCode: reg delete "HKLM\SOFTWARE\Microsoft\EdgeUpdate" /v "DoNotUpdateToEdgeWithChromium" /f
|
||||
-
|
||||
@@ -1846,26 +1851,26 @@ actions:
|
||||
-
|
||||
name: Disable MFU tracking
|
||||
recommend: standard
|
||||
docs: https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.EdgeUI::DisableMFUTracking
|
||||
docs: https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.EdgeUI::DisableMFUTracking
|
||||
code: reg add "HKCU\Software\Policies\Microsoft\Windows\EdgeUI" /v "DisableMFUTracking" /t REG_DWORD /d 1 /f
|
||||
revertCode: reg add "HKCU\Software\Policies\Microsoft\Windows\EdgeUI" /v "DisableMFUTracking" /t REG_DWORD /d 0 /f
|
||||
-
|
||||
name: Disable recent apps
|
||||
recommend: standard
|
||||
docs: https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.EdgeUI::DisableRecentApps
|
||||
docs: https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.EdgeUI::DisableRecentApps
|
||||
code: reg add "HKCU\Software\Policies\Microsoft\Windows\EdgeUI" /v "DisableRecentApps" /t REG_DWORD /d 1 /f
|
||||
revertCode: reg add "HKCU\Software\Policies\Microsoft\Windows\EdgeUI" /v "DisableRecentApps" /t REG_DWORD /d 0/f
|
||||
-
|
||||
name: Turn off backtracking
|
||||
recommend: standard
|
||||
docs: https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.EdgeUI::TurnOffBackstack
|
||||
docs: https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.EdgeUI::TurnOffBackstack
|
||||
code: reg add "HKCU\Software\Policies\Microsoft\Windows\EdgeUI" /v "TurnOffBackstack" /t REG_DWORD /d 1 /f
|
||||
revertCode: reg add "HKCU\Software\Policies\Microsoft\Windows\EdgeUI" /v "TurnOffBackstack" /t REG_DWORD /d 0 /f
|
||||
-
|
||||
name: Disable Search Suggestions in Edge
|
||||
docs:
|
||||
- https://docs.microsoft.com/en-us/microsoft-edge/deploy/group-policies/address-bar-settings-gp
|
||||
- https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.MicrosoftEdge::AllowSearchSuggestionsinAddressBar
|
||||
- https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.MicrosoftEdge::AllowSearchSuggestionsinAddressBar
|
||||
recommend: standard
|
||||
code: reg add "HKLM\SOFTWARE\Policies\Microsoft\MicrosoftEdge\SearchScopes" /v "ShowSearchSuggestionsGlobal" /t REG_DWORD /d 0 /f
|
||||
revertCode: reg add "HKLM\SOFTWARE\Policies\Microsoft\MicrosoftEdge\SearchScopes" /v "ShowSearchSuggestionsGlobal" /t REG_DWORD /d 1 /f
|
||||
@@ -2625,20 +2630,20 @@ actions:
|
||||
-
|
||||
name: Disable online tips
|
||||
recommend: standard
|
||||
docs: https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.ControlPanel::AllowOnlineTips
|
||||
docs: https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.ControlPanel::AllowOnlineTips
|
||||
code: reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "AllowOnlineTips" /t REG_DWORD /d 0 /f
|
||||
revertCode: reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "AllowOnlineTips" /t REG_DWORD /d 1 /f
|
||||
-
|
||||
name: Turn off Internet File Association service
|
||||
recommend: standard
|
||||
docs: https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.InternetCommunicationManagement::ShellNoUseInternetOpenWith_2
|
||||
docs: https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.InternetCommunicationManagement::ShellNoUseInternetOpenWith_2
|
||||
code: reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoInternetOpenWith" /t REG_DWORD /d 1 /f
|
||||
revertCode: reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoInternetOpenWith" /t REG_DWORD /d 0 /f
|
||||
-
|
||||
name: Turn off the "Order Prints" picture task
|
||||
recommend: standard
|
||||
docs:
|
||||
- https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.InternetCommunicationManagement::ShellRemoveOrderPrints_2
|
||||
- https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.InternetCommunicationManagement::ShellRemoveOrderPrints_2
|
||||
- https://www.stigviewer.com/stig/microsoft_windows_server_2012_member_server/2013-07-25/finding/WN12-CC-000042
|
||||
code: reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoOnlinePrintsWizard" /t REG_DWORD /d 1 /f
|
||||
revertCode: reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoOnlinePrintsWizard" /t REG_DWORD /d 0 /f
|
||||
@@ -2660,19 +2665,19 @@ actions:
|
||||
-
|
||||
name: Do not keep history of recently opened documents
|
||||
recommend: strict
|
||||
docs: https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.StartMenu::NoRecentDocsHistory
|
||||
docs: https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.StartMenu::NoRecentDocsHistory
|
||||
code: reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoRecentDocsHistory" /t REG_DWORD /d 1 /f
|
||||
revertCode: reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoRecentDocsHistory" /t REG_DWORD /d 0 /f
|
||||
-
|
||||
name: Clear history of recently opened documents on exit
|
||||
recommend: strict
|
||||
docs: https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.StartMenu::ClearRecentDocsOnExit
|
||||
docs: https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.StartMenu::ClearRecentDocsOnExit
|
||||
code: reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "ClearRecentDocsOnExit" /t REG_DWORD /d 1 /f
|
||||
revertCode: reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "ClearRecentDocsOnExit" /t REG_DWORD /d 01 /f
|
||||
-
|
||||
name: Disable Live Tiles push notifications
|
||||
recommend: standard
|
||||
docs: https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.Notifications::NoTileNotification
|
||||
docs: https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.Notifications::NoTileNotification
|
||||
code: reg add "HKCU\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" /v "NoTileApplicationNotification" /t REG_DWORD /d 1 /f
|
||||
revertCode: reg add "HKCU\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" /v "NoTileApplicationNotification" /t REG_DWORD /d 0 /f
|
||||
-
|
||||
@@ -2680,26 +2685,27 @@ actions:
|
||||
recommend: standard
|
||||
docs:
|
||||
- https://www.stigviewer.com/stig/microsoft_windows_server_2012_member_server/2013-07-25/finding/WN12-CC-000030
|
||||
- https://getadmx.com/?Category=Windows_10_2016&Policy=Microsoft.Policies.InternetCommunicationManagement::ShellNoUseStoreOpenWith_1
|
||||
- https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.InternetCommunicationManagement::ShellNoUseStoreOpenWith_1
|
||||
code: reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Explorer" /v "NoUseStoreOpenWith" /t REG_DWORD /d 1 /f
|
||||
revertCode: reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Explorer" /v "NoUseStoreOpenWith" /t REG_DWORD /d 0 /f
|
||||
-
|
||||
name: Do not show recently used files in Quick Access
|
||||
recommend: strict
|
||||
docs: https://www.tenforums.com/tutorials/2713-add-remove-recent-files-quick-access-windows-10-a.html
|
||||
docs:
|
||||
- https://matthewhill.uk/windows/group-policy-disable-recent-files-frequent-folder-explorer/ # ShowRecent
|
||||
- https://www.howto-connect.com/delete-recent-frequent-from-file-explorer-on-windows-10/ # 3134ef9c-6b18-4996-ad04-ed5912e00eb5
|
||||
- https://docs.microsoft.com/en-us/windows/win32/sysinfo/32-bit-and-64-bit-application-data-in-the-registry # Wow6432Node
|
||||
code: |-
|
||||
if %PROCESSOR_ARCHITECTURE%==x86 ( REM is 32 bit?
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /v "ShowRecent" /d 0 /t REG_DWORD /f
|
||||
) else (
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /v "ShowRecent" /d 0 /t "REG_DWORD" /f
|
||||
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HomeFolderDesktop\NameSpace\DelegateFolders\{3134ef9c-6b18-4996-ad04-ed5912e00eb5}" /f
|
||||
if not %PROCESSOR_ARCHITECTURE%==x86 ( REM is 64 bit?
|
||||
reg delete "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\HomeFolderDesktop\NameSpace\DelegateFolders\{3134ef9c-6b18-4996-ad04-ed5912e00eb5}" /f
|
||||
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HomeFolderDesktop\NameSpace\DelegateFolders\{3134ef9c-6b18-4996-ad04-ed5912e00eb5}" /f
|
||||
)
|
||||
revertCode:
|
||||
if %PROCESSOR_ARCHITECTURE%==x86 ( REM is 32 bit?
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /v "ShowRecent" /d 1 /t REG_DWORD /f
|
||||
) else (
|
||||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /v "ShowRecent" /d "1" /t "REG_DWORD" /f
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HomeFolderDesktop\NameSpace\DelegateFolders\{3134ef9c-6b18-4996-ad04-ed5912e00eb5}" /f
|
||||
if not %PROCESSOR_ARCHITECTURE%==x86 ( REM is 64 bit?
|
||||
reg add "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\HomeFolderDesktop\NameSpace\DelegateFolders\{3134ef9c-6b18-4996-ad04-ed5912e00eb5}" /f
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HomeFolderDesktop\NameSpace\DelegateFolders\{3134ef9c-6b18-4996-ad04-ed5912e00eb5}" /f
|
||||
)
|
||||
-
|
||||
name: Disable Sync Provider Notifications
|
||||
@@ -2707,12 +2713,15 @@ actions:
|
||||
revertCode: reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v "ShowSyncProviderNotifications" /d 1 /t REG_DWORD /f
|
||||
-
|
||||
name: Turn hibernate off to disable sleep for quick start
|
||||
docs: http://www.windows10windows7.com/w10/win10zs/100102504.html
|
||||
docs: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/compact-os#ram-pagefilesys-and-hiberfilsys
|
||||
code: powercfg -h off
|
||||
revertCode: powercfg -h on
|
||||
-
|
||||
name: Enable camera on/off OSD notifications
|
||||
docs: https://www.tenforums.com/tutorials/166065-how-enable-disable-camera-off-osd-notifications-windows-10-a.html
|
||||
docs:
|
||||
- https://docs.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-coremmres-nophysicalcameraled
|
||||
- https://www.reddit.com/r/Surface/comments/88nyln/the_webcamled_took_anyone_it_apart/dwm64p5
|
||||
- https://answers.microsoft.com/en-us/windows/forum/all/enable-osd-notification-for-webcam/caf1fff4-78d3-4b93-905b-ef657097a44e
|
||||
code: reg add "HKLM\SOFTWARE\Microsoft\OEM\Device\Capture" /v "NoPhysicalCameraLED" /d 1 /t REG_DWORD /f
|
||||
revertCode: reg delete "HKLM\Software\Microsoft\OEM\Device\Capture" /v "NoPhysicalCameraLED" /f
|
||||
-
|
||||
@@ -2729,11 +2738,11 @@ actions:
|
||||
-
|
||||
name: Desktop
|
||||
code: |-
|
||||
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" /v "ThisPCPolicy" /t REG_SZ /d "Hide" /f
|
||||
reg add "HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" /v "ThisPCPolicy" /t REG_SZ /d "Hide" /f
|
||||
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag" /v "ThisPCPolicy" /t REG_SZ /d "Hide" /f
|
||||
reg add "HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag" /v "ThisPCPolicy" /t REG_SZ /d "Hide" /f
|
||||
revertCode: |-
|
||||
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" /v "ThisPCPolicy" /t REG_SZ /d "Show" /f
|
||||
reg add "HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag" /v "ThisPCPolicy" /t REG_SZ /d "Show" /f
|
||||
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag" /v "ThisPCPolicy" /t REG_SZ /d "Show" /f
|
||||
reg add "HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag" /v "ThisPCPolicy" /t REG_SZ /d "Show" /f
|
||||
-
|
||||
name: Documents
|
||||
code: |-
|
||||
@@ -2852,14 +2861,18 @@ actions:
|
||||
code: sc stop "XboxNetApiSvc" & sc config "XboxNetApiSvc" start=disabled
|
||||
revertCode: sc config "XboxNetApiSvc" start=demand
|
||||
-
|
||||
name: Volume Shadow Copy Service
|
||||
recommend: standard
|
||||
docs: https://docs.microsoft.com/en-us/windows-server/storage/file-server/volume-shadow-copy-service
|
||||
name: Disable Volume Shadow Copy Service (breaks System Restore and Windows Backup) # Also known as • Volume Snapshot Service • VSS • VSC
|
||||
recommend: strict
|
||||
docs:
|
||||
- https://docs.microsoft.com/en-us/windows-server/storage/file-server/volume-shadow-copy-service
|
||||
- https://www.schneier.com/blog/archives/2009/12/the_security_im.html
|
||||
code: sc stop "VSS" & sc config "VSS" start=disabled
|
||||
revertCode: sc config "VSS" start=demand
|
||||
-
|
||||
name: Disable NetBios for all interfaces
|
||||
docs: https://10dsecurity.com/saying-goodbye-netbios/
|
||||
docs:
|
||||
- https://bobcares.com/blog/disable-netbios-and-llmnr-protocols-in-windows-using-gpo/
|
||||
- https://social.technet.microsoft.com/Forums/windowsserver/en-US/c5f3c095-1ad2-4963-b075-787f800b81f2/
|
||||
call:
|
||||
function: RunPowerShell
|
||||
parameters:
|
||||
@@ -3481,7 +3494,7 @@ actions:
|
||||
packageName: Microsoft.ECApp
|
||||
-
|
||||
name: Lock app (shows lock screen)
|
||||
docs: https://www.dashtech.org/can-you-disable-lockapp-exe-on-windows-10/
|
||||
docs: https://www.getwox.com/what-is-lockapp-exe/
|
||||
call:
|
||||
function: UninstallSystemApp
|
||||
parameters:
|
||||
@@ -4329,30 +4342,32 @@ actions:
|
||||
code: |-
|
||||
:: Configure time source
|
||||
w32tm /config /syncfromflags:manual /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org"
|
||||
:: Restart time service if running
|
||||
:: Stop time service if running
|
||||
SC queryex "w32time"|Find "STATE"|Find /v "RUNNING">Nul||(
|
||||
net stop w32time
|
||||
net start w32time
|
||||
)
|
||||
:: Sync now
|
||||
:: Start time service and sync now
|
||||
net start w32time
|
||||
w32tm /config /update
|
||||
w32tm /resync
|
||||
revertCode: |-
|
||||
:: Configure time source
|
||||
w32tm /config /syncfromflags:manual /manualpeerlist:"time.windows.com"
|
||||
:: Restart time service if running
|
||||
:: Stop time service if running
|
||||
SC queryex "w32time"|Find "STATE"|Find /v "RUNNING">Nul||(
|
||||
net stop w32time
|
||||
net start w32time
|
||||
)
|
||||
:: Sync now
|
||||
:: Start time servie and sync now
|
||||
net start w32time
|
||||
w32tm /config /update
|
||||
w32tm /resync
|
||||
-
|
||||
name: Disable Reserved Storage for updates
|
||||
name: Disable Reserved Storage for updates # since 19H1 (1903)
|
||||
docs:
|
||||
- https://techcommunity.microsoft.com/t5/storage-at-microsoft/windows-10-and-reserved-storage/ba-p/428327
|
||||
- https://www.tenforums.com/tutorials/124858-enable-disable-reserved-storage-windows-10-a.html
|
||||
- https://techcommunity.microsoft.com/t5/storage-at-microsoft/windows-10-and-reserved-storage/ba-p/428327 # Announcement
|
||||
- https://techcommunity.microsoft.com/t5/windows-it-pro-blog/managing-reserved-storage-in-windows-10-environments/ba-p/1297070#toc-hId--8696946 # Set-ReservedStorageState
|
||||
- https://www.howtogeek.com/425563/how-to-disable-reserved-storage-on-windows-10/ # ShippedWithReserves
|
||||
- https://techcommunity.microsoft.com/t5/windows-servicing/reserve-manager-enabled-with-low-disk-space-block/m-p/2073132 # PassedPolicy
|
||||
code: |-
|
||||
dism /online /Set-ReservedStorageState /State:Disabled /NoRestart
|
||||
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\ReserveManager" /v "MiscPolicyInfo" /t REG_DWORD /d "2" /f
|
||||
|
||||
5
src/infrastructure/Threading/AsyncSleep.ts
Normal file
5
src/infrastructure/Threading/AsyncSleep.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export type SchedulerType = (callback: (...args: any[]) => void, ms: number) => void;
|
||||
|
||||
export function sleepAsync(time: number, scheduler: SchedulerType = setTimeout) {
|
||||
return new Promise((resolve) => scheduler(() => resolve(undefined), time));
|
||||
}
|
||||
@@ -1,26 +1,38 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<span class="part">Group by:</span>
|
||||
<MenuOptionList
|
||||
label="Group by"
|
||||
class="part">
|
||||
<MenuOptionListItem
|
||||
label="Cards"
|
||||
:enabled="!cardsSelected"
|
||||
@click="groupByCard()"
|
||||
/>
|
||||
<MenuOptionListItem
|
||||
label="None"
|
||||
:enabled="!noneSelected"
|
||||
@click="groupByNone()"
|
||||
/>
|
||||
</MenuOptionList>
|
||||
<span class="part">
|
||||
<span
|
||||
class="part"
|
||||
v-bind:class="{ 'disabled': cardsSelected, 'enabled': !cardsSelected}"
|
||||
@click="groupByCard()">Cards</span>
|
||||
<span class="part">|</span>
|
||||
<span class="part"
|
||||
v-bind:class="{ 'disabled': noneSelected, 'enabled': !noneSelected}"
|
||||
@click="groupByNone()">None</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator';
|
||||
import { Grouping } from './Grouping';
|
||||
import MenuOptionList from './../MenuOptionList.vue';
|
||||
import MenuOptionListItem from './../MenuOptionListItem.vue';
|
||||
|
||||
const DefaultGrouping = Grouping.Cards;
|
||||
|
||||
@Component
|
||||
@Component({
|
||||
components: {
|
||||
MenuOptionList,
|
||||
MenuOptionListItem,
|
||||
},
|
||||
})
|
||||
export default class TheGrouper extends Vue {
|
||||
public cardsSelected = false;
|
||||
public noneSelected = false;
|
||||
@@ -50,29 +62,5 @@ export default class TheGrouper extends Vue {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "@/presentation/styles/colors.scss";
|
||||
@import "@/presentation/styles/fonts.scss";
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
font-family: $normal-font;
|
||||
.part {
|
||||
display: flex;
|
||||
margin-right:5px;
|
||||
}
|
||||
}
|
||||
|
||||
.enabled {
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
font-weight:bold;
|
||||
text-decoration:underline;
|
||||
}
|
||||
}
|
||||
.disabled {
|
||||
color:$gray;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
38
src/presentation/components/Scripts/Menu/MenuOptionList.vue
Normal file
38
src/presentation/components/Scripts/Menu/MenuOptionList.vue
Normal file
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<div class="list">
|
||||
<div v-if="label">{{ label }}:</div>
|
||||
<div class="items">
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue, Prop } from 'vue-property-decorator';
|
||||
|
||||
@Component
|
||||
export default class MenuOptionList extends Vue {
|
||||
@Prop() public label: string;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "@/presentation/styles/fonts.scss";
|
||||
|
||||
$gap: 0.25rem;
|
||||
.list {
|
||||
font-family: $normal-font;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.items {
|
||||
* + *::before {
|
||||
content: '|';
|
||||
padding-right: $gap;
|
||||
padding-left: $gap;
|
||||
}
|
||||
}
|
||||
> *:not(:last-child) {
|
||||
margin-right: $gap;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,8 +1,10 @@
|
||||
<template>
|
||||
<span
|
||||
v-bind:class="{ 'disabled': enabled, 'enabled': !enabled}"
|
||||
v-non-collapsing
|
||||
@click="onClicked()">{{label}}</span>
|
||||
<span> <!-- Parent wrapper allows adding content inside with CSS without making it clickable -->
|
||||
<span
|
||||
v-bind:class="{ 'disabled': !enabled, 'enabled': enabled}"
|
||||
v-non-collapsing
|
||||
@click="enabled && onClicked()">{{label}}</span>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -12,7 +14,7 @@ import { NonCollapsing } from '@/presentation/components/Scripts/Cards/NonCollap
|
||||
@Component({
|
||||
directives: { NonCollapsing },
|
||||
})
|
||||
export default class SelectableOption extends Vue {
|
||||
export default class MenuOptionListItem extends Vue {
|
||||
@Prop() public enabled: boolean;
|
||||
@Prop() public label: string;
|
||||
@Emit('click') public onClicked() { return; }
|
||||
@@ -1,63 +1,51 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<div class="part">Select:</div>
|
||||
<div class="part">
|
||||
<div class="part">
|
||||
<SelectableOption
|
||||
label="None"
|
||||
:enabled="this.currentSelection == SelectionType.None"
|
||||
@click="selectType(SelectionType.None)"
|
||||
v-tooltip=" 'Deselect all selected scripts.<br/>' +
|
||||
'💡 Good start to dive deeper into tweaks and select only what you want.'"
|
||||
/>
|
||||
</div>
|
||||
<div class="part"> | </div>
|
||||
<div class="part">
|
||||
<SelectableOption
|
||||
label="Standard"
|
||||
:enabled="this.currentSelection == SelectionType.Standard"
|
||||
@click="selectType(SelectionType.Standard)"
|
||||
v-tooltip=" '🛡️ Balanced for privacy and functionality.<br/>' +
|
||||
'OS and applications will function normally.<br/>' +
|
||||
'💡 Recommended for everyone'"
|
||||
/>
|
||||
</div>
|
||||
<div class="part"> | </div>
|
||||
<div class="part">
|
||||
<SelectableOption
|
||||
label="Strict"
|
||||
:enabled="this.currentSelection == SelectionType.Strict"
|
||||
@click="selectType(SelectionType.Strict)"
|
||||
v-tooltip=" '🚫 Stronger privacy, disables risky functions that may leak your data.<br/>' +
|
||||
'⚠️ Double check to remove sripts where you would trade functionality for privacy<br/>' +
|
||||
'💡 Recommended for daily users that prefers more privacy over non-essential functions'"
|
||||
/>
|
||||
</div>
|
||||
<div class="part"> | </div>
|
||||
<div class="part">
|
||||
<SelectableOption
|
||||
label="All"
|
||||
:enabled="this.currentSelection == SelectionType.All"
|
||||
@click="selectType(SelectionType.All)"
|
||||
v-tooltip=" '🔒 Strongest privacy, disabling any functionality that may leak your data.<br/>' +
|
||||
'🛑 Not designed for daily users, it will break important functionalities.<br/>' +
|
||||
'💡 Only recommended for extreme use-cases like crime labs where no leak is acceptable'"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<MenuOptionList label="Select">
|
||||
<MenuOptionListItem
|
||||
label="None"
|
||||
:enabled="this.currentSelection !== SelectionType.None"
|
||||
@click="selectType(SelectionType.None)"
|
||||
v-tooltip=" 'Deselect all selected scripts.<br/>' +
|
||||
'💡 Good start to dive deeper into tweaks and select only what you want.'"
|
||||
/>
|
||||
<MenuOptionListItem
|
||||
label="Standard"
|
||||
:enabled="this.currentSelection !== SelectionType.Standard"
|
||||
@click="selectType(SelectionType.Standard)"
|
||||
v-tooltip=" '🛡️ Balanced for privacy and functionality.<br/>' +
|
||||
'OS and applications will function normally.<br/>' +
|
||||
'💡 Recommended for everyone'"
|
||||
/>
|
||||
<MenuOptionListItem
|
||||
label="Strict"
|
||||
:enabled="this.currentSelection !== SelectionType.Strict"
|
||||
@click="selectType(SelectionType.Strict)"
|
||||
v-tooltip=" '🚫 Stronger privacy, disables risky functions that may leak your data.<br/>' +
|
||||
'⚠️ Double check to remove scripts where you would trade functionality for privacy<br/>' +
|
||||
'💡 Recommended for daily users that prefers more privacy over non-essential functions'"
|
||||
/>
|
||||
<MenuOptionListItem
|
||||
label="All"
|
||||
:enabled="this.currentSelection !== SelectionType.All"
|
||||
@click="selectType(SelectionType.All)"
|
||||
v-tooltip=" '🔒 Strongest privacy, disabling any functionality that may leak your data.<br/>' +
|
||||
'🛑 Not designed for daily users, it will break important functionalities.<br/>' +
|
||||
'💡 Only recommended for extreme use-cases like crime labs where no leak is acceptable'"
|
||||
/>
|
||||
</MenuOptionList>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component } from 'vue-property-decorator';
|
||||
import { StatefulVue } from '@/presentation/components/Shared/StatefulVue';
|
||||
import SelectableOption from './SelectableOption.vue';
|
||||
import { ICategoryCollectionState } from '@/application/Context/State/ICategoryCollectionState';
|
||||
import { SelectionType, SelectionTypeHandler } from './SelectionTypeHandler';
|
||||
import MenuOptionList from './../MenuOptionList.vue';
|
||||
import MenuOptionListItem from '../MenuOptionListItem.vue';
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
SelectableOption,
|
||||
MenuOptionList,
|
||||
MenuOptionListItem,
|
||||
},
|
||||
})
|
||||
export default class TheSelector extends StatefulVue {
|
||||
@@ -72,13 +60,11 @@ export default class TheSelector extends StatefulVue {
|
||||
this.selectionTypeHandler.selectType(type);
|
||||
}
|
||||
|
||||
protected handleCollectionState(newState: ICategoryCollectionState, oldState: ICategoryCollectionState): void {
|
||||
protected handleCollectionState(newState: ICategoryCollectionState): void {
|
||||
this.events.unsubscribeAll();
|
||||
this.selectionTypeHandler = new SelectionTypeHandler(newState);
|
||||
this.updateSelections();
|
||||
newState.selection.changed.on(() => this.updateSelections());
|
||||
if (oldState) {
|
||||
oldState.selection.changed.on(() => this.updateSelections());
|
||||
}
|
||||
this.events.register(newState.selection.changed.on(() => this.updateSelections()));
|
||||
}
|
||||
|
||||
private updateSelections() {
|
||||
@@ -89,16 +75,5 @@ export default class TheSelector extends StatefulVue {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "@/presentation/styles/fonts.scss";
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
.part {
|
||||
display: flex;
|
||||
margin-right:5px;
|
||||
}
|
||||
font-family: $normal-font;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<!-- <div>OS:</div> -->
|
||||
<div class="os-list">
|
||||
<div v-for="os in this.allOses" :key="os.name">
|
||||
<span
|
||||
class="os-name"
|
||||
v-bind:class="{ 'current': currentOs === os.os }"
|
||||
v-on:click="changeOsAsync(os.os)">
|
||||
{{ os.name }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<MenuOptionList>
|
||||
<MenuOptionListItem
|
||||
v-for="os in this.allOses" :key="os.name"
|
||||
:enabled="currentOs !== os.os"
|
||||
@click="changeOsAsync(os.os)"
|
||||
:label="os.name"
|
||||
/>
|
||||
</MenuOptionList>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -20,8 +15,15 @@ import { OperatingSystem } from '@/domain/OperatingSystem';
|
||||
import { StatefulVue } from '@/presentation/components/Shared/StatefulVue';
|
||||
import { ICategoryCollectionState } from '@/application/Context/State/ICategoryCollectionState';
|
||||
import { ApplicationFactory } from '@/application/ApplicationFactory';
|
||||
import MenuOptionList from './MenuOptionList.vue';
|
||||
import MenuOptionListItem from './MenuOptionListItem.vue';
|
||||
|
||||
@Component
|
||||
@Component({
|
||||
components: {
|
||||
MenuOptionList,
|
||||
MenuOptionListItem,
|
||||
},
|
||||
})
|
||||
export default class TheOsChanger extends StatefulVue {
|
||||
public allOses: Array<{ name: string, os: OperatingSystem }> = [];
|
||||
public currentOs?: OperatingSystem = null;
|
||||
@@ -52,31 +54,5 @@ function renderOsName(os: OperatingSystem): string {
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "@/presentation/styles/fonts.scss";
|
||||
@import "@/presentation/styles/colors.scss";
|
||||
.container {
|
||||
font-family: $normal-font;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.os-list {
|
||||
display: flex;
|
||||
margin-left: 0.25rem;
|
||||
div + div::before {
|
||||
content: "|";
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
.os-name {
|
||||
&:not(.current) {
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
&.current {
|
||||
color: $gray;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -22,7 +22,8 @@ import LiquorTree from 'liquor-tree';
|
||||
import Node from './Node/Node.vue';
|
||||
import { INode } from './Node/INode';
|
||||
import { convertExistingToNode, toNewLiquorTreeNode } from './LiquorTree/NodeWrapper/NodeTranslator';
|
||||
import { INodeSelectedEvent } from './/INodeSelectedEvent';
|
||||
import { INodeSelectedEvent } from './INodeSelectedEvent';
|
||||
import { sleepAsync } from '@/infrastructure/Threading/AsyncSleep';
|
||||
import { getNewState } from './LiquorTree/NodeWrapper/NodeStateUpdater';
|
||||
import { LiquorTreeOptions } from './LiquorTree/LiquorTreeOptions';
|
||||
import { FilterPredicate, NodePredicateFilter } from './LiquorTree/NodeWrapper/NodePredicateFilter';
|
||||
@@ -121,7 +122,6 @@ function recurseDown(
|
||||
async function tryUntilDefinedAsync<T>(
|
||||
accessor: () => T | undefined,
|
||||
delayInMs: number, maxTries: number): Promise<T | undefined> {
|
||||
const sleepAsync = () => new Promise(((resolve) => setTimeout(resolve, delayInMs)));
|
||||
let triesLeft = maxTries;
|
||||
let value: T;
|
||||
while (triesLeft !== 0) {
|
||||
@@ -130,7 +130,7 @@ async function tryUntilDefinedAsync<T>(
|
||||
return value;
|
||||
}
|
||||
triesLeft--;
|
||||
await sleepAsync();
|
||||
await sleepAsync(delayInMs);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { parseApplication } from '@/application/Parser/ApplicationParser';
|
||||
|
||||
describe('ApplicationParser', () => {
|
||||
describe('parseApplication', () => {
|
||||
it('can parse current application', () => {
|
||||
// act
|
||||
const act = () => parseApplication();
|
||||
// assert
|
||||
expect(act).to.not.throw();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,48 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { parseApplication } from '@/application/Parser/ApplicationParser';
|
||||
import { IApplication } from '@/domain/IApplication';
|
||||
import { IUrlStatus } from './StatusChecker/IUrlStatus';
|
||||
import { getUrlStatusesInParallelAsync, IBatchRequestOptions } from './StatusChecker/BatchStatusChecker';
|
||||
|
||||
describe('collections', () => {
|
||||
// arrange
|
||||
const app = parseApplication();
|
||||
const urls = collectUniqueUrls(app);
|
||||
const options: IBatchRequestOptions = {
|
||||
domainOptions: {
|
||||
sameDomainParallelize: true, // no need to be so nice until sources start failing
|
||||
// sameDomainDelayInMs: 2 /* sec */ * 1000,
|
||||
},
|
||||
requestOptions: {
|
||||
retryExponentialBaseInMs: 3 /* sec */ * 1000,
|
||||
additionalHeaders: { referer: app.info.homepage },
|
||||
},
|
||||
};
|
||||
const testTimeoutInMs = urls.length * 60000 /* 1 minute */;
|
||||
it('have no dead urls', async () => {
|
||||
// act
|
||||
const results = await getUrlStatusesInParallelAsync(urls, options);
|
||||
// assert
|
||||
const deadUrls = results.filter((r) => r.statusCode !== 200);
|
||||
expect(deadUrls).to.have.lengthOf(0, printUrls(deadUrls));
|
||||
}).timeout(testTimeoutInMs);
|
||||
});
|
||||
|
||||
function collectUniqueUrls(app: IApplication): string[] {
|
||||
return app
|
||||
.collections
|
||||
.flatMap((a) => a.getAllScripts())
|
||||
.flatMap((script) => script.documentationUrls)
|
||||
.filter((url, index, array) => array.indexOf(url) === index);
|
||||
}
|
||||
|
||||
function printUrls(statuses: IUrlStatus[]): string {
|
||||
return '\n' +
|
||||
statuses.map((status) =>
|
||||
`- ${status.url}\n` +
|
||||
(status.statusCode ? `\tResponse code: ${status.statusCode}` : '') +
|
||||
(status.error ? `\tException: ${JSON.stringify(status.error, null, '\t')}` : ''))
|
||||
.join(`\n`)
|
||||
+ '\n';
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { sleepAsync } from '@/infrastructure/Threading/AsyncSleep';
|
||||
import { IUrlStatus } from './IUrlStatus';
|
||||
import { getUrlStatusAsync, IRequestOptions } from './Requestor';
|
||||
import { groupUrlsByDomain } from './UrlPerDomainGrouper';
|
||||
|
||||
export async function getUrlStatusesInParallelAsync(
|
||||
urls: string[],
|
||||
options?: IBatchRequestOptions): Promise<IUrlStatus[]> {
|
||||
const uniqueUrls = Array.from(new Set(urls));
|
||||
options = { ...DefaultOptions, ...options };
|
||||
console.log('Options: ', options); // tslint:disable-line: no-console
|
||||
const results = await requestAsync(uniqueUrls, options);
|
||||
return results;
|
||||
}
|
||||
|
||||
export interface IBatchRequestOptions {
|
||||
domainOptions?: IDomainOptions;
|
||||
requestOptions?: IRequestOptions;
|
||||
}
|
||||
|
||||
interface IDomainOptions {
|
||||
sameDomainParallelize?: boolean;
|
||||
sameDomainDelayInMs?: number;
|
||||
}
|
||||
|
||||
const DefaultOptions: IBatchRequestOptions = {
|
||||
domainOptions: {
|
||||
sameDomainParallelize: false,
|
||||
sameDomainDelayInMs: 3 /* sec */ * 1000,
|
||||
},
|
||||
requestOptions: {
|
||||
retryExponentialBaseInMs: 5 /* sec */ * 1000,
|
||||
additionalHeaders: {},
|
||||
},
|
||||
};
|
||||
|
||||
function requestAsync(urls: string[], options: IBatchRequestOptions): Promise<IUrlStatus[]> {
|
||||
if (!options.domainOptions.sameDomainParallelize) {
|
||||
return runOnEachDomainWithDelayAsync(
|
||||
urls,
|
||||
(url) => getUrlStatusAsync(url, options.requestOptions),
|
||||
options.domainOptions.sameDomainDelayInMs);
|
||||
} else {
|
||||
return Promise.all(
|
||||
urls.map((url) => getUrlStatusAsync(url, options.requestOptions)));
|
||||
}
|
||||
}
|
||||
|
||||
async function runOnEachDomainWithDelayAsync(
|
||||
urls: string[],
|
||||
action: (url: string) => Promise<IUrlStatus>,
|
||||
delayInMs: number): Promise<IUrlStatus[]> {
|
||||
const grouped = groupUrlsByDomain(urls);
|
||||
const tasks = grouped.map(async (group) => {
|
||||
const results = new Array<IUrlStatus>();
|
||||
for (const url of group) {
|
||||
const status = await action(url);
|
||||
results.push(status);
|
||||
if (results.length !== group.length) {
|
||||
await sleepAsync(delayInMs);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
});
|
||||
const r = await Promise.all(tasks);
|
||||
return r.flat();
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { sleepAsync } from '@/infrastructure/Threading/AsyncSleep';
|
||||
import { IUrlStatus } from './IUrlStatus';
|
||||
|
||||
const DefaultBaseRetryIntervalInMs = 5 /* sec */ * 1000;
|
||||
|
||||
export async function retryWithExponentialBackOffAsync(
|
||||
action: () => Promise<IUrlStatus>,
|
||||
baseRetryIntervalInMs: number = DefaultBaseRetryIntervalInMs,
|
||||
currentRetry = 1): Promise<IUrlStatus> {
|
||||
const maxTries: number = 3;
|
||||
const status = await action();
|
||||
if (shouldRetry(status)) {
|
||||
if (currentRetry <= maxTries) {
|
||||
const exponentialBackOffInMs = getRetryTimeoutInMs(currentRetry, baseRetryIntervalInMs);
|
||||
// tslint:disable-next-line: no-console
|
||||
console.log(`Retrying (${currentRetry}) in ${exponentialBackOffInMs / 1000} seconds`, status);
|
||||
await sleepAsync(exponentialBackOffInMs);
|
||||
return retryWithExponentialBackOffAsync(action, baseRetryIntervalInMs, currentRetry + 1);
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
function shouldRetry(status: IUrlStatus) {
|
||||
if (status.error) {
|
||||
return true;
|
||||
}
|
||||
return isTransientError(status.statusCode)
|
||||
|| status.statusCode === 429; // Too Many Requests
|
||||
}
|
||||
|
||||
function isTransientError(statusCode: number) {
|
||||
return statusCode >= 500 && statusCode <= 599;
|
||||
}
|
||||
|
||||
function getRetryTimeoutInMs(currentRetry: number, baseRetryIntervalInMs: number = DefaultBaseRetryIntervalInMs) {
|
||||
const retryRandomFactor = 0.5; // Retry intervals are between 50% and 150%
|
||||
// of the exponentially increasing base amount
|
||||
const minRandom = 1 - retryRandomFactor;
|
||||
const maxRandom = 1 + retryRandomFactor;
|
||||
const randomization = (Math.random() * (maxRandom - minRandom)) + maxRandom;
|
||||
const exponential = Math.pow(2, currentRetry - 1);
|
||||
return Math.ceil(exponential * baseRetryIntervalInMs * randomization);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export interface IUrlStatus {
|
||||
url: string;
|
||||
error?: any;
|
||||
statusCode?: number;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { retryWithExponentialBackOffAsync } from './ExponentialBackOffRetryHandler';
|
||||
import { IUrlStatus } from './IUrlStatus';
|
||||
import fetch from 'cross-fetch';
|
||||
|
||||
export interface IRequestOptions {
|
||||
retryExponentialBaseInMs?: number;
|
||||
additionalHeaders?: Record<string, string>;
|
||||
}
|
||||
|
||||
export async function getUrlStatusAsync(
|
||||
url: string,
|
||||
options: IRequestOptions = DefaultOptions): Promise<IUrlStatus> {
|
||||
options = { ...DefaultOptions, ...options };
|
||||
const fetchOptions = getFetchOptions(options);
|
||||
return retryWithExponentialBackOffAsync(async () => {
|
||||
console.log('Requesting', url); // tslint:disable-line: no-console
|
||||
try {
|
||||
const response = await fetch(url, fetchOptions);
|
||||
return { url, statusCode: response.status};
|
||||
} catch (err) {
|
||||
return { url, error: err};
|
||||
}
|
||||
}, options.retryExponentialBaseInMs);
|
||||
}
|
||||
|
||||
const DefaultOptions: IRequestOptions = {
|
||||
retryExponentialBaseInMs: 5000,
|
||||
additionalHeaders: {},
|
||||
};
|
||||
|
||||
function getFetchOptions(options: IRequestOptions) {
|
||||
return {
|
||||
method: 'GET',
|
||||
headers: { ...DefaultHeaders, ...options.additionalHeaders },
|
||||
};
|
||||
}
|
||||
|
||||
const DefaultHeaders: Record<string, string> = {
|
||||
/* Chrome on macOS */
|
||||
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36',
|
||||
'upgrade-insecure-requests': '1',
|
||||
'connection': 'keep-alive',
|
||||
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
|
||||
'accept-encoding': 'gzip, deflate, br',
|
||||
'cache-control': 'max-age=0',
|
||||
'accept-language': 'en-US,en;q=0.9',
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
export function groupUrlsByDomain(urls: string[]): string[][] {
|
||||
const domains = new Set<string>();
|
||||
const urlsWithDomain = urls.map((url) => ({
|
||||
url,
|
||||
domain: extractDomain(url),
|
||||
}));
|
||||
for (const url of urlsWithDomain) {
|
||||
domains.add(url.domain);
|
||||
}
|
||||
return Array.from(domains).map((domain) => {
|
||||
return urlsWithDomain
|
||||
.filter((url) => url.domain === domain)
|
||||
.map((url) => url.url);
|
||||
});
|
||||
}
|
||||
|
||||
function extractDomain(url: string): string {
|
||||
return url.split('://')[1].split('/')[0].toLowerCase();
|
||||
}
|
||||
@@ -16,12 +16,6 @@ import { CollectionDataStub } from '@tests/unit/stubs/CollectionDataStub';
|
||||
|
||||
describe('ApplicationParser', () => {
|
||||
describe('parseApplication', () => {
|
||||
it('can parse current application', () => { // Integration test
|
||||
// act
|
||||
const act = () => parseApplication();
|
||||
// assert
|
||||
expect(act).to.not.throw();
|
||||
});
|
||||
describe('parser', () => {
|
||||
it('returns result from the parser', () => {
|
||||
// arrange
|
||||
|
||||
@@ -5,17 +5,25 @@ import { ExpressionPosition } from '@/application/Parser/Script/Compiler/Express
|
||||
import { ExpressionArguments } from '@/application/Parser/Script/Compiler/Expressions/Expression/IExpression';
|
||||
|
||||
describe('ParameterSubstitutionParser', () => {
|
||||
it('finds at expected positions', () => {
|
||||
describe('finds at expected positions', () => {
|
||||
// arrange
|
||||
const testCases = [ {
|
||||
name: 'single parameter',
|
||||
const testCases = [
|
||||
{
|
||||
name: 'matches single parameter',
|
||||
code: '{{ $parameter }}!',
|
||||
expected: [ new ExpressionPosition(0, 16) ],
|
||||
}, {
|
||||
name: 'different parameters',
|
||||
expected: [new ExpressionPosition(0, 16)],
|
||||
},
|
||||
{
|
||||
name: 'matches different parameters',
|
||||
code: 'He{{ $firstParameter }} {{ $secondParameter }}!!',
|
||||
expected: [ new ExpressionPosition(2, 23), new ExpressionPosition(24, 46) ],
|
||||
}];
|
||||
expected: [new ExpressionPosition(2, 23), new ExpressionPosition(24, 46)],
|
||||
},
|
||||
{
|
||||
name: 'tolerates spaces around brackets',
|
||||
code: 'He{{$firstParameter}}!!',
|
||||
expected: [new ExpressionPosition(2, 21) ],
|
||||
},
|
||||
];
|
||||
for (const testCase of testCases) {
|
||||
it(testCase.name, () => {
|
||||
const sut = new ParameterSubstitutionParser();
|
||||
@@ -27,7 +35,7 @@ describe('ParameterSubstitutionParser', () => {
|
||||
});
|
||||
}
|
||||
});
|
||||
it('evaluates as expected', () => {
|
||||
describe('evaluates as expected', () => {
|
||||
const testCases = [ {
|
||||
name: 'single parameter',
|
||||
code: '{{ $parameter }}',
|
||||
@@ -45,7 +53,7 @@ describe('ParameterSubstitutionParser', () => {
|
||||
value: 'Hello',
|
||||
},
|
||||
{
|
||||
name: 'firstParameter',
|
||||
name: 'secondParameter',
|
||||
value: 'World',
|
||||
}],
|
||||
expected: [ 'Hello', 'World' ],
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { AsyncLazy } from '@/infrastructure/Threading/AsyncLazy';
|
||||
import { sleepAsync } from '@/infrastructure/Threading/AsyncSleep';
|
||||
|
||||
describe('AsyncLazy', () => {
|
||||
it('returns value from lambda', async () => {
|
||||
@@ -33,7 +34,6 @@ describe('AsyncLazy', () => {
|
||||
});
|
||||
it('when running long-running task in parallel', async () => {
|
||||
// act
|
||||
const sleepAsync = (time: number) => new Promise(((resolve) => setTimeout(resolve, time)));
|
||||
const sut = new AsyncLazy(async () => {
|
||||
await sleepAsync(100);
|
||||
totalExecuted++;
|
||||
79
tests/unit/infrastructure/Threading/AsyncSleep.spec.ts
Normal file
79
tests/unit/infrastructure/Threading/AsyncSleep.spec.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { sleepAsync, SchedulerType } from '@/infrastructure/Threading/AsyncSleep';
|
||||
|
||||
describe('AsyncSleep', () => {
|
||||
it('fulfills after delay', async () => {
|
||||
// arrange
|
||||
const delayInMs = 10;
|
||||
const scheduler = new SchedulerMock();
|
||||
// act
|
||||
const sleep = sleepAsync(delayInMs, scheduler.mock);
|
||||
const promiseState = watchPromiseState(sleep);
|
||||
scheduler.tickNext(delayInMs);
|
||||
await flushPromiseResolutionQueue();
|
||||
// assert
|
||||
const actual = promiseState.isFulfilled();
|
||||
expect(actual).to.equal(true);
|
||||
});
|
||||
it('pending before delay', async () => {
|
||||
// arrange
|
||||
const delayInMs = 10;
|
||||
const scheduler = new SchedulerMock();
|
||||
// act
|
||||
const sleep = sleepAsync(delayInMs, scheduler.mock);
|
||||
const promiseState = watchPromiseState(sleep);
|
||||
scheduler.tickNext(delayInMs / 5);
|
||||
await flushPromiseResolutionQueue();
|
||||
// assert
|
||||
const actual = promiseState.isPending();
|
||||
expect(actual).to.equal(true);
|
||||
});
|
||||
});
|
||||
|
||||
function flushPromiseResolutionQueue() {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
class SchedulerMock {
|
||||
public readonly mock: SchedulerType;
|
||||
private currentTime = 0;
|
||||
private scheduledActions = new Array<{time: number, action: (...args: any[]) => void}>();
|
||||
constructor() {
|
||||
this.mock = (callback: (...args: any[]) => void, ms: number) => {
|
||||
this.scheduledActions.push({ time: this.currentTime + ms, action: callback });
|
||||
};
|
||||
}
|
||||
public tickNext(ms: number) {
|
||||
const newTime = this.currentTime + ms;
|
||||
let newActions = this.scheduledActions;
|
||||
for (const action of this.scheduledActions) {
|
||||
if (newTime >= action.time) {
|
||||
newActions = newActions.filter((a) => a !== action);
|
||||
action.action();
|
||||
}
|
||||
}
|
||||
this.scheduledActions = newActions;
|
||||
}
|
||||
}
|
||||
|
||||
function watchPromiseState<T>(promise: Promise<T>) {
|
||||
let isPending = true;
|
||||
let isRejected = false;
|
||||
let isFulfilled = false;
|
||||
promise.then(
|
||||
() => {
|
||||
isFulfilled = true;
|
||||
isPending = false;
|
||||
},
|
||||
() => {
|
||||
isRejected = true;
|
||||
isPending = false;
|
||||
},
|
||||
);
|
||||
return {
|
||||
isFulfilled: () => isFulfilled,
|
||||
isPending: () => isPending,
|
||||
isRejected: () => isRejected,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user