Skip to content

Commit 6e14770

Browse files
committed
use a freetext entry field in qutselect_connect_app.sh instead of doing
a regex check.
1 parent 93535a9 commit 6e14770

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ endif()
3636
project(qutselect)
3737
set(PROJECT_LONGNAME "qutselect")
3838
set(PROJECT_VERSION_MAJOR 3)
39-
set(PROJECT_VERSION_MINOR 16)
39+
set(PROJECT_VERSION_MINOR 17)
4040
set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
4141

4242
# change output directory to top-level 'bin' dir.

scripts/qutselect_connect_app.sh

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,11 @@ elif [[ "${app}" == "chrome" ]] || [[ "${app}" == "bbb" ]]; then
171171
# when we start a BBB session we have to ask for a
172172
# potential room identifier
173173
BBB_BASE="https://bbb.hzdr.de/"
174-
ROOM_RE='^[A-Za-z0-9]{3}(-[A-Za-z0-9]{3}){3}$' # xxx-xxx-xxx-xxx
174+
bbb_url="${BBB_BASE}"
175175
room=""
176176

177177
while true; do
178+
bbb_url="${BBB_BASE}"
178179
room="$(
179180
yad --entry \
180181
--title="https://bbb.hzdr.de/b/xxx-xxx-xxx-xxx" \
@@ -195,25 +196,32 @@ elif [[ "${app}" == "chrome" ]] || [[ "${app}" == "bbb" ]]; then
195196
# Optional: remote whitespaces and if someone added the url, extract it
196197
room="${room//[[:space:]]/}"
197198
room="${room#"${BBB_BASE}"b/}" # removes "https://bbb.hzdr.de/b/" if there
198-
room=$(echo "${room}" | LC_ALL=C tr '[:upper:]' '[:lower:]')
199-
200-
if [[ "$room" =~ $ROOM_RE ]]; then
201-
break
199+
#room=$(echo "${room}" | LC_ALL=C tr '[:upper:]' '[:lower:]')
200+
201+
# now try to access the supplied URL and continue only if
202+
# a 200
203+
code=0
204+
if [[ -n "${room}" ]]; then
205+
bbb_url="${BBB_BASE}b/${room}"
206+
code="$(curl -sS -o /dev/null -L \
207+
--connect-timeout 5 --max-time 15 \
208+
-w '%{http_code}' \
209+
"${bbb_url}"
210+
)" || code=600
211+
212+
# http-error: 4xx/5xx
213+
if [[ "${code}" -lt 400 ]]; then
214+
break
215+
fi
202216
fi
203217

204218
yad --error \
205-
--title="Invalid Room-ID" \
219+
--title="Invalid Room-ID (${code}: ${bbb_url})" \
206220
--text="<span font_desc=\"${YAD_FONT_DESC}\"><b>The entered Room-ID was invalid.</b></span>\n\nExpected: xxx-xxx-xxx-xxx (each 3 alphanumerical characters)." \
207221
--window-type=dialog --on-top --center --fixed \
208222
--button="Retry":0
209223
done
210224

211-
if [[ -n "${room}" ]]; then
212-
bbb_url="${BBB_BASE}b/${room}"
213-
else
214-
bbb_url="${BBB_BASE}"
215-
fi
216-
217225
CMDOPT="${CMDOPT} --app=${bbb_url}"
218226
if [[ "${resolution}" == "fullscreen" ]]; then
219227
CMDOPT="${CMDOPT} --kiosk"

0 commit comments

Comments
 (0)