mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-12-13 23:56:47 +00:00
Update utils.sh
This commit is contained in:
@@ -493,6 +493,7 @@ hybrid_menu() {
|
|||||||
|
|
||||||
if is_web_mode; then
|
if is_web_mode; then
|
||||||
local interaction_id=$(generate_interaction_id)
|
local interaction_id=$(generate_interaction_id)
|
||||||
|
local clean_text=$(echo -e "$text" | sed 's/\\Z[0-9bn]//g')
|
||||||
local options_json="["
|
local options_json="["
|
||||||
for ((i=0; i<${#items[@]}; i+=2)); do
|
for ((i=0; i<${#items[@]}; i+=2)); do
|
||||||
if [ $i -gt 0 ]; then options_json+=","; fi
|
if [ $i -gt 0 ]; then options_json+=","; fi
|
||||||
@@ -500,10 +501,10 @@ hybrid_menu() {
|
|||||||
done
|
done
|
||||||
options_json+="]"
|
options_json+="]"
|
||||||
|
|
||||||
echo "WEB_INTERACTION:menu:${interaction_id}:$(echo -n "$title" | base64 -w0):$(echo -n "$text" | base64 -w0):$options_json" >> "${WEB_LOG:-/tmp/proxmenux_web.log}"
|
echo "WEB_INTERACTION:menu:${interaction_id}:$(echo -n "$title" | base64 -w0):$(echo -n "$clean_text" | base64 -w0):$options_json" >> "${WEB_LOG:-/tmp/proxmenux_web.log}"
|
||||||
wait_for_web_response "$interaction_id"
|
wait_for_web_response "$interaction_id"
|
||||||
else
|
else
|
||||||
dialog --title "$title" --menu "$text" "$height" "$width" "$menu_height" "${items[@]}" 3>&1 1>&2 2>&3
|
dialog --colors --title "$title" --menu "$text" "$height" "$width" "$menu_height" "${items[@]}" 3>&1 1>&2 2>&3
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,11 +517,12 @@ hybrid_yesno() {
|
|||||||
|
|
||||||
if is_web_mode; then
|
if is_web_mode; then
|
||||||
local interaction_id=$(generate_interaction_id)
|
local interaction_id=$(generate_interaction_id)
|
||||||
echo "WEB_INTERACTION:yesno:${interaction_id}:$(echo -n "$title" | base64 -w0):$(echo -n "$text" | base64 -w0)" >> "${WEB_LOG:-/tmp/proxmenux_web.log}"
|
local clean_text=$(echo -e "$text" | sed 's/\\Z[0-9bn]//g')
|
||||||
|
echo "WEB_INTERACTION:yesno:${interaction_id}:$(echo -n "$title" | base64 -w0):$(echo -n "$clean_text" | base64 -w0)" >> "${WEB_LOG:-/tmp/proxmenux_web.log}"
|
||||||
local response=$(wait_for_web_response "$interaction_id")
|
local response=$(wait_for_web_response "$interaction_id")
|
||||||
[[ "$response" == "yes" ]] && return 0 || return 1
|
[[ "$response" == "yes" ]] && return 0 || return 1
|
||||||
else
|
else
|
||||||
dialog --title "$title" --yesno "$text" "$height" "$width"
|
dialog --colors --title "$title" --yesno "$text" "$height" "$width"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -533,10 +535,11 @@ hybrid_msgbox() {
|
|||||||
|
|
||||||
if is_web_mode; then
|
if is_web_mode; then
|
||||||
local interaction_id=$(generate_interaction_id)
|
local interaction_id=$(generate_interaction_id)
|
||||||
echo "WEB_INTERACTION:msgbox:${interaction_id}:$(echo -n "$title" | base64 -w0):$(echo -n "$text" | base64 -w0)" >> "${WEB_LOG:-/tmp/proxmenux_web.log}"
|
local clean_text=$(echo -e "$text" | sed 's/\\Z[0-9bn]//g')
|
||||||
|
echo "WEB_INTERACTION:msgbox:${interaction_id}:$(echo -n "$title" | base64 -w0):$(echo -n "$clean_text" | base64 -w0)" >> "${WEB_LOG:-/tmp/proxmenux_web.log}"
|
||||||
wait_for_web_response "$interaction_id" > /dev/null
|
wait_for_web_response "$interaction_id" > /dev/null
|
||||||
else
|
else
|
||||||
dialog --title "$title" --msgbox "$text" "$height" "$width"
|
dialog --colors --title "$title" --msgbox "$text" "$height" "$width"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user