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

View File

@@ -79,11 +79,15 @@ make test # Server-Tests
## Installation
```
make install # kopiert die Extension nach ~/.local/share/gnome-shell/extensions und aktiviert sie
make update # überschreibt eine installierte Extension mit dem Stand aus diesem Ordner
cp .env.example .env # SYNC_TOKEN eintragen (derselbe wie auf dem Server)
make install # kopiert die Extension nach ~/.local/share/gnome-shell/extensions und aktiviert sie
make update # überschreibt eine installierte Extension mit dem Stand aus diesem Ordner
```
Danach ab- und wieder anmelden. Unter Wayland lädt die Shell neuen Code erst nach einem neuen Login.
Beide legen `~/.local/share/desktop-app/sync.json` aus der `.env` an, falls sie fehlt. Ohne `.env`
läuft die Extension rein lokal. Danach ab- und wieder anmelden. Unter Wayland lädt die Shell neuen
Code erst nach einem neuen Login. `make update` startet die Extension neu, damit ein neuer Sync-Zugang
sofort greift.
Voraussetzung: GNOME 46 (Ubuntu 24.04).
## Entwicklung

View File

@@ -44,6 +44,8 @@ export class Sync {
GLib.source_remove(this._timerId);
this._timerId = null;
}
// Laufende Anfrage abbrechen, ohne das als Verbindungsfehler zu melden
this._stopped = true;
this._session.abort();
}
@@ -140,6 +142,8 @@ export class Sync {
}
_fail(message) {
if (this._stopped)
return;
if (!this._failing)
console.log(`desktop-app sync: ${message}`);
this._failing = true;