@@ -71,7 +71,7 @@ do_query()
7171{
7272 local query=" $* "
7373 local b_opts=
74- local uri=" https://cht.sh /\"\$ (get_query_options $query )\" "
74+ local uri=" ${CHTSH_URL} /\"\$ (get_query_options $query )\" "
7575
7676 if [ -e " $HOME /.cht.sh/id" ]; then
7777 b_opts=" -b \"\$ HOME/.cht.sh/id\" "
@@ -105,7 +105,7 @@ prepare_query()
105105
106106get_list_of_sections ()
107107{
108- curl -s https://cht.sh /:list | grep -v ' /.*/' | grep ' /$' | xargs
108+ curl -s " ${CHTSH_URL} " /:list | grep -v ' /.*/' | grep ' /$' | xargs
109109}
110110
111111gen_random_str ()
@@ -142,6 +142,8 @@ if [ -e "$CHTSH_CONF" ]; then
142142 . " $CHTSH_CONF "
143143fi
144144
145+ [ -z " $CHTSH_URL " ] && CHTSH_URL=https://cht.sh
146+
145147if [ " $1 " = --read ]; then
146148 read -r a || a=exit
147149 printf " %s\n" " $a "
@@ -160,8 +162,6 @@ elif [ x"$1" = x--shell ]; then
160162 shift
161163fi
162164
163- prompt=" cht.sh"
164-
165165prompt=" cht.sh"
166166opts=" "
167167input=" "
175175query=$( echo " $input " | sed ' s@ *$@@; s@^ *@@; s@ @/@; s@ @+@g' )
176176
177177if [ " $shell_mode " != yes ]; then
178- curl -s https://cht.sh /" $( get_query_options " $query " ) "
178+ curl -s " ${CHTSH_URL} " /" $( get_query_options " $query " ) "
179179 exit 0
180180else
181181 new_section=" $1 "
192192 fi
193193 if [ -n " $this_query " ] && [ -z " $CHEATSH_RESTART " ]; then
194194 printf " $this_prompt$this_query \n"
195- curl -s https://cht.sh /" $( get_query_options " $query " ) "
195+ curl -s " ${CHTSH_URL} " /" $( get_query_options " $query " ) "
196196 fi
197197fi
198198
291291 echo copy: Make at least one query first.
292292 continue
293293 else
294- curl -s https://cht.sh /" $( get_query_options " $query " ? T) " > " $TMP1 "
294+ curl -s " ${CHTSH_URL} " /" $( get_query_options " $query " ? T) " > " $TMP1 "
295295 if [ " $is_macos " != yes ]; then
296296 xsel -i < " $TMP1 "
297297 else
310310 echo copy: Make at least one query first.
311311 continue
312312 else
313- curl -s https://cht.sh /" $( get_query_options " $query " ? TQ) " > " $TMP1 "
313+ curl -s " ${CHTSH_URL} " /" $( get_query_options " $query " ? TQ) " > " $TMP1 "
314314 if [ " $is_macos " != yes ]; then
315315 xsel -i < " $TMP1 "
316316 else
407407 continue
408408 ;;
409409 update)
410- [ -w " $0 " ] || { echo " The script is readonly; please update manually: curl -s https://cht.sh /:bash | sudo tee $0 " ; continue ; }
410+ [ -w " $0 " ] || { echo " The script is readonly; please update manually: curl -s " ${CHTSH_URL} " /:bash | sudo tee $0 " ; continue ; }
411411 TMP2=$( mktemp /tmp/cht.sh.XXXXXXXXXXXXX)
412- curl -s https://cht.sh /:cht.sh > " $TMP2 "
412+ curl -s " ${CHTSH_URL} " /:cht.sh > " $TMP2 "
413413 if ! cmp " $0 " " $TMP2 " > /dev/null 2>&1 ; then
414414 if grep -q ^__CHTSH_VERSION= " $TMP2 " ; then
415415 # section was vaildated by us already
428428 insttime=$( ls -l -- " $0 " | sed ' s/ */ /g' | cut -d ' ' -f 6-8)
429429 echo " cht.sh version $__CHTSH_VERSION of $__CHTSH_DATETIME ; installed at: $insttime "
430430 TMP2=$( mktemp /tmp/cht.sh.XXXXXXXXXXXXX)
431- if curl -s https://cht.sh /:cht.sh > " $TMP2 " ; then
431+ if curl -s " ${CHTSH_URL} " /:cht.sh > " $TMP2 " ; then
432432 if ! cmp " $0 " " $TMP2 " > /dev/null 2>&1 ; then
433433 echo " Update needed (type 'update' for that)" .
434434 else
0 commit comments