From 4e847dd573d15fba0a475e7fc39d714fb0546be0 Mon Sep 17 00:00:00 2001 From: Kroonk Date: Fri, 22 May 2026 13:12:42 +0200 Subject: [PATCH] feat: Add configure-whatsapp.sh helper script to automate bridge config setup on NAS --- configure-whatsapp.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 configure-whatsapp.sh diff --git a/configure-whatsapp.sh b/configure-whatsapp.sh new file mode 100644 index 0000000..8e88525 --- /dev/null +++ b/configure-whatsapp.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Automatisches Setup für die mautrix-whatsapp Konfiguration +# Ausgeführt im Matrix-Projektverzeichnis auf dem NAS + +CONFIG_FILE="data/whatsapp/config.yaml" + +if [ ! -f "$CONFIG_FILE" ]; then + echo "Fehler: $CONFIG_FILE wurde noch nicht generiert!" + echo "Bitte starte zuerst den whatsapp Container einmalig, um die Datei zu erzeugen:" + echo " docker compose up -d whatsapp" + exit 1 +fi + +echo "Passe Konfiguration in $CONFIG_FILE an..." + +# Homeserver Einstellungen +sed -i 's|address: http://localhost:8008|address: http://matrix_synapse:8008|g' "$CONFIG_FILE" +sed -i 's|domain: example.com|domain: mischlabs.de|g' "$CONFIG_FILE" + +# Appservice Einstellungen +sed -i 's|address: http://localhost:29318|address: http://matrix_whatsapp:29318|g' "$CONFIG_FILE" +sed -i 's|hostname: 127.0.0.1|hostname: 0.0.0.0|g' "$CONFIG_FILE" + +# Datenbank auf SQLite umstellen +sed -i 's|type: postgres|type: sqlite3-fk-wal|g' "$CONFIG_FILE" +sed -i 's|uri: postgres://user:password@host/database?sslmode=disable|uri: file:/data/mautrix-whatsapp.db?_txlock=immediate|g' "$CONFIG_FILE" + +# Token hinterlegen +sed -i 's|as_token: "This value is generated when generating the registration"|as_token: "0a3c59d1cbf443b88cca6147def3c8e83da2fc074d584cfeb3f4b8487e8f3418"|g' "$CONFIG_FILE" +sed -i 's|hs_token: "This value is generated when generating the registration"|hs_token: "55a049f147eb43a1897cdd5dc49961fbe8694fe52f3a447bbd12abee1905ae10"|g' "$CONFIG_FILE" + +# Berechtigungen anpassen +sed -i 's|example.com: user|mischlabs.de: admin|g' "$CONFIG_FILE" +sed -i 's|@admin:example.com|@MrDiderot:mischlabs.de|g' "$CONFIG_FILE" + +echo "Erfolgreich konfiguriert! Du kannst den Bridge-Container nun neu starten."