Strip all whitespace from join-data instead of just the first token

extract_join_data() previously used `awk '{print $1}'` as its final
step, which only keeps the first whitespace-delimited chunk. Since the
join-data token is base64 and never legitimately contains whitespace,
any paste that gets hard-wrapped across multiple lines (long tokens
wrapped by a terminal or the panel UI, or CRLF line endings) was
silently truncated at the first space/newline, even when the raw
input already contained the rest of the token. This produced a valid
but incomplete base64 string that decoded into a config.yml missing
trailing fields such as `remote`, causing wings to fail at startup
with "invalid remote configuration, cannot connect to panel".

Now strips every whitespace character from the token instead of only
keeping the first token, so wrapped/multi-line pastes are captured in
full regardless of how prompt() received them.

Also bumps the installer banner to v1.3.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Sebastian Cabrera 2026-09-09 21:19:14 -04:00
parent 54dd3e2199
commit 12c20e12e8
Signed by: okseby
GPG key ID: 2DDBFDEE356CF3DE

View file

@ -161,7 +161,7 @@ cat << "EOF"
\____\__,_|_|\__,_|\__, |\___/| .__/ \__,_|___/
|___/ |_|
Calagopus Wings Installer | v1.2
Calagopus Wings Installer | v1.3
EOF
@ -251,9 +251,13 @@ extract_join_data() {
# Strip a single layer of surrounding single or double quotes, if present.
out="$(printf '%s' "$out" | sed -E "s/^['\"]//; s/['\"]\$//")"
# In case the command was pasted with trailing shell noise (e.g. a
# trailing backslash/newline continuation), just take the first token.
out="$(printf '%s' "$out" | awk '{print $1}')"
# The join-data token is base64 and never legitimately contains whitespace.
# Strip EVERY whitespace character, not just the first token: a paste can
# get hard-wrapped across multiple lines (long tokens wrapped by a terminal
# or the panel's UI, or CRLF line endings), which previously left the token
# silently truncated at the first space/newline (via `awk '{print $1}'`)
# even when the raw input still contained the rest of it.
out="$(printf '%s' "$out" | tr -d '[:space:]')"
printf '%s' "$out"
}