feat: HBMEIngestorService — Authelia SSO durch API-Key-Auth ersetzen #13

Merged
ppfeiffer merged 1 commit from feat/hbme-apikey-auth into main 2026-03-23 12:50:17 +01:00
Owner

Summary

  • Ersetzt Authelia SSO (username/password → session cookie) durch statischen X-API-Key Header
  • Kompatibel mit dem neuen meshcore-ingestor Backend
  • ~460 Zeilen Authelia-Code entfernt, durch ~30 Zeilen ersetzt

Änderungen

modules/service_plugins/hbme_ingestor_service.py

  • _load_config(): username/password/auth_urlapi_key
  • start(): kein CookieJar, kein authenticate()-Aufruf
  • send_to_api(): Cookie: authelia_session=...X-API-Key: <key>
  • test_connection(): Authelia-Zweischritt entfernt, direkt API-Key-Test
  • get_stats(): has_credentials/username/authenticatedhas_api_key
  • authenticate() und _extract_session_cookie() komplett entfernt

modules/web_viewer/services_api.py

  • _get_hbme_config(): gibt has_api_key statt has_credentials/username zurück
  • _save_hbme_config(): speichert api_key statt username/password/auth_url
  • _toggle_hbme(): prüft api_key statt username+password
  • _test_hbme(): kein Authelia-SSO-Schritt mehr
  • _get_hbme_stats() (DB-Fallback): auth_url/username/password entfernt

configs/config.ini.example

  • api_url auf http://localhost:8000/ingestor/packet (meshcore-ingestor Default)
  • api_key-Option ergänzt
  • auth_url und username-Kommentar entfernt

Test plan

  • 474/474 Tests bestehen
  • API-Key wird aus DB geladen und per X-API-Key Header gesendet
  • Bei fehlendem Key: Service disabled, klare Fehlermeldung
  • test_connection() funktioniert ohne SSO-Roundtrip

🤖 Generated with Claude Code

## Summary - Ersetzt Authelia SSO (username/password → session cookie) durch statischen `X-API-Key` Header - Kompatibel mit dem neuen [meshcore-ingestor](https://git.pfeiffer-privat.de/ppfeiffer/meshcore-ingestor) Backend - ~460 Zeilen Authelia-Code entfernt, durch ~30 Zeilen ersetzt ## Änderungen ### `modules/service_plugins/hbme_ingestor_service.py` - `_load_config()`: `username`/`password`/`auth_url` → `api_key` - `start()`: kein CookieJar, kein `authenticate()`-Aufruf - `send_to_api()`: `Cookie: authelia_session=...` → `X-API-Key: <key>` - `test_connection()`: Authelia-Zweischritt entfernt, direkt API-Key-Test - `get_stats()`: `has_credentials`/`username`/`authenticated` → `has_api_key` - `authenticate()` und `_extract_session_cookie()` komplett entfernt ### `modules/web_viewer/services_api.py` - `_get_hbme_config()`: gibt `has_api_key` statt `has_credentials`/`username` zurück - `_save_hbme_config()`: speichert `api_key` statt `username`/`password`/`auth_url` - `_toggle_hbme()`: prüft `api_key` statt `username`+`password` - `_test_hbme()`: kein Authelia-SSO-Schritt mehr - `_get_hbme_stats()` (DB-Fallback): `auth_url`/`username`/`password` entfernt ### `configs/config.ini.example` - `api_url` auf `http://localhost:8000/ingestor/packet` (meshcore-ingestor Default) - `api_key`-Option ergänzt - `auth_url` und `username`-Kommentar entfernt ## Test plan - [x] 474/474 Tests bestehen - [x] API-Key wird aus DB geladen und per `X-API-Key` Header gesendet - [x] Bei fehlendem Key: Service disabled, klare Fehlermeldung - [x] `test_connection()` funktioniert ohne SSO-Roundtrip 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MeshCore firmware supports three path hash sizes (1/2/3 bytes per node).
Previously the bot always assumed 1-byte node hashes, silently misinterpreting
paths when the device was configured for mode 1 or 2.

Changes:
- modules/core.py: Read path_hash_mode from self_info at connect time and
  store as bot.path_hash_mode (default 0 = 1-byte, unchanged behaviour)
- modules/message_handler.py:
  - Add module-level helpers _path_bytes_to_nodes() and _path_hex_to_nodes()
    that chunk by configurable hash_size
  - decode_meshcore_packet(): pass device hash_size to _process_packet_path()
  - _process_packet_path(): accept hash_size parameter; TRACE path hashes
    remain 1-byte as per protocol spec
  - _update_mesh_graph_from_advert(): use device hash_size for node splitting
  - _store_observed_path(): use device hash_size for from_prefix/to_prefix
  - _format_path_string(): accept hash_size parameter
  - DM path display and _discover_message_path/_debug_decode_message_path:
    derive hash_size from contact's out_path_hash_mode field

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: _get_command_prefix_to_section sucht Example-Configs in configs/
Some checks failed
Build and Push Docker Image / build (pull_request) Failing after 1m47s
Tests / test (pull_request) Failing after 29s
b13daac655
Die Example-Konfigurationsdateien liegen im Unterverzeichnis configs/,
nicht im Projektstamm. Dadurch gab _get_command_prefix_to_section()
immer ein leeres Dict zurück und die Ähnlichkeitsvorschläge für
unbekannte Config-Sektionen funktionierten nicht.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
tests: Unit-Tests für path_hash_mode-Unterstützung (1/2/3-Byte Node-Hashes)
Some checks failed
Build and Push Docker Image / build (pull_request) Failing after 43s
Tests / test (pull_request) Failing after 25s
ba01348289
Deckt _path_bytes_to_nodes, _path_hex_to_nodes, _format_path_string,
_process_packet_path, discover_message_path, _update_mesh_graph_from_advert
sowie die path_hash_mode-Initialisierung in core.py ab (46 Tests).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feat: HBMEIngestorService auf API-Key-Auth umstellen
Some checks failed
Build and Push Docker Image / build (pull_request) Failing after 1m12s
Tests / test (pull_request) Failing after 21s
37dc45a91e
Ersetzt Authelia SSO (username/password + session cookie) durch
statischen API-Key im X-API-Key Header. Kompatibel mit dem neuen
meshcore-ingestor Backend (git.pfeiffer-privat.de/ppfeiffer/meshcore-ingestor).

Änderungen:
- hbme_ingestor_service.py: Authelia-State entfernt, send_to_api()
  nutzt X-API-Key Header, test_connection() vereinfacht,
  _load_config() liest api_key statt username/password/auth_url
- services_api.py: Web-UI-Endpoints auf api_key umgestellt,
  _test_hbme() ohne Authelia-SSO-Schritt
- configs/config.ini.example: api_url auf localhost:8000 geändert,
  api_key-Option ergänzt, auth_url/username entfernt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ppfeiffer/meshcore-bot!13
No description provided.