Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions database/migrations/2026_11_02_000001_add_rss_settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Spatie\LaravelSettings\Migrations\SettingsMigration;

return new class extends SettingsMigration
{
/**
* Run the migrations.
*/
public function up(): void
{
foreach ([
'incident_unknown',
'incident_investigating',
'incident_identified',
'incident_watching',
'incident_fixed',
'maintenance_upcoming',
'maintenance_in_progress',
'maintenance_complete',
] as $property) {
rescue(fn () => $this->migrator->add('rss.'.$property, true));
}

rescue(fn () => $this->migrator->add('rss.max_items', 100));
rescue(fn () => $this->migrator->add('rss.refresh_interval', 60));
}
};
2 changes: 0 additions & 2 deletions public/build/assets/cachet-Bx3l3HHD.css

This file was deleted.

5 changes: 5 additions & 0 deletions public/build/assets/cachet-CzZOVsa9.js

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions public/build/assets/cachet-DHCAi8ZN.js

This file was deleted.

2 changes: 2 additions & 0 deletions public/build/assets/cachet-DtIUKjOy.css

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions public/build/assets/metrics-0rXi1BiZ.js

This file was deleted.

7 changes: 7 additions & 0 deletions public/build/assets/metrics-BtN9hG-b.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions public/build/assets/theme-D_q-etUt.css

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions public/build/assets/theme-DuFjw7tD.css

This file was deleted.

8 changes: 4 additions & 4 deletions public/build/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"resources/css/cachet.css": {
"file": "assets/cachet-Bx3l3HHD.css",
"file": "assets/cachet-DtIUKjOy.css",
"name": "cachet",
"names": [
"cachet.css"
Expand All @@ -9,7 +9,7 @@
"isEntry": true
},
"resources/css/dashboard/theme.css": {
"file": "assets/theme-DuFjw7tD.css",
"file": "assets/theme-D_q-etUt.css",
"name": "theme",
"names": [
"theme.css"
Expand All @@ -18,7 +18,7 @@
"isEntry": true
},
"resources/js/cachet.js": {
"file": "assets/cachet-DHCAi8ZN.js",
"file": "assets/cachet-CzZOVsa9.js",
"name": "cachet",
"src": "resources/js/cachet.js",
"isEntry": true,
Expand All @@ -27,7 +27,7 @@
]
},
"resources/js/metrics.js": {
"file": "assets/metrics-0rXi1BiZ.js",
"file": "assets/metrics-BtN9hG-b.js",
"name": "metrics",
"src": "resources/js/metrics.js",
"isDynamicEntry": true
Expand Down
3 changes: 3 additions & 0 deletions resources/lang/en/cachet.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@
'open_source_status_page' => 'The open source status page.',
'all_times_shown_in' => 'All times are shown in *:timezone*.',
'rss_feed' => ':name RSS feed',
'rss_feed_link' => 'RSS feed',
'rss_incidents_feed' => 'Incidents RSS feed',
'rss_maintenance_feed' => 'Maintenance RSS feed',
];
1 change: 1 addition & 0 deletions resources/lang/en/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'manage_customization' => 'Manage Customization',
'manage_localization' => 'Manage Localization',
'manage_notifications' => 'Manage Notifications',
'manage_rss' => 'Manage RSS',
'manage_theme' => 'Manage Theme',
'manage_api_keys' => 'Manage API Keys',
'manage_webhooks' => 'Manage Webhooks',
Expand Down
12 changes: 12 additions & 0 deletions resources/lang/en/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@
'show_timezone_helper' => 'Show the active timezone next to dates on the status page.',
],
],
'manage_rss' => [
'feed_section_title' => 'Feed',
'max_items_label' => 'Maximum items',
'max_items_helper' => 'The most incidents and the most maintenance events included in a feed.',
'refresh_interval_label' => 'Refresh interval',
'refresh_interval_helper' => 'How long a feed is cached, and how long readers are told to wait before checking again.',
'refresh_interval_suffix' => 'seconds',
'incidents_section_title' => 'Incidents',
'incidents_section_description' => 'Include incidents in these statuses in the RSS feeds.',
'maintenance_section_title' => 'Maintenance',
'maintenance_section_description' => 'Include maintenance in these states in the RSS feeds.',
],
'manage_notifications' => [
'subscriptions_section_title' => 'Subscriptions',
'allow_subscribers_label' => 'Allow subscriptions',
Expand Down
4 changes: 4 additions & 0 deletions resources/svg/rss.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion resources/views/components/footer.blade.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
@php($footerHook = \Cachet\Facades\CachetView::renderHook(\Cachet\View\RenderHook::FOOTER))

@if ($showSupport || $showTimezone || (string) $footerHook !== '')
@if ($showSupport || $showTimezone || (string) $footerHook !== '' || $showRss)
<footer data-component="footer" class="mt-auto border-t border-zinc-900/10 dark:border-white/15">
<div data-slot="content" class="container mx-auto flex max-w-5xl flex-col items-center justify-center gap-3 px-4 py-8 text-center text-xs text-zinc-500 dark:text-zinc-400 sm:px-6 lg:px-8">
@if($showRss)
<a data-slot="rss" href="{{ route('cachet.rss') }}" title="{{ __('cachet::cachet.rss_feed_link') }}" aria-label="{{ __('cachet::cachet.rss_feed_link') }}" class="text-zinc-500 transition hover:text-accent-content dark:text-zinc-400">
@svg('cachet-rss', 'size-5')
</a>
@endif
@if($showSupport)
<div data-slot="support" class="inline-flex items-center gap-2 tracking-tight">
<span>{{ __('cachet::cachet.powered_by') }}</span>
Expand Down
12 changes: 9 additions & 3 deletions resources/views/components/incident-timeline.blade.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{{ \Cachet\Facades\CachetView::renderHook(\Cachet\View\RenderHook::STATUS_PAGE_INCIDENT_TIMELINE_BEFORE) }}
<section data-component="incident-timeline" class="flex flex-col gap-4">
<div data-slot="header" class="flex flex-col justify-between gap-3 md:flex-row md:items-center md:gap-0">
<h2 data-slot="title" class="text-2xl font-semibold tracking-tight text-zinc-900 dark:text-zinc-100">
{{ $recentIncidentsOnly ? __('cachet::incident.timeline.recent_incidents_header') : __('cachet::incident.timeline.past_incidents_header') }}
</h2>
<div class="flex items-center gap-3">
<h2 data-slot="title" class="text-2xl font-semibold tracking-tight text-zinc-900 dark:text-zinc-100">
{{ $recentIncidentsOnly ? __('cachet::incident.timeline.recent_incidents_header') : __('cachet::incident.timeline.past_incidents_header') }}
</h2>

<a data-slot="rss" href="{{ route('cachet.rss.incidents') }}" title="{{ __('cachet::cachet.rss_incidents_feed') }}" aria-label="{{ __('cachet::cachet.rss_incidents_feed') }}" class="text-zinc-500 transition hover:text-accent-content dark:text-zinc-400">
@svg('cachet-rss', 'size-5')
</a>
</div>

<fieldset data-slot="filters" aria-label="{{ __('cachet::incident.timeline.date_range_label') }}" class="grid grid-cols-2 gap-3 text-sm text-zinc-500 dark:text-zinc-400">
<label class="flex flex-col gap-1">
Expand Down
8 changes: 7 additions & 1 deletion resources/views/components/schedules.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<section data-component="schedules" class="flex flex-col gap-4">
<h2 data-slot="title" class="text-2xl font-semibold tracking-tight text-zinc-900 dark:text-zinc-100">{{ __('cachet::schedule.planned_maintenance_header') }}</h2>
<div data-slot="header" class="flex items-center justify-between gap-3">
<h2 data-slot="title" class="text-2xl font-semibold tracking-tight text-zinc-900 dark:text-zinc-100">{{ __('cachet::schedule.planned_maintenance_header') }}</h2>

<a data-slot="rss" href="{{ route('cachet.rss.maintenance') }}" title="{{ __('cachet::cachet.rss_maintenance_feed') }}" aria-label="{{ __('cachet::cachet.rss_maintenance_feed') }}" class="text-zinc-500 transition hover:text-accent-content dark:text-zinc-400">
@svg('cachet-rss', 'size-5')
</a>
</div>

<div data-slot="content" class="group relative overflow-hidden rounded-lg bg-white shadow-sm ring-1 ring-zinc-900/10 dark:bg-zinc-900 dark:ring-white/15">
<ul data-slot="list" class="divide-y divide-zinc-900/10 dark:divide-white/15">
Expand Down
18 changes: 11 additions & 7 deletions resources/views/rss.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,34 @@
<rss version="2.0">
<channel>
<title><![CDATA[ {{ __('cachet::cachet.rss_feed', ['name' => $statusPageName]) }} ]]></title>
<link><![CDATA[ {{ route('cachet.rss') }} ]]></link>
<link><![CDATA[ {{ $feedUrl }} ]]></link>
@if($statusAbout)
<description><![CDATA[ {{ $statusAbout }} ]]></description>
@endif
<language>{{ config('app.locale') }}</language>
<pubDate>{{ now()->toRssString() }}</pubDate>

@foreach($incidents as $incident)
@foreach($items as $item)
@php
$latestUpdate = $incident->updates->last();
$publishedAt = $latestUpdate?->updated_at ?? $incident->created_at;
$feedVersion = sha1($incident->guid.$incident->updated_at?->format('Y-m-d H:i:s.u').$incident->updates->map(
$incident = $item['model'];
$isSchedule = $incident instanceof \Cachet\Models\Schedule;
$publishedAt = $item['publishedAt'];
$feedVersion = sha1(($isSchedule ? 'schedule-'.$incident->id : $incident->guid).$incident->updated_at?->format('Y-m-d H:i:s.u').$incident->updates->map(
fn ($update) => $update->id.$update->updated_at?->format('Y-m-d H:i:s.u')
)->join(''));
@endphp
<item>
<title>[{{ $incident->status?->getLabel() }}] {{ $incident->name }}</title>
<link>{{ route('cachet.status-page.incident', $incident) }}</link>
<link>{{ $isSchedule ? route('cachet.status-page.schedule', $incident) : route('cachet.status-page.incident', $incident) }}</link>
<description><![CDATA[
{{ $incident->created_at->toRssString() }}: {!! str_replace(']]>', ']]]]><![CDATA[>', $incident->formattedMessage()) !!}
{{ ($isSchedule ? $incident->scheduled_at : $incident->created_at)->toRssString() }}: {!! str_replace(']]>', ']]]]><![CDATA[>', $incident->formattedMessage()) !!}
@foreach($incident->updates as $update)
[{{ $update->status?->getLabel() }}] {{ $update->updated_at->toRssString() }}: {!! str_replace(']]>', ']]]]><![CDATA[>', $update->formattedMessage()) !!}
@endforeach
]]></description>
@foreach($incident->components as $component)
<category domain="component:{{ $component->id }}">{{ $component->name }}</category>
@endforeach
<guid isPermaLink="false">{{ $feedVersion }}</guid>
<pubDate>{{ $publishedAt->toRssString() }}</pubDate>
</item>
Expand Down
83 changes: 83 additions & 0 deletions src/Filament/Pages/Settings/ManageRss.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php

namespace Cachet\Filament\Pages\Settings;

use Cachet\Enums\IncidentStatusEnum;
use Cachet\Enums\ScheduleStatusEnum;
use Cachet\Http\Controllers\RssController;
use Cachet\Settings\RssSettings;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
use Illuminate\Support\Facades\Cache;

class ManageRss extends SettingsPage
{
protected static string $settings = RssSettings::class;

public static function getNavigationGroup(): ?string
{
return __('cachet::navigation.settings.label');
}

public static function getNavigationLabel(): string
{
return __('cachet::navigation.settings.items.manage_rss');
}

public function form(Schema $schema): Schema
{
return $schema
->components([
Section::make(__('cachet::settings.manage_rss.feed_section_title'))
->columns(2)
->schema([
TextInput::make('max_items')
->label(__('cachet::settings.manage_rss.max_items_label'))
->helperText(__('cachet::settings.manage_rss.max_items_helper'))
->numeric()
->integer()
->minValue(1)
->maxValue(500)
->required(),
TextInput::make('refresh_interval')
->label(__('cachet::settings.manage_rss.refresh_interval_label'))
->helperText(__('cachet::settings.manage_rss.refresh_interval_helper'))
->numeric()
->integer()
->minValue(10)
->maxValue(86400)
->suffix(__('cachet::settings.manage_rss.refresh_interval_suffix'))
->required(),
]),

Section::make(__('cachet::settings.manage_rss.incidents_section_title'))
->description(__('cachet::settings.manage_rss.incidents_section_description'))
->columns(2)
->schema(array_map(
fn (IncidentStatusEnum $status) => Toggle::make('incident_'.$status->name)->label($status->getLabel()),
IncidentStatusEnum::cases(),
)),

Section::make(__('cachet::settings.manage_rss.maintenance_section_title'))
->description(__('cachet::settings.manage_rss.maintenance_section_description'))
->columns(2)
->schema(array_map(
fn (ScheduleStatusEnum $status) => Toggle::make('maintenance_'.$status->name)->label($status->getLabel()),
ScheduleStatusEnum::cases(),
)),
]);
}

/**
* Drop the cached feeds so the new settings apply immediately.
*/
protected function afterSave(): void
{
foreach ([RssController::CACHE_KEY_COMBINED, RssController::CACHE_KEY_INCIDENTS, RssController::CACHE_KEY_MAINTENANCE] as $key) {
Cache::forget($key);
Cache::forget($key.'-last-modified');
}
}
}
Loading
Loading