diff --git a/README.md b/README.md index 527ab11..a3f2465 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,11 @@ https://quill.p3k.io/ By submitting code to this project, you agree to irrevocably release it under the same license as this project. +### Credits + +Quill icon designed by [http://thenounproject.com/term/quill/17013/ Juan Pablo Bravo from the Noun Project] + + ### License Copyright 2013 by Aaron Parecki diff --git a/composer.json b/composer.json index 76a91ec..c771330 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "indieweb/mention-client": "0.*", "indieweb/date-formatter": "0.1.*", "indieauth/client": "0.1.3", - "mpratt/relativetime": ">=1.0" + "mpratt/relativetime": ">=1.0", + "firebase/php-jwt": "dev-master" } } diff --git a/composer.lock b/composer.lock index 4b20a2c..41b6052 100644 --- a/composer.lock +++ b/composer.lock @@ -3,8 +3,52 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "a734a0ce213069a3ecf69c1d2a32b25f", + "hash": "676692118149f622d7ca2349f775eb8c", "packages": [ + { + "name": "firebase/php-jwt", + "version": "dev-master", + "target-dir": "Firebase/PHP-JWT", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "53669d621149e49c2a428722a62acfef3342c260" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/53669d621149e49c2a428722a62acfef3342c260", + "reference": "53669d621149e49c2a428722a62acfef3342c260", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "Authentication/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "time": "2013-09-03 20:55:18" + }, { "name": "indieauth/client", "version": "0.1.3", @@ -410,7 +454,8 @@ ], "minimum-stability": "stable", "stability-flags": { - "saltybeagle/savant3": 20 + "saltybeagle/savant3": 20, + "firebase/php-jwt": 20 }, "platform": [ diff --git a/controllers/auth.php b/controllers/auth.php index 7caaba3..7caddd3 100644 --- a/controllers/auth.php +++ b/controllers/auth.php @@ -67,11 +67,6 @@ $app->get('/', function($format='html') use($app) { $res->body($html); }); -$app->get('/signin', function() use($app) { - $html = render('signin', array('title' => 'Sign In')); - $app->response()->body($html); -}); - $app->get('/auth/start', function() use($app) { $req = $app->request(); diff --git a/controllers/controllers.php b/controllers/controllers.php index 3ff111e..5b28bb8 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -63,6 +63,47 @@ $app->get('/docs', function() use($app) { $app->response()->body($html); }); +$app->get('/add-to-home', function() use($app) { + $params = $app->request()->params(); + + if(array_key_exists('token', $params) && !session('add-to-home-started')) { + + // Verify the token and sign the user in + try { + $data = JWT::decode($params['token'], Config::$jwtSecret); + $_SESSION['user_id'] = $data->user_id; + $_SESSION['me'] = $data->me; + $app->redirect('/new', 301); + } catch(DomainException $e) { + header('X-Error: DomainException'); + $app->redirect('/', 301); + } catch(UnexpectedValueException $e) { + header('X-Error: UnexpectedValueException'); + $app->redirect('/', 301); + } + + } else { + + if($user=require_login($app)) { + if(array_key_exists('start', $params)) { + $_SESSION['add-to-home-started'] = true; + + $token = JWT::encode(array( + 'user_id' => $_SESSION['user_id'], + 'me' => $_SESSION['me'], + 'created_at' => time() + ), Config::$jwtSecret); + + $app->redirect('/add-to-home?token='.$token, 301); + } else { + unset($_SESSION['add-to-home-started']); + $html = render('add-to-home', array('title' => 'Quill')); + $app->response()->body($html); + } + } + } +}); + $app->post('/micropub/post', function() use($app) { if($user=require_login($app)) { $params = $app->request()->params(); diff --git a/lib/config.template.php b/lib/config.template.php index 5dd1bf7..f8a1ab2 100644 --- a/lib/config.template.php +++ b/lib/config.template.php @@ -7,5 +7,7 @@ class Config { public static $dbName = 'quill'; public static $dbUsername = 'quill'; public static $dbPassword = ''; + + public static $jwtSecret = 'xxx'; } diff --git a/public/css/style.css b/public/css/style.css index 4f53d68..7872e7e 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -1,9 +1,23 @@ body { - padding-top: 70px; + padding-top: 10px; +} + +.header { + font-family:; "Helvetica Neue",Helvetica,Arial,sans-serif; + font-size: 22px; + font-weight: 500; + color: #888; + border-bottom: 6px #ddd solid; +} + +.narrow { + max-width: 700px; + margin-right: auto; + margin-left: auto; } .footer { - padding: 40px; + padding: 0; margin-top: 20px; text-align: center; color: #999; @@ -11,6 +25,25 @@ body { border-top: 1px #e5e5e5 solid; } +.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 diff --git a/public/images/indiepost-ui.png b/public/images/indiepost-ui.png deleted file mode 100644 index d7a4a2e..0000000 Binary files a/public/images/indiepost-ui.png and /dev/null differ diff --git a/public/images/quill-icon-114.png b/public/images/quill-icon-114.png new file mode 100644 index 0000000..2ad3540 Binary files /dev/null and b/public/images/quill-icon-114.png differ diff --git a/public/images/quill-icon-144.png b/public/images/quill-icon-144.png new file mode 100644 index 0000000..6f85b29 Binary files /dev/null and b/public/images/quill-icon-144.png differ diff --git a/public/images/quill-icon-57.png b/public/images/quill-icon-57.png new file mode 100644 index 0000000..2d4d156 Binary files /dev/null and b/public/images/quill-icon-57.png differ diff --git a/public/images/quill-icon-72.png b/public/images/quill-icon-72.png new file mode 100644 index 0000000..2329af6 Binary files /dev/null and b/public/images/quill-icon-72.png differ diff --git a/public/images/quill-icon.psd b/public/images/quill-icon.psd new file mode 100644 index 0000000..22a869d Binary files /dev/null and b/public/images/quill-icon.psd differ diff --git a/public/images/quill-logo-128.png b/public/images/quill-logo-128.png new file mode 100644 index 0000000..a01e833 Binary files /dev/null and b/public/images/quill-logo-128.png differ diff --git a/public/images/quill-logo-144.png b/public/images/quill-logo-144.png new file mode 100644 index 0000000..b84866b Binary files /dev/null and b/public/images/quill-logo-144.png differ diff --git a/public/images/quill-logo.png b/public/images/quill-logo.png new file mode 100644 index 0000000..cafc507 Binary files /dev/null and b/public/images/quill-logo.png differ diff --git a/public/images/quill-ui.png b/public/images/quill-ui.png new file mode 100644 index 0000000..d7de77a Binary files /dev/null and b/public/images/quill-ui.png differ diff --git a/views/add-to-home.php b/views/add-to-home.php new file mode 100644 index 0000000..857e959 --- /dev/null +++ b/views/add-to-home.php @@ -0,0 +1,6 @@ +
= $this->errorDescription ?>
+= $this->errorDescription ?>
+ + \ No newline at end of file diff --git a/views/auth_start.php b/views/auth_start.php index 819fd65..70dc83d 100644 --- a/views/auth_start.php +++ b/views/auth_start.php @@ -1,3 +1,6 @@ +