Mirror of Quill
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.

143 lines
5.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. <tr>
  10. <td>scope</td>
  11. <td><code><?= $this->user->micropub_scope ?></code> (should be a space-separated list of permissions including "create")</td>
  12. </tr>
  13. <tr>
  14. <td>micropub endpoint</td>
  15. <td><code><?= $this->user->micropub_endpoint ?></code> (should be a URL)</td>
  16. </tr>
  17. <tr>
  18. <td>media endpoint</td>
  19. <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>
  20. </tr>
  21. <?php if($this->user->supported_post_types): ?>
  22. <tr>
  23. <td>supported post types</td>
  24. <td>
  25. <ul>
  26. <?php
  27. $types = json_decode($this->user->supported_post_types, true);
  28. foreach($types as $type) {
  29. echo '<li>'.htmlspecialchars($type['name']).' ('.$type['type'].')</li>';
  30. }
  31. ?>
  32. </ul>
  33. </td>
  34. </tr>
  35. <?php endif ?>
  36. <tr>
  37. <td width="140">access token</td>
  38. <td><code style="word-break: break-word; white-space: pre-wrap;"><?= $this->user->micropub_access_token ?></code></td>
  39. </tr>
  40. <tr>
  41. <td>
  42. <input type="button" class="btn btn-default" value="Reset Login" id="reset-login">
  43. </td>
  44. <td>
  45. 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.
  46. </td>
  47. </tr>
  48. </table>
  49. <h3>Twitter</h3>
  50. <p>Connecting a Twitter account will automatically "favorite" and "retweet" tweets on Twitter when you favorite and retweet a Twitter URL in Quill.</p>
  51. <input type="button" id="twitter-button" value="Checking" class="btn">
  52. <h3>Backwards Compatibility</h3>
  53. <p>You can customize some of the properties that are sent in the Micropub request to work with your specific endpoint.</p>
  54. <table class="table table-condensed" width="100%">
  55. <tr>
  56. <td>Slug</td>
  57. <td width="160">
  58. <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>
  59. <div><input type="button" class="btn btn-primary" value="Save" id="save-slug-field"></div>
  60. </td>
  61. <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 endpoint is using a custom property or the deprecated <code>slug</code> property.</td>
  62. </tr>
  63. <tr>
  64. <td>Syndication</td>
  65. <td>
  66. <div style="margin-bottom:4px;">
  67. <select id="syndicate-to-field-name">
  68. <option value="mp-syndicate-to" <?= $this->user->micropub_syndicate_field == 'mp-syndicate-to' ? 'selected="selected"' : '' ?>>mp-syndicate-to</option>
  69. <option value="syndicate-to" <?= $this->user->micropub_syndicate_field == 'syndicate-to' ? 'selected="selected"' : '' ?>>syndicate-to</option>
  70. </select>
  71. </div>
  72. <div><input type="button" class="btn btn-primary" value="Save" id="save-syndicate-to-field"></div>
  73. </td>
  74. <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 endpoint is using the deprecated <code>syndicate-to</code> property.</td>
  75. </tr>
  76. <tr>
  77. <td>Send HTML Content</td>
  78. <td><input type="checkbox" id="send-html-content" <?= $this->user->micropub_optin_html_content ? 'checked="checked"' : '' ?>></td>
  79. <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>
  80. </tr>
  81. </table>
  82. </div>
  83. <script>
  84. $(function(){
  85. $.getJSON("/auth/twitter", function(data){
  86. // Check if we're already authorized with twitter
  87. if(data && data.result == 'ok') {
  88. $("#twitter-button").val("Connected").addClass("btn-success");
  89. } else if(data && data.url) {
  90. $("#twitter-button").val("Sign In").data("url", data.url).addClass("btn-warning");
  91. } else {
  92. $("#twitter-button").val("Error").addClass("btn-danger");
  93. }
  94. });
  95. $("#twitter-button").click(function(){
  96. if($(this).data('url')) {
  97. window.location = $(this).data('url');
  98. } else {
  99. $.getJSON("/auth/twitter", {login: 1}, function(data){
  100. window.location = data.url;
  101. });
  102. }
  103. });
  104. $("#send-html-content").click(function(){
  105. var enabled = $(this).attr("checked") == "checked";
  106. $.post("/settings/save", {
  107. html_content: (enabled ? 1 : 0)
  108. });
  109. });
  110. $("#save-slug-field").click(function(){
  111. $.post("/settings/save", {
  112. slug_field: $("#slug-field-name").val()
  113. });
  114. });
  115. $("#save-syndicate-to-field").click(function(){
  116. $.post("/settings/save", {
  117. syndicate_field: $("#syndicate-to-field-name").val()
  118. });
  119. });
  120. $("#reset-login").click(function(){
  121. $.post("/auth/reset", function(){
  122. window.location = "/";
  123. });
  124. });
  125. });
  126. </script>