diff --git a/.github/helper-scripts/replace_placeholders.sh b/.github/helper-scripts/replace_placeholders.sh deleted file mode 100755 index 1a738e8..0000000 --- a/.github/helper-scripts/replace_placeholders.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# Usage: ./replace_placeholders.sh source_file destination_file - -SOURCE_FILE="$1" -DEST_FILE="$2" - -# Check if source file exists -if [[ ! -f "$SOURCE_FILE" ]]; then - echo "Source file '$SOURCE_FILE' does not exist!" - exit 1 -fi - -# Read the entire source file into a variable -content=$(<"$SOURCE_FILE") - -# Extract unique placeholders: match { { file.xxx } } with arbitrary spaces -placeholders=$(grep -oP '\{\s*{\s*file\.(.*)\s*}\s*}' "$SOURCE_FILE" | sed -E 's/\{\s*\{\s*file\.//;s/\s*\}\s*\}//' | sort -u) - -for placeholder in $placeholders; do - if [[ -f "$placeholder" ]]; then - file_content=$(<"$placeholder") - - # Escape special characters - escaped_content=$(printf '%s' "$file_content" | perl -pe 's/([\\\/])/\\$1/g; s/\n/\\n/g;') - escaped_placeholder=$(printf '%s' "$placeholder" | perl -pe 's/([\\\/])/\\$1/g; s/\n/\\n/g;') - - content=$(printf '%s' "$content" | perl -pe "s/{\s*{\s*file\.${escaped_placeholder}\s*}\s*}/$escaped_content/g") - else - echo "Warning: File '$placeholder' not found, skipping." - fi -done - -# Write to destination file -printf '%b\n' "$content" > "$DEST_FILE" - -echo "Replacements complete. Output written to '$DEST_FILE'." diff --git a/app.py b/app.py index 02494d2..c6047f0 100644 --- a/app.py +++ b/app.py @@ -122,6 +122,9 @@ def proxy(path): headers = {k: v for k, v in request.headers if k.lower() != 'host'} if incomingJSON: + if not incomingJSON.get("recipients", None): + incomingJSON["recipients"] = "${RECIPIENTS}" + jsonData = fillInVars(incomingJSON) if "${NUMBER}" in path: @@ -141,7 +144,7 @@ def proxy(path): json=jsonData ) - infoLog(f"Forwarded {resp.text} to {targetURL} [{method}]") + infoLog(f"Forwarded {jsonData} to {targetURL} [{method}]") # return Response(resp.content, status=resp.status_code, headers=dict(resp.headers))