@ -0,0 +1,34 @@ | |||
<?php | |||
$app->get('/', function() use($app) { | |||
$res = $app->response(); | |||
ob_start(); | |||
render('index', array( | |||
'title' => 'Switchboard', | |||
'meta' => '' | |||
)); | |||
$html = ob_get_clean(); | |||
$res->body($html); | |||
}); | |||
$app->get('/subscription/:hash', function($hash) use($app) { | |||
$res = $app->response(); | |||
$subscription = db\get_by_col('subscriptions', 'hash', $hash); | |||
$feed = db\get_by_id('feeds', $subscription->feed_id); | |||
if(!$subscription) { | |||
$app->response()->status(404); | |||
} else { | |||
ob_start(); | |||
render('subscription-status', array( | |||
'title' => 'Switchboard', | |||
'meta' => '', | |||
'subscription' => $subscription, | |||
'feed' => $feed | |||
)); | |||
$html = ob_get_clean(); | |||
$res->body($html); | |||
} | |||
}); | |||
@ -0,0 +1,130 @@ | |||
body { | |||
padding-top: 10px; | |||
background: #fff; | |||
} | |||
body.logged-out { | |||
background: white; | |||
} | |||
.logged-out .jumbotron { | |||
background-color: #fffbeb; | |||
border: 1px #fff2bc solid; | |||
} | |||
.header { | |||
font-family:; "Helvetica Neue",Helvetica,Arial,sans-serif; | |||
font-size: 22px; | |||
font-weight: 500; | |||
color: #888; | |||
border-bottom: 6px #ddd solid; | |||
padding-bottom: 4px; | |||
} | |||
.narrow { | |||
max-width: 700px; | |||
margin-right: auto; | |||
margin-left: auto; | |||
} | |||
.footer { | |||
padding: 0; | |||
margin-top: 20px; | |||
text-align: center; | |||
color: #999; | |||
background-color: #f9f9f9; | |||
border-top: 1px #e5e5e5 solid; | |||
position: absolute; | |||
bottom: 0; | |||
width: 100%; | |||
} | |||
.footer .nav { | |||
max-width: 700px; | |||
margin-right: auto; | |||
margin-left: auto; | |||
} | |||
.footer .credits { | |||
padding: 20px; | |||
font-size: 12px; | |||
} | |||
.jumbotron .tagline { | |||
font-size: 23px; | |||
} | |||
.jumbotron p { | |||
font-size: 18px; | |||
} | |||
/** | |||
* Bootstrap callouts | |||
*/ | |||
/* Base styles (regardless of theme) */ | |||
.bs-callout { | |||
margin: 20px 0; | |||
padding: 15px 30px 15px 15px; | |||
border-left: 5px solid #eee; | |||
} | |||
.bs-callout h4 { | |||
margin-top: 0; | |||
} | |||
.bs-callout p:last-child { | |||
margin-bottom: 0; | |||
} | |||
.bs-callout code, | |||
.bs-callout .highlight { | |||
background-color: #fff; | |||
} | |||
/* Themes for different contexts */ | |||
.bs-callout-danger { | |||
background-color: #fcf2f2; | |||
border-color: #dFb5b4; | |||
} | |||
.bs-callout-warning { | |||
background-color: #fefbed; | |||
border-color: #f1e7bc; | |||
} | |||
.bs-callout-info { | |||
background-color: #f0f7fd; | |||
border-color: #d0e3f0; | |||
} | |||
.bs-callout-success { | |||
background-color: #dff0d8; | |||
border-color: #b5dca5; | |||
} | |||
.bs-callout-danger h4 { | |||
color: #B94A48; | |||
} | |||
.bs-callout-warning h4 { | |||
color: #C09853; | |||
} | |||
.bs-callout-info h4 { | |||
color: #3A87AD; | |||
} | |||
.bs-callout-success h4 { | |||
color: #3c763d; | |||
} | |||
.bs-callout.pre { | |||
font-family: Menlo,Monaco,Consolas,"Courier New",monospace; | |||
word-break: break-all; | |||
word-wrap: break-word; | |||
} | |||
@-webkit-keyframes pulsate { | |||
0% {-webkit-transform: scale(0.9, 0.9); opacity: 1.0;} | |||
50% {opacity: 0.0;} | |||
100% {-webkit-transform: scale(1.1, 1.1); opacity: 1.0;} | |||
} |
@ -0,0 +1,27 @@ | |||
<div class="narrow"> | |||
<div class="jumbotron h-x-app"> | |||
<h1><img src="/images/icons/apple-icon-144x144.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>To publish content using Switchboard as your hub, add the following links to your home page:</p> | |||
<p><pre><link rel="self" href="https://example.com/"> | |||
<link rel="hub" href="https://switchboard.p3k.io/"></pre></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> | |||
<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> | |||
<a href="<?= Config::$base_url ?>/" class="u-url"></a> | |||
</div> | |||
</div> |
@ -0,0 +1,65 @@ | |||
<!doctype html> | |||
<html lang="en"> | |||
<head> | |||
<title><?= $this->title ?></title> | |||
<meta charset="utf-8"> | |||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |||
<meta name="apple-mobile-web-app-capable" content="yes" /> | |||
<!-- standard viewport tag to set the viewport to the device's width | |||
, Android 2.3 devices need this so 100% width works properly and | |||
doesn't allow children to blow up the viewport width--> | |||
<meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width" /> | |||
<!-- width=device-width causes the iPhone 5 to letterbox the app, so | |||
we want to exclude it for iPhone 5 to allow full screen apps --> | |||
<meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1" media="(device-height: 568px)" /> | |||
<link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css"> | |||
<link rel="stylesheet" href="/bootstrap/css/bootstrap-theme.min.css"> | |||
<link href="/font-awesome/css/font-awesome.min.css" rel="stylesheet" media="all"> | |||
<link rel="stylesheet" href="/openwebicons/css/openwebicons-bootstrap.css" /> | |||
<link rel="stylesheet" href="/css/style.css"> | |||
<!-- icon stuff from www.favicongenerator.org --> | |||
<link rel="apple-touch-icon" sizes="57x57" href="/images/icons/apple-icon-57x57.png"> | |||
<link rel="apple-touch-icon" sizes="60x60" href="/images/icons/apple-icon-60x60.png"> | |||
<link rel="apple-touch-icon" sizes="72x72" href="/images/icons/apple-icon-72x72.png"> | |||
<link rel="apple-touch-icon" sizes="76x76" href="/images/icons/apple-icon-76x76.png"> | |||
<link rel="apple-touch-icon" sizes="114x114" href="/images/icons/apple-icon-114x114.png"> | |||
<link rel="apple-touch-icon" sizes="120x120" href="/images/icons/apple-icon-120x120.png"> | |||
<link rel="apple-touch-icon" sizes="144x144" href="/images/icons/apple-icon-144x144.png"> | |||
<link rel="apple-touch-icon" sizes="152x152" href="/images/icons/apple-icon-152x152.png"> | |||
<link rel="apple-touch-icon" sizes="180x180" href="/images/icons/apple-icon-180x180.png"> | |||
<link rel="icon" type="image/png" sizes="192x192" href="/images/icons/android-icon-192x192.png"> | |||
<link rel="icon" type="image/png" sizes="32x32" href="/images/icons/favicon-32x32.png"> | |||
<link rel="icon" type="image/png" sizes="96x96" href="/images/icons/favicon-96x96.png"> | |||
<link rel="icon" type="image/png" sizes="16x16" href="/images/icons/favicon-16x16.png"> | |||
<link rel="manifest" href="/images/icons/manifest.json"> | |||
<meta name="msapplication-TileColor" content="#ffffff"> | |||
<meta name="msapplication-TileImage" content="/images/icons/ms-icon-144x144.png"> | |||
<meta name="theme-color" content="#ffffff"> | |||
<link rel="icon" href="/favicon.ico" type="image/x-icon"> | |||
<script src="/js/jquery-1.7.1.min.js"></script> | |||
</head> | |||
<body role="document"> | |||
<div class="page"> | |||
<div class="container"> | |||
<?= $this->fetch($this->page . '.php') ?> | |||
</div> | |||
<div class="footer"> | |||
<p class="credits"> | |||
This code is <a href="https://github.com/aaronpk/Switchboard">open source</a>. | |||
Feel free to send a pull request, or <a href="https://github.com/aaronpk/Switchboard/issues">file an issue</a>. | |||
</p> | |||
</div> | |||
</div> | |||
</body> | |||
</html> |
@ -0,0 +1,36 @@ | |||
<? if($this->subscription->active): ?> | |||
<div class="bs bs-callout bs-callout-success">This subscription is active!</div> | |||
<? else: ?> | |||
<div class="bs bs-callout bs-callout-danger">This subscription is not active</div> | |||
<? endif; ?> | |||
<table class="table"> | |||
<?php $tz = -7 * 3600; ?> | |||
<tr> | |||
<td>Feed URL (Topic)</td> | |||
<td><?= $this->feed->feed_url ?></td> | |||
</tr> | |||
<tr> | |||
<td>Callback URL</td> | |||
<td><?= $this->subscription->callback_url ?></td> | |||
</tr> | |||
<tr> | |||
<td>Date Subscription was Requested</td> | |||
<td><?= $this->subscription->date_requested ? friendly_date($this->subscription->date_requested, $tz) : '' ?></td> | |||
</tr> | |||
<tr> | |||
<td>Subscription Verification Response (from your server)</td> | |||
<td><pre><?= htmlspecialchars($this->subscription->challenge_response) ?></pre></td> | |||
</tr> | |||
<tr> | |||
<td>Date Subscription was Confirmed</td> | |||
<td><?= $this->subscription->date_confirmed ? friendly_date($this->subscription->date_confirmed, $tz) : '' ?></td> | |||
</tr> | |||
<tr> | |||
<td>Subscription Expiration</td> | |||
<td><?= $this->subscription->date_expires ? friendly_date($this->subscription->date_expires, $tz) : '' ?></td> | |||
</tr> | |||
</table> |