This commit is contained in:
team3
2026-09-19 21:12:39 +02:00
parent 4548178a7c
commit a6cc15984f
3 changed files with 37 additions and 6 deletions

View File

@@ -5,9 +5,11 @@ SRC = $(CURDIR)/$(UUID)
DEST = $(HOME)/.local/share/gnome-shell/extensions/$(UUID)
VENV = backend/.venv
PORT ?= 8040
SYNC_URL = https://planer.marha.de
SYNC_JSON = $(HOME)/.local/share/desktop-app/sync.json
.ONESHELL:
.PHONY: install update enable venv dev prod stop logs down test
.PHONY: install update enable sync-config reload venv dev prod stop logs down test
install:
@if [ -e "$(DEST)" ]; then
@@ -17,7 +19,7 @@ install:
fi
mkdir -p "$(dir $(DEST))"
cp -r "$(SRC)" "$(DEST)"
$(MAKE) --no-print-directory enable
$(MAKE) --no-print-directory enable sync-config
echo "Installiert. Jetzt ab- und wieder anmelden."
update:
@@ -32,12 +34,33 @@ update:
cp -r "$(SRC)" "$(DEST)"
echo "Aktualisiert."
fi
echo "Änderungen wirken nach dem nächsten Ab- und Anmelden."
$(MAKE) --no-print-directory sync-config reload
echo "Neuer Code wirkt nach dem nächsten Ab- und Anmelden."
# UUID in die aktiven Extensions eintragen, falls sie fehlt
enable:
@python3 dev/enable.py "$(UUID)"
# sync.json aus der .env anlegen, falls sie fehlt. Ohne .env bleibt die Extension rein lokal.
sync-config:
@if [ -f "$(SYNC_JSON)" ]; then
echo "Sync-Zugang vorhanden: $(SYNC_JSON)"
elif [ -f .env ] && grep -q "^SYNC_TOKEN=.\+" .env; then
mkdir -p "$(dir $(SYNC_JSON))"
printf '{"url": "$(SYNC_URL)", "token": "%s", "interval": 5}\n' "$$(grep ^SYNC_TOKEN= .env | cut -d= -f2-)" > "$(SYNC_JSON)"
chmod 600 "$(SYNC_JSON)"
echo "Sync-Zugang angelegt: $(SYNC_JSON)"
else
echo "Kein Sync-Zugang: .env mit SYNC_TOKEN fehlt. Extension läuft lokal."
fi
# Extension aus- und einschalten, damit sie sync.json neu liest. Geht nur in einer laufenden Session.
reload:
@if gnome-extensions info $(UUID) 2>/dev/null | grep -q "ACTIVE"; then
gnome-extensions disable $(UUID) && gnome-extensions enable $(UUID)
echo "Extension neu gestartet."
fi
# ── Server ───────────────────────────────────────────────────────────────────
venv: $(VENV)/bin/uvicorn