Skip to main content

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:

StoreKey in localStoragePurpose
braincandyConfigbraincandyConfigSaves all configuration page settings
sessionsessionSaves 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:

  1. URL parameters (highest priority) — If a ?config=... parameter is present, it overrides everything
  2. localStorage — If no URL parameters exist, settings are loaded from the saved config
  3. 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:

KeyFull NameExample Value
sScreens4
spSpeed10
beBeat Meter Enabledtrue
bminBeat Meter Min BPM30
bmaxBeat Meter Max BPM240
bsBeat Meter Soundtrue
mtMedia Types"igvr" (i=image, g=gif, v=video, r=redgifs)
srSubreddits["nsfw", "legalteens"]
soSort"hot"
tTime"day"
mMode"source-rotation"
info

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:

CharacterType
iImage
gGIF
vVideo
rRedgifs

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:

  1. The age check middleware detects they haven't verified their age
  2. The URL query parameters (including config) are preserved in the redirect
  3. 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:

SettingDefault
Screens1
Speed10 seconds
Beat MeterEnabled
Beat Meter Min BPM30
Beat Meter Max BPM240
Beat Meter SoundOn
PixelationDisabled
Pixelation Level4
Media TypesAll enabled (image, gif, video, redgifs)
SubredditsNone
Selected PresetsNone
SortHot
TimeDay
ModeSource 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.