128 lines
4.9 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. <tr>
  22. <td width="140">access token</td>
  23. <td><code style="word-break: break-word; white-space: pre-wrap;"><?= $this->user->micropub_access_token ?></code></td>
  24. </tr>
  25. <tr>
  26. <td>
  27. <input type="button" class="btn btn-default" value="Reset Login" id="reset-login">
  28. </td>
  29. <td>
  30. Clicking this button will erase the access token Quill has stored for you, 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.
  31. </td>
  32. </tr>
  33. </table>
  34. <h3>Twitter</h3>
  35. <p>Connecting a Twitter account will automatically "favorite" and "retweet" tweets on Twitter when you favorite and retweet a Twitter URL in Quill.</p>
  36. <input type="button" id="twitter-button" value="Checking" class="btn">
  37. <h3>Backwards Compatibility</h3>
  38. <p>You can customize some of the properties that are sent in the Micropub request to work with your specific endpoint.</p>
  39. <table class="table table-condensed" width="100%">
  40. <tr>
  41. <td>Slug</td>
  42. <td width="160">
  43. <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>
  44. <div><input type="button" class="btn btn-primary" value="Save" id="save-slug-field"></div>
  45. </td>
  46. <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>
  47. </tr>
  48. <tr>
  49. <td>Syndication</td>
  50. <td>
  51. <div style="margin-bottom:4px;">
  52. <select id="syndicate-to-field-name">
  53. <option value="mp-syndicate-to" <?= $this->user->micropub_syndicate_field == 'mp-syndicate-to' ? 'selected="selected"' : '' ?>>mp-syndicate-to</option>
  54. <option value="syndicate-to" <?= $this->user->micropub_syndicate_field == 'syndicate-to' ? 'selected="selected"' : '' ?>>syndicate-to</option>
  55. </select>
  56. </div>
  57. <div><input type="button" class="btn btn-primary" value="Save" id="save-syndicate-to-field"></div>
  58. </td>
  59. <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>
  60. </tr>
  61. <tr>
  62. <td>Send HTML Content</td>
  63. <td><input type="checkbox" id="send-html-content" <?= $this->user->micropub_optin_html_content ? 'checked="checked"' : '' ?>></td>
  64. <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>
  65. </tr>
  66. </table>
  67. </div>
  68. <script>
  69. $(function(){
  70. $.getJSON("/auth/twitter", function(data){
  71. // Check if we're already authorized with twitter
  72. if(data && data.result == 'ok') {
  73. $("#twitter-button").val("Connected").addClass("btn-success");
  74. } else if(data && data.url) {
  75. $("#twitter-button").val("Sign In").data("url", data.url).addClass("btn-warning");
  76. } else {
  77. $("#twitter-button").val("Error").addClass("btn-danger");
  78. }
  79. });
  80. $("#twitter-button").click(function(){
  81. if($(this).data('url')) {
  82. window.location = $(this).data('url');
  83. } else {
  84. $.getJSON("/auth/twitter", {login: 1}, function(data){
  85. window.location = data.url;
  86. });
  87. }
  88. });
  89. $("#send-html-content").click(function(){
  90. var enabled = $(this).attr("checked") == "checked";
  91. $.post("/settings/save", {
  92. html_content: (enabled ? 1 : 0)
  93. });
  94. });
  95. $("#save-slug-field").click(function(){
  96. $.post("/settings/save", {
  97. slug_field: $("#slug-field-name").val()
  98. });
  99. });
  100. $("#save-syndicate-to-field").click(function(){
  101. $.post("/settings/save", {
  102. syndicate_field: $("#syndicate-to-field-name").val()
  103. });
  104. });
  105. $("#reset-login").click(function(){
  106. $.post("/auth/reset", function(){
  107. window.location = "/";
  108. });
  109. });
  110. });
  111. </script>