Commit graph

20 commits

Author SHA1 Message Date
011687b391 Close event streams for expired sessions
When a session expires close any event streams that have been opened
with that session.  This prevents an attacker with a leaked session
cookie from opening a stream and receiving updates indefinitely without
being detected.

By sending the session the event stream is opened with when the stream
is established this closure on session expiry also serves as a way for
a user agent to be notified whenever its own access level changes.
2025-07-08 16:13:46 +02:00
e52972853d License under AGPL version 3 or later
I firmly believe in free software.

The application I'm making here have capabilities that I've not seen in
any system.  It presents itself as an opportunity to collaborate on a
tool that serves the people rather than corporations.  Whose incentives
are to help people rather, not make the most money.  And whose terms
ensure that these freedoms and incentives cannot be taken back or
subverted.

I license this software under the AGPL.
2025-06-30 18:58:24 +02:00
3f9f218ed0 Add composable for string sort and search
To avoid hydration matches string operations need to do the same thing
on the client and server. Add utilities for performing sorting and fuzzy
matching of strings that uses the account's locale.
2025-06-27 18:13:51 +02:00
3be7f8be05 Refactor user storage and update
Rename accounts to users to be consistent with the new naming scheme
where account only referes to the logged in user of the session and
implement live updates of users via a user store which listens for
updates from the event stream.
2025-06-23 00:28:58 +02:00
fe06d0d6bd Refactor API types and sync logic
All checks were successful
/ build (push) Successful in 2m5s
/ deploy (push) Successful in 16s
Rename and refactor the types passed over the API to be based on an
entity that's either living or a tombstone.  A living entity has a
deleted property that's either undefined or false, while a tombstone
has a deleted property set to true.  All entities have a numeric id
and an updatedAt timestamp.

To sync entities, an array of replacements are passed around. Living
entities are replaced with tombstones when they're deleted. And
tombstones are replaced with living entities when restored.
2025-06-11 21:05:17 +02:00
cf90de1aae Refactor event source and storage from useSchedule
Split up useSchedule into a useEventSource composable and a schedules
store for keeping track of the schedule updates.
2025-05-26 13:53:11 +02:00
fae8b4e2e4 Use a pinia store to manage session state
Replace the convoluted useAccountSession composable with a pinia store
that in addition allows for the consolidation of all session related
functions to grouped into one module.
2025-05-24 18:18:27 +02:00
7f3029aee8 Pass Set-Cookie header from session on page load
If a session is refreshed when accessed through /api/auth/session during
a SSR then the Set-Cookie header was lost.  Pass this along to the
client in this case to keep the session alive.
2025-05-23 21:32:20 +02:00
89b1d2a547 Show crew on event cards when logged in as crew 2025-03-15 20:37:08 +01:00
cef6b13dd1 Add assigment of crew to events and shifts 2025-03-15 18:18:08 +01:00
bb306ee938 Pass headers when server fetches the schedule
Fix the inital server side load of the schedule not including crew only
items due to headers not being passed from the client to server side
request made to fetch the schedule.
2025-03-10 20:59:22 +01:00
f69ca520c0 Refetch schedule and stream if session is updated 2025-03-10 16:43:21 +01:00
13f344472e Move schedule fetching into useSchedule composable 2025-03-10 15:41:32 +01:00
8c8f340553 Type false session as null
Make the typing for the session work again by telling TypeScript the
false value is actually null.
2025-03-09 15:50:18 +01:00
2897542823 Cache session data
The session is always explicitly updated when it changes, cache it on
the client if it has already been loaded.
2025-03-08 00:34:46 +01:00
ed74f4bb0e Use false instead of null for empty session
The caching layer of Nuxt assumes no entry exists if it's nullish.  This
causes null to be treated as if the resource needs to be fetched.  Use
false instead.
2025-03-08 00:33:35 +01:00
d4cbbcbc2d Fix session being double requested
If the returned value of the fetched endpoint is blank that gets
converted to undefined, which confuses the request sharing between the
client and server causing the session to be requested on both sides.

Transform value to null if it's blank so that the session fetch is
de-duplicated.
2025-03-07 16:45:40 +01:00
b2a5b67096 Refactor push subscription logic into a composable 2025-03-07 16:08:45 +01:00
150cb82f5c Basic account and session system
Provide a basic account system with login and server side session store
identified by a cookie.  Upon successful login a signed session cookie
is set by the server with the session stored on the server identifying
which account it is logged in as.  The client uses a shared useFetch on
the session endpoint to identify if it's logged in and which account it
is logged in as, and refreshes this when loggin in or out.
2025-03-07 12:41:57 +01:00
250ca9a1ac Port application from Next.js to Nuxt
Nuxt is based on Vue.js and I find their building blocks to be much
neater compared to the React based Next.js.
2025-03-05 15:36:50 +01:00