mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Validate FCM service account JSON content
This commit is contained in:
parent
c7f96ad75b
commit
296f37f5f5
3 changed files with 12 additions and 0 deletions
|
|
@ -183,6 +183,16 @@ class Notification extends Base
|
|||
}
|
||||
$push_config[$driver_name][$conf_name] = $conf_value;
|
||||
|
||||
// Validate the FCM service account.
|
||||
if ($conf_name === 'service_account' && $conf_value !== null)
|
||||
{
|
||||
$decoded_value = @json_decode($conf_value, true);
|
||||
if (!$decoded_value || !isset($decoded_value['project_id']) || !isset($decoded_value['private_key']))
|
||||
{
|
||||
throw new Exception('msg_advanced_mailer_invalid_fcm_json');
|
||||
}
|
||||
}
|
||||
|
||||
// Save certificates in a separate file and only store the filename in config.php.
|
||||
if ($conf_name === 'certificate' || $conf_name === 'service_account')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -153,3 +153,4 @@ $lang->cmd_advanced_mailer_updated_count = 'Updated';
|
|||
$lang->cmd_advanced_mailer_not_rhymix = 'This module is for XE. It is incompatible with Rhymix. Please use the version included with Rhymix.';
|
||||
$lang->msg_advanced_mailer_about_fcm_legacy = 'The FCM Legacy API will stop working after June 2024.<br>Please change to the HTTP v1 API and set up a service account private key.';
|
||||
$lang->msg_advanced_mailer_about_fcm_service_account = 'Generate a new private key in the "Service accounts" menu of the Firebase console.<br>Then paste the contents of the downloaded JSON file above.';
|
||||
$lang->msg_advanced_mailer_invalid_fcm_json = 'The FCM service account you entered is not valid JSON.';
|
||||
|
|
|
|||
|
|
@ -153,3 +153,4 @@ $lang->cmd_advanced_mailer_updated_count = '변경';
|
|||
$lang->cmd_advanced_mailer_not_rhymix = '이 모듈은 XE용으로, 라이믹스와는 호환되지 않습니다. 라이믹스에 기본 포함된 버전을 사용하시기 바랍니다.';
|
||||
$lang->msg_advanced_mailer_about_fcm_legacy = 'FCM Legacy API는 2024년 6월 이후 사용할 수 없습니다.<br>HTTP v1 API로 변경하고 서비스 계정 비공개 키를 설정하십시오.';
|
||||
$lang->msg_advanced_mailer_about_fcm_service_account = 'Firebase 콘솔의 "서비스 계정" 메뉴에서 비공개 키를 생성한 후,<br>다운로드한 JSON 파일의 내용을 빈 칸에 붙여넣으십시오.';
|
||||
$lang->msg_advanced_mailer_invalid_fcm_json = '입력하신 FCM 서비스 계정 파일 내용은 유효한 JSON이 아닙니다.';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue