2 Commits

Author SHA1 Message Date
anoracleofra-code 982a335d3f feat: add cross-platform start.sh script and update package.json for macOS/Linux
Former-commit-id: 3888c91ab3
2026-03-04 23:12:14 -07:00
anoracleofra-code 362a6e2ceb Initial commit: ShadowBroker v0.1
Former-commit-id: 8ed321f2ba
2026-03-04 22:44:08 -07:00
9 changed files with 136 additions and 15 deletions
+20 -3
View File
@@ -138,7 +138,24 @@ Built with **Next.js**, **MapLibre GL**, **FastAPI**, and **Python**, it's desig
## 🚀 Getting Started
### Prerequisites
### 📦 Quick Start (No Code Required)
If you just want to run the dashboard without dealing with terminal commands:
1. Go to the **[Releases](../../releases)** tab on the right side of this GitHub page.
2. Download the `ShadowBroker_v0.1.zip` file.
3. Extract the folder to your computer.
4. **Windows:** Double-click `start.bat`.
**Mac/Linux:** Open terminal, type `chmod +x start.sh`, and run `./start.sh`.
5. It will automatically install everything and launch the dashboard!
---
### 💻 Developer Setup
If you want to modify the code or run from source:
#### Prerequisites
- **Node.js** 18+ and **npm**
- **Python** 3.10+ with `pip`
@@ -275,8 +292,8 @@ AISSTREAM_API_KEY=your_aisstream_key # Maritime vessel tracking
N2YO_API_KEY=your_n2yo_key # Satellite position data
# Optional (enhances data quality)
OPENSKY_USERNAME=your_opensky_user # Higher rate limits for flight data
OPENSKY_PASSWORD=your_opensky_pass
OPENSKY_CLIENT_ID=your_opensky_client_id # Higher rate limits for flight data
OPENSKY_CLIENT_SECRET=your_opensky_secret
LTA_ACCOUNT_KEY=your_lta_key # Singapore CCTV cameras
```
+1
View File
@@ -0,0 +1 @@
ba57965389036194d6dd60e6de33d2e1e1bbf20b
@@ -1 +1 @@
83ba61e7af89c1dc7b4d9b972e08d3edf3493966
5d33551b09405e7e252c6a11f080a6c9eca50f6b
+1 -1
View File
@@ -73,7 +73,7 @@ class OpenSkyClient:
# User provided credentials
opensky_client = OpenSkyClient(
client_id=os.environ.get("OPENSKY_CLIENT_ID", "vancecook-api-client"),
client_secret=os.environ.get("OPENSKY_CLIENT_SECRET", "0hWKkj1lpZItUMo2usi4YUjqu8I8YOoD")
client_secret=os.environ.get("OPENSKY_CLIENT_SECRET", "YOUR_OPENSKY_SECRET")
)
# Throttling and caching for OpenSky to observe the 400 req/day limit
+37
View File
@@ -0,0 +1,37 @@
import os
import zipfile
zip_name = 'ShadowBroker_v0.1.zip'
if os.path.exists(zip_name):
try:
os.remove(zip_name)
except Exception as e:
print(f"Failed to delete old zip: {e}")
def add_dir(zipf, dir_path, excludes):
for root, dirs, files in os.walk(dir_path):
dirs[:] = [d for d in dirs if d not in excludes]
for f in files:
file_path = os.path.join(root, f)
zipf.write(file_path, arcname=file_path)
try:
with zipfile.ZipFile(zip_name, 'w', zipfile.ZIP_DEFLATED) as zipf:
print("Zipping backend...")
add_dir(zipf, 'backend', {'venv', '__pycache__'})
print("Zipping frontend...")
add_dir(zipf, 'frontend', {'node_modules', '.next'})
print("Zipping root files...")
zipf.write('docker-compose.yml')
zipf.write('start.bat')
zipf.write('start.sh')
zipf.write('README.md')
final_size = os.path.getsize(zip_name) / (1024 * 1024)
print(f"\n✅ SUCCESS! Created {zip_name}. Final size: {final_size:.2f} MB")
except Exception as e:
print(f"\n❌ ERROR creating zip: {e}")
+2 -2
View File
@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "concurrently --names \"NEXT,API\" --prefix-colors \"cyan,yellow\" \"next dev\" \"cd ../backend && venv\\Scripts\\python.exe main.py\"",
"dev": "concurrently \"npm run dev:frontend\" \"cd ../backend && python -m uvicorn main:app --reload\"",
"dev:frontend": "next dev",
"dev:backend": "cd ../backend && venv\\Scripts\\python.exe main.py",
"build": "next build",
@@ -37,4 +37,4 @@
"tailwindcss": "^4",
"typescript": "^5"
}
}
}
+1 -8
View File
@@ -95,14 +95,7 @@ export default function CesiumViewer({ data, activeLayers, activeFilters, effect
viewerRef.current.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(-95.0, 39.0, 20000000.0)
});
// Add TomTom Traffic Flow Layer (Raster)
const trafficProvider = new Cesium.UrlTemplateImageryProvider({
url: "https://api.tomtom.com/traffic/map/4/tile/flow/relative/{z}/{x}/{y}.png?key=uLndz1KvLDpwetYRwoiw8wKwk9i23sWG",
credit: ""
});
viewerRef.current.trafficLayer = viewerRef.current.imageryLayers.addImageryProvider(trafficProvider);
viewerRef.current.trafficLayer.show = false; // default off
// Add Google Photorealistic 3D Tiles if available, otherwise fallback to base
// ── Primitive Collections for Fast Rendering ──
const Cesium2 = (window as any).Cesium;
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
echo "======================================================="
echo " S H A D O W B R O K E R - macOS / Linux Start "
echo "======================================================="
echo ""
# Check for Node.js
if ! command -v npm &> /dev/null; then
echo "[!] ERROR: npm is not installed. Please install Node.js (https://nodejs.org/)"
exit 1
fi
# Check for Python
if ! command -v python3 &> /dev/null; then
echo "[!] ERROR: python3 is not installed. Please install Python 3.10+ (https://python.org/)"
exit 1
fi
echo "[*] Setting up Backend Environment..."
cd backend
if [ ! -d "venv" ]; then
echo "[*] Creating Python Virtual Environment..."
python3 -m venv venv
fi
echo "[*] Installing Backend dependencies..."
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then
# In case someone runs this in Git Bash on Windows
source venv/Scripts/activate
else
source venv/bin/activate
fi
pip install -r requirements.txt
cd ..
echo "[*] Setting up Frontend Environment..."
cd frontend
if [ ! -d "node_modules" ]; then
echo "[*] Installing Frontend dependencies..."
npm install
fi
echo ""
echo "======================================================="
echo " 🚀 Starting Services... "
echo " Dashboard will be available at: http://localhost:3000"
echo " Keep this window open! Note: Initial load takes ~10s "
echo "======================================================="
echo ""
# Start both services (npm run dev automatically calls the python backend on Mac/Linux if scripts are configured cross-platform)
npm run dev
+21
View File
@@ -0,0 +1,21 @@
import os
import zipfile
def create_clean_zip():
zip_name = 'ShadowBroker_v0.1.zip'
exclude_dirs = {'.git', 'node_modules', 'venv', '.next', '__pycache__'}
exclude_files = {zip_name, 'zip_repo.py', '.env', '.env.local'}
with zipfile.ZipFile(zip_name, 'w', zipfile.ZIP_DEFLATED) as zipf:
for root, dirs, files in os.walk('.'):
dirs[:] = [d for d in dirs if d not in exclude_dirs]
for file in files:
if file in exclude_files:
continue
file_path = os.path.join(root, file)
arcname = os.path.relpath(file_path, '.')
zipf.write(file_path, arcname)
print(f"Created {zip_name} successfully!")
if __name__ == '__main__':
create_clean_zip()