Handle optional base/mbase passed as arguments to the dcgi - gophercgis - Collection of gopher CGI/DCGI for geomyidae
(HTM) hg clone https://bitbucket.org/iamleot/gophercgis
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) changeset c1665e58af51f8a9452e323467289d4ac8bfaf23
(DIR) parent 2b07185ab6ab48367a5c99f561f08232d371c313
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Mon, 17 Dec 2018 13:04:40
Handle optional base/mbase passed as arguments to the dcgi
Diffstat:
twitter/tweets.dcgi | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
---
diff -r 2b07185ab6ab -r c1665e58af51 twitter/tweets.dcgi
--- a/twitter/tweets.dcgi Mon Dec 17 11:18:29 2018 +0100
+++ b/twitter/tweets.dcgi Mon Dec 17 13:04:40 2018 +0100
@@ -4,31 +4,39 @@
CGI="${CGI_BASEDIR}/twitter/tweets.dcgi"
+base="https://twitter.com"
+mbase="https://mobile.twitter.com"
+args="$2"
-case "$2" in
+case "${args}" in
+${base}/*)
+ args=${args#${base}/}
+ ;;
+${mbase}/*)
+ args=${args#${mbase}/}
+ ;;
+esac
+
+case "${args}" in
*/status/*)
- IFS=/ set -- "$2"
+ IFS=/ set -- "${args}"
set -- $*
username="$1"
id="$3"
;;
*/*)
- IFS=/ set -- "$2"
+ IFS=/ set -- "${args}"
set -- $*
username="$1"
id="$2"
;;
*)
- username="$2"
+ username="${args}"
id=""
;;
esac
-base="https://twitter.com"
-mbase="https://mobile.twitter.com"
-
-
#
# Given a username and optional max id tscrape the next 20 tweets
#