More TOR configurations

This commit is contained in:
kexkey
2019-12-09 11:08:35 -05:00
committed by kexkey
parent 51cb4a2e9a
commit d0afa09181
12 changed files with 56 additions and 40 deletions

View File

@@ -6,6 +6,7 @@ notify_web() {
trace "Entering notify_web()..."
local url=${1}
local torbypass=${3}
# Let's encode the body to base64 so we won't have to escape the special chars...
local body=$(echo "${2}" | base64 | tr -d '\n')
@@ -14,10 +15,17 @@ notify_web() {
local response
local http_code
local curl_code
local msg
if [ -n "${torbypass}" ]; then
msg="{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"${url}\",\"body\":\"${body}\",\"torbypass\":${torbypass}}"
else
msg="{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"${url}\",\"body\":\"${body}\"}"
fi
# We use the pid as the response-topic, so there's no conflict in responses.
trace "[notify_web] mosquitto_rr -h broker -W 21 -t notifier -e \"response/$$\" -m \"{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"${url}\",\"body\":\"${body}\"}\""
response=$(mosquitto_rr -h broker -W 21 -t notifier -e "response/$$" -m "{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"${url}\",\"body\":\"${body}\"}")
trace "[notify_web] mosquitto_rr -h broker -W 21 -t notifier -e \"response/$$\" -m \"${msg}\""
response=$(mosquitto_rr -h broker -W 21 -t notifier -e "response/$$" -m ${msg})
returncode=$?
trace_rc ${returncode}