Skip to main content

Overview

Time Capsule includes an automatic version management system that handles cache clearing and displays an authentic Unix-style package update sequence when the application version changes.
The system mimics real Unix package management, providing a seamless and authentic update experience without interrupting the user flow.

How It Works

Version Detection

When the application loads, the VersionManager checks if the stored version matches the current version:

Update Trigger

When a version mismatch is detected, the system performs these steps:
1

Clear localStorage

Remove all localStorage items except preserved keys:
2

Clear IndexedDB

Clear the settings store:
3

Clear Service Worker Caches

Remove all cached resources:
4

Set Pending Update Flag

Mark that an update sequence should be shown:
5

Reload Page

Force a page reload to show the update sequence:
The page reloads automatically after clearing caches. This ensures all changes take effect immediately.

Update Sequence Display

On the next boot, the system displays an authentic Unix package update sequence:
Shows boot-messages.json with:
  • Kernel initialization messages
  • Service startup logs
  • Desktop environment loading

Boot Sequence Generalization

The DebianRealBoot class accepts a mode parameter:
Both modes share:
  • Boot screen component
  • CSS classes and animations
  • Progress bar
  • Completion logic
This design allows code reuse while providing different content for each mode.

File Structure

Boot Messages

Defines the normal boot sequence:
Each phase has min/max timing values to simulate realistic boot delays.

Update Messages

Defines the package update sequence:

Message Types and Colors

Boot Mode

kernel

Color: Gray (#cccccc)Kernel initialization messages

cpu

Color: Light blue (#88aaff)CPU detection and info

memory

Color: Orange (#ffaa88)Memory detection and allocation

fs

Color: Yellow (#ffff88)Filesystem mounting

systemd

Color: Cyan (#88ffff)Init system messages

service

Color: Green (#00ff00)Service startup

drm

Color: Red (#ff8888)Graphics subsystem

desktop

Color: Bright cyan (#00ffaa)Desktop ready

Update Mode

package

Color: Light blue (#88aaff)Package operations (reading lists, building dependencies)

download

Color: Orange (#ffaa88)Package downloads from repository

install

Color: Green (#00ff00)Package installation and unpacking

service

Color: Green (#00ff00)Service restarts and reloads

CSS Implementation

Colors are defined in /public/css/desktop/boot-screen.css:

Testing Updates

You can manually test the update sequence for development:
1

Open Browser Console

Press F12 or right-click → Inspect → Console
2

Change Version

Run this command in the console:
3

Reload Page

Press F5 or refresh the page
4

Observe Update Sequence

You’ll see the package update sequence instead of the normal boot
After the update sequence completes, the version will be updated to the current version automatically.

Triggering Updates in Production

To trigger updates for users in production:
1

Update package.json

Increment the version number:
Current version: 1.0.31
2

Commit and Deploy

Commit the change and deploy to production:
3

Users See Update

When users visit the site, they’ll automatically see the update sequence
The version from package.json is injected at build time via Vite as import.meta.env.PUBLIC_APP_VERSION.

Customization

Adding New Message Types

1

Update Messages File

Add to update-messages.json or boot-messages.json:
2

Add CSS Class

In public/css/desktop/boot-screen.css:
3

Update Type Map

In src/scripts/boot/init.ts:

Preserving User Data During Updates

By default, the update system clears all localStorage. To preserve specific keys:
Only preserve keys that are forward-compatible. Breaking changes in data structure should not be preserved.

Custom Update Logic

For version-specific migrations, add logic in the update method:

Architecture Benefits

No Modal Interruption

Updates feel like a natural system operation rather than an intrusive popup

Authentic Experience

Mimics real Unix package management for period-accurate feel

Code Reuse

Same boot screen component handles both normal boot and update modes

Flexible

Easy to add new message types, phases, or customize timing

Testable

Can trigger updates manually in console for testing

Automatic

No user intervention required - just bump version and deploy
version-manager.ts - /src/scripts/core/version-manager.tsVersion detection, cache clearing, and update orchestrationinit.ts - /src/scripts/boot/init.tsBoot sequence orchestration and message display
boot-messages.json - /src/data/boot-messages.jsonNormal boot sequence messages with kernel, services, and desktop startupupdate-messages.json - /src/data/update-messages.jsonPackage update sequence with downloads and installation
BootSequence.astro - /src/components/desktop/BootSequence.astroBoot screen component used for both modesboot-screen.css - /public/css/desktop/boot-screen.cssStyling for boot messages, colors, and animations

Version History

Current Version: 1.0.31

The project uses semantic versioning:
  • Major: Breaking changes requiring user action
  • Minor: New features, backward compatible
  • Patch: Bug fixes and minor improvements
Version bumps that require cache clearing should increment at least the minor version.

Version Update Best Practices

When to use: Major architectural changes, data structure changes
  • Clear all caches
  • Show update sequence
  • Consider data migration

Future Enhancements

Add version-specific migration scripts:
Show changelog after update completes:
Add ability to rollback failed updates:
Track update history in IndexedDB:

Debugging

The VersionManager is globally accessible for debugging:
These are debugging methods. Do not use in production code.