-
Notifications
You must be signed in to change notification settings - Fork 0
File Formats
Last updated: 12/23/2025
NaviDuck utilizes structured file formats for persistent storage of configuration, user data, and application state. All files are stored in JSON format with UTF-8 encoding to ensure cross-platform compatibility and human readability.
Stores user preferences and application settings that persist between sessions.
-
Linux/macOS:
~/.naviduck_config.json -
Windows:
C:\Users\<username>\.naviduck_config.json
{
"version": "3.0.0",
"default_engine": "brave",
"use_emoji": false,
"engines": {
"ddg": true,
"ddg_api": true,
"google": true,
"wikipedia": true,
"brave": true
},
"display": {
"max_results": 10,
"show_icons": true,
"color_scheme": "default"
},
"network": {
"timeout": 30,
"max_retries": 3,
"use_system_proxy": false
}
}| Field | Type | Default | Description |
|---|---|---|---|
version |
string | "3.0.0" | Configuration file version |
default_engine |
string | "brave" | Primary search engine identifier |
use_emoji |
boolean | false | Display emoji instead of Nerd Font icons |
engines |
object | all true | Enabled/disabled status per search engine |
display.max_results |
integer | 10 | Maximum results to display per search |
display.show_icons |
boolean | true | Show icons in interface |
display.color_scheme |
string | "default" | Color theme identifier |
network.timeout |
integer | 30 | Request timeout in seconds |
network.max_retries |
integer | 3 | Maximum retry attempts |
network.use_system_proxy |
boolean | false | Use system proxy settings |
- Configuration is loaded at application startup and saved on clean exit
- Changes take effect immediately for most settings
- Missing fields revert to defaults
- File is created with defaults if missing
Stores user-generated content: browsing history, bookmarks, and session data.
-
Linux/macOS:
~/.naviduck_data.json -
Windows:
C:\Users\<username>\.naviduck_data.json
{
"history": [
{
"type": "search",
"query": "python tutorial",
"engine": "brave",
"timestamp": "2025-12-22T14:30:45.123456",
"results": 8
},
{
"type": "visit",
"url": "https://example.com",
"title": "Example Domain",
"timestamp": "2025-12-22T14:35:22.987654",
"tor": false
}
],
"bookmarks": [
{
"title": "Python Documentation",
"url": "https://docs.python.org",
"added": "2025-12-20T09:15:30.000000",
"tags": ["programming", "documentation"]
}
],
"cache": {
"last_search": "python tutorial",
"last_results": [
{
"title": "Python Tutorial",
"url": "https://python.org/tutorial",
"snippet": "Official Python tutorial...",
"engine": "brave"
}
]
}
}| Field | Type | Required | Description |
|---|---|---|---|
type |
string | yes | "search" or "visit" |
query |
string | conditional | Search query (for type="search") |
engine |
string | conditional | Search engine (for type="search") |
url |
string | conditional | URL visited (for type="visit") |
title |
string | conditional | Page title (for type="visit") |
timestamp |
string | yes | ISO 8601 format with microseconds |
results |
integer | optional | Number of results found |
tor |
boolean | optional | Whether Tor was used |
| Field | Type | Required | Description |
|---|---|---|---|
title |
string | yes | Bookmark title (max 80 chars) |
url |
string | yes | Full URL |
added |
string | yes | ISO 8601 timestamp |
tags |
array | optional | User-defined tags |
| Field | Type | Description |
|---|---|---|
last_search |
string | Most recent search query |
last_results |
array | Cached search results |
- History is limited to 100 most recent entries (FIFO)
- Bookmarks have no practical limit
- Cache is temporary and may be cleared
- Data is saved incrementally during operation
Temporary storage for Tor process data when using built-in Tor functionality.
Temporary directory with prefix naviduck_tor_ (OS-specific):
-
Linux/macOS:
/tmp/naviduck_tor_XXXXXX -
Windows:
C:\Users\<username>\AppData\Local\Temp\naviduck_tor_XXXXXX
- Tor configuration files
- Identity data
- Log files (if enabled)
- Cache data
- Created when Tor starts via
tor startcommand - Automatically cleaned up on Tor stop or application exit
- Contains no persistent user data
- May contain identifiable network information
Files are created automatically when needed:
- Check if file exists at standard location
- Create with default schema if missing
- Set appropriate file permissions (600 on Unix-like systems)
- Write initial data
def load_config():
try:
with open(config_path, 'r', encoding='utf-8') as f:
return json.load(f)
except FileNotFoundError:
return create_default_config()
except json.JSONDecodeError:
return handle_corrupted_config()def save_config(config):
try:
# Create backup of existing file
if os.path.exists(config_path):
shutil.copy2(config_path, config_path + '.backup')
# Write new configuration
with open(config_path, 'w', encoding='utf-8') as f:
json.dump(config, f, indent=2, ensure_ascii=False)
# Set secure permissions
os.chmod(config_path, 0o600)
except Exception as e:
logger.error(f"Failed to save config: {e}")
# Attempt to restore from backupAll files are validated on load:
- JSON syntax validation
- Schema validation (required fields, types)
- Value range checking
- Security checks (no executable content)
- Configuration and data files: 600 (owner read/write only)
- Temporary files: Default system temporary permissions
- Backup files: Same as original files
- No encryption at rest (plain JSON)
- Sensitive data minimization
- No passwords or API keys stored
- Tor identity data in temporary directories only
- JSON format prevents binary corruption
- Schema validation on load
- Automatic backup before overwrites
- Fallback to defaults on corruption
Each configuration file includes a version field to handle schema changes.
- Detect version mismatch
- Apply migration transforms if available
- Update version field
- Save migrated configuration
- New fields added with defaults
- Obsolete fields ignored but preserved
- Major version changes may require manual intervention
- Migration scripts provided for significant changes
| Issue | Symptoms | Resolution |
|---|---|---|
| Corrupted JSON | Application fails to start | Delete file (will be recreated) or restore backup |
| Permission denied | Cannot save settings | Check file ownership and permissions (should be 600) |
| Invalid schema | Settings not loading | Check version compatibility or reset to defaults |
| Disk full | Save operations fail | Free disk space or change storage location |
- Automatic: Delete corrupted file → fresh start with defaults
- Manual: Edit JSON file with text editor
-
Backup: Restore from
*.backupfile -
Reset: Use
naviduck --reset-config(if implemented)
Enable verbose logging to see file operations:
NAVIDUCK_DEBUG=1 python naviduck.py- Backup configuration before major updates
- Version control configuration if customizing extensively
- Report corrupted files as bugs
- Use secure locations for sensitive data
- Always validate before use
- Provide migration paths
- Maintain backward compatibility when possible
- Document schema changes
- Handle errors gracefully
- Monitor disk usage for Tor temporary files
- Set appropriate ulimits for file descriptors
- Consider location for multi-user systems
- Audit configuration for security compliance
- Optional encryption for sensitive data
- Cloud synchronization support
- Import/export functionality
- Configuration profiles
- Advanced backup strategies
No current deprecations. Schema changes will be announced with:
- 6 months notice for breaking changes
- Migration tools provided
- Dual support during transition periods
Last updated: 12/23/2025
File Formats version: 3.0.0