Commit d9aca7db authored by jan.koester's avatar jan.koester
Browse files

test

parent 3787f2fc
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ namespace blogi {
            try { getConfig(*Args->database[0], "GOOGLE_PLACE_ID", _placeId); } catch(...) {}
            try { getConfig(*Args->database[0], "GOOGLE_REVIEW_NOTIFY_EMAIL", _notifyEmail); } catch(...) {}
            try { getConfig(*Args->database[0], "GOOGLE_REVIEW_SYNC_DAYS", _syncDays); } catch(...) {}
            try { getConfig(*Args->database[0], "GOOGLE_REVIEW_LANGUAGE", _language); } catch(...) {}

            _syncThread = std::thread(&GooglePlugin::_syncWorker, this);

@@ -124,6 +125,10 @@ namespace blogi {
                    _placeId = cur.value;
                    setConfig(*Args->database[tid], "GOOGLE_PLACE_ID", cur.value);
                    saved = true;
                } else if(cur.key == "google_language") {
                    _language = cur.value;
                    setConfig(*Args->database[tid], "GOOGLE_REVIEW_LANGUAGE", cur.value);
                    saved = true;
                }
            }

@@ -176,6 +181,7 @@ namespace blogi {

            addTextField("google_api_key",       "Google Places API Key",  _apiKey);
            addTextField("google_place_id",       "Google Place ID",        _placeId);
            addTextField("google_language",       "Sprache (z.B. de, en)",  _language);
            addTextField("google_notify_email",   "Notification E-Mail",    _notifyEmail);
            addTextField("google_sync_days",      "Sync Interval (days)",   std::to_string(_syncDays), "number");

@@ -319,6 +325,7 @@ namespace blogi {
        std::string _apiKey;
        std::string _placeId;
        std::string _notifyEmail;
        std::string _language = "de";
        int         _syncDays = 1;

        void _syncWorker() {
@@ -338,7 +345,8 @@ namespace blogi {
        void _fetchFromGoogle(int tid) {
            try {
                std::string path = "/maps/api/place/details/json?place_id=" + _placeId
                                 + "&fields=reviews%2Creviews.profile_photo_url&key=" + _apiKey;
                                 + "&fields=reviews%2Creviews.profile_photo_url&language=" + _language
                                 + "&key=" + _apiKey;
                libhttppp::HttpUrl apiUrl("https://maps.googleapis.com" + path);
                libhttppp::HttpClient client(apiUrl);
                client.setTimeout(15);