mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-25 21:32:51 +09:00
Merge pull request #2323 from kijin/fcm-http-v1
Firebase (FCM) HTTP v1 API 지원
This commit is contained in:
commit
77b57627f2
227 changed files with 14001 additions and 2206 deletions
|
|
@ -67,6 +67,12 @@ class Notification extends Base
|
|||
$apns_certificate = Storage::read($apns_certificate_filename);
|
||||
}
|
||||
Context::set('apns_certificate', $apns_certificate);
|
||||
$fcmv1_service_account = false;
|
||||
if ($fcmv1_service_account_filename = config('push.fcmv1.service_account'))
|
||||
{
|
||||
$fcmv1_service_account = Storage::read($fcmv1_service_account_filename);
|
||||
}
|
||||
Context::set('fcmv1_service_account', $fcmv1_service_account);
|
||||
|
||||
// Workaround for compatibility with older version of Amazon SES driver.
|
||||
config('mail.ses.api_key', config('mail.ses.api_user'));
|
||||
|
|
@ -177,18 +183,36 @@ class Notification extends Base
|
|||
}
|
||||
$push_config[$driver_name][$conf_name] = $conf_value;
|
||||
|
||||
// Save certificates in a separate file and only store the filename in config.php.
|
||||
if ($conf_name === 'certificate')
|
||||
// Validate the FCM service account.
|
||||
if ($conf_name === 'service_account' && $conf_value !== null)
|
||||
{
|
||||
$filename = Config::get('push.' . $driver_name . '.certificate');
|
||||
$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')
|
||||
{
|
||||
$filename = Config::get('push.' . $driver_name . '.' . $conf_name);
|
||||
if (!$filename)
|
||||
{
|
||||
$filename = './files/config/' . $driver_name . '/cert-' . \Rhymix\Framework\Security::getRandom(32) . '.pem';
|
||||
if ($conf_name === 'certificate')
|
||||
{
|
||||
$filename = './files/config/' . $driver_name . '/cert-' . \Rhymix\Framework\Security::getRandom(32) . '.pem';
|
||||
}
|
||||
else
|
||||
{
|
||||
$filename = './files/config/' . $driver_name . '/pkey-' . \Rhymix\Framework\Security::getRandom(32) . '.json';
|
||||
}
|
||||
}
|
||||
|
||||
if ($conf_value !== null)
|
||||
{
|
||||
Storage::write($filename, $conf_value);
|
||||
Storage::write('./files/config/' . $driver_name . '/index.html', '<!-- Direct Access Not Allowed -->');
|
||||
$push_config[$driver_name][$conf_name] = $filename;
|
||||
}
|
||||
elseif (Storage::exists($filename))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue