Compare commits

..

No commits in common. "54dd3e21997e6471a1e77348eea527647a8dec71" and "37b8bbce966ba813555b037e8fba372605da69e1" have entirely different histories.

View file

@ -34,19 +34,9 @@ need_tty() {
prompt() { prompt() {
local msg="$1" local msg="$1"
local out line local out
printf "${BOLD}%s${RESET}" "$msg" >"$TTY" printf "${BOLD}%s${RESET}" "$msg" >"$TTY"
IFS= read -r out <"$TTY" IFS= read -r out <"$TTY"
# A pasted value (e.g. join-data copied from the panel UI) can arrive with an
# embedded newline. `read` stops at the first one, which would otherwise
# silently truncate the rest onto a "phantom" line consumed by a later
# prompt. Drain any additional lines that are already buffered so nothing
# gets lost; this never blocks waiting on new keystrokes.
while IFS= read -r -t 0.1 line <"$TTY" 2>/dev/null; do
out+="$line"
done
printf "%s" "$out" printf "%s" "$out"
} }
@ -233,8 +223,7 @@ section "Configuration"
# Pulls just the base64 join-data token out of whatever the user pastes. # Pulls just the base64 join-data token out of whatever the user pastes.
# Accepts: # Accepts:
# - the raw token by itself # - the raw token by itself
# - the full "calagopus-wings configure --join-data <token>" command as # - the full "wings configure --join-data <token>" command
# generated by the panel (or the older "wings configure --join-data ..." form)
# - either wrapped in single/double quotes, with extra surrounding whitespace # - either wrapped in single/double quotes, with extra surrounding whitespace
extract_join_data() { extract_join_data() {
local raw="$1" local raw="$1"
@ -259,7 +248,7 @@ extract_join_data() {
} }
if confirm_default_no "Run wings configure --join-data now?"; then if confirm_default_no "Run wings configure --join-data now?"; then
JOIN_DATA_RAW="$(prompt "Paste join-data (raw token or the full 'calagopus-wings configure --join-data ...' command): ")" JOIN_DATA_RAW="$(prompt "Paste join-data (raw token or the full 'wings configure --join-data ...' command): ")"
JOIN_DATA="$(extract_join_data "$JOIN_DATA_RAW")" JOIN_DATA="$(extract_join_data "$JOIN_DATA_RAW")"
if [[ -n "$JOIN_DATA" ]]; then if [[ -n "$JOIN_DATA" ]]; then