diff --git a/src/api/DynuAPI.cpp b/src/api/DynuAPI.cpp index 1cc3bb0..c5f05e0 100644 --- a/src/api/DynuAPI.cpp +++ b/src/api/DynuAPI.cpp @@ -6,11 +6,6 @@ int DynuAPI::refreshIp(std:: string ip) { - static std::string dynuapikey = "88vNpMfDhMM2YYDNfWR1DNYfRX9W6fYg"; - - static std::string domainid = "8506047"; //id of the dynu domain - static std::string domainname = "luki.dynu.net"; - Hashmap args; args.add("name", domainname); args.add("ipv4Address", ip); @@ -22,7 +17,7 @@ int DynuAPI::refreshIp(std:: string ip) { std::string dynurepl = request("https://api.dynu.com/v2/dns/" + domainid, true, args, headers); - std::cout << "[DEBUG] api reply:: " << dynurepl << std::endl; +// std::cout << "[DEBUG] api reply:: " << dynurepl << std::endl; if (dynurepl != "{\"statusCode\":200}") { return -1; diff --git a/src/api/DynuAPI.h b/src/api/DynuAPI.h index 53d0d42..fad52a9 100644 --- a/src/api/DynuAPI.h +++ b/src/api/DynuAPI.h @@ -12,8 +12,10 @@ class DynuAPI : API{ public: int refreshIp(std::string ip); private: + const std::string dynuapikey = "88vNpMfDhMM2YYDNfWR1DNYfRX9W6fYg"; - + const std::string domainid = "8506047"; //id of the dynu domain + const std::string domainname = "luki.dynu.net"; }; diff --git a/src/api/IPAPI.h b/src/api/IPAPI.h index 1a280d8..a8836c4 100644 --- a/src/api/IPAPI.h +++ b/src/api/IPAPI.h @@ -12,7 +12,6 @@ class IPAPI : API{ public: std::string getGlobalIp(); - }; diff --git a/src/api/TelegramAPI.cpp b/src/api/TelegramAPI.cpp index 6d2f9f5..c2dd2f8 100644 --- a/src/api/TelegramAPI.cpp +++ b/src/api/TelegramAPI.cpp @@ -12,5 +12,5 @@ void TelegramAPI::sendMessage(std::string text) { std::vector headers; std::string reply = request("https://api.telegram.org/bot" + apikey + "/sendmessage", false, args, headers); - std::cout << "[DEBUG] " << reply << std::endl; +// std::cout << "[DEBUG] " << reply << std::endl; } diff --git a/src/api/TelegramAPI.h b/src/api/TelegramAPI.h index e6e4c7a..bd8be49 100644 --- a/src/api/TelegramAPI.h +++ b/src/api/TelegramAPI.h @@ -14,8 +14,8 @@ public: void sendMessage(std::string text); private: - std::string apikey = "717213769:AAHan1nSXhUsxLJAN1Dv8Oc0z8wqwDdYPn4"; - std::string chatid = "618154204"; + const std::string apikey = "717213769:AAHan1nSXhUsxLJAN1Dv8Oc0z8wqwDdYPn4"; + const std::string chatid = "618154204"; }; diff --git a/src/main.cpp b/src/main.cpp index 18a87d7..f15abe6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -42,9 +42,9 @@ int main(int argc, char *argv[]) { std::cout << "[INFO] ip changed! -- from :" << oldip << "to: " << ip << std::endl; DynuAPI dynu; - TelegramAPI tele; if(dynu.refreshIp(ip)){ + TelegramAPI tele; tele.sendMessage(oldip + " moved to " + ip); } else{ //error