diff --git a/controllers/Controller.php b/controllers/Controller.php
index 93e7361..af37e56 100644
--- a/controllers/Controller.php
+++ b/controllers/Controller.php
@@ -89,8 +89,32 @@ class Controller {
return $response;
}
- public function webmention_details(Request $request, Response $response) {
+ public function webmention_details(Request $request, Response $response, $args) {
+ if(!$this->_is_logged_in($request, $response)) {
+ return $response;
+ }
+
+ // Look up the webmention by its token
+ $webmention = ORM::for_table('webmentions')->where('token', $args['code'])->find_one();
+
+ if(!$webmention) {
+ $response->setContent(view('not-found'));
+ return $response;
+ }
+ $site = ORM::for_table('sites')->where_id_is($webmention->site_id)->find_one();
+
+ $statuses = ORM::for_table('webmention_status')->where('webmention_id', $webmention->id)->order_by_desc('created_at')->find_many();
+
+ $response->setContent(view('webmention-details', [
+ 'title' => 'Webmention Details',
+ 'user' => $this->_user(),
+ 'accounts' => $this->_accounts(),
+ 'site' => $site,
+ 'webmention' => $webmention,
+ 'statuses' => $statuses
+ ]));
+ return $response;
}
private function _user() {
diff --git a/lib/Telegraph/Webmention.php b/lib/Telegraph/Webmention.php
index 0ec2dbc..392edb7 100644
--- a/lib/Telegraph/Webmention.php
+++ b/lib/Telegraph/Webmention.php
@@ -86,6 +86,9 @@ class Webmention {
if(array_key_exists('Location', $response['headers'])) {
$webmention->webmention_status_url = \Mf2\resolveUrl($endpoint, $response['headers']['Location']);
// TODO: queue a job to poll the endpoint for updates and deliver to the callback URL
+ } else {
+ // No status URL was returned, so we can't follow up with this later. Mark as complete.
+ $webmention->complete = 1;
}
} else {
diff --git a/views/dashboard.php b/views/dashboard.php
index e630894..7b06f07 100644
--- a/views/dashboard.php
+++ b/views/dashboard.php
@@ -3,21 +3,23 @@
+
+
Webmention Request
+
+
+
+
Details
+
+ if(count($statuses) == 0): ?>
+
The request is queued for processing. Check for updates again later.
+ else: ?>
+
+
+ if($webmention->webmention_endpoint): ?>
+
+ Webmention Endpoint |
+ = $this->e($webmention->webmention_endpoint) ?> |
+
+ endif; ?>
+ if($webmention->pingback_endpoint): ?>
+
+ Pingback Endpoint |
+ = $this->e($webmention->pingback_endpoint) ?> |
+
+ endif; ?>
+ if($webmention->webmention_endpoint == false && $webmention->pingback_endpoint == false): ?>
+
+ Webmention Endpoint |
+ No webmention endpoint was discovered for this target |
+
+ endif; ?>
+ if($webmention->webmention_endpoint): ?>
+
+ Status URL |
+ = $webmention->webmention_status_url ? $this->e($webmention->webmention_status_url) : 'The webmention endpoint did not return a status URL' ?> |
+
+ endif; ?>
+
+
+
Logs
+
+
+
+
+ Date |
+ Status |
+ HTTP Code |
+
+
+
+ foreach($statuses as $status): ?>
+
+ = date('M j, g:ia', strtotime($status->created_at)) ?> |
+ = $status->status ?> |
+ = $status->http_code ?> |
+
+
+
+ = $this->e($status->raw_response) ?>
+ |
+
+ endforeach; ?>
+
+
+
+ endif; ?>
+
+