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.

214 lines
7.8 KiB

5 years ago
  1. <div class="narrow">
  2. <?= partial('partials/header') ?>
  3. <h2>Signed In As</h2>
  4. <table class="table table-condensed">
  5. <tr>
  6. <td>me</td>
  7. <td><code><?= $this->user->url; ?></code> (should be your URL)</td>
  8. </tr>
  9. <?php if(profile('name')) { ?>
  10. <tr>
  11. <td>Name</td>
  12. <td><code><?= profile('name'); ?></code> </td>
  13. </tr>
  14. <?php } ?>
  15. <?php if(profile('photo')) { ?>
  16. <tr>
  17. <td>Photo</td>
  18. <td><code><?= profile('photo'); ?></code> </td>
  19. </tr>
  20. <?php } ?>
  21. <tr>
  22. <td>scope</td>
  23. <td><code><?= $this->user->micropub_scope ?></code> (should be a space-separated list of permissions including "create")</td>
  24. </tr>
  25. <tr>
  26. <td>micropub endpoint</td>
  27. <td><code><?= $this->user->micropub_endpoint ?></code> (should be a URL)</td>
  28. </tr>
  29. <tr>
  30. <td>media endpoint</td>
  31. <td><?= $this->user->micropub_media_endpoint ? '<code>'.$this->user->micropub_media_endpoint.'</code>' : '<a href="https://www.w3.org/TR/micropub/#media-endpoint">no media endpoint</a>' ?></td>
  32. </tr>
  33. <?php if($this->user->supported_post_types): ?>
  34. <tr>
  35. <td>supported post types</td>
  36. <td>
  37. <ul>
  38. <?php
  39. $types = json_decode($this->user->supported_post_types, true);
  40. foreach($types as $type) {
  41. echo '<li>'.htmlspecialchars($type['name']).' ('.$type['type'].')</li>';
  42. }
  43. ?>
  44. </ul>
  45. </td>
  46. </tr>
  47. <?php endif ?>
  48. <tr>
  49. <td width="140">access token</td>
  50. <td><code style="word-break: break-word; white-space: pre-wrap;"><?= $this->user->micropub_access_token ?></code></td>
  51. </tr>
  52. <tr>
  53. <td>
  54. <input type="button" class="btn btn-default" value="Reset Login" id="reset-login">
  55. </td>
  56. <td>
  57. Clicking this button will tell your token endpoint to revoke the token, Quill will forget the access token stored, forget all cached endpoints, and sign you out. If you sign back in, you will start over and see the debugging screens and scope options again.
  58. </td>
  59. </tr>
  60. </table>
  61. <h3>Syndication Targets</h3>
  62. <div class="form-group">
  63. <label for="note_syndicate-to"><a href="javascript:reload_syndications()">Reload</a></label>
  64. <div id="syndication-container">
  65. <?php
  66. if($this->syndication_targets) {
  67. echo '<ul>';
  68. foreach($this->syndication_targets as $syn) {
  69. echo '<li>'
  70. . '<button data-syndicate-to="'.(isset($syn['uid']) ? htmlspecialchars($syn['uid']) : htmlspecialchars($syn['target'])).'" class="btn btn-default btn-block">'
  71. . ($syn['favicon'] ? '<img src="'.htmlspecialchars($syn['favicon']).'" width="16" height="16"> ' : '')
  72. . htmlspecialchars($syn['target'])
  73. . '</button>'
  74. . '</li>';
  75. }
  76. echo '</ul>';
  77. } else {
  78. ?><div class="bs-callout bs-callout-warning">No syndication targets were found on your site.
  79. Your server can provide a <a href="/docs/syndication">list of supported syndication targets</a> that will appear as buttons here.</div><?php
  80. }
  81. ?>
  82. </div>
  83. </div>
  84. <h3>Channels</h3>
  85. <div class="form-group">
  86. <label for="note_channels"><a href="javascript:reload_channels()">Reload</a></label>
  87. <div id="channel-container">
  88. <?php
  89. if($this->channels) {
  90. echo '<select class="form-control" name="channel">';
  91. foreach($this->channels as $ch) {
  92. echo '<option value="'.htmlspecialchars($ch).'">'
  93. . htmlspecialchars($ch)
  94. . '</option>';
  95. }
  96. echo '</select>';
  97. } else {
  98. ?><div class="bs-callout bs-callout-warning">No channels were found on your site.
  99. Your server can provide a <a href="/docs/channels">list of channels</a> that will appear as buttons here.</div><?php
  100. }
  101. ?>
  102. </div>
  103. </div>
  104. <?php if(!Config::$twitterClientID): ?>
  105. <h3>Twitter</h3>
  106. <p>Connecting a Twitter account will automatically "favorite" and "retweet" tweets on Twitter when you favorite and retweet a Twitter URL in Quill.</p>
  107. <input type="button" id="twitter-button" value="Checking" class="btn">
  108. <?php endif ?>
  109. <h3>Backwards Compatibility</h3>
  110. <p>You can customize some of the properties that are sent in the Micropub request to work with older software.</p>
  111. <table class="table table-condensed" width="100%">
  112. <tr>
  113. <td>Slug</td>
  114. <td width="160">
  115. <div style="margin-bottom:4px;"><input type="text" id="slug-field-name" value="<?= $this->user->micropub_slug_field ?>" placeholder="mp-slug" class="form-control"></div>
  116. <div><input type="button" class="btn btn-primary" value="Save" id="save-slug-field"></div>
  117. </td>
  118. <td>Choose the name of the field that the slug will be sent in. This should be set to <code>mp-slug</code> unless your software is using a custom property or the deprecated <code>slug</code> property.</td>
  119. </tr>
  120. <tr>
  121. <td>Syndication</td>
  122. <td>
  123. <div style="margin-bottom:4px;">
  124. <select id="syndicate-to-field-name">
  125. <option value="mp-syndicate-to" <?= $this->user->micropub_syndicate_field == 'mp-syndicate-to' ? 'selected="selected"' : '' ?>>mp-syndicate-to</option>
  126. <option value="syndicate-to" <?= $this->user->micropub_syndicate_field == 'syndicate-to' ? 'selected="selected"' : '' ?>>syndicate-to</option>
  127. </select>
  128. </div>
  129. <div><input type="button" class="btn btn-primary" value="Save" id="save-syndicate-to-field"></div>
  130. </td>
  131. <td>Choose the name of the field that the syndication values will be sent in. This should be set to <code>mp-syndicate-to</code> unless your software is using the deprecated <code>syndicate-to</code> property.</td>
  132. </tr>
  133. <tr>
  134. <td>Send HTML Content</td>
  135. <td><input type="checkbox" id="send-html-content" <?= $this->user->micropub_optin_html_content ? 'checked="checked"' : '' ?>></td>
  136. <td>When checked, content from Quill's HTML editor will be sent in a property called <code>content[html]</code> rather than just <code>content</code>. See the <a href="https://www.w3.org/TR/micropub/#new-article-with-html">Micropub specification</a> for more details.</td>
  137. </tr>
  138. </table>
  139. </div>
  140. <script>
  141. $(function(){
  142. <?php if(!Config::$twitterClientID): ?>
  143. $.getJSON("/auth/twitter", function(data){
  144. // Check if we're already authorized with twitter
  145. if(data && data.result == 'ok') {
  146. $("#twitter-button").val("Connected").addClass("btn-success");
  147. } else if(data && data.url) {
  148. $("#twitter-button").val("Sign In").data("url", data.url).addClass("btn-warning");
  149. } else {
  150. $("#twitter-button").val("Error").addClass("btn-danger");
  151. }
  152. });
  153. $("#twitter-button").click(function(){
  154. if($(this).data('url')) {
  155. window.location = $(this).data('url');
  156. } else {
  157. $.getJSON("/auth/twitter", {login: 1}, function(data){
  158. window.location = data.url;
  159. });
  160. }
  161. });
  162. <?php endif ?>
  163. $("#send-html-content").click(function(){
  164. var enabled = $(this).attr("checked") == "checked";
  165. $.post("/settings/save", {
  166. html_content: (enabled ? 1 : 0)
  167. });
  168. });
  169. $("#save-slug-field").click(function(){
  170. $.post("/settings/save", {
  171. slug_field: $("#slug-field-name").val()
  172. });
  173. });
  174. $("#save-syndicate-to-field").click(function(){
  175. $.post("/settings/save", {
  176. syndicate_field: $("#syndicate-to-field-name").val()
  177. });
  178. });
  179. $("#reset-login").click(function(){
  180. $.post("/auth/reset", function(){
  181. window.location = "/";
  182. });
  183. });
  184. });
  185. <?= partial('partials/syndication-js') ?>
  186. </script>