# Electron Auto-Updates Configuration

**Author**: Matthew Raymer  
**Date**: 2025-07-12  
**Status**: **DISABLED** - Manual Updates Only

## Overview

TimeSafari's Electron application currently has auto-updates disabled due to hosting on Gitea instead of GitHub. This document explains the current configuration and provides guidance for future update mechanisms.

## Current Status

### Auto-Updates Disabled

Auto-updates are currently disabled for the following reasons:

1. **Repository Hosting**: The project is hosted on Gitea (`https://gitea.anomalistdesign.com/trent_larson/crowd-funder-for-time-pwa`) rather than GitHub
2. **Provider Limitations**: `electron-updater` primarily supports GitHub, S3, and other major cloud providers
3. **404 Errors**: Attempting to use GitHub auto-updates with a Gitea repository causes 404 errors

### Configuration Changes Made

1. **Repository URL Updated**: Changed from `https://github.com/trentlarson/crowd-master` to the correct Gitea URL
2. **Publish Configuration Removed**: Removed GitHub provider from `electron-builder.config.json`
3. **Auto-Updater Disabled**: Commented out auto-updater code in `electron/src/index.ts`

## Error Resolution

The original error:
```
HttpError: 404 
"method: GET url: https://github.com/trentlarson/crowd-master/releases.atom"
```

This occurred because:
- The app was trying to check for updates on GitHub
- The repository doesn't exist on GitHub
- The auto-updater was configured for GitHub releases

## Future Update Options

### Option 1: Manual Distribution
- Build and distribute packages manually
- Users download and install new versions manually
- No automatic update checking

### Option 2: Custom Update Server
- Implement a custom update server compatible with `electron-updater`
- Host update files on a web server
- Configure custom update endpoints

### Option 3: GitHub Migration
- Move repository to GitHub
- Set up GitHub releases
- Re-enable auto-updates

### Option 4: Alternative Update Providers
- Use S3 or other supported providers
- Implement custom update mechanism
- Use third-party update services

## Current Build Process

### Development Builds
```bash
npm run build:electron:dev
```

### Production Builds
```bash
npm run build:electron:prod
```

### Package Distribution
```bash
# Windows
npm run build:electron:windows:prod

# macOS
npm run build:electron:mac:prod

# Linux
npm run build:electron:linux:prod
```

## Manual Update Process

1. **Build New Version**: Use appropriate build script
2. **Test Package**: Verify the built package works correctly
3. **Distribute**: Share the package with users
4. **User Installation**: Users manually download and install

## Security Considerations

### Disabled Auto-Updates
- No automatic security updates
- Users must manually update for security patches
- Consider implementing update notifications

### Package Verification
- Verify package integrity before distribution
- Use code signing for packages
- Implement checksum verification

## Monitoring and Maintenance

### Version Tracking
- Track application versions manually
- Document changes between versions
- Maintain changelog for users

### User Communication
- Notify users of available updates
- Provide clear update instructions
- Document breaking changes

## Recommendations

### Short Term
1. Continue with manual distribution
2. Implement update notifications in-app
3. Provide clear update instructions

### Long Term
1. Evaluate hosting platform options
2. Consider implementing custom update server
3. Plan for automated update mechanism

## Configuration Files

### electron-builder.config.json
```json
{
  "appId": "app.timesafari.desktop",
  "productName": "TimeSafari",
  // publish configuration removed
}
```

### electron/src/index.ts
```typescript
// Auto-updater disabled
// import { autoUpdater } from 'electron-updater';

// Auto-updates disabled - not supported on Gitea hosting
// if (!electronIsDev && !process.env.APPIMAGE) {
//   try {
//     autoUpdater.checkForUpdatesAndNotify();
//   } catch (error) {
//     console.log('Update check failed (suppressed):', error);
//   }
// }
```

## Troubleshooting

### Common Issues

1. **404 Errors**: Ensure repository URL is correct
2. **Build Failures**: Check build configuration
3. **Package Issues**: Verify package contents

### Debug Mode
```bash
# Enable debug logging
DEBUG=* npm run build:electron:dev
```

---

**Status**: Auto-updates disabled  
**Last Updated**: 2025-07-12  
**Version**: 1.0  
**Maintainer**: Matthew Raymer 