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.

230 lines
8.4 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>Post Format Settings</h3>
  62. <table class="table table-condensed" width="100%">
  63. <tr>
  64. <td>Weight Unit</td>
  65. <td width="160">
  66. <div style="margin-bottom:4px;"><input type="text" id="weight-unit" value="<?= $this->user->weight_unit ?>" class="form-control"></div>
  67. <div><input type="button" class="btn btn-primary" value="Save" id="save-weight-unit"></div>
  68. </td>
  69. <td>The unit to be used for <a href="/weight">weight posts</a>.</td>
  70. </tr>
  71. </table>
  72. <h3>Syndication Targets</h3>
  73. <div class="form-group">
  74. <label for="note_syndicate-to"><a href="javascript:reload_syndications()">Reload</a></label>
  75. <div id="syndication-container">
  76. <?php
  77. if($this->syndication_targets) {
  78. echo '<ul>';
  79. foreach($this->syndication_targets as $syn) {
  80. echo '<li>'
  81. . '<button data-syndicate-to="'.(isset($syn['uid']) ? htmlspecialchars($syn['uid']) : htmlspecialchars($syn['target'])).'" class="btn btn-default btn-block">'
  82. . ($syn['favicon'] ? '<img src="'.htmlspecialchars($syn['favicon']).'" width="16" height="16"> ' : '')
  83. . htmlspecialchars($syn['target'])
  84. . '</button>'
  85. . '</li>';
  86. }
  87. echo '</ul>';
  88. } else {
  89. ?><div class="bs-callout bs-callout-warning">No syndication targets were found on your site.
  90. Your server can provide a <a href="/docs/syndication">list of supported syndication targets</a> that will appear as buttons here.</div><?php
  91. }
  92. ?>
  93. </div>
  94. </div>
  95. <h3>Channels</h3>
  96. <div class="form-group">
  97. <label for="note_channels"><a href="javascript:reload_channels()">Reload</a></label>
  98. <div id="channel-container">
  99. <?php
  100. if($this->channels) {
  101. echo '<select class="form-control" name="channel">';
  102. foreach($this->channels as $ch) {
  103. echo '<option value="'.htmlspecialchars($ch).'">'
  104. . htmlspecialchars($ch)
  105. . '</option>';
  106. }
  107. echo '</select>';
  108. } else {
  109. ?><div class="bs-callout bs-callout-warning">No channels were found on your site.
  110. Your server can provide a <a href="/docs/channels">list of channels</a> that will appear as buttons here.</div><?php
  111. }
  112. ?>
  113. </div>
  114. </div>
  115. <?php if(!Config::$twitterClientID): ?>
  116. <h3>Twitter</h3>
  117. <p>Connecting a Twitter account will automatically "favorite" and "retweet" tweets on Twitter when you favorite and retweet a Twitter URL in Quill.</p>
  118. <input type="button" id="twitter-button" value="Checking" class="btn">
  119. <?php endif ?>
  120. <h3>Backwards Compatibility</h3>
  121. <p>You can customize some of the properties that are sent in the Micropub request to work with older software.</p>
  122. <table class="table table-condensed" width="100%">
  123. <tr>
  124. <td>Slug</td>
  125. <td width="160">
  126. <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>
  127. <div><input type="button" class="btn btn-primary" value="Save" id="save-slug-field"></div>
  128. </td>
  129. <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>
  130. </tr>
  131. <tr>
  132. <td>Syndication</td>
  133. <td>
  134. <div style="margin-bottom:4px;">
  135. <select id="syndicate-to-field-name">
  136. <option value="mp-syndicate-to" <?= $this->user->micropub_syndicate_field == 'mp-syndicate-to' ? 'selected="selected"' : '' ?>>mp-syndicate-to</option>
  137. <option value="syndicate-to" <?= $this->user->micropub_syndicate_field == 'syndicate-to' ? 'selected="selected"' : '' ?>>syndicate-to</option>
  138. </select>
  139. </div>
  140. <div><input type="button" class="btn btn-primary" value="Save" id="save-syndicate-to-field"></div>
  141. </td>
  142. <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>
  143. </tr>
  144. <tr>
  145. <td>Send HTML Content</td>
  146. <td><input type="checkbox" id="send-html-content" <?= $this->user->micropub_optin_html_content ? 'checked="checked"' : '' ?>></td>
  147. <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>
  148. </tr>
  149. </table>
  150. </div>
  151. <script>
  152. $(function(){
  153. <?php if(!Config::$twitterClientID): ?>
  154. $.getJSON("/auth/twitter", function(data){
  155. // Check if we're already authorized with twitter
  156. if(data && data.result == 'ok') {
  157. $("#twitter-button").val("Connected").addClass("btn-success");
  158. } else if(data && data.url) {
  159. $("#twitter-button").val("Sign In").data("url", data.url).addClass("btn-warning");
  160. } else {
  161. $("#twitter-button").val("Error").addClass("btn-danger");
  162. }
  163. });
  164. $("#twitter-button").click(function(){
  165. if($(this).data('url')) {
  166. window.location = $(this).data('url');
  167. } else {
  168. $.getJSON("/auth/twitter", {login: 1}, function(data){
  169. window.location = data.url;
  170. });
  171. }
  172. });
  173. <?php endif ?>
  174. $("#send-html-content").click(function(){
  175. var enabled = $(this).attr("checked") == "checked";
  176. $.post("/settings/save", {
  177. html_content: (enabled ? 1 : 0)
  178. });
  179. });
  180. $("#save-slug-field").click(function(){
  181. $.post("/settings/save", {
  182. slug_field: $("#slug-field-name").val()
  183. });
  184. });
  185. $("#save-syndicate-to-field").click(function(){
  186. $.post("/settings/save", {
  187. syndicate_field: $("#syndicate-to-field-name").val()
  188. });
  189. });
  190. $("#reset-login").click(function(){
  191. $.post("/auth/reset", function(){
  192. window.location = "/";
  193. });
  194. });
  195. $("#save-weight-unit").click(function(){
  196. $.post("/settings/save", {
  197. weight_unit: $("#weight-unit").val()
  198. });
  199. });
  200. });
  201. <?= partial('partials/syndication-js') ?>
  202. </script>