apikey.hbs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. aria-label="Copy"
  16. hx-on:click="handleShortURLCopyLink(this);"
  17. data-url="{{user.apikey}}"
  18. >
  19. {{> icons/copy}}
  20. </button>
  21. {{> icons/check}}
  22. </div>
  23. <p
  24. hx-on:click="handleShortURLCopyLink(this);"
  25. data-url="{{user.apikey}}"
  26. >
  27. {{user.apikey}}
  28. </p>
  29. {{/if}}
  30. {{#if error}}
  31. <p class="error">{{error}}</p>
  32. {{/if}}
  33. </div>
  34. <form
  35. hx-post="/api/auth/apikey"
  36. id="generate-apikey"
  37. hx-target="#apikey-wrapper"
  38. hx-swap="outerHTML"
  39. >
  40. <button class="secondary">
  41. <span>{{> icons/zap}}</span>
  42. <span>{{> icons/spinner}}</span>
  43. {{#if user.apikey}}Reg{{else}}G{{/if}}enerate key
  44. </button>
  45. </form>
  46. </section>