X-Git-Url: https://git.rapsys.eu/airbundle/blobdiff_plain/fce9c148e3f79ba6e02bf23a1a3e2f0e04e275dc..b8b55ddc3d67e65f83b7e38d88affc654a264e0e:/Command/CalendarCommand.php diff --git a/Command/CalendarCommand.php b/Command/CalendarCommand.php index bc1075e..07e537b 100644 --- a/Command/CalendarCommand.php +++ b/Command/CalendarCommand.php @@ -122,25 +122,6 @@ class CalendarCommand extends Command { //Retrieve calendars $calendars = $cacheCalendars->get(); - //XXX: calendars content - #var_export($calendars); - #$debug = [ - # '635317121880-usqucmne71jnmprl8br9khh2om4n8cmh.apps.googleusercontent.com' => [ - # 'project' => 'calendar-317315', - # 'secret' => 'HRsKd4FIc9gxQHM4IoBWnlbD', - # 'redirect' => 'https://airlibre.eu/calendar/callback', - # 'tokens' => [ - # 'ya29.a0ARrdaM_cNpedJ-B3irC76_0-C7cfF-WmMh0smAs4m7cSvBChnniWr-e79q0IfAbh5DSG4FlHbCMvmaYb7xX4V45PujT2U4InZmpHfspiPv-QeR4XeZJp7bLXwnw7A4M0imeeYyQcwCW7GJ8O7dGLBQlBZAvt_Q' => [ - # 'calendar' => 'airlibre', - # 'expire' => 3599, - # 'scope' => 'https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/calendar.events', - # 'type' => 'Bearer', - # 'created' => 1625417137, - # ], - # ], - # ], - #]; - //Check expired token foreach($calendars as $clientId => $client) { //Get google client @@ -194,6 +175,8 @@ class CalendarCommand extends Command { $cache->save($cacheCalendars); //Drop token and report + //XXX: submit app to avoid expiration + //XXX: see https://console.cloud.google.com/apis/credentials/consent?project=calendar-317315 echo 'Token '.$tokenId.' for calendar '.$token['calendar'].' has expired and is not refreshable'."\n"; //Return failure @@ -297,6 +280,7 @@ class CalendarCommand extends Command { foreach($sessions as $sessionId => $session) { //Init shared properties //TODO: validate for constraints here ??? https://developers.google.com/calendar/api/guides/extended-properties + //TODO: drop shared as unused ??? $shared = [ 'gps' => $session['l_latitude'].','.$session['l_longitude'] ]; @@ -367,7 +351,7 @@ class CalendarCommand extends Command { //TODO: replace 'airlibre' with $this->config['calendar']['prefix'] when possible with prefix validating [a-v0-9]{5,} //XXX: see https://developers.google.com/calendar/api/v3/reference/events/insert#id 'id' => $token['prefix'].$sessionId, - 'summary' => $session['au_pseudonym'].' '.$this->translator->trans('at '.$session['l_short']), + 'summary' => $session['au_pseudonym'].' '.$this->translator->trans('at '.$session['l_title']), #'description' => $markdown->convert(strip_tags($session['p_description'])), 'description' => $description, 'status' => empty($session['a_canceled'])?'confirmed':'cancelled', @@ -408,7 +392,7 @@ class CalendarCommand extends Command { //With updated event if ($session['updated'] >= (new \DateTime($event->getUpdated()))) { //Set summary - $event->setSummary($session['au_pseudonym'].' '.$this->translator->trans('at '.$session['l_short'])); + $event->setSummary($session['au_pseudonym'].' '.$this->translator->trans('at '.$session['l_title'])); //Set description $event->setDescription($description);