Commit graph

44 commits

Author SHA1 Message Date
f4f23e6c18 Validate timezone with normalizeZone
All checks were successful
/ build (push) Successful in 1m29s
/ deploy (push) Successful in 16s
Instead of constructing a new DateTime object and seeing if it
succeeded, validate the client's timezone selection using the
Info.normalizeZone utility function.  This prevents throwing an
unexpected error creating the DateTime object after the change
in e100555 to throw on invalid dates.
2025-06-14 19:26:58 +02:00
fb7a60db28 Add per account locale setting
Add a per user account setting for the locale so that the server can
correctly render pages with localized time formatting.
2025-06-13 21:50:22 +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
251e83f640 Rename AcountSession to ServerSession
All checks were successful
/ build (push) Successful in 1m12s
/ deploy (push) Successful in 16s
Start the work of clearly distingushing client side types, server side
types and types shared over the API by renaming "AccountSession" and
"Session" names used on the server to "ServerSession".
2025-06-09 16:51:05 +02:00
16191a8dd2 Add debug route to delete the database
All checks were successful
/ build (push) Successful in 1m15s
/ deploy (push) Successful in 16s
To simplify development add a debug route to delete the database content
so that it'll be re-generated to the demo schedule.
2025-05-31 23:10:25 +02:00
04b9707272 Move /api/account to /api/auth/account
All checks were successful
/ build (push) Successful in 1m16s
/ deploy (push) Successful in 16s
An account refers to the user the active session is logged in as. As
such it doesn't make sense outside of the /auth API paths that deals
with the current authenticated user.  Move /api/account to
/api/auth/account to reflect this.
2025-05-31 21:44:19 +02:00
e7dc00db54 Remove old editing interface
All checks were successful
/ build (push) Successful in 1m13s
/ deploy (push) Successful in 15s
Remove broken placeholder event editing interface that did not take
account to access permissions or events having multiple solts.
2025-05-27 17:38:23 +02:00
68f731f094 Send keepalive as a comment
All checks were successful
/ build (push) Successful in 1m20s
/ deploy (push) Successful in 16s
Avoid invoking the event dispatching for keepalives.
2025-05-25 23:38:24 +02:00
ed67982ec0 Explicitly set locale to avoid hydration mismatch
Some functions in luxon default to the system's locale while other
functions default to "en-US".  Explicitly set the locale everywhere
the luxon objects are created to avoid possible mismatches and
unexpected behaviour should the system's locale be different.
2025-05-25 23:38:06 +02:00
4444daaca9 Load secrets from files
All checks were successful
/ build (push) Successful in 1m8s
/ deploy (push) Successful in 16s
Putting secrets into environment variables is problematic due to them
being inherited by sub-processes, the ease as which these can be
leaked in logs, and the lack of support for loading secrets into
environment variables by systems such as systemd and docker.

Change the loading of secrets to be done by loading the content of a
file specified by an environment variable.
2025-05-20 00:43:29 +02:00
c9976af26b Include the name of the cookie in the signature
If a cookie is signed for one purpose, but the server also uses a
differently named signed cookie name for another purpose, then it's
possible for a malicious client to substitute the value of one signed
cookie with the value of another and have it pass the signature check.

Include the name of the cookie when computing the signature so that no
cookies signed for example for "user_session" can be used as a value for
a hypothetical "admin_session" cookie.
2025-05-20 00:36:10 +02:00
a16921f264 Read vapid subject from the environment
Load the contact details for push notifications from the
NUXT_VAPID_SUBJECT environment variable.
2025-05-20 00:25:28 +02:00
c986d939ec Read vapid details from runtime config
Use the useRuntimeConfig interface to read vapid details on the server
side.  This is a more portale way to deal with loading data from the
environment in Nuxt.js.
2025-05-20 00:22:28 +02:00
529d640a0e Assign crew randomly in demo schedule 2025-03-15 20:26:43 +01:00
278492ad69 Fix missmatched parenthesis 2025-03-15 18:30:22 +01:00
cef6b13dd1 Add assigment of crew to events and shifts 2025-03-15 18:18:08 +01:00
262a691ed6 Move toId to shared/utils/functions.ts 2025-03-15 13:46:13 +01:00
29b34deef0 Make session cookie permament
Set a max age for the session cookie to prevent it from expiring when
the browser is closed.  To prevent the age limit from being being
reached the session cookie is refreshed every time the session is
loaded.  This should fix login being lost when the browser is stopped.
2025-03-11 16:30:51 +01:00
5255ed698e Implement access controlled edit schedule endpoint
Add PATCH /api/schedule endpoint for editing the schedule in a manner
that's access controlled.
2025-03-11 14:11:05 +01:00
a9ba0c55e1 Implement role based shifts for crew 2025-03-10 20:58:33 +01:00
4806343250 Filter crew events to only be visible for crew 2025-03-10 16:26:52 +01:00
ddecfa3805 Set seed when generating interests into events
Prevent adding accounts from changing who's interestin in what in the
generated demo schedule.
2025-03-10 14:42:40 +01:00
6c4107a1cb Fix incorrect time offset in generated schedule
When correcting for a timezone being ahead of UTC the start has to be
moved backwards in time, not forward.  Fixes the generated schodule
not using central european times.
2025-03-10 14:40:52 +01:00
db8393c3a9 Add crew designator to events
Distinguish between events for attendees to see and events that are
meant only for the crew.
2025-03-10 14:40:02 +01:00
40c25f8990 Fix logic inversion braking interested 2025-03-09 23:56:39 +01:00
c4a6f6b3f9 Add per account overridable timezone setting
To make it possible to render the timetable in the user's local time we
need to know the timezone to render it in on the server.  Otherwise
there will be hydration errors and paint flashing as the client renders
a different timezone.

Add a server global default timezone that can be overriden on a
per-account bases to prepare for timezone handling the timetable.
2025-03-09 15:53:51 +01:00
c71841801b Use deleteCookie to remove session cookie 2025-03-08 00:36:10 +01:00
8ef4636635 Add create account functionality 2025-03-07 23:53:57 +01:00
598b9fd7d6 Add delete account function 2025-03-07 22:28:55 +01:00
db9a12250e Track which account is interested in which events
Store a list of ids of events and slots that accounts have marked as
being interested in, and show aggeregate counts in the schedule.
2025-03-07 20:15:41 +01:00
52dfde95d1 Tie push subscriptions to current session
If a user logs out from a device the expectation should be that device
no longer having any association with the user's account.  Any existing
push notifications should thefore be removed on server.  For this reason
tie push notifications to a session, and remove them when the session is
deleted.
2025-03-07 15:47:48 +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
abdcc83eb9 Refactor subscription format
Place the actual push subscription data into a push property on the
subscription so that other properties can be added to it.
2025-03-07 12:37:47 +01:00
b4934005ae Pull JSON read file logic into a function 2025-03-07 12:27:19 +01:00
8da4b02154 Implement signed cookie helpers
Provide a convenient wrapper for setting SHA-256 HMAC signed cookies and
retreiving them with the signature validated.  The secret key is
configured in the NUXT_COOKIE_SECRET_KEY environment variable.
2025-03-06 22:07:51 +01:00
3da83a7feb Fix demo schedule origin being on Saturday
It was intended to have Monday as the origin point.
2025-03-05 22:54:43 +01:00
e703902c5e Fix generated schedule using wrong date format 2025-03-05 22:43:07 +01:00
228d75db72 Generate a demo schedule if no schedule exists 2025-03-05 22:15:46 +01:00
5cc310384e Move stored data to a volume
Fix the silly data wipe on re-deployment by writing the data to a
volume instead of the ephemeral container filesystem.
2025-03-05 19:10:13 +01:00
6ea3567c94 Refactor code saving data
Move the code dealing with saving and loading data to server/database to
gather it all up into one place.
2025-03-05 18:41:47 +01:00
d8a31db44d Handle event streams being cancelled
h3 doesn't correctly handle unexpected stream closures, bypass h3 and
operate directly on the Node.js ServerResponse object to handle them.
2025-03-05 16:02:26 +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
8c8b561f1a Convert indents to tabs 2025-03-01 17:06:41 +01:00
5e4ea1be61 Setup defaut Nuxt template 2025-03-01 16:52:23 +01:00