mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-02-04 19:28:52 -06:00
- Add build troubleshooting and Windows-specific guides - Document branding guidelines and asset management - Add desktop build configuration documentation - Include symlink and OneDrive fix guides - Add code signing and permissions documentation - Document quick start guides for various scenarios
4.7 KiB
4.7 KiB
Desktop App Settings Configuration
The TimeTracker desktop app includes a comprehensive settings system that allows users to configure the server URL and API token.
Settings Location
Settings are stored using Electron's secure storage (electron-store), which saves data in a JSON file in the user's application data directory:
- Windows:
%APPDATA%\timetracker-desktop\config.json - macOS:
~/Library/Application Support/timetracker-desktop/config.json - Linux:
~/.config/timetracker-desktop/config.json
Settings Access
Users can access settings in two ways:
1. Settings Screen (In-App)
- Open the TimeTracker desktop app
- Click on "Settings" in the navigation menu
- The settings screen will display:
- Server URL: Current server URL (editable)
- API Token: Masked API token (editable)
- Save Settings button: Saves the configuration
- Test Connection button: Validates the connection
2. Command Line Arguments
The server URL can be set via command line when launching the app:
# Windows
TimeTracker.exe --server-url https://your-server.com
# Linux/macOS
./TimeTracker --server-url https://your-server.com
3. Environment Variable
The server URL can also be set via environment variable:
# Windows
set TIMETRACKER_SERVER_URL=https://your-server.com
TimeTracker.exe
# Linux/macOS
export TIMETRACKER_SERVER_URL=https://your-server.com
./TimeTracker
Settings Features
Server URL Configuration
- Validation: The app validates that the URL is properly formatted (must start with
http://orhttps://) - Persistence: Server URL is saved to secure storage and persists across app restarts
- Change Detection: The app automatically reinitializes the API client when the server URL changes
API Token Configuration
- Security: API tokens are stored securely using Electron's secure storage
- Masking: Existing tokens are displayed as
••••••••for security - Validation: Tokens must start with
tt_to be considered valid - Update: Users can update their API token without re-entering the server URL
Connection Testing
The settings screen includes a "Test Connection" button that:
- Validates the server URL format
- Tests the API token against the server
- Provides immediate feedback on connection status
- Shows success/error messages
Settings File Structure
The settings file (config.json) contains:
{
"server_url": "https://your-server.com",
"api_token": "tt_your_api_token_here"
}
Implementation Details
Settings Loading
When the settings view is opened:
- The app loads current settings from secure storage
- Server URL is displayed in the input field
- API token is masked if it exists
- Settings are ready for editing
Settings Saving
When "Save Settings" is clicked:
- Server URL is validated
- API token is validated (if changed)
- Settings are saved to secure storage
- API client is reinitialized with new settings
- Connection is automatically tested
- Success/error message is displayed
Settings Validation
- Server URL: Must be a valid HTTP/HTTPS URL
- API Token: Must start with
tt_and be non-empty - Connection: Server must be reachable and token must be valid
Security Considerations
- Secure Storage: Settings are stored using Electron's secure storage, which provides encryption on some platforms
- Token Masking: API tokens are masked when displayed (
••••••••) - No Plain Text Logging: API tokens are never logged to console or files
- Local Storage Only: Settings are stored locally and never transmitted except to the configured server
Troubleshooting
Settings Not Saving
- Check that the app has write permissions to the application data directory
- Verify that the server URL is a valid HTTP/HTTPS URL
- Ensure the API token starts with
tt_
Connection Test Fails
- Verify the server URL is correct and accessible
- Check that the API token is valid and not expired
- Ensure the server is running and the API is accessible
- Check network connectivity and firewall settings
Settings File Location
To manually edit or backup settings:
Windows:
%APPDATA%\timetracker-desktop\config.json
macOS:
~/Library/Application Support/timetracker-desktop/config.json
Linux:
~/.config/timetracker-desktop/config.json
Code References
- Settings UI:
desktop/src/renderer/index.html(settings view) - Settings Logic:
desktop/src/renderer/js/app.js(loadSettings, handleSaveSettings, handleTestConnection) - Storage:
desktop/src/shared/config.js(storeGet, storeSet, storeDelete, storeClear) - Main Process:
desktop/src/main/main.js(command line argument parsing)