diff --git a/CHANGELOG.md b/CHANGELOG.md index 38acd724..a76e9399 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ developers to maintain and readjust their custom modifications on the main proje ### Added - Add support for PHP 8.4 (#1640) +- Add new secret token header field to webhooks and default to X-EA-Token (#1607) ### Fixed diff --git a/application/config/app.php b/application/config/app.php index 6cdba90a..dca27c74 100644 --- a/application/config/app.php +++ b/application/config/app.php @@ -9,10 +9,10 @@ | */ -$config['version'] = '1.5.0'; // This must be changed manually. +$config['version'] = '1.5.1-beta.1'; // This must be changed manually. $config['url'] = Config::BASE_URL; $config['debug'] = Config::DEBUG_MODE; -$config['cache_busting_token'] = 'ZV954'; +$config['cache_busting_token'] = 'UH44E'; diff --git a/application/controllers/Webhooks.php b/application/controllers/Webhooks.php index 47f6bf80..901268b1 100644 --- a/application/controllers/Webhooks.php +++ b/application/controllers/Webhooks.php @@ -20,7 +20,16 @@ */ class Webhooks extends EA_Controller { - public array $allowed_webhook_fields = ['id', 'name', 'url', 'actions', 'secret_token', 'is_ssl_verified', 'notes']; + public array $allowed_webhook_fields = [ + 'id', + 'name', + 'url', + 'actions', + 'secret_header', + 'secret_token', + 'is_ssl_verified', + 'notes', + ]; public array $optional_webhook_fields = [ // diff --git a/application/language/arabic/translations_lang.php b/application/language/arabic/translations_lang.php index aabebdbc..50302e6b 100755 --- a/application/language/arabic/translations_lang.php +++ b/application/language/arabic/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'الحقول'; $lang['invalid_credentials_provided'] = 'تم تقديم بيانات اعتماد غير صالحة، يرجى المحاولة مرة أخرى'; $lang['calendar_url'] = 'عنوان URL للتقويم'; $lang['please_select'] = 'يرجى الاختيار'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/bosnian/translations_lang.php b/application/language/bosnian/translations_lang.php index e7561f8f..06be9326 100644 --- a/application/language/bosnian/translations_lang.php +++ b/application/language/bosnian/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Polja'; $lang['invalid_credentials_provided'] = 'Nevažeći akreditivi su navedeni, pokušajte ponovo.'; $lang['calendar_url'] = 'URL kalendara'; $lang['please_select'] = 'Molimo izaberite'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/bulgarian/translations_lang.php b/application/language/bulgarian/translations_lang.php index ce2a1e6b..8b5192f7 100755 --- a/application/language/bulgarian/translations_lang.php +++ b/application/language/bulgarian/translations_lang.php @@ -482,4 +482,5 @@ $lang['display_on_calendar'] = 'Покажи в календара'; $lang['display_in_services'] = 'Покажи в услугите'; $lang['import_ldap_users'] = 'Импортиране на LDAP потребители'; $lang['manage_providers'] = 'Управление на доставчици'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/catalan/translations_lang.php b/application/language/catalan/translations_lang.php index f318d6f9..c3f0a93b 100644 --- a/application/language/catalan/translations_lang.php +++ b/application/language/catalan/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Camps'; $lang['invalid_credentials_provided'] = 'Les credencials no són vàlides, torneu-ho a provar un altre cop.'; $lang['calendar_url'] = 'URL del calendari'; $lang['please_select'] = 'Si us plau, seleccioneu'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/chinese/translations_lang.php b/application/language/chinese/translations_lang.php index fc5f41ce..91c7151e 100755 --- a/application/language/chinese/translations_lang.php +++ b/application/language/chinese/translations_lang.php @@ -496,4 +496,5 @@ $lang['email'] = '电子邮件'; $lang['website'] = '网站'; $lang['social_media'] = '社交媒体'; $lang['follow_us'] = '关注我们'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/croatian/translations_lang.php b/application/language/croatian/translations_lang.php index 8356d720..32b78e9f 100644 --- a/application/language/croatian/translations_lang.php +++ b/application/language/croatian/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Polja'; $lang['invalid_credentials_provided'] = 'Pruženi podaci za prijavu su neispravni, pokušajte ponovo.'; $lang['calendar_url'] = 'URL Kalendar'; $lang['please_select'] = 'Molimo Odaberite'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/czech/translations_lang.php b/application/language/czech/translations_lang.php index cd5cbdeb..51734c71 100644 --- a/application/language/czech/translations_lang.php +++ b/application/language/czech/translations_lang.php @@ -489,4 +489,5 @@ $lang['export'] = 'Exportovat'; $lang['open'] = 'Otevřít'; $lang['close'] = 'Zavřít'; $lang['confirm_delete'] = 'Opravdu chcete odstranit tento záznam?'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/danish/translations_lang.php b/application/language/danish/translations_lang.php index b783eb00..b7bab183 100755 --- a/application/language/danish/translations_lang.php +++ b/application/language/danish/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Felter'; $lang['invalid_credentials_provided'] = 'Ugyldige legitimationsoplysninger angivet, prøv igen.'; $lang['calendar_url'] = 'Kalender URL'; $lang['please_select'] = 'Vælg venligst'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/dutch/translations_lang.php b/application/language/dutch/translations_lang.php index c5ba363f..3d08f78f 100755 --- a/application/language/dutch/translations_lang.php +++ b/application/language/dutch/translations_lang.php @@ -494,4 +494,5 @@ $lang['event_detail'] = 'Evenement Detail'; $lang['event_success'] = 'Evenement succesvol toegevoegd.'; $lang['event_update_success'] = 'Evenement succesvol bijgewerkt.'; $lang['event_delete_success'] = 'Evenement succesvol verwijderd.'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/english/translations_lang.php b/application/language/english/translations_lang.php index 81a85f9f..e641365e 100755 --- a/application/language/english/translations_lang.php +++ b/application/language/english/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Fields'; $lang['invalid_credentials_provided'] = 'Invalid credentials provided, please try again.'; $lang['calendar_url'] = 'Calendar URL'; $lang['please_select'] = 'Please Select'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/estonian/translations_lang.php b/application/language/estonian/translations_lang.php index 4ecfcfd7..c5c7d76a 100644 --- a/application/language/estonian/translations_lang.php +++ b/application/language/estonian/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Väljad'; $lang['invalid_credentials_provided'] = 'Esitatud andmed on vigased, palun proovige uuesti.'; $lang['calendar_url'] = 'Kalendri URL'; $lang['please_select'] = 'Palun Valige'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/finnish/translations_lang.php b/application/language/finnish/translations_lang.php index c58e0211..8a2d995d 100755 --- a/application/language/finnish/translations_lang.php +++ b/application/language/finnish/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Kentät'; $lang['invalid_credentials_provided'] = 'Tunnukset olivat virheelliset, ole hyvä ja yritä uudelleen.'; $lang['calendar_url'] = 'Kalenterin URL'; $lang['please_select'] = 'Valitse'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/french/translations_lang.php b/application/language/french/translations_lang.php index 31ed453c..777e86a4 100755 --- a/application/language/french/translations_lang.php +++ b/application/language/french/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Champs'; $lang['invalid_credentials_provided'] = 'Identifiants fournis invalides, veuillez réessayer.'; $lang['calendar_url'] = 'URL du Calendrier'; $lang['please_select'] = 'Veuillez Sélectionner'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/german/translations_lang.php b/application/language/german/translations_lang.php index 1e88a192..b176a95a 100755 --- a/application/language/german/translations_lang.php +++ b/application/language/german/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Fields'; $lang['invalid_credentials_provided'] = 'Invalid credentials provided, please try again.'; $lang['calendar_url'] = 'Calendar URL'; $lang['please_select'] = 'Bitte Wählen'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/greek/translations_lang.php b/application/language/greek/translations_lang.php index 586585e8..79f11503 100755 --- a/application/language/greek/translations_lang.php +++ b/application/language/greek/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Fields'; $lang['invalid_credentials_provided'] = 'Invalid credentials provided, please try again.'; $lang['calendar_url'] = 'Calendar URL'; $lang['please_select'] = 'Παρακαλώ Επιλέξτε'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/hebrew/translations_lang.php b/application/language/hebrew/translations_lang.php index 37da8744..4a333999 100644 --- a/application/language/hebrew/translations_lang.php +++ b/application/language/hebrew/translations_lang.php @@ -450,4 +450,5 @@ $lang['webhook_saved'] = 'WebHook נשמר בהצלחה.'; $lang['webhook_deleted'] = 'WebHook נמחק בהצלחה.'; $lang['delete_webhook'] = 'מחק WebHook'; $lang['contact_info'] = 'מידע ליצירת קשר'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/hindi/translations_lang.php b/application/language/hindi/translations_lang.php index 4f267e5b..8f4fe9eb 100755 --- a/application/language/hindi/translations_lang.php +++ b/application/language/hindi/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'फ़ील्ड्स'; $lang['invalid_credentials_provided'] = 'अमान्य क्रेडेंशियल्स प्रदान किए गए हैं, कृपया पुनः प्रयास करें।'; $lang['calendar_url'] = 'कैलेंडर URL'; $lang['please_select'] = 'कृपया चयन करें'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/hungarian/translations_lang.php b/application/language/hungarian/translations_lang.php index b9530391..0a6c5997 100755 --- a/application/language/hungarian/translations_lang.php +++ b/application/language/hungarian/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Mezők'; $lang['invalid_credentials_provided'] = 'Érvénytelen hitelesítő adatok lettek megadva, kérem próbálja újra.'; $lang['calendar_url'] = 'Naptár URL'; $lang['please_select'] = 'Kérem válasszon'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/italian/translations_lang.php b/application/language/italian/translations_lang.php index dadbaa1c..a03b4b52 100755 --- a/application/language/italian/translations_lang.php +++ b/application/language/italian/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Campi'; $lang['invalid_credentials_provided'] = 'Credenziali fornite non valide, riprova.'; $lang['calendar_url'] = 'URL Calendario'; $lang['please_select'] = 'Seleziona'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/japanese/translations_lang.php b/application/language/japanese/translations_lang.php index fd7f917e..e9c59d59 100755 --- a/application/language/japanese/translations_lang.php +++ b/application/language/japanese/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'フィールド'; $lang['invalid_credentials_provided'] = '無効な認証情報が提供されました。もう一度お試しください。'; $lang['calendar_url'] = 'カレンダーURL'; $lang['please_select'] = '選択してください'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/latvian/translations_lang.php b/application/language/latvian/translations_lang.php index f6ccff1d..34482b62 100644 --- a/application/language/latvian/translations_lang.php +++ b/application/language/latvian/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Lauki'; $lang['invalid_credentials_provided'] = 'Sniegti nepareizi akreditācijas dati, lūdzu, mēģiniet vēlreiz.'; $lang['calendar_url'] = 'Kalendāra URL'; $lang['please_select'] = 'Lūdzu, izvēlieties'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/lithuanian/translations_lang.php b/application/language/lithuanian/translations_lang.php index de37e3c8..3e043944 100644 --- a/application/language/lithuanian/translations_lang.php +++ b/application/language/lithuanian/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Fields'; $lang['invalid_credentials_provided'] = 'Pateikti negaliojantys duomenys, bandykite dar kartą.'; $lang['calendar_url'] = 'Kalendoriaus URL'; $lang['please_select'] = 'Prašome pasirinkti'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/luxembourgish/translations_lang.php b/application/language/luxembourgish/translations_lang.php index 5b95d324..23041777 100755 --- a/application/language/luxembourgish/translations_lang.php +++ b/application/language/luxembourgish/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Felder'; $lang['invalid_credentials_provided'] = 'Onvalabel Benotzerdaten, probéiert w.e.g. nach eng Kéier.'; $lang['calendar_url'] = 'Kalenner URL'; $lang['please_select'] = 'Wielt w.e.g.'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/marathi/translations_lang.php b/application/language/marathi/translations_lang.php index 2e6c80ee..7c5b4921 100644 --- a/application/language/marathi/translations_lang.php +++ b/application/language/marathi/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'फील्ड'; $lang['invalid_credentials_provided'] = 'अवैध प्रमाणपत्रे प्रदान केली गेली, कृपया पुन्हा प्रयत्न करा.'; $lang['calendar_url'] = 'कॅलेंडर URL'; $lang['please_select'] = 'कृपया निवडा'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/norwegian/translations_lang.php b/application/language/norwegian/translations_lang.php index 61ffe972..e644235d 100644 --- a/application/language/norwegian/translations_lang.php +++ b/application/language/norwegian/translations_lang.php @@ -458,4 +458,5 @@ $lang['default_timezone_hint'] = 'Angi standard tidssoneverdi som skal brukes fo $lang['default_language'] = 'Standardspråk'; $lang['default_language_hint'] = 'Angi standard språkverdi som skal brukes for nye poster.'; $lang['sync_method_prompt'] = 'Hvilken synkroniseringsmetode ønsker du å bruke?'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/persian/translations_lang.php b/application/language/persian/translations_lang.php index c3b58843..ec90c90f 100644 --- a/application/language/persian/translations_lang.php +++ b/application/language/persian/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'فیلدها'; $lang['invalid_credentials_provided'] = 'اعتبارنامههای نامعتبر ارائه شده است، لطفاً دوباره تلاش کنید.'; $lang['calendar_url'] = 'URL تقویم'; $lang['please_select'] = 'لطفاً انتخاب کنید'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/polish/translations_lang.php b/application/language/polish/translations_lang.php index 2f509c8c..087b5edf 100755 --- a/application/language/polish/translations_lang.php +++ b/application/language/polish/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Pola'; $lang['invalid_credentials_provided'] = 'Podano nieprawidłowe dane logowania, spróbuj ponownie.'; $lang['calendar_url'] = 'URL kalendarza'; $lang['please_select'] = 'Proszę wybrać'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/portuguese-br/translations_lang.php b/application/language/portuguese-br/translations_lang.php index ec3dfb42..8711b64a 100755 --- a/application/language/portuguese-br/translations_lang.php +++ b/application/language/portuguese-br/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Campos'; $lang['invalid_credentials_provided'] = 'Credenciais inválidas fornecidas, por favor, tente novamente.'; $lang['calendar_url'] = 'URL do Calendário'; $lang['please_select'] = 'Por Favor, Selecione'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/portuguese/translations_lang.php b/application/language/portuguese/translations_lang.php index ff158939..819ac9c2 100755 --- a/application/language/portuguese/translations_lang.php +++ b/application/language/portuguese/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Campos'; $lang['invalid_credentials_provided'] = 'Credenciais inválidas fornecidas, por favor, tente novamente.'; $lang['calendar_url'] = 'URL do Calendário'; $lang['please_select'] = 'Por Favor Selecione'; -// End \ No newline at end of file +$lang['secret_header'] = 'Secret Header'; +// End diff --git a/application/language/romanian/translations_lang.php b/application/language/romanian/translations_lang.php index 0de3bfe7..0ee367be 100755 --- a/application/language/romanian/translations_lang.php +++ b/application/language/romanian/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Câmpuri'; $lang['invalid_credentials_provided'] = 'Credențiale invalide furnizate, vă rugăm să încercați din nou.'; $lang['calendar_url'] = 'URL Calendar'; $lang['please_select'] = 'Vă Rugăm să Selectați'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/russian/translations_lang.php b/application/language/russian/translations_lang.php index c98b03a8..eb9e3937 100644 --- a/application/language/russian/translations_lang.php +++ b/application/language/russian/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Поля'; $lang['invalid_credentials_provided'] = 'Предоставлены неверные учетные данные, пожалуйста, попробуйте снова.'; $lang['calendar_url'] = 'URL Календаря'; $lang['please_select'] = 'Пожалуйста, выберите'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/serbian/translations_lang.php b/application/language/serbian/translations_lang.php index f9acfd84..13881ebf 100644 --- a/application/language/serbian/translations_lang.php +++ b/application/language/serbian/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Polja'; $lang['invalid_credentials_provided'] = 'Pružene kredencijale su nevažeće, molimo pokušajte ponovo.'; $lang['calendar_url'] = 'URL Kalendara'; $lang['please_select'] = 'Molimo izaberite'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/slovak/translations_lang.php b/application/language/slovak/translations_lang.php index 5e708d88..fa8fd649 100755 --- a/application/language/slovak/translations_lang.php +++ b/application/language/slovak/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Polia'; $lang['invalid_credentials_provided'] = 'Poskytnuté údaje sú neplatné, skúste to prosím znova.'; $lang['calendar_url'] = 'URL kalendára'; $lang['please_select'] = 'Vyberte prosím'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/slovenian/translations_lang.php b/application/language/slovenian/translations_lang.php index 803127c4..a010cc64 100644 --- a/application/language/slovenian/translations_lang.php +++ b/application/language/slovenian/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Polja'; $lang['invalid_credentials_provided'] = 'Navedene neveljavne poverilnice, poskusite znova.'; $lang['calendar_url'] = 'URL koledarja'; $lang['please_select'] = 'Prosim izberite'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/spanish/translations_lang.php b/application/language/spanish/translations_lang.php index fcf0b43d..8e5b63e7 100755 --- a/application/language/spanish/translations_lang.php +++ b/application/language/spanish/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Campos'; $lang['invalid_credentials_provided'] = 'Credenciales inválidas proporcionadas, por favor intente nuevamente.'; $lang['calendar_url'] = 'URL del Calendario'; $lang['please_select'] = 'Por Favor Seleccione'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/swedish/translations_lang.php b/application/language/swedish/translations_lang.php index e4134413..7690f4f8 100644 --- a/application/language/swedish/translations_lang.php +++ b/application/language/swedish/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Fält'; $lang['invalid_credentials_provided'] = 'Ogiltiga uppgifter angivna, vänligen försök igen.'; $lang['calendar_url'] = 'Kalender-URL'; $lang['please_select'] = 'Vänligen välj'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/thai/translations_lang.php b/application/language/thai/translations_lang.php index 0068dc34..da589e1e 100644 --- a/application/language/thai/translations_lang.php +++ b/application/language/thai/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'ฟิลด์'; $lang['invalid_credentials_provided'] = 'ข้อมูลรับรองไม่ถูกต้อง กรุณาลองอีกครั้ง'; $lang['calendar_url'] = 'URL ปฏิทิน'; $lang['please_select'] = 'กรุณาเลือก'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/traditional-chinese/translations_lang.php b/application/language/traditional-chinese/translations_lang.php index 9f402dfa..1b63d7ec 100644 --- a/application/language/traditional-chinese/translations_lang.php +++ b/application/language/traditional-chinese/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = '欄位'; $lang['invalid_credentials_provided'] = '提供的憑證無效,請重試。'; $lang['calendar_url'] = '日曆網址'; $lang['please_select'] = '請選擇'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/language/turkish/translations_lang.php b/application/language/turkish/translations_lang.php index f56bbc6c..b763c619 100755 --- a/application/language/turkish/translations_lang.php +++ b/application/language/turkish/translations_lang.php @@ -483,4 +483,5 @@ $lang['fields'] = 'Alanlar'; $lang['invalid_credentials_provided'] = 'Geçersiz kimlik bilgileri sağlandı, lütfen tekrar deneyin.'; $lang['calendar_url'] = 'Takvim URL'; $lang['please_select'] = 'Lütfen Seçin'; +$lang['secret_header'] = 'Secret Header'; // End diff --git a/application/libraries/Webhooks_client.php b/application/libraries/Webhooks_client.php index 921c71a3..a3ace6f8 100644 --- a/application/libraries/Webhooks_client.php +++ b/application/libraries/Webhooks_client.php @@ -74,13 +74,22 @@ class Webhooks_client try { $client = new Client(); - $client->post($webhook['url'], [ + $headers = []; + + if (!empty($webhook['secret_header']) && !empty($webhook['secret_token'])) { + $headers[$webhook['secret_header']] = $webhook['secret_token']; + } + + $response = $client->post($webhook['url'], [ 'verify' => $webhook['is_ssl_verified'], + 'headers' => $headers, 'json' => [ 'action' => $action, 'payload' => $payload, ], ]); + + echo $response->getBody()->getContents(); // Use this for quick debugging } catch (Throwable $e) { log_message( 'error', diff --git a/application/migrations/060_add_secret_header_column_to_webhooks_table.php b/application/migrations/060_add_secret_header_column_to_webhooks_table.php new file mode 100644 index 00000000..eb85215a --- /dev/null +++ b/application/migrations/060_add_secret_header_column_to_webhooks_table.php @@ -0,0 +1,44 @@ + + * @copyright Copyright (c) Alex Tselegidis + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org + * @since v1.4.0 + * ---------------------------------------------------------------------------- */ + +class Migration_Add_secret_header_column_to_webhooks_table extends EA_Migration +{ + /** + * Upgrade method. + */ + public function up(): void + { + if (!$this->db->field_exists('secret_header', 'webhooks')) { + $fields = [ + 'secret_header' => [ + 'type' => 'VARCHAR', + 'constraint' => '256', + 'default' => 'X-Ea-Token', + 'after' => 'actions', + ], + ]; + + $this->dbforge->add_column('webhooks', $fields); + } + } + + /** + * Downgrade method. + */ + public function down(): void + { + if ($this->db->field_exists('secret_header', 'webhooks')) { + $this->dbforge->drop_column('webhooks', 'secret_header'); + } + } +} diff --git a/application/views/pages/webhooks.php b/application/views/pages/webhooks.php index b770b6eb..a581bad6 100755 --- a/application/views/pages/webhooks.php +++ b/application/views/pages/webhooks.php @@ -79,13 +79,21 @@