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.

198 lines
7.3 KiB

  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. ?>
  11. <tr>
  12. <td>User Name</td>
  13. <td><code><?= profile('name'); ?></code> </td>
  14. </tr>
  15. <?php } ?>
  16. <tr>
  17. <td>scope</td>
  18. <td><code><?= $this->user->micropub_scope ?></code> (should be a space-separated list of permissions including "create")</td>
  19. </tr>
  20. <tr>
  21. <td>micropub endpoint</td>
  22. <td><code><?= $this->user->micropub_endpoint ?></code> (should be a URL)</td>
  23. </tr>
  24. <tr>
  25. <td>media endpoint</td>
  26. <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>
  27. </tr>
  28. <?php if($this->user->supported_post_types): ?>
  29. <tr>
  30. <td>supported post types</td>
  31. <td>
  32. <ul>
  33. <?php
  34. $types = json_decode($this->user->supported_post_types, true);
  35. foreach($types as $type) {
  36. echo '<li>'.htmlspecialchars($type['name']).' ('.$type['type'].')</li>';
  37. }
  38. ?>
  39. </ul>
  40. </td>
  41. </tr>
  42. <?php endif ?>
  43. <tr>
  44. <td width="140">access token</td>
  45. <td><code style="word-break: break-word; white-space: pre-wrap;"><?= $this->user->micropub_access_token ?></code></td>
  46. </tr>
  47. <tr>
  48. <td>
  49. <input type="button" class="btn btn-default" value="Reset Login" id="reset-login">
  50. </td>
  51. <td>
  52. 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.
  53. </td>
  54. </tr>
  55. </table>
  56. <h3>Syndication Targets</h3>
  57. <div class="form-group">
  58. <label for="note_syndicate-to"><a href="javascript:reload_syndications()">Reload</a></label>
  59. <div id="syndication-container">
  60. <?php
  61. if($this->syndication_targets) {
  62. echo '<ul>';
  63. foreach($this->syndication_targets as $syn) {
  64. echo '<li>'
  65. . '<button data-syndicate-to="'.(isset($syn['uid']) ? htmlspecialchars($syn['uid']) : htmlspecialchars($syn['target'])).'" class="btn btn-default btn-block">'
  66. . ($syn['favicon'] ? '<img src="'.htmlspecialchars($syn['favicon']).'" width="16" height="16"> ' : '')
  67. . htmlspecialchars($syn['target'])
  68. . '</button>'
  69. . '</li>';
  70. }
  71. echo '</ul>';
  72. } else {
  73. ?><div class="bs-callout bs-callout-warning">No syndication targets were found on your site.
  74. Your server can provide a <a href="/docs#syndication">list of supported syndication targets</a> that will appear as checkboxes here.</div><?php
  75. }
  76. ?>
  77. </div>
  78. </div>
  79. <h3>Twitter</h3>
  80. <p>Connecting a Twitter account will automatically "favorite" and "retweet" tweets on Twitter when you favorite and retweet a Twitter URL in Quill.</p>
  81. <input type="button" id="twitter-button" value="Checking" class="btn">
  82. <h3>Backwards Compatibility</h3>
  83. <p>You can customize some of the properties that are sent in the Micropub request to work with older software.</p>
  84. <table class="table table-condensed" width="100%">
  85. <tr>
  86. <td>Slug</td>
  87. <td width="160">
  88. <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>
  89. <div><input type="button" class="btn btn-primary" value="Save" id="save-slug-field"></div>
  90. </td>
  91. <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>
  92. </tr>
  93. <tr>
  94. <td>Syndication</td>
  95. <td>
  96. <div style="margin-bottom:4px;">
  97. <select id="syndicate-to-field-name">
  98. <option value="mp-syndicate-to" <?= $this->user->micropub_syndicate_field == 'mp-syndicate-to' ? 'selected="selected"' : '' ?>>mp-syndicate-to</option>
  99. <option value="syndicate-to" <?= $this->user->micropub_syndicate_field == 'syndicate-to' ? 'selected="selected"' : '' ?>>syndicate-to</option>
  100. </select>
  101. </div>
  102. <div><input type="button" class="btn btn-primary" value="Save" id="save-syndicate-to-field"></div>
  103. </td>
  104. <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>
  105. </tr>
  106. <tr>
  107. <td>Send HTML Content</td>
  108. <td><input type="checkbox" id="send-html-content" <?= $this->user->micropub_optin_html_content ? 'checked="checked"' : '' ?>></td>
  109. <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>
  110. </tr>
  111. </table>
  112. </div>
  113. <script>
  114. $(function(){
  115. $.getJSON("/auth/twitter", function(data){
  116. // Check if we're already authorized with twitter
  117. if(data && data.result == 'ok') {
  118. $("#twitter-button").val("Connected").addClass("btn-success");
  119. } else if(data && data.url) {
  120. $("#twitter-button").val("Sign In").data("url", data.url).addClass("btn-warning");
  121. } else {
  122. $("#twitter-button").val("Error").addClass("btn-danger");
  123. }
  124. });
  125. $("#twitter-button").click(function(){
  126. if($(this).data('url')) {
  127. window.location = $(this).data('url');
  128. } else {
  129. $.getJSON("/auth/twitter", {login: 1}, function(data){
  130. window.location = data.url;
  131. });
  132. }
  133. });
  134. $("#send-html-content").click(function(){
  135. var enabled = $(this).attr("checked") == "checked";
  136. $.post("/settings/save", {
  137. html_content: (enabled ? 1 : 0)
  138. });
  139. });
  140. $("#save-slug-field").click(function(){
  141. $.post("/settings/save", {
  142. slug_field: $("#slug-field-name").val()
  143. });
  144. });
  145. $("#save-syndicate-to-field").click(function(){
  146. $.post("/settings/save", {
  147. syndicate_field: $("#syndicate-to-field-name").val()
  148. });
  149. });
  150. $("#reset-login").click(function(){
  151. $.post("/auth/reset", function(){
  152. window.location = "/";
  153. });
  154. });
  155. });
  156. function reload_syndications() {
  157. $.getJSON("/micropub/syndications", function(data){
  158. if(data.targets) {
  159. $("#syndication-container").html('<ul></ul>');
  160. for(var i in data.targets) {
  161. var target = data.targets[i].target;
  162. var uid = data.targets[i].uid;
  163. var favicon = data.targets[i].favicon;
  164. $("#syndication-container ul").append('<li><button data-syndicate-to="'+htmlspecialchars(uid ? uid : target)+'" class="btn btn-default btn-block">'+(favicon ? '<img src="'+htmlspecialchars(favicon)+'" width="16" height="16"> ':'')+htmlspecialchars(target)+'</button></li>');
  165. }
  166. bind_syndication_buttons();
  167. } else {
  168. }
  169. console.log(data);
  170. });
  171. }
  172. </script>