home.html 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <pstm-uri>/</pstm-uri>
  2. <pstm-template>main</pstm-template>
  3. <!--
  4. Server-side variant (pstm-*).
  5. The branch is chosen by statum-mkpstm at request time from the X-Statum-Slot
  6. headers the client carries. A normal browser navigation sends no such headers,
  7. so the default ("guest") branch is what is first painted; the client then takes
  8. over the live UI below. To see the authenticated variant directly, replay the
  9. request with the stored frame:
  10. curl http://localhost:8080/ -H "X-Statum-Slot: <base64-frame>"
  11. -->
  12. <p pstm-if="auth != null">Server-rendered: signed in.</p>
  13. <p pstm-else>Server-rendered: browsing as a guest.</p>
  14. <hr>
  15. <p>Counter (set by the entrypoint): <span stm-text="counter.value">…</span></p>
  16. <!--
  17. Client-side variant (stm-*).
  18. Evaluated live against the held slots after the entrypoint hydrates the page.
  19. -->
  20. <div stm-if="auth != null">
  21. <p>Welcome back, <strong stm-text="auth.name">user</strong>.</p>
  22. <form stm-action="{uri: '/logout', method: 'POST'}">
  23. <button type="submit">Log out</button>
  24. </form>
  25. </div>
  26. <div stm-else>
  27. <p>Sign in to personalise this page.</p>
  28. <form stm-action="{uri: '/login', method: 'POST'}">
  29. <label>Name <input name="name" placeholder='try "admin"'></label>
  30. <button type="submit">Log in</button>
  31. </form>
  32. </div>