mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-02-16 18:14:23 +01:00
Removed old developement API key
This commit is contained in:
parent
a29b5a62bb
commit
0c1a283867
3 changed files with 41 additions and 24 deletions
|
@ -21,6 +21,7 @@
|
||||||
namespace Poniverse\Ponyfm\Library\Notifications\Drivers;
|
namespace Poniverse\Ponyfm\Library\Notifications\Drivers;
|
||||||
|
|
||||||
|
|
||||||
|
use Config;
|
||||||
use Poniverse\Ponyfm\Contracts\Favouritable;
|
use Poniverse\Ponyfm\Contracts\Favouritable;
|
||||||
use Poniverse\Ponyfm\Models\Activity;
|
use Poniverse\Ponyfm\Models\Activity;
|
||||||
use Poniverse\Ponyfm\Models\Comment;
|
use Poniverse\Ponyfm\Models\Comment;
|
||||||
|
@ -37,32 +38,34 @@ class NativeDriver extends AbstractDriver {
|
||||||
* @param User[] $recipients collection of {@link User} objects
|
* @param User[] $recipients collection of {@link User} objects
|
||||||
*/
|
*/
|
||||||
private function pushNotifications(Activity $activity, $recipients) {
|
private function pushNotifications(Activity $activity, $recipients) {
|
||||||
$apiKeys = array(
|
if (Config::get('ponyfm.gcm_key') != 'default') {
|
||||||
'GCM' => 'AIzaSyCLmCVIgASWL280rHyPz8OP7il3pf8SrGg',
|
$apiKeys = array(
|
||||||
);
|
'GCM' => Config::get('ponyfm.gcm_key'),
|
||||||
|
|
||||||
$webPush = new WebPush($apiKeys);
|
|
||||||
|
|
||||||
$data = [
|
|
||||||
'id' => $activity->id,
|
|
||||||
'text' => $activity->getTextAttribute(),
|
|
||||||
'title' => $activity->getTitleFromActivityType(),
|
|
||||||
'image' => $activity->getThumbnailUrlAttribute(),
|
|
||||||
'url' => $activity->url
|
|
||||||
];
|
|
||||||
|
|
||||||
$jsonData = json_encode($data);
|
|
||||||
|
|
||||||
foreach ($recipients as $recipient) {
|
|
||||||
$webPush->sendNotification(
|
|
||||||
$recipient->endpoint,
|
|
||||||
$jsonData,
|
|
||||||
$recipient->p256dh,
|
|
||||||
$recipient->auth
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
$webPush->flush();
|
$webPush = new WebPush($apiKeys);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'id' => $activity->id,
|
||||||
|
'text' => $activity->getTextAttribute(),
|
||||||
|
'title' => $activity->getTitleFromActivityType(),
|
||||||
|
'image' => $activity->getThumbnailUrlAttribute(),
|
||||||
|
'url' => $activity->url
|
||||||
|
];
|
||||||
|
|
||||||
|
$jsonData = json_encode($data);
|
||||||
|
|
||||||
|
foreach ($recipients as $recipient) {
|
||||||
|
$webPush->sendNotification(
|
||||||
|
$recipient->endpoint,
|
||||||
|
$jsonData,
|
||||||
|
$recipient->p256dh,
|
||||||
|
$recipient->auth
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$webPush->flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -116,4 +116,17 @@ return [
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'user_slug_minimum_length' => 3
|
'user_slug_minimum_length' => 3
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Indexing queue name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Google Cloud Messaging API key. Needs to be generated in the Google Cloud
|
||||||
|
| Console as a browser key. This is used to send notifications to users
|
||||||
|
| with push notifications enabled.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'gcm_key' => env('GCM_KEY', 'default'),
|
||||||
];
|
];
|
||||||
|
|
|
@ -24,3 +24,4 @@ PONI_CLIENT_SECRET=null
|
||||||
PONYFM_DATASTORE=/vagrant/storage/app/datastore
|
PONYFM_DATASTORE=/vagrant/storage/app/datastore
|
||||||
|
|
||||||
GOOGLE_ANALYTICS_ID=null
|
GOOGLE_ANALYTICS_ID=null
|
||||||
|
GCM_KEY=12345
|
||||||
|
|
Loading…
Reference in a new issue