You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.1KB

  1. <?php
  2. $app->get('/pebble', function() use($app) {
  3. $html = render('pebble', array(
  4. 'title' => 'Teacup for Pebble'
  5. ));
  6. $app->response()->body($html);
  7. });
  8. $app->get('/pebble/settings', function() use($app) {
  9. $html = render('pebble-settings-login', array(
  10. 'title' => 'Log In',
  11. 'footer' => false
  12. ));
  13. $app->response()->body($html);
  14. });
  15. $app->get('/pebble/settings/finished', function() use($app) {
  16. if($user=require_login($app)) {
  17. $token = JWT::encode(array(
  18. 'user_id' => $_SESSION['user_id'],
  19. 'me' => $_SESSION['me'],
  20. 'created_at' => time()
  21. ), Config::$jwtSecret);
  22. $html = render('pebble-settings', array(
  23. 'title' => 'Pebble Settings',
  24. 'token' => $token
  25. ));
  26. $app->response()->body($html);
  27. }
  28. });
  29. $app->get('/pebble/options.json', function() use($app) {
  30. if($user=require_login($app)) {
  31. $params = $app->request()->params();
  32. $options = get_entry_options($user->id, k($params,'latitude'), k($params,'longitude'));
  33. $app->response()['Content-Type'] = 'application/json';
  34. $app->response()->body(json_encode($options));
  35. }
  36. });