Refactor to use stdout instead of functions, remove pterodactyl plugin
This commit is contained in:
parent
e170f72947
commit
2ef30d6382
@ -1,7 +1,7 @@
|
||||
# Record name $3
|
||||
# Record type $4
|
||||
# Record content $5 (TODO default: own IP)
|
||||
# Cloudflare Proxy $6 (true/false)
|
||||
# Record type $4 (A)
|
||||
# Record content $5 (own IP)
|
||||
# Cloudflare Proxy $6 (true)
|
||||
|
||||
if FETCH=$(curl -sX GET "https://api.cloudflare.com/client/v4/zones/$ZONE/dns_records" \
|
||||
-H "X-Auth-Email: ${EMAIL}" \
|
||||
@ -21,11 +21,11 @@ if FETCH=$(curl -sX GET "https://api.cloudflare.com/client/v4/zones/$ZONE/dns_re
|
||||
;;
|
||||
"set")
|
||||
if ! (containsElement "$3" "${DOMAIN[@]}"); then
|
||||
if $(curl -sX POST "https://api.cloudflare.com/client/v4/zones/$ZONE/dns_records" \
|
||||
if (curl -sX POST "https://api.cloudflare.com/client/v4/zones/$ZONE/dns_records" \
|
||||
-H "X-Auth-Email: ${EMAIL}" \
|
||||
-H "X-Auth-Key: ${AUTH_KEY}" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data "{\"type\":\"${4}\",\"name\":\"${3}\",\"content\":\"${5}\",\"proxied\":"${6}"}" | jq -r '.success'); then
|
||||
--data "{\"type\":\"${4:-A}\",\"name\":\"${3}\",\"content\":\"${5:-$(curl -sS https://api.ipify.org)}\",\"proxied\":"${6:-true}"}" > /dev/null 2>&1); then
|
||||
echo "done Registered entry successfully."
|
||||
else
|
||||
echo "erro Failed to add entry"
|
||||
@ -33,11 +33,11 @@ if FETCH=$(curl -sX GET "https://api.cloudflare.com/client/v4/zones/$ZONE/dns_re
|
||||
else
|
||||
for ((i=0;i<${#DOMAIN[@]};++i)); do
|
||||
if [[ "${DOMAIN[$i]}" = "$3" ]]; then
|
||||
if $(curl -sX PUT "https://api.cloudflare.com/client/v4/zones/$ZONE/dns_records/$(echo "${FETCH}" | jq --compact-output -r "{(.result[$i].id): .result[$i].name}" | grep -oP "(?<=\{\")(.*)(?=\"\:\".*\"\})")" \
|
||||
if (curl -sX PUT "https://api.cloudflare.com/client/v4/zones/$ZONE/dns_records/$(echo "${FETCH}" | jq --compact-output -r "{(.result[$i].id): .result[$i].name}" | grep -oP "(?<=\{\")(.*)(?=\"\:\".*\"\})")" \
|
||||
-H "X-Auth-Email: ${EMAIL}" \
|
||||
-H "X-Auth-Key: ${AUTH_KEY}" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data "{\"type\":\"${4}\",\"name\":\"${3}\",\"content\":\"${5}\",\"proxied\":"${6}"}" | jq -r '.success'); then
|
||||
--data "{\"type\":\"${4:-A}\",\"name\":\"${3}\",\"content\":\"${5:-$(curl -sS https://api.ipify.org)}\",\"proxied\":"${6:-true}"}" > /dev/null 2>&1); then
|
||||
echo "done Edited entry successfully."
|
||||
else
|
||||
echo "erro Failed to edit entry"
|
||||
@ -50,10 +50,10 @@ if FETCH=$(curl -sX GET "https://api.cloudflare.com/client/v4/zones/$ZONE/dns_re
|
||||
if (containsElement "$3" "${DOMAIN[@]}"); then
|
||||
for ((i=0;i<${#DOMAIN[@]};++i)); do
|
||||
if [[ "${DOMAIN[$i]}" = "$3" ]]; then
|
||||
if $(curl -sX DELETE "https://api.cloudflare.com/client/v4/zones/$ZONE/dns_records/$(echo "${FETCH}" | jq --compact-output -r "{(.result[$i].id): .result[$i].name}" | grep -oP "(?<=\{\")(.*)(?=\"\:\".*\"\})")" \
|
||||
if (curl -sX DELETE "https://api.cloudflare.com/client/v4/zones/$ZONE/dns_records/$(echo "${FETCH}" | jq --compact-output -r "{(.result[$i].id): .result[$i].name}" | grep -oP "(?<=\{\")(.*)(?=\"\:\".*\"\})")" \
|
||||
-H "X-Auth-Email: ${EMAIL}" \
|
||||
-H "X-Auth-Key: ${AUTH_KEY}" \
|
||||
-H "Content-Type: application/json" | jq -r '.success'); then
|
||||
-H "Content-Type: application/json" > /dev/null 2>&1); then
|
||||
echo "done Removed entry successfully."
|
||||
else
|
||||
echo "erro Failed to remove entry"
|
||||
|
@ -1,30 +0,0 @@
|
||||
case "$2" in
|
||||
"update")
|
||||
cd /var/www/pterodactyl || exit
|
||||
php artisan down
|
||||
echo "info Fetching latest releases"
|
||||
curl -L https://github.com/pterodactyl/panel/releases/download/"$(getlatest "Pterodactyl/panel")"/panel.tar.gz | tar --strip-components=1 -xzv
|
||||
curl -L https://github.com/RXCommunity/RedXen-Panel/archive/"$(getlatest "RXCommunity/RedXen-Panel")".tar.gz | tar --strip-components=1 -xzv
|
||||
echo "info Ensuring permissions are correct"
|
||||
chown -R www-data:www-data ./*
|
||||
chmod -R 755 storage/* bootstrap/cache
|
||||
echo "info Getting latest deps"
|
||||
composer install --no-dev --optimize-autoloader || echo "erro Failed to get deps!"
|
||||
|
||||
artisanfunc=(
|
||||
"view:clear"
|
||||
"cache:clear"
|
||||
"config:cache"
|
||||
"migrate --force"
|
||||
"db:seed --force"
|
||||
"p:migration:clean-orphaned-keys -n"
|
||||
"up"
|
||||
)
|
||||
|
||||
echo "info Running migrations and clearance"
|
||||
for f in "${artisanfunc[@]}"; do
|
||||
php artisan $f || echo "erro Failed to execute 'artisan ${f}'"
|
||||
done
|
||||
;;
|
||||
*); echo "warn Nothing to do";;
|
||||
esac
|
Reference in New Issue
Block a user