"""Enhanced Dashboard configuration v2."""
from dataclasses import dataclass, field
from typing import Optional, List, Dict
import json
import os
@dataclass
class Service:
name: str
url: str
ip: str
port: int
category: str
icon: str = "server"
favorite: bool = False
critical: bool = False
group: Optional[str] = None
# Proxmox configuration
PROXMOX_NODES = [
{"name": "empire", "ip": "192.168.1.75", "port": 8006},
{"name": "republic", "ip": "192.168.1.80", "port": 8006},
{"name": "Jedi", "ip": "192.168.1.40", "port": 8006},
{"name": "hoth", "ip": "192.168.1.76", "port": 8006},
]
PROXMOX_API_TOKEN = "root@pam!dashboard"
PROXMOX_API_SECRET = "edb7e222-f45d-4b15-8089-0c7eee397ab5"
# PBS configuration
PBS_URL = "https://192.168.1.159:8007"
PBS_API_TOKEN = "root@pam!dashboard"
PBS_API_SECRET = "edb7e222-f45d-4b15-8089-0c7eee397ab5"
# OPNsense configuration
OPNSENSE_URL = "https://192.168.1.1"
OPNSENSE_API_KEY = ""
OPNSENSE_API_SECRET = ""
# Prometheus configuration
PROMETHEUS_URL = "http://192.168.1.163:9090"
# Camera configuration
GO2RTC_URL = "http://192.168.1.241:1985"
CAMERAS = ["FPE", "Front_Porch", "Driveway", "Driveway_door", "Backyard", "House_side", "Street_side", "Porch_Downstairs"]
# Sabnzbd configuration
SABNZBD_URL = "http://192.168.1.66:7777"
SABNZBD_API_KEY = ""
# Uptime Kuma configuration
UPTIME_KUMA_URL = "http://192.168.1.155:3001"
UPTIME_KUMA_STATUS_PAGE = "uptime"
# Docker hosts
DOCKER_HOSTS = [
{"name": "c3p0", "ip": "192.168.1.54", "port": 2375},
{"name": "frigate", "ip": "192.168.1.241", "port": 2375},
]
# Service groups
SERVICE_GROUPS = {
"Arr Stack": ["Radarr", "Sonarr", "Lidarr", "Prowlarr", "Sabnzbd"],
"Media Players": ["Jellyfin", "Jellyseerr", "Tdarr"],
"Cameras": ["Frigate", "go2rtc"],
}
# Icon SVG paths
SERVICE_ICONS = {
"shield": '',
"globe": '',
"archive": '',
"lock": '',
"film": '',
"star": '',
"video": '',
"tv": '',
"music": '',
"search": '',
"download": '',
"cog": '',
"chart": '',
"heartbeat": '',
"key": '',
"git": '',
"workflow": '',
"book": '',
"image": '',
"brain": '',
"home": '',
"camera": '',
"message": '',
"server": '',
"database": '',
}
# Services
SERVICES = [
Service("OPNsense", "https://192.168.1.1", "192.168.1.1", 443, "Infrastructure", "shield", critical=True),
Service("NPM", "https://192.168.1.38:81", "192.168.1.38", 81, "Infrastructure", "globe", critical=True),
Service("PBS", "https://192.168.1.159:8007", "192.168.1.159", 8007, "Infrastructure", "archive", critical=True),
Service("Authentik", "https://auth.deathstar-home.one", "192.168.1.200", 9000, "Infrastructure", "lock"),
Service("Jellyfin", "https://jellyfin.deathstar-home.one", "192.168.1.49", 8096, "Media", "film", favorite=True, group="Media Players"),
Service("Jellyseerr", "https://request.deathstar-home.one", "192.168.1.12", 5055, "Media", "star", favorite=True, group="Media Players"),
Service("Radarr", "https://radarr.deathstar-home.one", "192.168.1.56", 7878, "Media", "film", group="Arr Stack"),
Service("Sonarr", "https://sonarr.deathstar-home.one", "192.168.1.62", 8989, "Media", "tv", group="Arr Stack"),
Service("Lidarr", "https://lidarr.deathstar-home.one", "192.168.1.23", 8686, "Media", "music", group="Arr Stack"),
Service("Prowlarr", "https://prowlarr.deathstar-home.one", "192.168.1.58", 9696, "Media", "search", group="Arr Stack"),
Service("Sabnzbd", "https://sabnzbd.deathstar-home.one", "192.168.1.66", 7777, "Media", "download", group="Arr Stack"),
Service("Tdarr", "https://tdarr.deathstar-home.one", "192.168.1.182", 8265, "Media", "cog", group="Media Players"),
Service("Grafana", "https://grafana.deathstar-home.one", "192.168.1.163", 3000, "Monitoring", "chart", favorite=True),
Service("Uptime Kuma", "https://status.deathstar-home.one", "192.168.1.155", 3001, "Monitoring", "heartbeat"),
Service("Vaultwarden", "https://vault.deathstar-home.one", "192.168.1.154", 80, "Apps", "key", favorite=True),
Service("Gitea", "https://git.deathstar-home.one", "192.168.1.135", 3000, "Apps", "git"),
Service("n8n", "https://n8n.deathstar-home.one", "192.168.1.254", 5678, "Apps", "workflow"),
Service("BookStack", "https://docs.deathstar-home.one", "192.168.1.194", 80, "Apps", "book"),
Service("Immich", "https://cloud.deathstar-home.one", "192.168.1.54", 2283, "Apps", "image", favorite=True),
Service("Open WebUI", "https://ai.deathstar-home.one", "192.168.1.63", 8080, "Apps", "brain"),
Service("Home Assistant", "https://astro.deathstar-home.one", "192.168.1.50", 8123, "Home", "home", favorite=True, critical=True),
Service("Frigate", "https://frigate.deathstar-home.one", "192.168.1.241", 5000, "Home", "camera", group="Cameras"),
Service("go2rtc", "http://192.168.1.241:1985", "192.168.1.241", 1985, "Home", "video", group="Cameras"),
Service("Matrix", "https://chat.deathstar-home.one", "192.168.1.162", 8080, "Home", "message"),
]
CATEGORIES = {
"Infrastructure": {"color": "blue", "icon": "server"},
"Media": {"color": "purple", "icon": "film"},
"Monitoring": {"color": "amber", "icon": "activity"},
"Apps": {"color": "emerald", "icon": "grid"},
"Home": {"color": "cyan", "icon": "home"},
}
SETTINGS_FILE = "/opt/dashboard/settings.json"
DEFAULT_SETTINGS = {
"refresh_interval": 30,
"theme": "dark",
"favorites": ["Jellyfin", "Jellyseerr", "Grafana", "Vaultwarden", "Immich", "Home Assistant"],
"collapsed_categories": [],
"show_response_times": True,
"show_icons": True,
}
def load_settings():
try:
if os.path.exists(SETTINGS_FILE):
with open(SETTINGS_FILE, 'r') as f:
return {**DEFAULT_SETTINGS, **json.load(f)}
except:
pass
return DEFAULT_SETTINGS.copy()
def save_settings(settings):
try:
with open(SETTINGS_FILE, 'w') as f:
json.dump(settings, f, indent=2)
return True
except:
return False
def get_services_by_category():
categories = {}
for service in SERVICES:
if service.category not in categories:
categories[service.category] = []
categories[service.category].append(service)
return categories
def get_favorites():
settings = load_settings()
fav_names = settings.get("favorites", [])
return [s for s in SERVICES if s.name in fav_names or s.favorite]
def get_critical_services():
return [s for s in SERVICES if s.critical]
def get_service_icon(icon_name):
return SERVICE_ICONS.get(icon_name, SERVICE_ICONS["server"])