Diff

mod_rest/example/rest.sh @ 6344:eb834f754f57 draft default tip

Merge update
author Trần H. Trung <xmpp:trần.h.trung@trung.fun>
date Fri, 18 Jul 2025 20:45:38 +0700
parent 6329:c95dffd984a4
line wrap: on
line diff
--- a/mod_rest/example/rest.sh	Sun Jun 15 01:08:46 2025 +0700
+++ b/mod_rest/example/rest.sh	Fri Jul 18 20:45:38 2025 +0700
@@ -18,6 +18,7 @@
 # Settings
 HOST=""
 DOMAIN=""
+PRINT="b"
 
 SESSION="session-read-only"
 
@@ -26,7 +27,7 @@
 	source "${XDG_CONFIG_HOME:-$HOME/.config}/restrc"
 
 	if [ -z "${SCOPE:-}" ]; then
-		SCOPE="openid xmpp"
+		SCOPE="openid offline_access xmpp"
 	fi
 fi
 
@@ -35,8 +36,21 @@
 	exit 1
 fi
 
-while getopts 'r:h:' flag; do
+while getopts 'vr:h:' flag; do
 	case "$flag" in
+		v)
+			case "$PRINT" in
+				b)
+					PRINT="Bb"
+					;;
+				Bb)
+					PRINT="HBhb"
+					;;
+				HBhb)
+					PRINT="HBhbm"
+					;;
+			esac
+			;;
 		r)
 			case "$OPTARG" in
 				o)
@@ -88,4 +102,4 @@
 	shift 1
 fi
 
-https --check-status -p b --"$SESSION" rest -A oauth2 -a "$HOST" --oauth2-scope "$SCOPE" "$HOST/rest$GET_PATH" "$@"
+https --check-status -p "$PRINT" --"$SESSION" rest -A oauth2 -a "$HOST" --oauth2-scope "$SCOPE" "$HOST/rest$GET_PATH" "$@"