AdguardTeam / AdguardTeam/Scriptlets

Improve 'set-local-storage-item' — allow modifying nested properties

オープン
#502 コメント 0 件 リアクション 1 件 担当者 1 名 @slavaleleka に割り当て済み GitHub で見る
enhancement Priority: P4
主要言語
JavaScript
スター
195
フォーク
33
PR マージ指標
30日以内にマージされた PR はありません

説明

Currently, only top-level keys can be modified in local storage using the `set-local-storage-item` scriptlet. However, some applications store data in local storage by saving an object and using nested properties within it.

A good example is help.semmelweis.hu, where the result of the cookie notice is stored under the `app` key in local storage, specifically within a nested object such as `app.consentOptions.analytics`.

At the moment, there’s no way to do something like this:

```adblock
help.semmelweis.hu#%#//scriptlet('set-local-storage-item', 'app.consentOptions.functional', 'true')
help.semmelweis.hu#%#//scriptlet('set-local-storage-item', 'app.consentOptions.analytics', 'false')
help.semmelweis.hu#%#//scriptlet('set-local-storage-item', 'app.consentOptions.marketing', 'false')
```

For backward compatibility, perhaps the best option would be to add a new parameter that determines whether dots should be interpreted as nesting. The default value of this parameter would be `false`. There are two main reasons for this:
- currently, both ADG and uBO include an example in their documentation using `player.live.current.mute`, and
- there are also existing matches for the regex `'?set-local-storage-item'?, '?.*\.` in both the AdGuard Filters and uAssets.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。