mirror of
https://github.com/kennethreitz/kjvstudy.org.git
synced 2026-06-05 23:00:16 +00:00
79dfd14400
Introduces a complete Tauri v2 project structure for building a native macOS desktop application. The app runs FastAPI as a sidecar process on port 31102 (number of KJV verses) and renders the existing web UI in a native WebKit webview. Key additions: - src-tauri/: Complete Tauri configuration and Rust source - Desktop entry point (kjvstudy_org/desktop.py) - PyInstaller bundling script for Python sidecar - Desktop-specific pyproject.toml without WeasyPrint - App icons for macOS (.icns) and Windows (.ico) - Makefile.desktop with build targets - Comprehensive DESKTOP.md documentation WeasyPrint is intentionally excluded from the desktop build to avoid native library bundling complexity. PDF buttons are automatically hidden when WeasyPrint is unavailable (existing graceful degradation). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
"""Desktop application entry point for KJV Study.
|
|
|
|
This module provides a standalone entry point for the desktop application,
|
|
configured to run on a non-standard port (31102 - the number of verses in the KJV).
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
|
|
|
|
def main():
|
|
"""Start the KJV Study server for desktop use."""
|
|
import uvicorn
|
|
|
|
# Get port from environment or use default (31102 = number of KJV verses)
|
|
port = int(os.environ.get("KJVSTUDY_PORT", "31102"))
|
|
host = os.environ.get("KJVSTUDY_HOST", "127.0.0.1")
|
|
|
|
# Determine the base directory for resources
|
|
if getattr(sys, "frozen", False):
|
|
# Running as bundled executable (PyInstaller)
|
|
base_dir = os.path.dirname(sys.executable)
|
|
else:
|
|
# Running as script
|
|
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
# Change to base directory so relative paths work
|
|
os.chdir(base_dir)
|
|
|
|
print(f"Starting KJV Study server on {host}:{port}")
|
|
print(f"Base directory: {base_dir}")
|
|
|
|
uvicorn.run(
|
|
"kjvstudy_org.server:app",
|
|
host=host,
|
|
port=port,
|
|
log_level="warning",
|
|
# Disable reload in production
|
|
reload=False,
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|