Generische iCal-Kanäle mit Bestandsklärung und sicheren Exporten bereitstellen
Deploy FeWo mit PipelineManager / deploy (push) Successful in 2m33s
Deploy FeWo mit PipelineManager / deploy (push) Successful in 2m33s
This commit is contained in:
1 parent
6fe5bbc6e3
commit
783068501c
42 files changed
+2646
-248
No files matched your search
@@ -4,7 +4,7 @@
|
||||
|
||||
use App\Actions\MonitorChannels;
|
||||
use App\Actions\ProcessPortalMail;
|
||||
use App\Channels\ICal\ICalFeed;
|
||||
use App\Channels\ICal\ICalExport;
|
||||
use App\Channels\Mail\MailboxReader;
|
||||
use App\Channels\Mail\PortalMail;
|
||||
use App\Enums\ChannelTaskStatus;
|
||||
@@ -23,16 +23,23 @@
|
||||
*/
|
||||
class ChannelController extends Controller
|
||||
{
|
||||
public function feed(string $token, ICalFeed $feed): Response
|
||||
public function feed(string $token, ICalExport $feed): Response
|
||||
{
|
||||
$channel = Channel::query()->where('export_token', $token)->where('is_active', true)->firstOrFail();
|
||||
$channel = Channel::query()->where(fn ($query) => $query->where('export_token', $token)
|
||||
->orWhere(fn ($previous) => $previous->where('previous_export_token', $token)->where('previous_export_token_expires_at', '>', now())))->firstOrFail();
|
||||
|
||||
abort_unless($channel->servesItsLandlord(), 404);
|
||||
|
||||
return response($feed->build($channel), 200, [
|
||||
$body = $feed->build($channel);
|
||||
if ($body === null) {
|
||||
return response('Der Export ist pausiert; es liegt noch kein gültiger Kalenderstand vor.', 503, ['Retry-After' => '300', 'Cache-Control' => 'no-store']);
|
||||
}
|
||||
|
||||
return response($body, 200, [
|
||||
'Content-Type' => 'text/calendar; charset=utf-8',
|
||||
'Content-Disposition' => 'inline; filename="belegung.ics"',
|
||||
'Cache-Control' => 'no-cache, max-age=0',
|
||||
'X-Fewo-Export-State' => $channel->exportsOccupations() ? 'live' : 'frozen',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user