Sharing & Persistence
Braincandy automatically saves your configuration and generates shareable URLs so you can restore your settings or share them with others.
Configuration Persistence (LocalStorage)
Your entire configuration is automatically saved to your browser's localStorage every time you change a setting or start a session. This means:
- When you return to Braincandy later, all your settings are restored exactly as you left them
- This includes: screen count, speed, beat meter settings, pixelation settings, selected media types, subreddits, presets, sort/time/mode options
- No account or login is needed — persistence is handled entirely in the browser
How It Works
Braincandy uses two Pinia stores with the pinia-plugin-persistedstate module:
| Store | Key in localStorage | Purpose |
|---|---|---|
| braincandyConfig | braincandyConfig | Saves all configuration page settings |
| session | session | Saves session state (media pool, favorites, stats, etc.) |
Both stores are configured with persist: true, which means all state is automatically serialized to and restored from localStorage without any manual code.
Loading Priority
When the configuration page loads, settings are restored in the following priority order:
- URL parameters (highest priority) — If a
?config=...parameter is present, it overrides everything - localStorage — If no URL parameters exist, settings are loaded from the saved config
- Defaults — If neither URL nor localStorage has data, defaults are used
Shareable Configuration URLs
Every change you make on the configuration page is automatically encoded into the URL as a query parameter. This lets you:
- Copy the URL from your browser's address bar and share it
- Bookmark a specific configuration
- Send a link to someone who will get your exact setup
URL Format
The configuration is encoded as a Base64 JSON string in the config query parameter:
https://braincandy.fapstats.com?config=eyJzIjoxLCJzcCI6MTAsImJlIjp0cnVlLC4uLn0=
Encoded Fields
The following settings are encoded in the URL:
| Key | Full Name | Example Value |
|---|---|---|
s | Screens | 4 |
sp | Speed | 10 |
be | Beat Meter Enabled | true |
bmin | Beat Meter Min BPM | 30 |
bmax | Beat Meter Max BPM | 240 |
bs | Beat Meter Sound | true |
mt | Media Types | "igvr" (i=image, g=gif, v=video, r=redgifs) |
sr | Subreddits | ["nsfw", "legalteens"] |
so | Sort | "hot" |
t | Time | "day" |
m | Mode | "source-rotation" |
Selected presets are not encoded separately in the URL because they are derived from the subreddit list. When loading a URL config, the preset buttons will appear active if all their subreddits are present.
Media Type Encoding
Media types are encoded as a compact string where each character represents an enabled type:
| Character | Type |
|---|---|
i | Image |
g | GIF |
v | Video |
r | Redgifs |
For example, "igvr" means all types are enabled. "iv" means only images and videos are enabled.
URL Updates
The URL is updated using window.history.replaceState(), which means:
- The URL changes without adding entries to the browser history
- You won't end up with a long history of URL changes when tweaking settings
- The URL is always in sync with your current configuration
Age Check Preservation
If you share a Braincandy URL with someone who hasn't passed the age check yet:
- The age check middleware detects they haven't verified their age
- The URL query parameters (including
config) are preserved in the redirect - After confirming their age, they are redirected to the configuration page with the shared settings intact
Default Configuration
The default configuration (used when no saved or URL config exists) is:
| Setting | Default |
|---|---|
| Screens | 1 |
| Speed | 10 seconds |
| Beat Meter | Enabled |
| Beat Meter Min BPM | 30 |
| Beat Meter Max BPM | 240 |
| Beat Meter Sound | On |
| Pixelation | Disabled |
| Pixelation Level | 4 |
| Media Types | All enabled (image, gif, video, redgifs) |
| Subreddits | None |
| Selected Presets | None |
| Sort | Hot |
| Time | Day |
| Mode | Source Rotation |
You can reset to these defaults at any time by clicking the "Reset to Defaults" button on the configuration page. This button is only enabled when the current configuration differs from the defaults.
Favorites Persistence
During a session, any items you mark as favorites are stored in the session store, which persists to localStorage. This means:
- If you accidentally close the browser during a session, your favorites are not lost
- After ending a session, favorites are captured in the stats snapshot and displayed on the statistics page
- When you start a new session (or click "Start New Session"), favorites are cleared as part of the session reset
Next: Check out the FAQ & Tips guide for common questions and advanced tips.