Optional per-user browser storage state persistence for camofox-browser.
Saves and restores cookies + localStorage across session restarts, container deploys, and idle timeouts using Playwright's storageState API.
In camofox.config.json:
{
"plugins": {
"persistence": {
"enabled": true,
"profileDir": "/data/profiles"
}
}
}Or override via environment variable:
CAMOFOX_PROFILE_DIR=/data/profiles
- Session create: If a persisted
storageStateexists for theuserId, it's restored into the new Playwright context. - First run: If no persisted state exists, bootstrap cookies from
CAMOFOX_COOKIES_DIR/cookies.txtare imported (if present). - Cookie import / session close / shutdown: Storage state is checkpointed to disk via atomic tmp-write + rename.
- User isolation: Each
userIdmaps to a deterministic SHA256-hashed subdirectory underprofileDir, so arbitrary userIds are path-safe.
When running with Docker, mount the profile directory as a volume:
docker run -d \
-p 9377:9377 \
-v /host/profiles:/data/profiles \
camofox-browserBased on PR #62 by company8.