Compare commits

...

1 Commits

Author SHA1 Message Date
Moritz Jörg
04d12adfc3 wip: Try to add user information to sessions.
Will test with temp project in tilt.

This did not work, will try again with a different
entrypoint :/
2025-09-12 07:53:38 +02:00
8 changed files with 26 additions and 5 deletions

View File

@@ -20,6 +20,7 @@ let InitApp () =
let! authenticated = authApi.IsAuthenticated()
if authenticated.IsSome && not (isNullOrUndefined sessionStorage["archive_id"]) then
do! Utils.initAtlantisSessionUrls ()
window.location.href <- "/map.html"
else
sessionStorage.removeItem "archive_id"

View File

@@ -479,6 +479,8 @@ let SelectApp () =
let! registered = userApi.IsRegistered ()
let! active = userApi.IsActive ()
Dom.window?umami?identify("moritz.jorg@oceanbox.io")
Dom.window?umami?track()
setRegistered registered
setActive active
console.debug $"user registered={registered} active={active}"

View File

@@ -24,7 +24,14 @@ let LoginApp () =
localStorage.setItem ("access_token", t.access_token)
if t.refresh_token.Length > 0 then
localStorage.setItem ("refresh_token", t.refresh_token)
try
// Extract user info from token and identify with Umami
let umami = Dom.window?umami
umami?reset()
umami?identify(credentials.username)
console.log("Umami", credentials.username)
with ex -> console.error("Umami wrong", ex)
// console.log("Output", umami?identify(credentials.username))
// NOTE(SimenLK): It has to reload because the api is created on start up, when there is no access token..
// Dom.window.location.reload ()
Dom.window.location.href <- "/atlas.html"

View File

@@ -1848,7 +1848,6 @@ let MapAppElement () =
async {
do! initAtlantisSessionUrls ()
do! Auth.establishAuthentication ()
// do! Auth.startTokenRefreshLoopOrLogin ()
let archiveIdOpt = sessionStorage["archive_id"] |> Utils.tryStr |> Option.map Guid.Parse
match archiveIdOpt with
@@ -1928,6 +1927,16 @@ let MapAppElement () =
|> Async.StartImmediate
)
Hook.useEffectOnce (fun _ ->
async {
let umami = Dom.window?umami
umami?identify(model.identity.user)
umami?track(fun () -> model.identity.user)
console.error("[Mapster] Umami set")
}
|> Async.StartImmediate
)
Hook.useEffectOnChange (model.archive.polygon, fun _ -> renderGeoFences model)
Hook.useEffectOnChange (model.showFences, fun _ -> renderGeoFences model)
Hook.useEffectOnChange (model.sideNavMode, fun _ -> renderGeoFences model)

View File

@@ -9,6 +9,8 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
<link rel="shortcut icon" href="favicon.png" />
<script defer src="https://umami.srv.oceanbox.io/umami" data-website-id="cafda8c2-4b29-4d55-a3ea-30b112bae895"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@main/dist/en/v7.0.0/legacy/ol.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.4.0/dist/themes/light.css" />
<!-- <script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/shoelace@2.4.0/dist/shoelace.js"></script>-->
@@ -34,7 +36,6 @@
<atlas-app id="app" style="height: inherit"></atlas-app>
</div>
<script type="module" src="./build/Atlas/Atlas.jsx"></script>
<script defer src="https://umami.srv.oceanbox.io/umami" data-website-id="16e7d807-4db5-45fd-92a9-27393445a153"></script>
</body>
</html>

View File

@@ -10,6 +10,7 @@
<link rel="shortcut icon" href="favicon.png" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@main/dist/en/v7.0.0/legacy/ol.css">
<script defer src="https://umami.srv.oceanbox.io/umami" data-website-id="cafda8c2-4b29-4d55-a3ea-30b112bae895"></script>
<!-- Used to hide custom components until they are defined and prevent a flash of unstyled content -->
<style>
*:not(:defined) { display:none }

View File

@@ -18,7 +18,7 @@
margin: 0;
}
</style>
<script defer src="https://umami.srv.oceanbox.io/umami" data-website-id="16e7d807-4db5-45fd-92a9-27393445a153"></script>
<script defer src="https://umami.srv.oceanbox.io/umami" data-website-id="cafda8c2-4b29-4d55-a3ea-30b112bae895"></script>
</head>
<body>

View File

@@ -19,7 +19,7 @@
margin: 0;
}
</style>
<script defer src="https://umami.srv.oceanbox.io/umami" data-website-id="16e7d807-4db5-45fd-92a9-27393445a153"></script>
<script defer src="https://umami.srv.oceanbox.io/umami" data-website-id="cafda8c2-4b29-4d55-a3ea-30b112bae895"></script>
<script id="shader-preamble-glsl" type="x-shader/x-glsl">
#define kNumTextureUnits 4
#define kFragmentShader %FRAGMENT_SHADER%