New automation action that executes user scripts from a dedicated scripts/ directory. Available as both a DO action and THEN action. Scripts are selected from a dropdown populated by /api/scripts. Security: only scripts in the scripts dir can run, path traversal blocked, no shell=True, stdout/stderr capped, configurable timeout (max 300s). Scripts receive SOULSYNC_EVENT, SOULSYNC_AUTOMATION, and SOULSYNC_SCRIPTS_DIR environment variables. Includes Dockerfile + docker-compose.yml changes for the scripts volume mount, and three example scripts (hello_world.sh, system_info.py, notify_ntfy.sh).
12 lines
442 B
Bash
12 lines
442 B
Bash
#!/bin/bash
|
|
# Send a notification via ntfy.sh (self-hosted or public)
|
|
# Configure: set NTFY_URL and NTFY_TOPIC environment variables
|
|
# Example: NTFY_URL=https://ntfy.sh NTFY_TOPIC=soulsync
|
|
|
|
NTFY_URL="${NTFY_URL:-https://ntfy.sh}"
|
|
NTFY_TOPIC="${NTFY_TOPIC:-soulsync}"
|
|
|
|
curl -s -d "SoulSync automation '${SOULSYNC_AUTOMATION}' completed" \
|
|
"${NTFY_URL}/${NTFY_TOPIC}" > /dev/null 2>&1
|
|
|
|
echo "Notification sent to ${NTFY_URL}/${NTFY_TOPIC}"
|