Skip to content

Commit

Permalink
feat: upgrade to Manifest V3 in Chrome
Browse files Browse the repository at this point in the history
BREAKING CHANGE: browser versions older than Chrome 123, Edge 123,
Firefox 115 and Opera 109 are no longer supported
  • Loading branch information
dessant committed May 28, 2024
1 parent b52a44b commit 42149b3
Show file tree
Hide file tree
Showing 46 changed files with 13,757 additions and 32,363 deletions.
13 changes: 6 additions & 7 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
[chrome]
Chrome >= 92
Edge >= 92
Opera >= 78
Chrome >= 123
Edge >= 123
Opera >= 109

[edge]
Edge >= 92
Edge >= 123

[firefox]
Firefox >= 91
FirefoxAndroid >= 91
Firefox >= 115

[opera]
Opera >= 78
Opera >= 109
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ This error is outside the control of the extension, and should not be reported a
Visit the wiki to learn more about the issue.
https://github.com/dessant/buster/wiki/Inaccessible-reCAPTCHA-audio-challenge
Full automation and scripting are not within the scope of this project due to the potential for misuse.
The solver must always be manually started from the extension button.
-->

**System**
Expand Down
5 changes: 1 addition & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ about: Suggest an idea for this project
---

<!--
Full automation is not within the scope of this project due to its potential for misuse.
Full automation and scripting are not within the scope of this project due to the potential for misuse.
The solver must always be manually started from the extension button.
The extension helps solve reCAPTCHA audio challenges, other services
and challenge types are not within the scope of this project.
-->

**Is your feature request related to a problem? Please describe.**
Expand Down
9 changes: 1 addition & 8 deletions .github/label-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,9 @@ wontfix-automation:
issues:
comment: >
@{issue-author}, full automation and scripting are not within the scope
of this project due to their potential for misuse.
of this project due to the potential for misuse.
The solver must always be manually started from the extension button.
close: true
wontfix-service:
issues:
comment: >
@{issue-author}, the extension helps solve reCAPTCHA audio challenges.
Other services and challenge types are not within the scope
of this project.
close: true
recaptcha-error:
issues:
comment: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
contents: read
steps:
- name: Clone repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: 'false'
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
Expand All @@ -32,7 +32,7 @@ jobs:
run: sha256sum artifacts/*/*
if: startsWith(github.ref, 'refs/tags/v')
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
name: artifacts
Expand All @@ -47,14 +47,14 @@ jobs:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: artifacts
path: artifacts/
- name: Hash artifacts
run: sha256sum artifacts/*/*
- name: Create GitHub release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/label-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/label-actions@v3
- uses: dessant/label-actions@v4
2 changes: 1 addition & 1 deletion .github/workflows/lockdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: dessant/repo-lockdown@v3
- uses: dessant/repo-lockdown@v4
with:
exclude-pr-created-before: '2021-11-02T00:00:00Z'
pr-comment: 'This project does not accept pull requests. Please use issues to report bugs or suggest new features.'
Expand Down
17 changes: 11 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
/.assets/
/secrets.json

node_modules/
/app/
/artifacts/
/dist/

/.vscode
/secrets.json

/report.json
/report.html

/web-ext-config.js

node_modules/
/npm-debug.log

/report.json
/report.html
/.vscode

xcuserdata/

.DS_Store
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.12.1
20.12.2
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ please consider contributing with

## Description

Buster is a browser extension which helps you to solve difficult captchas
Buster is a browser extension which helps you to solve difficult CAPTCHAs
by completing reCAPTCHA audio challenges using speech recognition.
Challenges are solved by clicking on the extension button at the bottom
of the reCAPTCHA widget.
Expand All @@ -49,10 +49,10 @@ delaying and often blocking our access to services and information
depending on our physical and cognitive abilities, our social
and cultural background, and the devices or networks we connect from.

The difficulty of captchas can be so out of balance,
The difficulty of CAPTCHA challenges can be so out of balance,
that sometimes they seem friendlier to bots than they are to humans.

The goal of this project is to improve our experience on the web,
The goal of this project is to improve our user experience on the web,
by giving us easy access to solutions utilized by automated systems.

## Client App
Expand All @@ -72,7 +72,7 @@ from [this](https://github.com/dessant/buster-client#readme) repository.

## License

Copyright (c) 2018-2023 Armin Sebastian
Copyright (c) 2018-2024 Armin Sebastian

This software is released under the terms of the GNU General Public License v3.0.
See the [LICENSE](LICENSE) file for further information.
15 changes: 6 additions & 9 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const path = require('node:path');

const corejsVersion = require(path.join(
path.dirname(require.resolve('core-js')),
'package.json'
)).version;
const corejsVersion = require(
path.join(path.dirname(require.resolve('core-js')), 'package.json')
).version;

module.exports = function (api) {
api.cache(true);

const presets = [
[
'@babel/env',
Expand All @@ -24,11 +25,7 @@ module.exports = function (api) {
new RegExp(`node_modules\\${path.sep}(?!(vueton|wesa)\\${path.sep}).*`)
];

const parserOpts = {plugins: ['importAssertions']};

if (api.env('production')) {
plugins.push('lodash');
}
const parserOpts = {plugins: ['importAttributes']};

return {presets, plugins, ignore, parserOpts};
};
78 changes: 59 additions & 19 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ const {ensureDirSync, readJsonSync} = require('fs-extra');
const sharp = require('sharp');
const CryptoJS = require('crypto-js');

const appVersion = require('./package.json').version;

const targetEnv = process.env.TARGET_ENV || 'chrome';
const isProduction = process.env.NODE_ENV === 'production';
const enableContributions =
(process.env.ENABLE_CONTRIBUTIONS || 'true') === 'true';

const mv3 = ['chrome'].includes(targetEnv);

const distDir = path.join(__dirname, 'dist', targetEnv);

function initEnv() {
Expand All @@ -46,45 +51,73 @@ function js(done) {
}

function html() {
return src(
enableContributions
? 'src/**/*.html'
: ['src/**/*.html', '!src/contribute/*.html'],
{base: '.'}
)
const htmlSrc = ['src/**/*.html'];

if (mv3) {
htmlSrc.push('!src/background/*.html');
}

if (!enableContributions) {
htmlSrc.push('!src/contribute/*.html');
}

if (!(mv3 && !['firefox', 'safari'].includes(targetEnv))) {
htmlSrc.push('!src/offscreen/*.html');
}

return src(htmlSrc, {base: '.'})
.pipe(gulpif(isProduction, htmlmin({collapseWhitespace: true})))
.pipe(dest(distDir));
}

function css() {
return src('src/solve/*.css', {base: '.'})
.pipe(postcss())
.pipe(dest(distDir));
return src('src/base/*.css', {base: '.'}).pipe(postcss()).pipe(dest(distDir));
}

async function images(done) {
ensureDirSync(path.join(distDir, 'src/assets/icons/app'));
const appIconSvg = readFileSync('src/assets/icons/app/icon.svg');
const appIconSizes = [16, 19, 24, 32, 38, 48, 64, 96, 128];
if (targetEnv === 'safari') {
appIconSizes.push(256, 512, 1024);
}
for (const size of appIconSizes) {
await sharp(appIconSvg, {density: (72 * size) / 24})
.resize(size)
.toFile(path.join(distDir, `src/assets/icons/app/icon-${size}.png`));
}

// Chrome Web Store does not correctly display optimized icons
if (isProduction && targetEnv !== 'chrome') {
await new Promise(resolve => {
src(path.join(distDir, 'src/assets/icons/app/*.png'), {base: '.'})
src(path.join(distDir, 'src/assets/icons/app/*.png'), {
base: '.',
encoding: false
})
.pipe(imagemin())
.pipe(dest('.'))
.on('error', done)
.on('finish', resolve);
});
}

await new Promise(resolve => {
src('src/assets/icons/@(app|misc)/*.@(png|svg)', {
base: '.',
encoding: false
})
.pipe(gulpif(isProduction, imagemin()))
.pipe(dest(distDir))
.on('error', done)
.on('finish', resolve);
});

if (enableContributions) {
await new Promise(resolve => {
src('node_modules/vueton/components/contribute/assets/*.@(png|svg)')
src(
'node_modules/vueton/components/contribute/assets/*.@(png|webp|svg)',
{encoding: false}
)
.pipe(gulpif(isProduction, imagemin()))
.pipe(dest(path.join(distDir, 'src/contribute/assets')))
.on('error', done)
Expand All @@ -104,7 +137,8 @@ async function fonts(done) {

await new Promise(resolve => {
src(
'node_modules/@fontsource/roboto/files/roboto-latin-@(400|500|700)-normal.woff2'
'node_modules/@fontsource/roboto/files/roboto-latin-@(400|500|700)-normal.woff2',
{encoding: false}
)
.pipe(dest(path.join(distDir, 'src/assets/fonts/files')))
.on('error', done)
Expand Down Expand Up @@ -156,7 +190,7 @@ function manifest() {
jsonMerge({
fileName: 'manifest.json',
edit: (parsedJson, file) => {
parsedJson.version = require('./package.json').version;
parsedJson.version = appVersion;
return parsedJson;
}
})
Expand All @@ -165,22 +199,28 @@ function manifest() {
.pipe(dest(distDir));
}

function license() {
function license(done) {
let year = '2018';
const currentYear = new Date().getFullYear().toString();
if (year !== currentYear) {
year = `${year}-${currentYear}`;
}

const notice = `Buster: Captcha Solver for Humans
let notice = `Buster: Captcha Solver for Humans
Copyright (c) ${year} Armin Sebastian
`;

if (['safari', 'samsung'].includes(targetEnv)) {
writeFileSync(path.join(distDir, 'NOTICE'), notice);
done();
} else {
notice = `${notice}
This software is released under the terms of the GNU General Public License v3.0.
See the LICENSE file for further information.
`;

writeFileSync(path.join(distDir, 'NOTICE'), notice);
return src('LICENSE').pipe(dest(distDir));
writeFileSync(path.join(distDir, 'NOTICE'), notice);
return src('LICENSE').pipe(dest(distDir));
}
}

function secrets(done) {
Expand All @@ -195,7 +235,7 @@ function secrets(done) {

const key = CryptoJS.SHA256(
readFileSync(path.join(distDir, 'src/background/script.js')).toString() +
readFileSync(path.join(distDir, 'src/solve/script.js')).toString()
readFileSync(path.join(distDir, 'src/base/script.js')).toString()
).toString();

const ciphertext = CryptoJS.AES.encrypt(data, key).toString();
Expand Down
Loading

0 comments on commit 42149b3

Please sign in to comment.