Skip to content

Commit

Permalink
Merge branch 'master' into fix/compatibility-table-03
Browse files Browse the repository at this point in the history
  • Loading branch information
slavaleleka committed Sep 12, 2024
2 parents a403bb2 + 39ae8a6 commit 8bda13a
Show file tree
Hide file tree
Showing 89 changed files with 2,751 additions and 558 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ module.exports = {
'no-shadow': 0,
'no-bitwise': 0,
'no-new': 0,
'function-call-argument-newline': [
'error',
'consistent',
],
'import/prefer-default-export': 0,
'no-continue': 0,
'no-await-in-loop': 0,
Expand All @@ -62,6 +66,7 @@ module.exports = {
'jsdoc/require-param-description': 0,
'jsdoc/require-returns': 'off',
'jsdoc/require-returns-description': 0,
'jsdoc/no-defaults': 0,
},
overrides: [
{
Expand Down
28 changes: 12 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Github Release

env:
NODE_VERSION: 18
NODE_VERSION: 20

# Workflow need write access to the repository to create a GitHub release
permissions:
Expand Down Expand Up @@ -32,10 +32,10 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Check out the repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org
Expand Down Expand Up @@ -64,26 +64,22 @@ jobs:

notify:
name: Send Slack notification
needs:
- release

needs: release
# Note: 'always()' is needed to run the notify job even if the test job was failed
if:
${{ always() &&
(
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch'
)
${{
always() &&
github.repository == 'AdguardTeam/Scriptlets' &&
(github.event_name == 'push' || github.event_name == 'workflow_dispatch')
}}
runs-on: ubuntu-latest
steps:
- name: Conclusion
uses: technote-space/workflow-conclusion-action@v3

- name: Send Slack notification
uses: 8398a7/action-slack@v3
with:
status: ${{ env.WORKFLOW_CONCLUSION }}
fields: workflow, repo, message, commit, author, eventName, ref
status: ${{ needs.release.result }}
fields: workflow, repo, message, commit, author, eventName, ref, job
job_name: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
26 changes: 15 additions & 11 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Test Scriptlets

env:
NODE_VERSION: 18
NODE_VERSION: 20

on:
push:
Expand All @@ -15,9 +15,9 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.jobs
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

Expand All @@ -34,25 +34,29 @@ jobs:
run: yarn build

notify:
needs:
- build

name: Send Slack notification on failure
needs: build
# Run this job only if the previous job failed and the event was triggered by the 'AdguardTeam/Scriptlets' repository
# Note: 'always()' is needed to run the notify job even if the test job was failed
if:
${{ always() &&
${{
always() &&
needs.check_code.result == 'failure' &&
github.repository == 'AdguardTeam/Scriptlets' &&
(
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch' ||
github.event.pull_request.head.repo.full_name == github.repository
)
}}
runs-on: ubuntu-latest
steps:
- name: Conclusion
uses: technote-space/workflow-conclusion-action@v3
- name: Send Slack notification
uses: 8398a7/action-slack@v3
with:
status: ${{ env.WORKFLOW_CONCLUSION }}
fields: workflow, repo, message, commit, author, eventName, ref
status: failure
fields: workflow, repo, message, commit, author, eventName, ref, job
job_name: check_code
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
33 changes: 32 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,44 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic

## [Unreleased]

### Fixed

- issue with re-adding element on every DOM change in `trusted-create-element` scriptlet [#450]
- setting cookie which name has special prefix `__Host-` or `__Secure-` by
`trusted-set-cookie` and `trusted-set-cookie-reload` scriptlets [#448]

[Unreleased]: https://github.com/AdguardTeam/Scriptlets/compare/v1.11.27...HEAD
[#450]: https://github.com/AdguardTeam/Scriptlets/issues/450
[#448]: https://github.com/AdguardTeam/Scriptlets/issues/448

## [v1.11.27] - 2024-08-29

### Added

- `reload` option for `trusted-click-element` scriptlet [#301]
- support for matching line number in `abort-on-stack-trace` scriptlet
when `inlineScript` or `injectedScript` option is used [#439]
- new values to `set-cookie` and `set-cookie-reload` scriptlets: `checked`, `unchecked` [#444]
- new values to `set-local-storage-item` and `set-session-storage-item` scriptlets:
`allowed`, `denied` [#445]
- UBO aliases `noop-vast2.xml`, `noop-vast3.xml`, and `noop-vast4.xml` for correspondent AdGuard redirects
- new field `uniqueId` to scriptlet configuration, allowing scriptlets to be executed only once per context

### Changed

- UBO alias `noop-vmap1.0.xml` for `noopvmap-1.0` redirect is replaced by `noop-vmap1.xml`

### Fixed

- issue with modifying `RegExp.$1, …, RegExp.$9` values
in `log-on-stack-trace` and `abort-on-stack-trace` scriptlets [#384]

[Unreleased]: https://github.com/AdguardTeam/Scriptlets/compare/v1.11.16...HEAD
[v1.11.27]: https://github.com/AdguardTeam/Scriptlets/compare/v1.11.16...v1.11.27
[#384]: https://github.com/AdguardTeam/Scriptlets/issues/384
[#301]: https://github.com/AdguardTeam/Scriptlets/issues/301
[#439]: https://github.com/AdguardTeam/Scriptlets/issues/439
[#444]: https://github.com/AdguardTeam/Scriptlets/issues/444
[#445]: https://github.com/AdguardTeam/Scriptlets/issues/445

## [v1.11.16] - 2024-08-01

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ where:
* @property {boolean} [verbose] — Flag to enable debug information printing to console.
* @property {string} [ruleText] — Deprecated: Source rule text, needed for debug purposes.
* @property {string} [domainName] — Domain name where scriptlet is applied, needed for debug purposes.
* @property {string} [uniqueId] — Optional unique identifier for a scriptlet instance.
* Used to ensure the scriptlet is executed only once per context by tracking its execution status.
*/
```
Expand Down
2 changes: 1 addition & 1 deletion bamboo-specs/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plan:
key: SCRIPTLETSBUILD
name: scriptlets - build
variables:
dockerContainer: adguard/puppeteer-runner:18.2--1
dockerContainer: adguard/puppeteer-runner:23.3--1

stages:
- Build:
Expand Down
2 changes: 1 addition & 1 deletion bamboo-specs/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environments:

npmjs:
docker:
image: adguard/puppeteer-runner:18.2--1
image: adguard/puppeteer-runner:23.3--1
volumes:
${system.YARN_DIR}: "${bamboo.cacheYarn}"
triggers: [ ]
Expand Down
2 changes: 1 addition & 1 deletion bamboo-specs/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plan:
key: SCRIPTLETSTEST
name: scriptlets - test new
variables:
dockerPuppeteer: adguard/puppeteer-runner:18.2--1
dockerPuppeteer: adguard/puppeteer-runner:23.3--1

stages:
- Build:
Expand Down
2 changes: 1 addition & 1 deletion dist/build.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=1.11.16
version=1.11.27
15 changes: 15 additions & 0 deletions dist/redirect-files/amazon-apstag.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
(function(source, args) {
const flag = "done";
const uniqueIdentifier = source.uniqueId + source.name + "_" + (Array.isArray(args) ? args.join("_") : "");
if (source.uniqueId) {
if (Window.prototype.toString[uniqueIdentifier] === flag) {
return;
}
}
function AmazonApstag(source) {
var apstagWrapper = {
fetchBids(a, b) {
Expand Down Expand Up @@ -45,6 +52,14 @@
const updatedArgs = args ? [].concat(source).concat(args) : [ source ];
try {
AmazonApstag.apply(this, updatedArgs);
if (source.uniqueId) {
Object.defineProperty(Window.prototype.toString, uniqueIdentifier, {
value: flag,
enumerable: false,
writable: false,
configurable: false
});
}
} catch (e) {
console.log(e);
}
Expand Down
15 changes: 15 additions & 0 deletions dist/redirect-files/ati-smarttag.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
(function(source, args) {
const flag = "done";
const uniqueIdentifier = source.uniqueId + source.name + "_" + (Array.isArray(args) ? args.join("_") : "");
if (source.uniqueId) {
if (Window.prototype.toString[uniqueIdentifier] === flag) {
return;
}
}
function ATInternetSmartTag(source) {
var setNoopFuncWrapper = {
set: noopFunc
Expand Down Expand Up @@ -105,6 +112,14 @@
const updatedArgs = args ? [].concat(source).concat(args) : [ source ];
try {
ATInternetSmartTag.apply(this, updatedArgs);
if (source.uniqueId) {
Object.defineProperty(Window.prototype.toString, uniqueIdentifier, {
value: flag,
enumerable: false,
writable: false,
configurable: false
});
}
} catch (e) {
console.log(e);
}
Expand Down
15 changes: 15 additions & 0 deletions dist/redirect-files/didomi-loader.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
(function(source, args) {
const flag = "done";
const uniqueIdentifier = source.uniqueId + source.name + "_" + (Array.isArray(args) ? args.join("_") : "");
if (source.uniqueId) {
if (Window.prototype.toString[uniqueIdentifier] === flag) {
return;
}
}
function DidomiLoader(source) {
function UserConsentStatusForVendorSubscribe() {}
UserConsentStatusForVendorSubscribe.prototype.filter = function() {
Expand Down Expand Up @@ -153,6 +160,14 @@
const updatedArgs = args ? [].concat(source).concat(args) : [ source ];
try {
DidomiLoader.apply(this, updatedArgs);
if (source.uniqueId) {
Object.defineProperty(Window.prototype.toString, uniqueIdentifier, {
value: flag,
enumerable: false,
writable: false,
configurable: false
});
}
} catch (e) {
console.log(e);
}
Expand Down
15 changes: 15 additions & 0 deletions dist/redirect-files/fingerprintjs2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
(function(source, args) {
const flag = "done";
const uniqueIdentifier = source.uniqueId + source.name + "_" + (Array.isArray(args) ? args.join("_") : "");
if (source.uniqueId) {
if (Window.prototype.toString[uniqueIdentifier] === flag) {
return;
}
}
function Fingerprintjs2(source) {
var browserId = "";
for (var i = 0; i < 8; i += 1) {
Expand Down Expand Up @@ -52,6 +59,14 @@
const updatedArgs = args ? [].concat(source).concat(args) : [ source ];
try {
Fingerprintjs2.apply(this, updatedArgs);
if (source.uniqueId) {
Object.defineProperty(Window.prototype.toString, uniqueIdentifier, {
value: flag,
enumerable: false,
writable: false,
configurable: false
});
}
} catch (e) {
console.log(e);
}
Expand Down
15 changes: 15 additions & 0 deletions dist/redirect-files/fingerprintjs3.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
(function(source, args) {
const flag = "done";
const uniqueIdentifier = source.uniqueId + source.name + "_" + (Array.isArray(args) ? args.join("_") : "");
if (source.uniqueId) {
if (Window.prototype.toString[uniqueIdentifier] === flag) {
return;
}
}
function Fingerprintjs3(source) {
var visitorId = function() {
var id = "";
Expand Down Expand Up @@ -56,6 +63,14 @@
const updatedArgs = args ? [].concat(source).concat(args) : [ source ];
try {
Fingerprintjs3.apply(this, updatedArgs);
if (source.uniqueId) {
Object.defineProperty(Window.prototype.toString, uniqueIdentifier, {
value: flag,
enumerable: false,
writable: false,
configurable: false
});
}
} catch (e) {
console.log(e);
}
Expand Down
15 changes: 15 additions & 0 deletions dist/redirect-files/gemius.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
(function(source, args) {
const flag = "done";
const uniqueIdentifier = source.uniqueId + source.name + "_" + (Array.isArray(args) ? args.join("_") : "");
if (source.uniqueId) {
if (Window.prototype.toString[uniqueIdentifier] === flag) {
return;
}
}
function Gemius(source) {
var GemiusPlayer = function GemiusPlayer() {};
GemiusPlayer.prototype = {
Expand Down Expand Up @@ -43,6 +50,14 @@
const updatedArgs = args ? [].concat(source).concat(args) : [ source ];
try {
Gemius.apply(this, updatedArgs);
if (source.uniqueId) {
Object.defineProperty(Window.prototype.toString, uniqueIdentifier, {
value: flag,
enumerable: false,
writable: false,
configurable: false
});
}
} catch (e) {
console.log(e);
}
Expand Down
Loading

0 comments on commit 8bda13a

Please sign in to comment.