apikey.hbs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <section id="apikey-wrapper">
  2. <h2>API</h2>
  3. <p>
  4. In additional to this website, you can use the API to create, delete and
  5. get shortened URLs. If you're not familiar with API, don't generate the key.
  6. DO NOT share this key on the client side of your website.
  7. <a href="https://docs.kutt.it" title="API Docs" target="_blank">
  8. Read API docs.
  9. </a>
  10. </p>
  11. <div id="apikey">
  12. {{#if user.apikey}}
  13. <div class="clipboard small">
  14. <button
  15. type="button"
  16. aria-label="Copy"
  17. hx-on:click="handleShortURLCopyLink(this);"
  18. data-url="{{user.apikey}}"
  19. >
  20. {{> icons/copy}}
  21. </button>
  22. {{> icons/check}}
  23. </div>
  24. <p
  25. hx-on:click="handleShortURLCopyLink(this);"
  26. data-url="{{user.apikey}}"
  27. >
  28. {{user.apikey}}
  29. </p>
  30. {{/if}}
  31. {{#if error}}
  32. <p class="error">{{error}}</p>
  33. {{/if}}
  34. </div>
  35. <form
  36. hx-post="/api/auth/apikey"
  37. id="generate-apikey"
  38. hx-target="#apikey-wrapper"
  39. hx-swap="outerHTML"
  40. >
  41. <button type="button" class="secondary">
  42. <span>{{> icons/zap}}</span>
  43. <span>{{> icons/spinner}}</span>
  44. {{#if user.apikey}}Reg{{else}}G{{/if}}enerate key
  45. </button>
  46. </form>
  47. </section>