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

Use webpack to compile bypasses into one js file #3

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{ts,js}]
indent_style = space
indent_size = 2
45 changes: 45 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"extends": [
"airbnb-base",
"airbnb-typescript/base"
],
"env": {
"browser": true,
"jest": true
},
"globals": {
"page": true,
"browser": true,
"context": true,
"jestPuppeteer": true
},
"parserOptions": {
"project": [
"./tsconfig.json",
"./tests/tsconfig.json"
]
},
"rules": {
"no-return-assign": 0,
"no-param-reassign": 0,
"curly": [
2,
"all"
],
"max-len": 1,
"import/no-dynamic-require": 0,
"no-plusplus": 0,
"@typescript-eslint/no-implied-eval": 0,
"@typescript-eslint/no-unused-vars": [
// 2,
// {
// "ignoreRestSiblings": true,
// "argsIgnorePattern": "^_"
// }
0
]
},
"overrides": [{
"files": ["**/*.ts"]
}]
}
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
25 changes: 25 additions & 0 deletions .github/actions/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM node:16

LABEL "com.github.actions.name"="Puppeteer Headful"
LABEL "com.github.actions.description"="A GitHub Action / Docker image for Puppeteer, the Headful Chrome Node API"
LABEL "com.github.actions.icon"="layout"
LABEL "com.github.actions.color"="blue"

LABEL "repository"="https://github.com/mujo-code/puppeteer-headful"
LABEL "homepage"="https://github.com/mujo-code/puppeteer-headful"
LABEL "maintainer"="Jacob Lowe"

RUN apt-get update \
&& apt-get install -yq wget gnupg xvfb dumb-init dbus \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& npm config set update-notifier false

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x entrypoint.sh
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/entrypoint.sh"]
20 changes: 20 additions & 0 deletions .github/actions/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

# Startup Xvfb
Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 &

# Export some variables
export DISPLAY=:99.0
export PUPPETEER_EXEC_PATH="google-chrome-stable"

# Run commands
cmd=$@
echo "Running '$cmd'!"
if $cmd; then
# no op
echo "Successfully ran '$cmd'"
else
exit_code=$?
echo "Failure running '$cmd', exited with $exit_code"
exit $exit_code
fi
39 changes: 39 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Auto testing

on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]

jobs:
chromium:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
cache-dependency-path: |
package-lock.json
tests/package-lock.json

- name: Build
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 'true'
run: |
npm install
npm run build
cd tests
npm install

- name: Auto Testing
uses: ./.github/actions
env:
CI: 'true'
with:
args: npm run test:chromium
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build and Release

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- uses: actions/checkout@v3

- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'

- name: Build
run: |
npm install
npm run build

- name: Get short commit SHA
id: id
run: echo "::set-output name=id::$(git rev-parse --short HEAD)"

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%S')"

- name: Release
uses: softprops/action-gh-release@v1
with:
name: ${{ steps.date.outputs.date }}
tag_name: ${{ steps.id.outputs.id }}
files: |
dist/rules.json
dist/bundle.js
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
*.swp

pids
logs
results
tmp

# API keys and secrets
.env

# Dependency directory
node_modules
bower_components

# Editors
.idea
*.iml
.vscode

# OS metadata
.DS_Store
Thumbs.db

# Ignore built ts files
dist/**/*
extension-*
build

# ignore yarn.lock
yarn.lock
5 changes: 0 additions & 5 deletions .jshintrc

This file was deleted.

21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# FastForward Bypasses

This is a collection of bypass for [FastForward](https://github.com/FastForwardTeam/FastForward)

### How to add a bypass?
1. Install the dependencies with `npm i`
2. Go to the folder `src/bypass`
3. Create a new file with the name of the bypass (The name must end with `.b.ts`)
4. Add your own bypass in the file
5. (Optional) Create a new file for auto testing (The name must end with `.t.ts`)
6. Run `npm run build`
7. Copy the `dist/bundle.js` file to extension's `src/js/` folder and rename the file to `injection_script.js`
8. Copy the `dist/rules.json` file to extension's `src/js/` folder

### How to run auto testing?
1. Go to the folder `tests`
2. Install the dependencies with `npm i`
3. Run `npm run test:chromium`

### There is an error!
Please report the error to [FastForward](https://discord.com/invite/RSAf7b5njt)
Loading