Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(manifest): Upgrade to manifest v3 #387

Merged
merged 78 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
d81c881
feat(manifest): Updates strict_min_version
ERosendo Aug 4, 2024
c8804b9
feat(manifest): Upgrades the manifest version number
ERosendo Aug 4, 2024
0a5d49f
feat(manifest): Separates permissions into permission and host_permis…
ERosendo Aug 4, 2024
6fb4a43
feat(manifest): Update web_accessible_resources to use new format
ERosendo Aug 4, 2024
74c313e
feat(manifest): Replace background.script with service_worker
ERosendo Aug 4, 2024
4ad4152
feat(manifest): Use import statement for background script
ERosendo Aug 7, 2024
2c40faf
feat(manifest): Add "scripting" permission to manifest
ERosendo Aug 7, 2024
e65d0a5
refactor(background): Extract helper functions from background script
ERosendo Aug 7, 2024
a6195b7
refactor(options): Import toolbar utils module in options.html
ERosendo Aug 7, 2024
4d552b1
feat(recap): Removes file containing the abstraction layer for RECAP …
ERosendo Aug 13, 2024
bee814e
feat(background): Adds background fetch helper and refactor RECAP API…
ERosendo Aug 13, 2024
b4ed157
refactor(notifier): Remove function compatible with exportInstance
ERosendo Aug 13, 2024
34e4cd9
feat(notifier): Adds background service for displaying notifications
ERosendo Aug 13, 2024
ef4fd1f
feat(background): Updates list of injected context scripts
ERosendo Aug 13, 2024
9900c56
feat(appellate): Removes recap and notifier instances from appellate.js
ERosendo Aug 13, 2024
5e4356b
refactor(appellate): Updates the handleDocketDisplayPage method
ERosendo Aug 13, 2024
0798c26
refactor(appellate): Updates the handleDocketReportFilter method
ERosendo Aug 13, 2024
c1d4b0a
refactor(appellate): Updates the handleCaseSelectionPage method
ERosendo Aug 13, 2024
f3f4439
refactor(appellate): Updates the handleCaseQueryPage helper
ERosendo Aug 13, 2024
cf68728
refactor(appellate): Update method that adds recap icons to entries
ERosendo Aug 13, 2024
7989638
refactor(appellate): Updates helper method to handle attachment pages
ERosendo Aug 13, 2024
174bc9a
refactor(appellate): Updates helper method that handle single doc pages
ERosendo Aug 13, 2024
6218e9e
feat(district): Removes recap and notifier instances from content_del…
ERosendo Aug 13, 2024
1d96f1c
refactor(district): Updates helper to check for document restrictions
ERosendo Aug 13, 2024
8f65da8
refactor(district): Updates the handleDocketQueryUrl method
ERosendo Aug 13, 2024
ad09afd
refactor(district): Updates the handleDocketDisplayPage method
ERosendo Aug 13, 2024
b0dbc47
refactor(district): Updates helper method to handle attachment pages
ERosendo Aug 13, 2024
b6ff14f
refactor(district): Updates the handleiQuerySummaryPage method
ERosendo Aug 13, 2024
9c91b5f
refactor(district): Updates the handleSingleDocumentPageCheck method
ERosendo Aug 13, 2024
3d5bfa9
refactor(district): Updates helper method to add recap icons to entries
ERosendo Aug 13, 2024
f8e54e5
refactor(district): Updates the helper to handle claim register pages
ERosendo Aug 13, 2024
954b8ac
refactor(acms): Updates helper method that handles docket reports
ERosendo Aug 13, 2024
bf11862
feat(acms): Adds background service for fetching Vue data
ERosendo Aug 14, 2024
900fa9a
Refactor(acms): Updates helper method to handle attachment pages
ERosendo Aug 14, 2024
aecfcfc
feat(pdf): Modernize PDF upload helpers for compatibility with new ma…
ERosendo Aug 14, 2024
248aed6
feat(background): Remove event handling for free document uploads
ERosendo Aug 14, 2024
7cc63d6
feat(appellate): Updates the onDocumentViewSubmit method
ERosendo Aug 14, 2024
3f7b7a8
feat(appellate): Modernize onclick event handler for docket entries
ERosendo Aug 14, 2024
657d350
feat(background): Adds helper script to intercept form submissions
ERosendo Aug 19, 2024
ecb08db
feat(district): Modernize helper methods to upload files
ERosendo Aug 19, 2024
75ea14e
feat(manifest): Updates file to support Firefox-specific requirements
ERosendo Aug 19, 2024
38bd74f
feat(style): Add rules for multiline ternary expressions
ERosendo Aug 19, 2024
40893d1
feat(style): Allow 1-space indentation for SwitchCase blocks
ERosendo Aug 19, 2024
180d562
feat(style): Align prettier printWidth with eslint (80 characters)
ERosendo Aug 19, 2024
8b4a506
refactor(acms): Extract ACMS API helpers to background service
ERosendo Aug 19, 2024
6d60159
feat(acms): Updates helper method to handle download pages
ERosendo Aug 19, 2024
fbfd9eb
fix(tests): Replaces outdated test logic with new helper methods
ERosendo Aug 20, 2024
851609d
style(utils): Applies Prettier formatting to utility functions
ERosendo Aug 20, 2024
0980e22
feat(utils): Removes exportInstance and importInstance methods
ERosendo Aug 20, 2024
7f7f1ab
refactor(utils): Removes unused httpRequest helper function
ERosendo Aug 20, 2024
7bf91fc
refactor(utils): Replaces old Chrome.extension API with newer equivalent
ERosendo Aug 20, 2024
ea1ee52
chore(git blame): update .git-blame-ignore-revs file
ERosendo Aug 20, 2024
920175f
feat(background): Rename main background script to service_worker.js
ERosendo Aug 21, 2024
e5ab547
feat(log): Updates log messages
ERosendo Aug 21, 2024
aa8b68e
fix(banner): Adds missing spaces to banner text
ERosendo Aug 23, 2024
7837f1c
fix(appellate): Adds logic to get case_id before adding create alert …
ERosendo Aug 23, 2024
2a2cde1
feat(recap): Update list of sources
ERosendo Aug 24, 2024
9a1d888
feat(background): Adds waitUntil helper to keep service worker alive
ERosendo Aug 26, 2024
470047d
feat(pacer): Replaces old Chrome.extension API with newer equivalent
ERosendo Aug 26, 2024
c1990aa
docs(background): Enhanced comment for waitUntil helper
ERosendo Aug 26, 2024
10c2626
chore(gitignore): Ignore 'build' folder to prevent release packages f…
ERosendo Aug 27, 2024
0ea7260
feat(assets): Add 'favicon.ico' to assets for use in Firefox
ERosendo Aug 27, 2024
0612376
feat(package.json): Add 'build' script to automate release package cr…
ERosendo Aug 27, 2024
053c5f2
docs(readme): Update releasing instructions to reflect new build steps
ERosendo Aug 27, 2024
e92ac27
feat(docs): Updates the chages.md file
ERosendo Aug 27, 2024
d650278
feat(build): Adds pre-build check to ensure jq is installed
ERosendo Aug 27, 2024
1a3b54a
refactor(build): Reorganize bash script commands
ERosendo Aug 27, 2024
8d8f77a
efactor(build): Enhance safety by removing -f flag from rm command
ERosendo Aug 27, 2024
c24b78e
refactor(build): Streamlines browser-specific manifest cleaning step
ERosendo Aug 27, 2024
7fd4579
Merge pull request #388 from freelawproject/feat-add-script-to-create…
mlissner Aug 27, 2024
3caa0d7
test(contentDelegate): Fix failing test
ERosendo Aug 28, 2024
088cdca
fix(background): Tweak variable name in the overwriteSubmitMethod fun…
ERosendo Aug 28, 2024
37c3ac3
feat(manifest): Rename applications key to browser_specific_settings
ERosendo Aug 28, 2024
4a04e68
feat(fetch): Implements browser-specific fetch selection logic
ERosendo Aug 28, 2024
345b160
refactor(background): Removes unnecessary console logs
ERosendo Aug 28, 2024
041f200
feat(packaging): Do release
ERosendo Aug 28, 2024
fa77fc1
Merge pull request #389 from freelawproject/new-release-2.8.0
mlissner Aug 28, 2024
75c5475
Merge pull request #390 from freelawproject/feat-address-warning-in-f…
mlissner Aug 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ module.exports = {
'rules': {
'indent': [
'error',
2
2,
{ "SwitchCase": 1 }
],
'linebreak-style': [
'error',
Expand All @@ -34,6 +35,10 @@ module.exports = {
{
'code': 80,
}
],
'multiline-ternary': [
"error",
"always-multiline"
]
}
};
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ d36f8b36a38873b775efd7edd30bbed4b3ceaa66

# Update code styling in recap.js
fafff6c2bc400d574cf7c3ca3401f067101439b4

# Update code styling in utils.js
851609d953d88363684323316bb0faa936641cc6
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ coverage
/src/recap.zip
/recap-chrome.iml
/.idea/
.vscode/
.vscode/
build/
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"trailingComma": "es5",
"printWidth": 120,
"printWidth": 80,
"tabWidth": 2,
"semi": true,
"singleQuote": true
Expand Down
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ Fixes:
For developers:
- Nothing yet

## 2.8.0 (2024-08-27)

Features:
- Upgrade to manifest v3([333](https://github.com/freelawproject/recap/issues/333), [387](https://github.com/freelawproject/recap-chrome/pull/387))

For developers:
- Adds script to automate release package creation ([388](https://github.com/freelawproject/recap-chrome/pull/388))


## 2.7.2 (2024-07-21)

Fixes:
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ When a new version is needed, the release process is:

1. Do the [manual QA tests][qa]
1. Update `package.json` and `manifest.json` with a new release version.
1. Run `web-ext lint` to ensure no regressions.
1. Update CHANGES.md
1. Commit the code.
1. Tag the code with something like:
Expand All @@ -86,13 +85,16 @@ When a new version is needed, the release process is:
git push --tags -f

1. Make sure you don't have any working/testing code in your tree that could get zipped up in the next step.
1. Zip up the archive with the rather archaic:
1. Run the following commands in your terminal from the project root directory to create release packages for Chrome and Firefox in the `build` folder:

cd src && zip -FSr recap.zip *
npm run release-chrome
npm run release-firefox

1. Make a new release on [Github announcing the release][ghtags] that includes the .zip file.
1. Upload that to the [Chrome Market][market].
1. Upload that to addons.mozilla.org
The `build.sh` script relies on the [jq][jq] command-line JSON processor. Make sure you have it installed before proceeding.

1. Make a new release on [Github announcing the release][ghtags] that includes the .zip files in the release assets.
1. Upload the `chrome-release.zip` file to the [Chrome Web Store.][market].
1. Upload the `firefox-release.zip` file to addons.mozilla.org.


Copyright
Expand Down Expand Up @@ -131,3 +133,4 @@ RECAP for Chrome. If not, see: http://www.gnu.org/licenses/
[recap-issues]: https://github.com/freelawproject/recap/issues
[commits]: https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines
[qa]: https://github.com/freelawproject/recap/wiki/QA-Testing
[jq]: https://jqlang.github.io/jq/
15 changes: 6 additions & 9 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ module.exports = function(config) {
files: [
{ pattern: 'node_modules/whatwg-fetch/fetch.js', type: 'module' },
'src/assets/js/FileSaver.js',
'src/notifier.js',
'src/utils/fetch.js',
'src/utils/notifier.js',
'src/pacer.js',
'src/recap.js',
'src/toolbar_button.js',
'src/utils.js',
'src/action_button.js',
'src/pdf_upload.js',
'test/mock-utils.js',
'src/content_delegate.js',
'src/appellate/utils.js',
'src/appellate/appellate.js',
Expand All @@ -42,9 +41,7 @@ module.exports = function(config) {


// list of files / patterns to exclude
exclude: [
'spec/*ZipSpec.js',
],
exclude: [],


// preprocess matching files before serving them to the browser
Expand Down Expand Up @@ -79,7 +76,7 @@ module.exports = function(config) {
browsers: ['ChromeHeadless'],

// set these options to view logs in development
// see https://github.com/karma-runner/karma/issues/2582#issuecomment-413660796
// see https://github.com/karma-runner/karma/issues/2582#issuecomment-413660796
// browserConsoleLogOptions: {
// level: 'log',
// format: '%b %T: %m',
Expand All @@ -91,7 +88,7 @@ module.exports = function(config) {
client: {
captureConsole: true,
},

customLaunchers: {
CustomChromeHeadless: {
base: 'ChromeHeadless',
Expand All @@ -112,4 +109,4 @@ module.exports = function(config) {
// how many browser should be started simultaneous
concurrency: Infinity
})
};
};
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
"name": "recap-chrome",
"version": "2.7.2",
"version": "2.8.0",
"description": "RECAP improves the experience of using PACER, the online public acces system for the U.S. federal courts",
"main": " ",
"directories": {
"test": "test"
},
"scripts": {
"test": "./node_modules/.bin/karma start --single-run",
"postinstall": "vendor-copy"
"postinstall": "vendor-copy",
"release-chrome": "./scripts/build.sh chrome",
"release-firefox": "./scripts/build.sh firefox"
},
"repository": {
"type": "git",
Expand Down
57 changes: 57 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash
# Create a browser extension release package
set -e

# Checks if jq is installed
if ! command -v jq >/dev/null 2>&1; then
echo "jq is not installed. Please install jq before continuing."
exit 1
fi

# 1. Capture browser type from argument
browserType=$1

# 2. Construct release zip filename
zipName=$browserType-release.zip

# 3. Rename base manifest file
cd src/ && mv manifest.json manifest.base.json
if [[ "$browserType" == "firefox" ]]; then
faviconUrl='assets/images/favicon.icon'
# Remove unnecessary properties for Firefox manifest
jq 'del(.background.service_worker)' manifest.base.json >manifest.json
else
faviconUrl='https://www.courtlistener.com/static/ico/favicon.ico'
# Remove unnecessary property for Chrome/Chromium manifest
jq 'del(.background.scripts, .browser_specific_settings)' manifest.base.json >manifest.json
fi

# 4. Add search provider configuration to manifest
jq --arg favicon "$faviconUrl" '.chrome_settings_overrides.search_provider += {
"name": "RECAP Archive",
"search_url": "https://www.courtlistener.com/?type=r&q={searchTerms}&order_by=score+desc",
"favicon_url": $favicon,
"keyword": "recap",
"encoding": "UTF-8",
"is_default": false
}' manifest.json >manifest.tmp && mv manifest.tmp manifest.json

# 5. Create release package
# - Include all files except the base manifest
zip -rq $zipName * -x "*.base.json"

# 6. Ensure release directory exists (create if needed)
mkdir -p ../build/release/

# 7. Clean up any existing release zip
file="../build/release/$browserType-release.zip"
if [ -f "$file" ] ; then
rm "$file"
fi

# 8. Move package to release directory
mv $zipName ../build/release

# 9. Remove Browser-Specific Manifest File
# Rename base manifest back to main manifest
mv manifest.base.json manifest.json
Loading
Loading