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.

205 lines
7.6 KiB

2 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 checkboxes here.</div><?php
  80. }
  81. ?>
  82. </div>
  83. </div>
  84. <?php if(!Config::$twitterClientID): ?>
  85. <h3>Twitter</h3>
  86. <p>Connecting a Twitter account will automatically "favorite" and "retweet" tweets on Twitter when you favorite and retweet a Twitter URL in Quill.</p>
  87. <input type="button" id="twitter-button" value="Checking" class="btn">
  88. <?php endif ?>
  89. <h3>Backwards Compatibility</h3>
  90. <p>You can customize some of the properties that are sent in the Micropub request to work with older software.</p>
  91. <table class="table table-condensed" width="100%">
  92. <tr>
  93. <td>Slug</td>
  94. <td width="160">
  95. <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>
  96. <div><input type="button" class="btn btn-primary" value="Save" id="save-slug-field"></div>
  97. </td>
  98. <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>
  99. </tr>
  100. <tr>
  101. <td>Syndication</td>
  102. <td>
  103. <div style="margin-bottom:4px;">
  104. <select id="syndicate-to-field-name">
  105. <option value="mp-syndicate-to" <?= $this->user->micropub_syndicate_field == 'mp-syndicate-to' ? 'selected="selected"' : '' ?>>mp-syndicate-to</option>
  106. <option value="syndicate-to" <?= $this->user->micropub_syndicate_field == 'syndicate-to' ? 'selected="selected"' : '' ?>>syndicate-to</option>
  107. </select>
  108. </div>
  109. <div><input type="button" class="btn btn-primary" value="Save" id="save-syndicate-to-field"></div>
  110. </td>
  111. <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>
  112. </tr>
  113. <tr>
  114. <td>Send HTML Content</td>
  115. <td><input type="checkbox" id="send-html-content" <?= $this->user->micropub_optin_html_content ? 'checked="checked"' : '' ?>></td>
  116. <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>
  117. </tr>
  118. </table>
  119. </div>
  120. <script>
  121. $(function(){
  122. <?php if(!Config::$twitterClientID): ?>
  123. $.getJSON("/auth/twitter", function(data){
  124. // Check if we're already authorized with twitter
  125. if(data && data.result == 'ok') {
  126. $("#twitter-button").val("Connected").addClass("btn-success");
  127. } else if(data && data.url) {
  128. $("#twitter-button").val("Sign In").data("url", data.url).addClass("btn-warning");
  129. } else {
  130. $("#twitter-button").val("Error").addClass("btn-danger");
  131. }
  132. });
  133. $("#twitter-button").click(function(){
  134. if($(this).data('url')) {
  135. window.location = $(this).data('url');
  136. } else {
  137. $.getJSON("/auth/twitter", {login: 1}, function(data){
  138. window.location = data.url;
  139. });
  140. }
  141. });
  142. <?php endif ?>
  143. $("#send-html-content").click(function(){
  144. var enabled = $(this).attr("checked") == "checked";
  145. $.post("/settings/save", {
  146. html_content: (enabled ? 1 : 0)
  147. });
  148. });
  149. $("#save-slug-field").click(function(){
  150. $.post("/settings/save", {
  151. slug_field: $("#slug-field-name").val()
  152. });
  153. });
  154. $("#save-syndicate-to-field").click(function(){
  155. $.post("/settings/save", {
  156. syndicate_field: $("#syndicate-to-field-name").val()
  157. });
  158. });
  159. $("#reset-login").click(function(){
  160. $.post("/auth/reset", function(){
  161. window.location = "/";
  162. });
  163. });
  164. });
  165. function reload_syndications() {
  166. $.getJSON("/micropub/syndications", function(data){
  167. if(data.targets) {
  168. $("#syndication-container").html('<ul></ul>');
  169. for(var i in data.targets) {
  170. var target = data.targets[i].target;
  171. var uid = data.targets[i].uid;
  172. var favicon = data.targets[i].favicon;
  173. $("#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>');
  174. }
  175. bind_syndication_buttons();
  176. } else {
  177. }
  178. console.log(data);
  179. });
  180. }
  181. </script>