1
0
mirror of https://github.com/uBlockOrigin/uAssets.git synced 2025-01-31 12:51:40 +01:00

Revert "Rewrite readme and fix workflows (#25811)"

This reverts commit 62aad268de8797ed134e045eed6b7690ab9e8aec.
This commit is contained in:
Raymond Hill 2024-11-04 10:00:45 -05:00
parent 5f905fec74
commit 66e9fe8719
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
25 changed files with 195 additions and 191 deletions

View File

@ -10,7 +10,7 @@ body:
description: |
**IMPORTANT:** Answer carefully and truthfully.
options:
- label: This is **NOT** a [_YouTube_](https://github.com/uBlockOrigin/uAssets/issues/20586), [_Facebook_](https://github.com/uBlockOrigin/uAssets/issues/3367), [_Twitch_](https://github.com/uBlockOrigin/uAssets/issues/5184) or [_a shortener/hosting site_](https://github.com/uBlockOrigin/uAssets/discussions/17361) report. _These sites MUST be reported by clicking their **respective links**_.
- label: This is **NOT** a [_YouTube_](https://www.github.com/uBlockOrigin/uAssets/issues/20586), [_Facebook_](https://www.github.com/uBlockOrigin/uAssets/issues/3367), [_Twitch_](https://www.github.com/uBlockOrigin/uAssets/issues/5184) or [_a shortener/hosting site_](https://github.com/uBlockOrigin/uAssets/discussions/17361) report. _These sites MUST be reported by clicking their **respective links**_.
required: true
- label: I read and understand the [policy about what is a valid filter issue](https://github.com/uBlockOrigin/uAssets/blob/master/README.md#uassets).
required: true

View File

@ -3,15 +3,14 @@ description: "DO NOT MANUALLY SELECT THIS TEMPLATE. It's used by uBlock Origin (
body:
- type: markdown
attributes:
value: >
To avoid burdening **VOLUNTEERS** with invalid or duplicate reports, disregarding these steps **WILL** get your account blocked on this repository temporarily, then permanently, with repeated disregard for the template.
value: To avoid burdening **VOLUNTEERS** with invalid or duplicate reports, disregarding these steps **WILL** get your account blocked on this repository temporarily, then permanently, with repeated disregard for the template.
- type: checkboxes
attributes:
label: Prerequisites
description: |
**IMPORTANT:** Answer carefully and truthfully.
options:
- label: This is **NOT** a [_YouTube_](https://github.com/uBlockOrigin/uAssets/issues/20586), [_Facebook_](https://github.com/uBlockOrigin/uAssets/issues/3367), [_Twitch_](https://github.com/uBlockOrigin/uAssets/issues/5184) or [_a shortener/hosting site_](https://github.com/uBlockOrigin/uAssets/discussions/17361) report. _These sites MUST be reported by clicking their **respective links**_.
- label: This is **NOT** a [_YouTube_](https://www.github.com/uBlockOrigin/uAssets/issues/20586), [_Facebook_](https://www.github.com/uBlockOrigin/uAssets/issues/3367), [_Twitch_](https://www.github.com/uBlockOrigin/uAssets/issues/5184) or [_a shortener/hosting site_](https://github.com/uBlockOrigin/uAssets/discussions/17361) report. _These sites MUST be reported by clicking their **respective links**_.
required: true
- label: I read and understand the [policy about what is a valid filter issue](https://github.com/uBlockOrigin/uAssets/blob/master/README.md#uassets).
required: true
@ -33,6 +32,7 @@ body:
required: true
- label: I did not answer truthfully to **ALL** the above checkboxes.
required: false
- type: textarea
attributes:
label: URL(s) where the issue occurs.
@ -46,18 +46,21 @@ body:
render: yaml
validations:
required: true
- type: textarea
attributes:
label: Description
description: Provide a clear and concise description of the issue.
validations:
required: true
- type: textarea
attributes:
label: Other extensions used
description: List other extensions you are using along uBO (write _none_ if no other extensions). This information helps volunteers investigate issues.
validations:
required: true
- type: textarea
attributes:
label: Screenshot(s)
@ -71,16 +74,18 @@ body:
<!-- Drag-and-drop screenshot here -->
<!-- ⬇️ ⬇️ ⬇️ -->
<!-- ⬆️ ⬆️ ⬆️ -->
</details>
validations:
required: false
- type: textarea
id: configuration
attributes:
label: Configuration
description: |
Auto-filled by uBO, don't change.
If this section gets automatically filled by uBO, leave it alone.
validations:
required: true

View File

@ -3,15 +3,14 @@ description: "DO NOT MANUALLY SELECT THIS TEMPLATE. It's used by uBlock Origin (
body:
- type: markdown
attributes:
value: >
To avoid burdening **VOLUNTEERS** with invalid or duplicate reports, disregarding these steps **WILL** get your account blocked on this repository temporarily, then permanently, with repeated disregard for the template.
value: To avoid burdening **VOLUNTEERS** with invalid or duplicate reports, disregarding these steps **WILL** get your account blocked on this repository temporarily, then permanently, with repeated disregard for the template.
- type: checkboxes
attributes:
label: Prerequisites
description: |
**IMPORTANT:** Answer carefully and truthfully.
options:
- label: This is **NOT** a [_YouTube_](https://github.com/uBlockOrigin/uAssets/issues/20586), [_Facebook_](https://github.com/uBlockOrigin/uAssets/issues/3367), [_Twitch_](https://github.com/uBlockOrigin/uAssets/issues/5184) or [_a shortener/hosting site_](https://github.com/uBlockOrigin/uAssets/discussions/17361) report. _These sites MUST be reported by clicking their **respective links**_.
- label: This is **NOT** a [_YouTube_](https://www.github.com/uBlockOrigin/uAssets/issues/20586), [_Facebook_](https://www.github.com/uBlockOrigin/uAssets/issues/3367), [_Twitch_](https://www.github.com/uBlockOrigin/uAssets/issues/5184) or [_a shortener/hosting site_](https://github.com/uBlockOrigin/uAssets/discussions/17361) report. _These sites MUST be reported by clicking their **respective links**_.
required: true
- label: I read and understand the [policy about what is a valid filter issue](https://github.com/uBlockOrigin/uAssets/blob/master/README.md#uassets).
required: true
@ -33,34 +32,39 @@ body:
required: true
- label: I did not answer truthfully to **ALL** the above checkboxes.
required: false
- type: textarea
id: url_address_of_the_web_page
attributes:
label: URL address of the web page
description: |
Auto-filled by uBO, don't change.
Auto-filled by uBO, leave it alone.
validations:
required: true
- type: textarea
id: category
attributes:
label: Category
description: |
Auto-filled by uBO, don't change.
Auto-filled by uBO, leave it alone.
validations:
required: true
- type: textarea
attributes:
label: Description
description: Provide a clear and concise description of the issue.
validations:
required: true
- type: textarea
attributes:
label: Other extensions used
description: List other extensions you are using along uBO (write _none_ if no other extensions). This information helps volunteers investigate issues.
validations:
required: true
- type: textarea
attributes:
label: Screenshot(s)
@ -74,16 +78,18 @@ body:
<!-- Drag-and-drop screenshot here -->
<!-- ⬇️ ⬇️ ⬇️ -->
<!-- ⬆️ ⬆️ ⬆️ -->
</details>
validations:
required: false
- type: textarea
id: configuration
attributes:
label: Configuration
description: |
Auto-filled by uBO, don't change.
Auto-filled by uBO, leave it alone.
validations:
required: true

View File

@ -4,15 +4,14 @@ labels: ["uBOL"]
body:
- type: markdown
attributes:
value: |
To avoid burdening **VOLUNTEERS** with invalid or duplicate reports, disregarding these steps **WILL** get your account blocked on this repository temporarily, then permanently, with repeated disregard for the template.
value: To avoid burdening **VOLUNTEERS** with invalid or duplicate reports, disregarding these steps **WILL** get your account blocked on this repository temporarily, then permanently, with repeated disregard for the template.
- type: checkboxes
attributes:
label: Prerequisites
description: |
**IMPORTANT:** Answer carefully and truthfully.
options:
- label: This is **NOT** a [_YouTube_](https://github.com/uBlockOrigin/uAssets/issues/20586), [_Facebook_](https://github.com/uBlockOrigin/uAssets/issues/3367), [_Twitch_](https://github.com/uBlockOrigin/uAssets/issues/5184) or [_a shortener/hosting site_](https://github.com/uBlockOrigin/uAssets/discussions/17361) report. _These sites MUST be reported by clicking their **respective links**_.
- label: This is **NOT** a [_YouTube_](https://www.github.com/uBlockOrigin/uAssets/issues/20586), [_Facebook_](https://www.github.com/uBlockOrigin/uAssets/issues/3367), [_Twitch_](https://www.github.com/uBlockOrigin/uAssets/issues/5184) or [_a shortener/hosting site_](https://github.com/uBlockOrigin/uAssets/discussions/17361) report. _These sites MUST be reported by clicking their **respective links**_.
required: true
- label: I read and understand the [policy about what is a valid filter issue](https://github.com/uBlockOrigin/uAssets/blob/master/README.md#uassets).
required: true
@ -36,7 +35,7 @@ body:
attributes:
label: URL address of the web page
description: |
Auto-filled by uBOL, don't change.
Auto-filled by uBOL, leave it alone.
validations:
required: true
@ -45,7 +44,7 @@ body:
attributes:
label: Category
description: |
Auto-filled by uBOL, don't change.
Auto-filled by uBOL, leave it alone.
validations:
required: true
@ -76,7 +75,9 @@ body:
<!-- Drag-and-drop screenshot here -->
<!-- ⬇️ ⬇️ ⬇️ -->
<!-- ⬆️ ⬆️ ⬆️ -->
</details>
validations:
required: false
@ -86,6 +87,6 @@ body:
attributes:
label: Configuration
description: |
Auto-filled by uBOL, don't change.
Auto-filled by uBOL, leave it alone.
validations:
required: true

View File

@ -2,15 +2,15 @@
### URL(s) where the issue occurs
`[At least one URL for a web page where the clearly described issue occurs is **mandatory**. The backticks surrounding the URLs is important; it prevents the URL from being clickable. Warn with "NSFW" where applicable.]`
`[At least one URL for a web page where the clearly described issue occurs is **mandatory**. The backticks surrounding the URLs is important, it prevents the URL from being clickable. Warn with "NSFW" where applicable.]`
### Describe the issue
[Be as clear as possible: nobody can read minds, and nobody is looking at your issue over your shoulder.]
[Be as clear as possible: nobody can read mind, and nobody is looking at your issue over your shoulder.]
### Screenshot(s)
[Screenshot(s) for difficult-to-describe visual issues are **mandatory**.]
[Screenshot(s) for difficult to describe visual issues are **mandatory**]
### Versions
@ -19,8 +19,8 @@
### Settings
- [List here all the changes you made to uBO's default settings.]
- [List here all the changes you made to uBO's default settings]
### Notes
[Add here the result of whatever investigation work you have done: please investigate the issues you report this prevents burdening other volunteers. This is especially true for issues arising from settings which are very different from default ones.]
[Add here the result of whatever investigation work you have done: please investigate the issues you report -- this prevents burdening other volunteers. This is especially true for issues arising from settings which are very different from default ones.]

View File

@ -1,18 +1,19 @@
name: Delete workflow runs
on:
workflow_dispatch:
name: del-runs-comments
on: workflow_dispatch
jobs:
runx:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Delete workflow runs
uses: christosgalano/delete-gh-workflow-runs@v1
- uses: christosgalano/delete-workflow-runs@v1.0.0
with:
owner: uBlockOrigin
repo: uAssets
token: ${{ secrets.GITHUB_TOKEN }}
workflow: on-issue-comment

View File

@ -6,7 +6,7 @@ on:
- master
workflow_dispatch:
# https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
@ -21,11 +21,10 @@ jobs:
name: Publish lists
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- name: Clone uAssets
uses: actions/checkout@v4
with:
ref: gh-pages
ref: gh-pages
- name: Copy filter lists to gh-pages
run: |
TMPDIR=$(mktemp -d)
@ -36,7 +35,6 @@ jobs:
cp $TMPDIR/filters/*.txt filters/
cp $TMPDIR/thirdparties/easylist/easy*.txt thirdparties/
cp $TMPDIR/dnr/*.json dnr/
- name: Patch last-updated field
run: |
DATE=$(date -Ru)
@ -48,7 +46,6 @@ jobs:
git checkout -q $f
fi
done
- name: Commit changes (if any)
run: |
if [[ -n $(git diff) ]]; then

View File

@ -1,38 +1,18 @@
name: Delete Bad Comments
name: on-issue-comment
on:
workflow_dispatch:
issue_comment:
types: created
jobs:
check-if-bad-comment:
name: Delete Bad Comment
name: delete bad comment
runs-on: ubuntu-latest
if: >-
(
(contains(github.event.comment.body, 'Download') ||
contains(github.event.comment.body, 'install') ||
contains(github.event.comment.body, 'mediafire') ||
contains(github.event.comment.body, 'changeme')) &&
(contains(github.event.comment.body, 'gcc') ||
contains(github.event.comment.body, 'usx'))
) ||
(
contains(github.event.comment.body, 'install') &&
(contains(github.event.comment.body, 'mediafire') ||
contains(github.event.comment.body, 'gofile'))
)
if: (( contains(github.event.comment.body, 'Download') || contains(github.event.comment.body, 'install') || contains(github.event.comment.body, 'mediafire') || contains(github.event.comment.body, 'changeme') ) && ( contains(github.event.comment.body, 'gcc') || contains(github.event.comment.body, 'usx'))) || ( contains(github.event.comment.body, 'install') && ( contains(github.event.comment.body, 'mediafire') || contains(github.event.comment.body, 'gofile') ))
permissions: write-all
steps:
- name: Echo event comment body
- name: Delete comment
run: |
echo "${{ github.event.comment.body }}"
- name: Delete comments
uses: actions-cool/issues-helper@v3
echo " ${{ github.event.comment.body }} "
- uses: actions-cool/issues-helper@v3
with:
actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,9 +1,8 @@
name: Triage YouTube issues
on:
workflow_dispatch:
issues:
types: [opened]
types: opened
jobs:
check-if-youtube:
@ -12,14 +11,12 @@ jobs:
if: contains(github.event.issue.title, 'youtube.com:')
permissions:
issues: write
steps:
- name: Add label
uses: actions-cool/issues-helper@v3
with:
actions: 'add-labels'
labels: 'duplicate'
- name: Add comment
uses: actions-cool/issues-helper@v3
with:
@ -28,7 +25,6 @@ jobs:
Please respect what is asked in the issue template to not unduly burden volunteers.
This is a `youtube.com` issue, see <https://github.com/uBlockOrigin/uAssets/issues/20586>.
- name: Close issue
uses: actions-cool/issues-helper@v3
with:

View File

@ -2,7 +2,7 @@ name: Update 3rd-party assets (daily)
on:
schedule:
- cron: "0 0 * * *"
- cron: "29 4 * * *"
workflow_dispatch:
permissions:
@ -15,15 +15,12 @@ jobs:
contents: write # for Git to git push
name: Update 3rd-party assets
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Clone uAssets
uses: actions/checkout@v3
- name: Fetch 3rd-party assets
run: |
./tools/update-3rdparties.sh
- name: Commit changes, if any
run: |
if [[ -n $(git diff) ]]; then

View File

@ -2,7 +2,7 @@ name: Update Easylist assets (hourly)
on:
schedule:
- cron: "0 * * * *"
- cron: "47 */3 * * *"
workflow_dispatch:
permissions:
@ -16,15 +16,12 @@ jobs:
contents: write # for Git to git push
name: Update Easylist assets
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- name: Clone uAssets
uses: actions/checkout@v4
- name: Assemble Easylist assets
run: |
./tools/make-easylist.sh
- name: Commit changes, if any
env:
GH_TOKEN: ${{ github.token }}

View File

@ -1,24 +1,22 @@
### Filter Lists
#### Filter lists
#### Ordering of Filters
##### Ordering of filters
- New filters must be added at the end of the list.
New filter must be added at the end of the list.
This approach allows for an easy assessment of a filter's relevance. Filters at the top will be the oldest and most likely to be obsolete.
The reason is to provide an easy way to check whether a filter is still relevant. The filters at the top of the file will be the oldest filters, and also the most likely to maybe be obsolete.
- Old filters confirmed to still be required should also be moved to the end of the list.
Old filters which are confirmed to still be required must be moved to the end of the list.
#### Issue Number Association
##### Issue number association
- **All** added filters must be associated with a formal issue number. For example:
**All** added filters must be associated with a formal issue number, example:
```
! https://github.com/uBlockOrigin/uAssets/issues/2
||data.inertanceretinallaurel.com^
```
! https://github.com/uBlockOrigin/uAssets/issues/2
||data.inertanceretinallaurel.com^
This practice documents the reason for adding a filter and provides a way to verify if an old filter is still necessary. The comment line preceding the filter(s) should consist solely of the URL to the issue, which contains all relevant details about the resolution.
This way this documents why a filter was added, and how to verify whether an old filter is still needed. The comment line preceding the filter(s) to solve a specific issue should be only a URL to the issue. The issue itself can contains all the details about how the issue was solved, and why it was solved this way, etc.
#### Commit Message
##### Commit message
- Keep it simple. For example: `this fixes #2`. The issue itself will contain all the necessary details.
Keep it simple, example: `this fixes #2`. The issue itself will contains all the details.

14
LICENSE
View File

@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -645,14 +645,14 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -1,58 +1,51 @@
# uAssets
This repository is dedicated to the resources for [uBlock Origin (uBO)](https://github.com/gorhill/uBlock). It serves as a hub for reporting new filters or existing filters that may cause webpage breakage. Contributions are welcome, and valuable contributors may be granted write permissions to the repository.
This repository is for the resources of [uBlock Origin (uBO)](https://github.com/gorhill/uBlock). It receives all reports for new filters or existing filters that cause web page breakage. Any contributors are welcome. Contributors who are proven valuable will get write permissions to the repository.
## Filter Inclusion Rationale
The rationale for including a specific filter in uBO's filter lists is the same as the [EasyList/EasyPrivacy policies](https://easylist.to/pages/policy.html) and also takes into account whether a filter requires uBO's extended filter syntax.
The rationale for including specific filters in uBO's filter lists aligns with the [EasyList/EasyPrivacy policies](https://easylist.to/pages/policy.html) and considers whether a filter requires uBO's extended filter syntax.
It is preferred to fix filter issues in EasyList. Any filters included in uBO's filter lists must use the [extended syntax](https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#extended-syntax).
It is preferred to address filter issues in EasyList first. Any filters included in uBO's filter lists must utilize the [extended syntax](https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#extended-syntax).
The EasyList-compatible fixes for high-traffic websites are added to uBO filters until they become added to EasyList.
High-traffic websites will have EasyList-compatible fixes added to uBO filters until they are incorporated into EasyList.
## Exceptions Handled by uAssets
uAssets will address the following exceptions even if they do not require the extended syntax:
uAssets will fix the following exceptions even if they do not require using the extended syntax:
- Ad-Reinsertion
- Anti-Blocker
- Context Menu/Dev Console Blockage
- Cut/Copy/Paste/Drag Blockage
- Context Menu Blockage
- Cut/Copy/Paste Blockage
- Popups/Popunders
- Website Breakage
- Resource Abuse/Coin Mining
- Video/Audio Ads
- Redirections/URL Parameter Removing
- Video Ads
### Exclusions
uAssets will **not** address the following:
uAssets will not address the following:
- Paywalls
- Porn Farms
## Reporting an Issue
#### How to correctly report an issue
To report an issue correctly:
- Disable all other browser extensions and see if the problem still persists
1. Disable all other browser extensions to see if the problem persists.
2. If the issue continues:
- On the problematic website, click the uBlock Origin icon.
- Click the chat icon.
- Click "Troubleshooting Information" to expand, and copy that information into the relevant GitHub issue.
- How to provide troubleshooting information:
## Support Forum
If the problem persists, then please:
- On the problematic website, click the uBlock Origin icon
- Click the chat icon
- Click "Troubleshooting Information" to expand, and copy that information into the appropriate github issue.
For support, questions, or assistance, visit [/r/uBlockOrigin](https://www.reddit.com/r/uBlockOrigin/).
#### Support Forum
## uBO Issues
For support, questions, or help, visit [/r/uBlockOrigin](https://www.reddit.com/r/uBlockOrigin/).
For issues related to uBO, please report them in the [uBO issue tracker](https://github.com/uBlockOrigin/uBlock-issues/issues).
#### uBO Issues
## uBO Lite (uBOL) Issues
Report issues with uBO in the [uBO issue tracker](https://github.com/uBlockOrigin/uBlock-issues/issues).
For issues specific to the Manifest Version 3 (MV3) variant, report them in the [uBOL issue tracker](https://github.com/uBlockOrigin/uBOL-home/issues).
#### uBO Lite (uBOL) Issues
## Concurrent Blockers
Report issues specific to the Manifest Version 3 (MV3) variant in the [uBOL issue tracker](https://github.com/uBlockOrigin/uBOL-home/issues).
Do **NOT** use any other [similarly-purposed blockers](https://x.com/gorhill/status/1033706103782170625) concurrently with uBO, as this may lead to website breakage or unpredictable results.
#### Similarly-Purposed Blockers
Do **NOT** use any other [similarly-purposed blockers](https://x.com/gorhill/status/1033706103782170625) concurrently with uBO. It can result in website breakage or undefined results.

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
#
# This script assumes a linux environment
set -e
@ -15,7 +17,7 @@ fi
PATCHES_DIR=$2
if [[ -z $PATCHES_DIR ]]; then
echo "Error: Patches directory is not provided, aborting"
echo "Error: patches directory is not provided, aborting"
exit 1
fi
@ -30,6 +32,7 @@ DIFF=$(mktemp)
FILES=( $(git diff --name-only) )
for FILE in "${FILES[@]}"; do
# Reference:
# https://github.com/ameshkov/diffupdates
@ -39,17 +42,19 @@ for FILE in "${FILES[@]}"; do
# Patches are for filter lists supporting differential updates
if (head "$FILE" | grep -q '^! Diff-Path: '); then
# Extract diff name from `! Diff-Path:` field
DIFF_NAME=$(grep -m 1 -oP '^! Diff-Path: [^#]+#?\K.*' "$FILE")
# Fall back to `! Diff-Name:` field if no name found
# Remove once `! Diff-Name:` is no longer needed after transition
if [[ -z $DIFF_NAME ]]; then
DIFF_NAME=$(grep -m 1 -oP '^! Diff-Name: \K.+' "$FILE")
fi
echo "Info: Diff name for ${FILE} is ${DIFF_NAME}"
# We need a patch name to generate a valid patch
if [[ -n $DIFF_NAME ]]; then
# Compute relative patch path
PATCH_PATH="$(realpath --relative-to="$(dirname "$FILE")" "$NEXT_PATCH_FILE")"
@ -69,14 +74,18 @@ for FILE in "${FILES[@]}"; do
echo "Info: Adding patch data of ${FILE} to ${PREVIOUS_PATCH_FILE}"
echo "diff name:$DIFF_NAME lines:$DIFF_LINES checksum:$FILE_CHECKSUM" >> "$PREVIOUS_PATCH_FILE"
cat "$DIFF" >> "$PREVIOUS_PATCH_FILE"
else
echo "Error: Diff name not found, skipping"
fi
fi
# Stage changed file
echo "Info: Staging $FILE"
git add -u "$FILE"
done
# Create a patch only if there was a previous version

View File

@ -1,6 +1,6 @@
/*******************************************************************************
uBlock Origin - a comprehensive, efficient content blocker
uBlock Origin - a browser extension to block requests.
Copyright (C) 2022-present Raymond Hill
This program is free software: you can redistribute it and/or modify
@ -14,7 +14,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see {https://www.gnu.org/licenses/}.
along with this program. If not, see {http://www.gnu.org/licenses/}.
Home: https://github.com/gorhill/uBlock
*/
@ -139,11 +139,11 @@ function trimSublist(text) {
/******************************************************************************/
function minify(text) {
// Remove issue-related comments
// remove issue-related comments
text = text.replace(/^! https:\/\/.*?[\n\r]+/gm, '');
// Remove empty lines
// remove empty lines
text = text.replace(/^[\n\r]+/gm, '');
// Convert potentially present Windows-style newlines
// convert potentially present Windows-style newlines
text = text.replace(/\r\n/g, '\n');
return text;
}

View File

@ -1,26 +1,35 @@
#!/usr/bin/env bash
#
# This script assumes a linux environment
echo "*** uAssets: Assembling EasyList lists"
TMPDIR=$(mktemp -d)
mkdir -p "$TMPDIR/easylist"
git clone --depth 1 https://github.com/easylist/easylist.git "$TMPDIR/easylist"
cp -R templates/easy*.template "$TMPDIR/easylist/"
mkdir -p $TMPDIR/easylist
git clone --depth 1 https://github.com/easylist/easylist.git $TMPDIR/easylist
cp -R templates/easy*.template $TMPDIR/easylist/
declare -A filters=(
["easylist.txt"]="easylist.template"
["easyprivacy.txt"]="easyprivacy.template"
["easylist-annoyances.txt"]="easylist-annoyances.template"
["easylist-cookies.txt"]="easylist-cookies.template"
["easylist-social.txt"]="easylist-social.template"
["easylist-newsletters.txt"]="easylist-newsletters.template"
["easylist-notifications.txt"]="easylist-notifications.template"
["easylist-chat.txt"]="easylist-chat.template"
)
echo "*** uAssets: Assembling easylist.txt"
node ./tools/make-easylist.mjs dir=$TMPDIR/easylist in=easylist.template out=thirdparties/easylist/easylist.txt
for filter in "${!filters[@]}"; do
echo "*** uAssets: Assembling $filter"
node ./tools/make-easylist.mjs dir="$TMPDIR/easylist" in="${filters[$filter]}" out="thirdparties/easylist/$filter"
done
echo "*** uAssets: Assembling easyprivacy.txt"
node ./tools/make-easylist.mjs dir=$TMPDIR/easylist in=easyprivacy.template out=thirdparties/easylist/easyprivacy.txt
rm -rf "$TMPDIR"
echo "*** uAssets: Assembling easylist-annoyances.txt"
node ./tools/make-easylist.mjs dir=$TMPDIR/easylist in=easylist-annoyances.template out=thirdparties/easylist/easylist-annoyances.txt
echo "*** uAssets: Assembling easylist-cookies.txt"
node ./tools/make-easylist.mjs dir=$TMPDIR/easylist in=easylist-cookies.template out=thirdparties/easylist/easylist-cookies.txt
echo "*** uAssets: Assembling easylist-social.txt"
node ./tools/make-easylist.mjs dir=$TMPDIR/easylist in=easylist-social.template out=thirdparties/easylist/easylist-social.txt
echo "*** uAssets: Assembling easylist-newsletters.txt"
node ./tools/make-easylist.mjs dir=$TMPDIR/easylist in=easylist-newsletters.template out=thirdparties/easylist/easylist-newsletters.txt
echo "*** uAssets: Assembling easylist-notifications.txt"
node ./tools/make-easylist.mjs dir=$TMPDIR/easylist in=easylist-notifications.template out=thirdparties/easylist/easylist-notifications.txt
echo "*** uAssets: Assembling easylist-chat.txt"
node ./tools/make-easylist.mjs dir=$TMPDIR/easylist in=easylist-chat.template out=thirdparties/easylist/easylist-chat.txt
rm -rf $TMPDIR

View File

@ -1,15 +1,21 @@
#!/usr/bin/env bash
#
# This script assumes a linux environment
declare -A filters=(
["filters.txt"]="ublock-filters.template"
["quick-fixes.txt"]="ublock-quick-fixes.template"
["privacy.txt"]="ublock-privacy.template"
["unbreak.txt"]="ublock-unbreak.template"
["badware.txt"]="ublock-badware.template"
["annoyances.txt"]="ublock-annoyances.template"
)
echo "*** uAssets: Assembling filters/filters.txt"
node ./tools/make-easylist.mjs in=templates/ublock-filters.template out=filters/filters.min.txt minify=1
for filter in "${!filters[@]}"; do
echo "*** uAssets: Assembling filters/$filter"
node ./tools/make-easylist.mjs in="templates/${filters[$filter]}" out="filters/$filter" minify=1
done
echo "*** uAssets: Assembling filters/quick-fixes.txt"
node ./tools/make-easylist.mjs in=templates/ublock-quick-fixes.template out=filters/quick-fixes.min.txt minify=1
echo "*** uAssets: Assembling filters/privacy.txt"
node ./tools/make-easylist.mjs in=templates/ublock-privacy.template out=filters/privacy.min.txt minify=1
echo "*** uAssets: Assembling filters/unbreak.txt"
node ./tools/make-easylist.mjs in=templates/ublock-unbreak.template out=filters/unbreak.min.txt minify=1
echo "*** uAssets: Assembling filters/badware.txt"
node ./tools/make-easylist.mjs in=templates/ublock-badware.template out=filters/badware.min.txt minify=1
echo "*** uAssets: Assembling filters/annoyances.txt"
node ./tools/make-easylist.mjs in=templates/ublock-annoyances.template out=filters/annoyances.min.txt minify=1

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
#
# This script assumes a linux environment
# https://stackoverflow.com/a/52526704
echo "*** Importing required uBO files"

View File

@ -1,6 +1,6 @@
/*******************************************************************************
uBlock Origin - a comprehensive, efficient content blocker
uBlock Origin - a browser extension to block requests.
Copyright (C) 2023-present Raymond Hill
This program is free software: you can redistribute it and/or modify
@ -14,7 +14,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see {https://www.gnu.org/licenses/}.
along with this program. If not, see {http://www.gnu.org/licenses/}.
Home: https://github.com/gorhill/uBlock
*/

View File

@ -1,22 +1,26 @@
#!/usr/bin/env bash
#
# This script assumes a linux environment
TEMPFILE=$(mktemp)
echo "*** uAssets: Updating remote assets..."
echo "*** uAssets: updating remote assets..."
declare -A assets=(
declare -A assets
assets=(
['thirdparties/pgl.yoyo.org/as/serverlist']='https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&startdate%5Bday%5D=&startdate%5Bmonth%5D=&startdate%5Byear%5D=&mimetype=plaintext'
['thirdparties/publicsuffix.org/list/effective_tld_names.dat']='https://publicsuffix.org/list/public_suffix_list.dat'
['thirdparties/urlhaus-filter/urlhaus-filter-online.txt']='https://malware-filter.gitlab.io/urlhaus-filter/urlhaus-filter-online.txt'
)
for localURL in "${!assets[@]}"; do
remoteURL="${assets[$localURL]}"
for i in "${!assets[@]}"; do
localURL="$i"
remoteURL="${assets[$i]}"
echo "*** Downloading ${remoteURL}"
if wget -q -T 30 -O "$TEMPFILE" -- "$remoteURL"; then
if [ -s "$TEMPFILE" ]; then
if ! cmp -s "$TEMPFILE" "$localURL"; then
echo "New version found: ${localURL}"
echo " New version found: ${localURL}"
if [ "$1" != "dry" ]; then
mv "$TEMPFILE" "$localURL"
fi

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
#
# This script assumes a linux environment
set -e
@ -9,19 +11,19 @@ set -e
REPO_DIR=$1
if [[ -z $REPO_DIR ]]; then
echo "Error: Repo directory is not provided, aborting"
echo "Error: repo directory is not provided, aborting"
exit 1
fi
PATCHES_DIR=$2
if [[ -z $PATCHES_DIR ]]; then
echo "Error: Patches directory is not provided, aborting"
echo "Error: patches directory is not provided, aborting"
exit 1
fi
FILTER_FILES=$3
if [[ -z $FILTER_FILES ]]; then
echo "Error: Filter lists are not provided, aborting"
echo "Error: filter lists are not provided, aborting"
exit 1
fi
FILTER_FILES=( "$FILTER_FILES" )
@ -39,6 +41,7 @@ NEW_PATCH_FILE=$(mktemp)
DIFF_FILE=$(mktemp)
for PATCH_FILE in "${PATCH_FILES[@]}"; do
# Extract tag from patch file name
[[ ${PATCH_FILE} =~ ^$PATCHES_DIR/([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\.patch$ ]] && \
PREVIOUS_VERSION=${BASH_REMATCH[1]}
@ -50,15 +53,14 @@ for PATCH_FILE in "${PATCH_FILES[@]}"; do
# Skip if version doesn't exist
if [ -z "$(ls -A "$OLD_REPO" 2>/dev/null)" ]; then
continue
continue;
fi
: > "$NEW_PATCH_FILE"
for FILTER_LIST in "${FILTER_FILES[@]}"; do
if [ ! -f "$OLD_REPO/$FILTER_LIST" ]; then
continue
fi
for FILTER_LIST in ${FILTER_FILES[@]}; do
if [ ! -f "$OLD_REPO/$FILTER_LIST" ]; then continue; fi
# Patches are for filter lists supporting differential updates
if ! (head "$OLD_REPO/$FILTER_LIST" | grep -q '^! Diff-Path: '); then
@ -70,8 +72,8 @@ for PATCH_FILE in "${PATCH_FILES[@]}"; do
# Extract diff name from `! Diff-Path:` field
DIFF_NAME=$(grep -m 1 -oP '^! Diff-Path: [^#]+#?\K.*' "$FILTER_LIST")
# Fall back to `! Diff-Name:` field if no name found
# Remove once `! Diff-Name:` is no longer needed after transition
if [[ -z $DIFF_NAME ]]; then
DIFF_NAME=$(grep -m 1 -oP '^! Diff-Name: \K.+' "$FILTER_LIST")
fi
@ -91,12 +93,12 @@ for PATCH_FILE in "${PATCH_FILES[@]}"; do
DIFF_LINE_COUNT=$(wc -l < "$DIFF_FILE")
# Patch header
DIFF_HEAD="Diff name:$DIFF_NAME lines:$DIFF_LINE_COUNT checksum:$FILE_CHECKSUM"
DIFF_HEAD="diff name:$DIFF_NAME lines:$DIFF_LINE_COUNT checksum:$FILE_CHECKSUM"
printf "\tAdding diff: %s\n" "$DIFF_HEAD"
echo "$DIFF_HEAD" >> "$NEW_PATCH_FILE"
# Patch data
cat "$DIFF_FILE" >> "$NEW_PATCH_FILE"
done
rm -rf "$OLD_REPO"
@ -106,6 +108,7 @@ for PATCH_FILE in "${PATCH_FILES[@]}"; do
ls -l "$PATCH_FILE"
echo "Info: Staging ${PATCH_FILE}"
git add -u "$PATCH_FILE"
done
rm -f "$DIFF_FILE"

View File

@ -1,6 +1,6 @@
/*******************************************************************************
uBlock Origin - a comprehensive, efficient content blocker
uBlock Origin - a browser extension to block requests.
Copyright (C) 2022-present Raymond Hill
This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
{
"engines": {
"node": ">=22.0.0"
"node": ">=17.5.0"
},
"type": "module"
}

View File

@ -1,6 +1,6 @@
/*******************************************************************************
uBlock Origin - a comprehensive, efficient content blocker
uBlock Origin - a browser extension to block requests.
Copyright (C) 2022-present Raymond Hill
This program is free software: you can redistribute it and/or modify