Skip to content

Commit

Permalink
Rename API functions for consistency with core code
Browse files Browse the repository at this point in the history
Signed-off-by: DL6ER <[email protected]>
  • Loading branch information
DL6ER committed Jun 19, 2024
1 parent ec305e6 commit 3306095
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions padd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ TestAPIAvailability() {
fi
}

Authenthication() {
LoginAPI() {
# Try to authenticate
LoginAPI
Authenticate

while [ "${validSession}" = false ] || [ -z "${validSession}" ] ; do
moveXOffset; echo "Authentication failed."
Expand All @@ -186,7 +186,7 @@ Authenthication() {
moveXOffset; secretRead; printf '\n'

# Try to authenticate again
LoginAPI
Authenticate
done

# Loop exited, authentication was successful
Expand All @@ -211,7 +211,7 @@ DeleteSession() {

}

LoginAPI() {
Authenticate() {
sessionResponse="$(curl -skS -X POST "${API_URL}auth" --user-agent "PADD ${padd_version}" --data "{\"password\":\"${password}\"}" )"

if [ -z "${sessionResponse}" ]; then
Expand Down Expand Up @@ -1327,7 +1327,7 @@ OutputJSON() {
TestAPIAvailability
# Authenticate with the FTL server
printf "%b" "Establishing connection with FTL...\n"
Authenthication
LoginAPI

GetSummaryInformation
printf "%b" "{\"domains_being_blocked\":${domains_being_blocked_raw},\"dns_queries_today\":${dns_queries_today_raw},\"ads_blocked_today\":${ads_blocked_today_raw},\"ads_percentage_today\":${ads_percentage_today},\"clients\": ${clients}}"
Expand All @@ -1349,7 +1349,7 @@ ShowVersion() {
TestAPIAvailability
# Authenticate with the FTL server
printf "%b" "Establishing connection with FTL...\n"
Authenthication
LoginAPI

GetVersionInformation
GetPADDInformation
Expand Down Expand Up @@ -1386,7 +1386,7 @@ StartupRoutine(){

# Authenticate with the FTL server
moveXOffset; printf "%b" "Establishing connection with FTL...\n"
Authenthication
LoginAPI

printf "%b" "Starting PADD...\n"

Expand Down Expand Up @@ -1418,7 +1418,7 @@ StartupRoutine(){
TestAPIAvailability
# Authenticate with the FTL server
moveXOffset; printf "%b" "Establishing connection with FTL...\n"
Authenthication
LoginAPI

# Get our information for the first time
moveXOffset; echo "- Gathering version info."
Expand Down Expand Up @@ -1453,7 +1453,7 @@ StartupRoutine(){

# Authenticate with the FTL server
moveXOffset; printf "%b" "Establishing connection with FTL...\n"
Authenthication
LoginAPI


# Get our information for the first time
Expand Down Expand Up @@ -1522,7 +1522,7 @@ NormalPADD() {
# as $password should be set already, PADD should automatically re-authenticate
authenthication_required=$(GetFTLData "info/ftl")
if [ "${authenthication_required}" = 401 ]; then
LoginAPI
Authenticate
fi

# Get uptime, CPU load, temp, etc. every 5 seconds
Expand Down

0 comments on commit 3306095

Please sign in to comment.