#!/bin/bash # Hermes' gateway used to be allowed whatever Matrix server Hermes' own # settings named, which Hermes can change from inside its sandbox. Now it # reaches only a server in ~/.config/coredesktop/sandbox/hermes.json, which # configure hermes asks about. Carry over the server the gateway reaches now, # from its systemd drop-in, which the sandbox can't write, so a gateway that # works keeps working; sandbox/setup.sh then rewrites the drop-in without it. DROPIN="$HOME/.config/systemd/user/hermes-gateway.service.d/coredesktop-sandbox.conf" [ -f "$DROPIN" ] || exit 0 COREDESKTOP="${COREDESKTOP:-$HOME/.local/share/coredesktop}" source "$COREDESKTOP/sandbox/hermes-homeserver.sh" host="$(sed -nE 's#^Environment="?COREDESKTOP_SANDBOX_DOMAINS=([^" ]*)"?$#\1#p' "$DROPIN" | head -n 1)" [[ "$host" =~ ^[A-Za-z0-9]([A-Za-z0-9.-]*[A-Za-z0-9])?$ ]] || exit 0 hermes_homeserver_allowed "$host" && exit 0 hermes_allow_homeserver "$host"