forked from STI/Astroport.ONE
55 lines
1.7 KiB
Bash
Executable File
55 lines
1.7 KiB
Bash
Executable File
################################################################################
|
|
# Author: Fred (support@qo-op.com)
|
|
# Version: 0.1
|
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
|
################################################################################
|
|
################################################################################
|
|
## API: ZONE
|
|
## Used by OSM2IPFS map_render.html & other UPlanet Client App
|
|
# ?zone=DEG&ulat=LAT&ulon=LON
|
|
## Search for TW numbers in received zone
|
|
# =
|
|
################################################################################
|
|
MY_PATH="`dirname \"$0\"`" # relative
|
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
. "${MY_PATH}/../tools/my.sh"
|
|
|
|
start=`date +%s`
|
|
|
|
echo "PORT=$1
|
|
THAT=$2
|
|
AND=$3
|
|
THIS=$4
|
|
APPNAME=$5
|
|
WHAT=$6
|
|
OBJ=$7
|
|
VAL=$8
|
|
MOATS=$9
|
|
COOKIE=$10"
|
|
PORT="$1" THAT="$2" AND="$3" THIS="$4" APPNAME="$5" WHAT="$6" OBJ="$7" VAL="$8" MOATS="$9" COOKIE="$10"
|
|
### transfer variables according to script
|
|
|
|
HTTPCORS="HTTP/1.1 200 OK
|
|
Access-Control-Allow-Origin: ${myASTROPORT}
|
|
Access-Control-Allow-Credentials: true
|
|
Access-Control-Allow-Methods: GET
|
|
Server: Astroport.ONE
|
|
Content-Type: text/html; charset=UTF-8
|
|
|
|
"
|
|
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
|
|
|
## CHECK FOR NOT PUBLISHING ALREADY (AVOID IPNS CRUSH)
|
|
alreadypublishing=$(ps axf --sort=+utime | grep -w 'ipfs name publish --key=' | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1)
|
|
if [[ ${alreadypublishing} ]]; then
|
|
echo "$HTTPCORS ERROR - (╥☁╥ ) - IPFS ALREADY PUBLISHING RETRY LATER" | nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
|
|
exit 1
|
|
fi
|
|
|
|
## START MANAGING UPLANET LAT/LON & PLAYER
|
|
mkdir -p ~/.zen/tmp/${MOATS}/
|
|
|
|
|
|
rm -Rf ~/.zen/tmp/${MOATS}/
|
|
exit 0
|