Skip to content

Commit

Permalink
AG-33558 Improve 'set-cookie' — add more supported values. #433
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 2ca4790
Merge: 4822423 15a2d8f
Author: Adam Wróblewski <adam@adguard.com>
Date:   Mon Jul 8 12:29:36 2024 +0200

    Merge branch 'master' into fix/AG-33558

commit 4822423
Author: Adam Wróblewski <adam@adguard.com>
Date:   Fri Jul 5 12:06:10 2024 +0200

    Add new values to `set-cookie` and `set-cookie-reload` scriptlets: `hide`, `hidden`
  • Loading branch information
AdamWr committed Jul 8, 2024
1 parent 15a2d8f commit 3e21a5a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic

### Added

- new values to `set-cookie` and `set-cookie-reload` scriptlets: `hide`, `hidden` [#433]
- new values to `set-local-storage-item` and `set-session-storage-item` scriptlets:
`accept`, `accepted`, `reject`, `rejected` [#429]
- ability to log original and modified content in `trusted-replace-node-text`, `xml-prune`, `m3u-prune`,
Expand All @@ -21,6 +22,7 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic
- Log message format [CoreLibs#180]

[Unreleased]: https://github.com/AdguardTeam/Scriptlets/compare/v1.11.1...HEAD
[#433]: https://github.com/AdguardTeam/Scriptlets/issues/433
[#429]: https://github.com/AdguardTeam/Scriptlets/issues/429
[#411]: https://github.com/AdguardTeam/Scriptlets/issues/411
[CoreLibs#180]: https://github.com/AdguardTeam/CoreLibs/issues/180
Expand Down
2 changes: 2 additions & 0 deletions src/helpers/cookie-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ export const getLimitedCookieValue = (value: string): string | number | null =>
'disabled',
'necessary',
'required',
'hide',
'hidden',
]);

let validValue;
Expand Down
1 change: 1 addition & 0 deletions src/scriptlets/set-cookie-reload.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
* - `enable` / `enabled`
* - `disable` / `disabled`
* - `necessary` / `required`
* - `hide` / `hidden`
* - `path` — optional, cookie path, defaults to `/`; possible values:
* - `/` — root path
* - `none` — to set no path at all
Expand Down
1 change: 1 addition & 0 deletions src/scriptlets/set-cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
* - `enable` / `enabled`
* - `disable` / `disabled`
* - `necessary` / `required`
* - `hide` / `hidden`
* - `path` — optional, cookie path, defaults to `/`; possible values:
* - `/` — root path
* - `none` — to set no path at all
Expand Down
2 changes: 2 additions & 0 deletions tests/scriptlets/set-cookie.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ const cookies = [
['__test-cookie_disabled', 'disabled'],
['__test-cookie_necessary', 'necessary'],
['__test-cookie_required', 'required'],
['__test-cookie_required', 'hide'],
['__test-cookie_required', 'hidden'],
];

test.each('Set cookie with valid value', cookies, (assert, [cName, cValue]) => {
Expand Down

0 comments on commit 3e21a5a

Please sign in to comment.