diff --git a/controllers/controllers.php b/controllers/controllers.php index 9c4ac4e..0dfa086 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -32,3 +32,25 @@ $app->get('/subscription/:hash', function($hash) use($app) { } }); +$app->get('/feed/:hash', function($hash) use($app) { + $res = $app->response(); + + $feed = db\get_by_col('feeds', 'hash', $hash); + $subscribers = ORM::for_table('subscriptions')->where('feed_id', $feed->id)->where('active', 1)->find_many(); + $num_subscribers = ORM::for_table('subscriptions')->where('feed_id', $feed->id)->where('active', 1)->count(); + + if(!$feed) { + $app->response()->status(404); + } else { + ob_start(); + render('feed-status', array( + 'title' => 'Switchboard', + 'meta' => '', + 'feed' => $feed, + 'subscribers' => $subscribers, + 'num_subscribers' => $num_subscribers + )); + $html = ob_get_clean(); + $res->body($html); + } +}); diff --git a/public/css/style.css b/public/css/style.css index 6d343ef..579e5d9 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -64,14 +64,14 @@ body.logged-out { font-size: 18px; } -.subscription-status { +.subscription-status, .feed-status { -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; border: 1px #ccc solid; } -.subscription-status pre { +.subscription-status pre, .feed-status pre { max-width: 500px; overflow: pre-wrap; } diff --git a/views/feed-status.php b/views/feed-status.php new file mode 100644 index 0000000..4552e11 --- /dev/null +++ b/views/feed-status.php @@ -0,0 +1,70 @@ + +
URL | += $this->feed->feed_url ?> | +
Last Ping Received | += friendly_date($this->feed->push_last_ping_received, $tz) ?> | +
Last Retrieved | += friendly_date($this->feed->last_retrieved, $tz) ?> | +
+ = $this->num_subscribers ?> active subscribers + | +|
= $subscriber->callback_url ?> |
+ |
Date Subscribed | += friendly_date($subscriber->date_created, $tz) ?> | +
Last Confirmed | += friendly_date($subscriber->date_confirmed, $tz) ?> | +
Date Expires | += friendly_date($subscriber->date_expires, $tz) ?> | +
Last Ping Sent | += friendly_date($subscriber->date_last_ping_sent, $tz) ?> | +
Last Response (from subscriber) |
+ = htmlspecialchars($subscriber->last_ping_headers."\n\n".$subscriber->last_ping_body) ?> |
+
Last ping was successful? | += $subscriber->last_ping_success ? 'Yes' : 'No' ?> (Subscriber must return 2xx on success) |
+
Retrying ping in | +
+ = $subscriber->last_ping_error_delay/2 ?> seconds + (Will be de-activated after 1 hour from first failed ping) + |
+