From b69d810958804275020bde7f8073f33b50c777a1 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Tue, 17 Jun 2025 20:49:52 -0400 Subject: [PATCH] Use url field for jq and retain tear off link --- host/blank/extract_form_fields.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/host/blank/extract_form_fields.sh b/host/blank/extract_form_fields.sh index ae789a6..671bbc5 100755 --- a/host/blank/extract_form_fields.sh +++ b/host/blank/extract_form_fields.sh @@ -73,9 +73,14 @@ echo "Extracted url: '$url'" # Construct the URLs with the subdomain onion_base="6dshf2gnj7yzxlfcaczlyi57up4mvbtd5orinuj5bjsfycnhz2w456yd.onion" constructed_url="http://$subdomain.$onion_base" -tear_off_link="http://$subdomain.$onion_base" + +# Use an existing tear_off_link from the config if provided; otherwise default +# to the constructed onion URL. +existing_tear_off_link=$(jq -r '.tear_off_link // empty' "$json_file") +tear_off_link="${existing_tear_off_link:-http://$subdomain.$onion_base}" + echo "Constructed URL: '$constructed_url'" -echo "Constructed Tear-off Link: '$tear_off_link'" +echo "Using Tear-off Link: '$tear_off_link'" # Check if the extracted fields are not empty if [ -z "$name" ] || [ -z "$subdomain" ] || [ -z "$title" ] || [ -z "$subtitle" ] || [ -z "$headline" ] || [ -z "$content" ] || [ -z "$url_message" ] || [ -z "$url" ]; then @@ -92,7 +97,7 @@ jq --arg name "$name" \ --arg headline "$headline" \ --arg content "$content" \ --arg url_message "$url_message" \ - --arg url "$constructed_url" \ + --arg url "$url" \ --arg tear_off_link "$tear_off_link" \ '.name = $name | .subdomain = $subdomain |