Browse Source

move docs to separate doc page

master
Aaron Parecki 5 years ago
parent
commit
de99db1028
No known key found for this signature in database GPG Key ID: 276C2817346D6056
3 changed files with 68 additions and 15 deletions
  1. +10
    -1
      controllers/controllers.php
  2. +54
    -0
      views/docs.php
  3. +4
    -14
      views/index.php

+ 10
- 1
controllers/controllers.php View File

@ -3,7 +3,16 @@
$app->get('/', function() use($app) {
$res = $app->response();
$html = render('index', array(
'title' => 'Switchboard',
'title' => 'Switchboard - a PubSub Hub',
'meta' => ''
));
$res->body($html);
});
$app->get('/docs', function() use($app) {
$res = $app->response();
$html = render('docs', array(
'title' => 'Switchboard Documentation',
'meta' => ''
));
$res->body($html);

+ 54
- 0
views/docs.php View File

@ -0,0 +1,54 @@
<div class="narrow">
<div class="jumbotron">
<h1><a href="/"><img src="/images/switchboard-logo.png" height="72" style="margin-bottom: 13px;" class="" alt="logo"></a> Switchboard</h1>
<h2>Publishing</h2>
<p>To publish content using Switchboard as your hub, add the following tags to your HTML feeds:</p>
<p><pre>&lt;link rel="self" href="https://example.com/"&gt;
&lt;link rel="hub" href="https://switchboard.p3k.io/"&gt;</pre></p>
<p>When you add a new item to the feed, send a POST request to <code>https://switchboard.p3k.io/</code> with the following
parameters:</p>
<p>
<ul>
<li><code>hub.mode=publish</code></li>
<li><code>hub.topic=https://example.com/</code></li>
</ul>
</p>
<p>Switchboard will send notifications to every subscriber that your feed has been updated. The request that Switchboard sends to your subscribers will be a POST request with no body. This is known as a "thin ping". Your subscribers will then request your feed to find updates.</p>
<h2>Subscribing</h2>
<p>If you are subscribing to a feed that uses Switchboard as its hub, here is what you can expect.</p>
<h3>Verification</h3>
<p>When you first request the subscription, Switchboard will send a verification request to your callback URL. The verification request will be a GET request to your callback URL with the following query parameters:</p>
<p>
<ul>
<li><code>hub.mode=subscribe</code></li>
<li><code>hub.topic=</code> the topic URL that you requested to subscribe to</li>
<li><code>hub.challenge=</code> a random string that you will need to echo to confirm the subscription</li>
<li><code>hub.lease_seconds=</code> the number of seconds this subscription will remain active</li>
</ul>
</p>
<p>To confirm the subscription, you will need to respond with <code>HTTP 200</code> and the body of the response must be exactly equal to the challenge string. Any other response will not activate your subscription.</p>
<h3>Notifications</h3>
<p>When there is new content available from the topic URL, Switchboard will send a POST request to your callback URL.</p>
<p>This POST request will have no body, and is meant to be an indication that the URL has been updated, and that you can fetch the new contents from there.</p>
</div>
</div>

+ 4
- 14
views/index.php View File

@ -3,23 +3,13 @@
<div class="jumbotron h-x-app">
<h1><img src="/images/switchboard-logo.png" height="72" style="margin-bottom: 13px;" class="u-logo p-name" alt="Switchboard"> Switchboard</h1>
<p class="tagline p-summary">Switchboard is a PubSubHubbub 0.4 hub.</p>
<p class="tagline p-summary">Switchboard is a PubSub hub.</p>
<p>To publish content using Switchboard as your hub, add the following links to your home page:</p>
<p><pre>&lt;link rel="self" href="https://example.com/"&gt;
&lt;link rel="hub" href="https://switchboard.p3k.io/"&gt;</pre></p>
<p><a href="/docs">Switchboard Documentation</a></p>
<p>Then, send a POST request to <code>https://switchboard.p3k.io/</code> with the following
parameters every time you add content to your home page:</p>
<p><a href="https://www.w3.org/TR/pubsub/">PubSub Spec</a></p>
<p>
<ul>
<li><code>hub.mode=publish</code></li>
<li><code>hub.topic=https://example.com/</code></li>
</ul>
</p>
<p>Read more info about <a href="https://indiewebcamp.com/how-to-push">how to publish and consume using PubSubHubbub</a>.</p>
<p>Read more about <a href="https://indiewebcamp.com/how-to-push">how to publish and consume using PubSub</a>.</p>
<a href="<?= Config::$base_url ?>/" class="u-url"></a>
</div>

Loading…
Cancel
Save