first commit

This commit is contained in:
Daniel Maas committed 2026-10-05 18:38:53 +02:00
commit 20d7fe39bd
6 files changed
+258

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
# Python
__pycache__/
*.py[cod]
# Virtual environments
.venv/
venv/
env/
# Environments / secrets
.env
# Tool caches
.mypy_cache/
.ruff_cache/
.pytest_cache/
# Flet
.flet/
build/
# IDE
.idea/
.vscode/
# macOS
.DS_Store
+69
View File
@@ -0,0 +1,69 @@
# Dansboard app
## Run the app
### uv
Run as a desktop app:
```bash
uv run flet run
```
Run as a web app:
```bash
uv run flet run --web
```
For more details on running the app, refer to the [Getting Started Guide](https://flet.dev/docs/).
## Build the app
### Android
```bash
flet build apk -v
```
For more details on building and signing `.apk` or `.aab`, refer to the [Android Packaging Guide](https://flet.dev/docs/publish/android/).
### iOS
```bash
flet build ipa -v
```
For more details on building and signing `.ipa`, refer to the [iOS Packaging Guide](https://flet.dev/docs/publish/ios/).
### macOS
```bash
flet build macos -v
```
For more details on building macOS package, refer to the [macOS Packaging Guide](https://flet.dev/docs/publish/macos/).
### Linux
```bash
flet build linux -v
```
For more details on building Linux package, refer to the [Linux Packaging Guide](https://flet.dev/docs/publish/linux/).
### Windows
```bash
flet build windows -v
```
For more details on building Windows package, refer to the [Windows Packaging Guide](https://flet.dev/docs/publish/windows/).
### Web
```bash
flet build web -v
```
For more details on building Web app, refer to the [Web Packaging Guide](https://flet.dev/docs/publish/web/).
+43
View File
@@ -0,0 +1,43 @@
[project]
name = "dansboard"
version = "0.1.0"
description = ""
readme = "README.md"
requires-python = ">=3.10"
authors = [
{ name = "Flet developer", email = "you@example.com" }
]
dependencies = [
"flet>=1.0.3"
]
[dependency-groups]
dev = [
"flet-cli>=1.0.3",
"flet-desktop>=1.0.3",
"flet-web>=1.0.3",
# Integration testing with `flet test` / pytest. The `test` extra brings in
# pytest, pytest-asyncio and the screenshot-comparison dependencies.
"flet[test]>=1.0.3",
]
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]
pythonpath = ["src"]
[tool.flet]
org = "com.mycompany"
product = "dansboard"
company = "Flet"
copyright = "Copyright (C) 2023-2026 by Flet"
# src/assets/icon.png is the icon for every platform. Keep it transparent and
# filling the whole canvas: web, Windows and Linux show it as-is, and Flet
# shrinks it to the margin iOS, macOS and Android each mask away. This colour
# is what sits behind it where transparency cannot survive - the iOS icon, the
# macOS tile and the Android background layer. Defaults to white.
# icon_background = "#ffffff"
[tool.flet.app]
path = "src"
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

+97
View File
@@ -0,0 +1,97 @@
import flet as ft
import requests
# Liste deiner Docker-Dienste auf dem Pi
SERVICES = [
{
"name": "Portainer",
"url": "https://192.168.2.33:9443",
"icon": ft.Icons.DIRECTIONS_BOAT,
"desc": "Container Management"
},
{
"name": "NGINX",
"url": "http://192.168.2.33:81",
"icon": ft.Icons.ASSISTANT_DIRECTION,
"desc": "Proxy Manager"
},
{
"name": "Jellyfin",
"url": "https://jellyfin.dansbude.org/",
"icon": ft.Icons.MOVIE,
"desc": "Media Server"
},
{
"name": "Gitea",
"url": "https://gitea.dansbude.org/",
"icon": ft.Icons.CODE,
"desc": "Git source control"
},
]
def check_status(url):
"""Prüft, ob der Dienst antwortet und gibt Fehler im Terminal aus."""
try:
# User-Agent simuliert einen echten Browser, Timeout auf 3.0s erhöht
headers = {'User-Agent': 'Mozilla/5.0'}
response = requests.get(url, timeout=3.0, verify=False, headers=headers)
# 200 (OK), 302 (Redirect) oder 401 (Unauthorized/Login nötig) heissen alle: Portainer LÄUFT!
if response.status_code < 500:
return ft.Colors.GREEN_400
else:
print(f"[STATUS] {url} antwortete mit Status Code: {response.status_code}")
return ft.Colors.ORANGE_400
except Exception as e:
# Das zeigt dir im Terminal EXAKT, warum der Check fehlschlägt:
print(f"[FEHLER] {url} -> {type(e).__name__}: {e}")
return ft.Colors.RED_400
def main(page: ft.Page):
page.title = "Dansboard"
page.theme_mode = ft.ThemeMode.DARK
page.padding = 30
page.scroll = ft.ScrollMode.AUTO
# Header
header = ft.Text("Dansboard", size=32, weight=ft.FontWeight.BOLD)
cards = []
for service in SERVICES:
# Status-Farbe abfragen
status_color = check_status(service["url"])
# Kachel für jeden Dienst bauen
card = ft.Container(
content=ft.Column([
ft.Row([
ft.Icon(service["icon"], size=30, color=ft.Colors.BLUE_400),
ft.Container(
width=12, height=12,
bgcolor=status_color,
border_radius=6,
tooltip="Online" if status_color == ft.Colors.GREEN_400 else "Offline"
)
]),
ft.Text(service["name"], size=18, weight=ft.FontWeight.BOLD),
ft.Text(service["desc"], size=12, color=ft.Colors.GREY_400),
]),
padding=20,
bgcolor=ft.Colors.SURFACE_CONTAINER_HIGHEST,
border_radius=12,
width=200,
height=130,
ink=True,
url=service["url"], # Öffnet Link im neuen Tab
)
cards.append(card)
# Raster mit allen Kacheln
grid = ft.Row(controls=cards, wrap=True, spacing=20)
page.add(header, ft.Divider(height=20, color=ft.Colors.TRANSPARENT), grid)
# Als Webserver auf Port 8550 starten
ft.run(main)
+22
View File
@@ -0,0 +1,22 @@
import flet.testing as ftt
async def test_increment(flet_app: ftt.FletTestApp):
"""Counter sample: tap the FAB and assert the counter goes 0 -> 1.
The `flet_app` fixture is provided automatically by the flet pytest plugin.
Run with `flet test` (or `uv run pytest`) from the project directory.
"""
tester = flet_app.tester
await tester.pump_and_settle()
# Initial state
assert (await tester.find_by_text("0")).count == 1
# Tap the increment button (found by its key) and let the UI settle
await tester.tap(await tester.find_by_key("increment"))
await tester.pump_and_settle()
# New state
assert (await tester.find_by_text("1")).count == 1