Sample CLI
gway web.cookies update-mask-on-cookie-change
Full Code
def update_mask_on_cookie_change():
"""
Called when any cookie is set or removed, to update the mask record (if any) in masks.cdv.
"""
mask = get("mask")
if mask:
norm = _normalize_mask(mask)
if not norm:
return
mask_map = _read_masks()
current = {k: v for k, v in _get_current_cookies().items() if k not in ("mask", "cookies_accepted")}
mask_map[norm] = current
_write_masks(mask_map)