From 0c468f3e4f985ac7897463e40dcb8b0c58710448 Mon Sep 17 00:00:00 2001 From: Xiretza Date: Tue, 16 Aug 2022 20:10:10 +0200 Subject: [PATCH] 2fb: use constants for API keys --- ITS_Open_direct_2fb/APIKey_template.h | 6 ++---- ITS_Open_direct_2fb/ITS_Open_direct_2fb.ino | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ITS_Open_direct_2fb/APIKey_template.h b/ITS_Open_direct_2fb/APIKey_template.h index 93ac795..482656d 100644 --- a/ITS_Open_direct_2fb/APIKey_template.h +++ b/ITS_Open_direct_2fb/APIKey_template.h @@ -1,6 +1,4 @@ // rename this file to "APIKey.h" and fill in a real key! -String thingtweetAPIKey = "myThingspeakKey"; -String serverAPIKey = "myserverAPIKey"; -String pingGetAPIKey ="pingGetApiKey"; - +#define UPDATE_API_KEY "updateApiKey" +#define PING_GET_API_KEY "pingGetApiKey" diff --git a/ITS_Open_direct_2fb/ITS_Open_direct_2fb.ino b/ITS_Open_direct_2fb/ITS_Open_direct_2fb.ino index aafff58..403b177 100644 --- a/ITS_Open_direct_2fb/ITS_Open_direct_2fb.ino +++ b/ITS_Open_direct_2fb/ITS_Open_direct_2fb.ino @@ -339,7 +339,7 @@ void TriggerServerUpdate(boolean stat) { if(debug){Serial.println("making HTTP request...");} // make HTTP GET request to server: String s =(stat?"true":"false"); - client.println("GET /api/update.php?open=" + s + "&apikey="+serverAPIKey+" HTTP/1.1"); + client.println("GET /api/update.php?open=" + s + "&apikey=" UPDATE_API_KEY + " HTTP/1.1"); client.println("HOST: " SERVER_DOMAIN); client.println("Connection: close"); client.println(); @@ -364,7 +364,7 @@ void readButtons(){ } void RequestPing() { - TriggerServerReq("/api/ping-get.php?apikey="+pingGetAPIKey,1); + TriggerServerReq("/api/ping-get.php?apikey=" PING_GET_API_KEY,1); } void launchUpdate(){