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.

109 lines
3.1 KiB

  1. <?php $this->layout('layout', ['title' => $title]); ?>
  2. <div class="column">
  3. <h1>X-Ray Certificate Setup</h1>
  4. <?php if(isset($_SESSION['me'])): ?>
  5. <?php if(isset($verified) && $verified): ?>
  6. <div class="section">
  7. <p>The challenge was saved and is now accessible via the <code>.well-known</code> path.</p>
  8. <p><a href="/.well-known/acme-challenge/<?= $token ?>">view challenge</a></p>
  9. </div>
  10. <?php else: ?>
  11. <div class="section">
  12. <form class="" action="/cert/save-challenge" method="post">
  13. <div class="field"><input type="text" name="token" placeholder="http://xray.p3k.io/.well-known/acme-challenge/_Tzyxwvut..." value="<?= isset($token) ? $token : '' ?>"></div>
  14. <div class="field"><textarea name="challenge" rows="4" placeholder="challenge value"><?= isset($challenge) ? $challenge : '' ?></textarea></div>
  15. <div class="field"><button type="submit" class="button">Save</button></div>
  16. </form>
  17. </div>
  18. <?php endif ?>
  19. <div style="margin-top: 1em; font-size: 12px;">
  20. Signed in as <?= $_SESSION['me'] ?> <a href="/cert/logout">Sign Out</a>.
  21. </div>
  22. <?php else: ?>
  23. <div class="section">
  24. <form class="" action="/cert/auth" method="get">
  25. <div class="field"><input type="url" name="me" placeholder="https://you.example.com"></div>
  26. <div class="field"><button type="submit" class="button">Sign In</button></div>
  27. <input type="hidden" name="client_id" value="https://<?= $_SERVER['SERVER_NAME'] ?>/">
  28. <input type="hidden" name="redirect_uri" value="https://<?= $_SERVER['SERVER_NAME'] ?>/cert/redirect">
  29. <input type="hidden" name="state" value="<?= isset($state) ? $state : '' ?>">
  30. </form>
  31. </div>
  32. <?php endif ?>
  33. </div>
  34. <script>
  35. var base = window.location.protocol + "//" + window.location.hostname + "/";
  36. document.querySelector("input[name=client_id]").value = base;
  37. document.querySelector("input[name=redirect_uri]").value = base+"cert/redirect";
  38. </script>
  39. <style type="text/css">
  40. body {
  41. color: #212121;
  42. font-family: "Helvetica Neue", "Calibri Light", Roboto, sans-serif;
  43. -webkit-font-smoothing: antialiased;
  44. -moz-osx-font-smoothing: grayscale;
  45. }
  46. body {
  47. background-color: #e9e9e9;
  48. font-size: 16px;
  49. }
  50. h1 {
  51. padding-top: 6rem;
  52. padding-bottom: 1rem;
  53. text-align: center;
  54. }
  55. a {
  56. color: #4183c4;
  57. text-decoration: none;
  58. }
  59. .column {
  60. max-width: 450px;
  61. margin: 0 auto;
  62. }
  63. .section {
  64. border: 1px #ccc solid;
  65. border-radius: 6px;
  66. background: white;
  67. padding: 12px;
  68. margin-top: 2em;
  69. }
  70. .help {
  71. text-align: center;
  72. font-size: 0.9rem;
  73. }
  74. form .field {
  75. margin-bottom: .5rem;
  76. display: flex;
  77. }
  78. form input, form textarea, form button {
  79. width: 100%;
  80. border: 1px #ccc solid;
  81. border-radius: 4px;
  82. flex: 1 0;
  83. font-size: 1rem;
  84. }
  85. form input, form textarea {
  86. padding: .5rem;
  87. }
  88. form .button {
  89. background-color: #009c95;
  90. border: 0;
  91. border-radius: 4px;
  92. color: white;
  93. font-weight: bold;
  94. font-size: 1rem;
  95. cursor: pointer;
  96. padding: 0.5rem;
  97. }
  98. </style>