sse support

This commit is contained in:
2026-01-20 20:48:19 -07:00
parent 88eb917381
commit 1130366bf5
15 changed files with 886 additions and 29 deletions
+12 -2
View File
@@ -11,7 +11,8 @@
<script src="/scripts/htmx.min.js.gz"></script>
<script src="/scripts/_hyperscript.min.js.gz"></script>
<script src="https://unpkg.com/htmx-ext-path-params@2.0.0/path-params.js"></script>
<script src="/scripts/htmx-ext-sse.js"></script>
<script src="/scripts/htmx-ext-path-params.js"></script>
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
@@ -22,7 +23,16 @@
{{- block "head" . }}{{ end }}
</head>
<body class="basis-full grow bg-background flex flex-col items-stretch" hx-ext="path-params">
<body
class="basis-full grow bg-background flex flex-col items-stretch"
hx-ext="path-params,sse"
{{/* subscribe to sse (if logged in) */}}
{{- if and .Identity .Identity.AccessToken }}
sse-connect="/api/events/"
sse-close="close"
{{- end }}
>
<header>
<nav class="flex flex-col items-center text-xl overflow-x-scroll overflow-y-hidden ">
{{- $path := or .Request.URL.Path "/" }}