Skip to content

Commit

Permalink
feat: adjust computeSignedAPI to computeSignedRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
WGrape committed Feb 5, 2023
1 parent e3bb4ef commit eeca00b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
12 changes: 7 additions & 5 deletions bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ time=$(date "+%Y-%m-%d %H:%M:%S")

# The common functions of ngxway is here.
# ================================
function computeSignedAPI() {
function computeSignedRequest() {
timeStamp=`date +%s`

(( length=timeStamp%16+10 ))
Expand All @@ -24,17 +24,19 @@ function computeSignedAPI() {

result=${signMd5: 0: $length}

signedAPI="http://${ngxway_addr}/?sign=${result}&timestamp=${timeStamp}"
signedURL="http://${ngxway_addr}/?sign=${result}&timestamp=${timeStamp}"
signedAPI="http://${ngxway_addr}/api/test?sign=${result}&timestamp=${timeStamp}"
}

function printSignedAPI() {
computeSignedAPI
function printSignedRequest() {
computeSignedRequest
echo "timeStamp=$timeStamp"
echo "length=$length"
echo "sign=$sign"
echo "signMd5=$signMd5"
echo "result = " $result
echo "url = " $signedAPI
echo "url = " $signedURL
echo "api = " $signedAPI
}

function printWhichSystem(){
Expand Down
6 changes: 3 additions & 3 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ else
fi

# Try to open it in your chrome if ngxway working in dev mode.
computeSignedAPI
computeSignedRequest
echo -e ""
echo -e "Now, you can visit the api to test : " $signedAPI
echo -e "Now, you can visit the url to test : " $signedURL
if [ $env == "dev" ]; then
open -a "/Applications/Google Chrome.app" $signedAPI > /dev/null 2>&1
open -a "/Applications/Google Chrome.app" $signedURL > /dev/null 2>&1
fi
2 changes: 1 addition & 1 deletion test/generate_signed_api.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
currentDir=$(pwd)
. $currentDir/bin/common.sh

printSignedAPI
printSignedRequest

0 comments on commit eeca00b

Please sign in to comment.