chore: monorepo - plugin, backend und hilfsdaten in einem repo

- Eltern-Ordner ist jetzt EIN Git-Repo (statt getrennter Repos).
- root .gitignore haelt Secrets (.env), node_modules, DB und Build-Artefakte raus.
- release.ps1: manueller Release (ZIP bauen + ans Backend laden).
- root README mit Struktur und Release-Ablauf.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
s4luorth
2026-06-07 14:41:38 +02:00
commit ecb5e1bd22
37 changed files with 4390 additions and 0 deletions

92
hilfsdaten/SPICKZETTEL.md Normal file
View File

@@ -0,0 +1,92 @@
# GDPR Content Blocker — Spickzettel (intern, NICHT ins Plugin)
Dieser Ordner liegt **außerhalb** des Plugin-Repos und wird nicht ausgeliefert.
Hier nur Hilfsdaten/Notizen für mich speichern.
## Wichtige URLs
- Gitea (Plugin): https://gitea.lucas-orth.de/lucas.orth/GDPR-Content-Blocker.git
- Lizenz-Backend: https://hub.lucas-orth.de
- Impressum: https://lucas-orth.de/impressum
- Datenschutz: https://lucas-orth.de/datenschutz
## Ordnerstruktur (lokal)
- `gdpr-content-blocker/` → das Plugin (Git-Repo, → Gitea). NUR Plugin-Dateien.
- `license-backend/` → Docker-Backend (separat).
- `hilfsdaten/` → dieser Ordner (Notizen, n8n, Skripte).
## Geheimnisse (NICHT hier im Klartext ablegen!)
- ADMIN_API_TOKEN → in license-backend/.env (openssl rand -hex 32)
- DOWNLOAD_SECRET → in license-backend/.env (openssl rand -hex 32)
- Gitea-Secrets: LICENSE_BACKEND_URL, LICENSE_ADMIN_TOKEN (Repo → Settings → Actions → Secrets)
---
## Backend starten / verwalten (auf dem Server)
```bash
cd /pfad/zu/license-backend
cp .env.example .env # einmalig, dann ausfüllen
docker compose up -d --build
docker compose logs -f
curl https://hub.lucas-orth.de/healthz
```
## Lizenzschlüssel erzeugen (manuell oder via n8n)
```bash
curl -X POST https://hub.lucas-orth.de/api/v1/licenses \
-H "X-Admin-Token: ADMIN_TOKEN" -H "Content-Type: application/json" \
-d '{"product":"gdpr-content-blocker","max_activations":1,"email":"kunde@x.de"}'
```
max_activations: 1 = Einzelseite, 3 = drei Seiten, -1 = unbegrenzt.
## Lizenz verwalten
```bash
# ansehen (Status + Domains)
curl https://hub.lucas-orth.de/api/v1/licenses/KEY -H "X-Admin-Token: TOKEN"
# sperren / entsperren
curl -X POST https://hub.lucas-orth.de/api/v1/licenses/KEY/disable -H "X-Admin-Token: TOKEN"
curl -X POST https://hub.lucas-orth.de/api/v1/licenses/KEY/enable -H "X-Admin-Token: TOKEN"
```
---
## Neue Plugin-Version ausliefern (Update)
WICHTIG: interner Plugin-Slug = `gdpr-content-blocker` (NICHT umbenennen — Lizenz/Update
hängen daran). Repo-/Ordnername = gdpr-content-blocker, das ist nur kosmetisch.
### Automatisch (mit Gitea Act Runner)
```bash
cd .../gdpr-content-blocker
# Version in gdpr-content-blocker.php (Header + CB_VERSION) bumpen, committen
git add -A && git commit -m "release: 1.0.1"
git tag v1.0.1
git push origin main
git push origin v1.0.1 # löst den Release-Workflow aus
```
### Manuell (ohne Runner)
```bash
cd .../gdpr-content-blocker
git archive --format=zip --prefix=gdpr-content-blocker/ -o gdpr-content-blocker.zip HEAD
curl -fSs -X POST "https://hub.lucas-orth.de/api/v1/releases?product=gdpr-content-blocker&version=1.0.1" \
-H "X-Admin-Token: ADMIN_TOKEN" -H "Content-Type: application/zip" \
--data-binary @gdpr-content-blocker.zip
```
### Prüfen
```bash
curl https://hub.lucas-orth.de/api/v1/releases/gdpr-content-blocker -H "X-Admin-Token: TOKEN"
```
## Erstinstallation auf einer Kundenseite
1. ZIP einmalig manuell in WordPress hochladen (Plugins → Installieren → Hochladen).
2. Aktivieren → Einstellungen → GDPR Content Blocker → Tab „Lizenz" → Key eintragen.
3. Künftige Updates kommen automatisch (sobald höhere Version im Backend liegt).
## Tests lokal
```bash
# Backend
cd license-backend
npm run test:unit
npm run test:integration # braucht express in node_modules
```