5cec57e06d
Testing / remote-protocol-compat (0.9.3) (push) Successful in 40s
Testing / remote-protocol-compat (0.9.5) (push) Successful in 38s
Testing / test (push) Failing after 1m3s
Package Extension / package-extension (push) Successful in 29s
Build & Publish Package / publish (push) Successful in 33s
- Add safe-by-default policy gates for raw command surfaces: command, script, and serve-http /command. - Require explicit opt-ins for page reads, browser control, and high-risk commands such as dom.eval, storage.*, and screenshots. - Remove all cookies support from CLI, SDK, extension commands, permissions, constants, docs, and tests. - Add diagnostic, events, watch, workspace, remote, raw command, script, HTTP gateway, tree-view, session import/export, and extension info/capability commands. - Add Chrome Web Store packaging that strips manifest.key while keeping local packages with a stable native-messaging extension ID. - Bump browser-cli and extension version to 0.14.1 and cover the new behavior with pytest and extension packaging tests. BREAKING CHANGE: cookies commands and the b.cookies SDK namespace have been removed; generic raw command execution now blocks non-safe commands unless explicitly allowed.
38 lines
930 B
Python
38 lines
930 B
Python
"""Storage namespace: ``b.storage.*``."""
|
|
from __future__ import annotations
|
|
|
|
from browser_cli.sdk.base import Namespace, sdk_command
|
|
|
|
class StorageNS(Namespace):
|
|
"""Read and write localStorage / sessionStorage."""
|
|
|
|
@sdk_command("storage.get", lambda self, key=None, *, type="local", tab_id=None: {
|
|
"key": key,
|
|
"type": type,
|
|
"tabId": tab_id,
|
|
})
|
|
def get(
|
|
self,
|
|
key: str | None = None,
|
|
*,
|
|
type: str = "local",
|
|
tab_id: int | None = None,
|
|
) -> str | dict | None:
|
|
"""Get a localStorage/sessionStorage entry (or all entries if key omitted)."""
|
|
|
|
@sdk_command("storage.set", lambda self, key, value, *, type="local", tab_id=None: {
|
|
"key": key,
|
|
"value": value,
|
|
"type": type,
|
|
"tabId": tab_id,
|
|
})
|
|
def set(
|
|
self,
|
|
key: str,
|
|
value: str,
|
|
*,
|
|
type: str = "local",
|
|
tab_id: int | None = None,
|
|
) -> None:
|
|
"""Set a localStorage/sessionStorage entry."""
|