Commit graph

117 commits

Author SHA1 Message Date
fad1bb2482 Ignore updatedAt timestamp when comparing entities
All checks were successful
/ build (push) Successful in 1m28s
/ deploy (push) Successful in 16s
To determine if the entity received from the server is the same as the
entity the client has the equals method is use.  To avoid problems with
clients that have incorrect clocks the timestamp is overriden with the
server's time when the entities are saved on the server.

This means that the entities received back from the server when the
client saves will have different timestamps than what the client set.
Ignore the updatedAt timestamp when comparing entities for equality so
that the update logic correctly replaces entities that only differ by
the update timestamp.
2025-06-13 21:06:48 +02:00
8c63c1cfbb Fix sanity checks failing on deleted entities
If the event/shift that a location/role was referencing had been marked
for deletion the sanity check would incorrectly refuse to delete the
event/role.  Fix by ignoring deleted events/shifts.
2025-06-13 20:51:24 +02:00
61734d4152 Add editing of client schedule entities
Add utility methods to more easily edit the fields of a single entity in
the schedule, along with a modification flag and is modified utility to
check for changes having been made.
2025-06-13 20:49:04 +02:00
faffe48706 Use TypeScript private modifier for methods
The Vue Ref system and assiated proxies does not work with the native
EcmaScript private fields, replace them with the TypeScript access
modifiers which are regular fields under the hood.
2025-06-13 17:04:55 +02:00
e100555304 Implement ClientSchedule state tracking class
All checks were successful
/ build (push) Successful in 2m16s
/ deploy (push) Successful in 16s
Write the logic of keeping track of location modifications and applying
updates from the server into the ClientSchedule class.  This should
serve as the foundation for replacing the prototype in-component update
logic which have turned into an unmaintainable spagetti.
2025-06-12 21:48:50 +02:00
aa52a6c651 Setup vitest
Done according to https://nuxt.com/docs/getting-started/testing
2025-06-12 21:38:47 +02:00
75abd82f81 Workaround issue with VSCode Nuxtr
When the object passed to defineNuxtConfig contains logic for enable
devtools option the Nuxtr plugin annoyingly shows an endlessly spinning
orb on the statusline.
2025-06-12 14:01:50 +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
25793fecb8 Add DISABLE_DEV_TOOLS env to disable Nuxt dev tools
All checks were successful
/ build (push) Successful in 1m14s
/ deploy (push) Successful in 15s
The dev tools built into Nuxt take up way too much resources to run on
low end hardware.  Add config to disable it.
2025-05-31 22:14:06 +02:00
2cb56247be Fix interested state for anonymous accounts
The EventCard logic assume interestedIds not being present means the
account can't set events as interested.  Fix this logic by checking if
the account is valid instead and always have interestedIds present on
the account store.
2025-05-31 22:05:20 +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
8d0d2400d3 Include message and stack in error page if useful
Show the .message and .stack properties of the error object in the error
page if these contain any useful information.
2025-05-26 14:01:46 +02:00
e8ff87d507 Fetch session in authenticated middleware
All checks were successful
/ build (push) Successful in 1m19s
/ deploy (push) Successful in 16s
The authenticated middleware runs before the page content is rendered.
This means that it'll run before the session is fetched in app.vue on
pages that are protected by it on the first load.  Fetch the session in
the middleware so that it doesn't act before the session is initalized.
2025-05-26 13:58:47 +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
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
e722876aae Use a pinia store to manage account state
All checks were successful
/ build (push) Successful in 3m29s
/ deploy (push) Successful in 47s
Refactor the existing scattered code dealing with the account state into
a pinia store.
2025-05-24 20:01:23 +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
c47452a8b4 Update secret name for deployment
All checks were successful
/ build (push) Successful in 1m13s
/ deploy (push) Successful in 16s
The service secret was renamed for consistency with the other secrets I
manage.
2025-05-23 21:56:56 +02:00
c7b4f5fa92 Render PushNotification on client only
All checks were successful
/ build (push) Successful in 1m52s
/ deploy (push) Successful in 15s
The push logic is only available on the client and causes hydration
mismatch when rendered on the server.
2025-05-23 21:35:19 +02:00
f2ab306338 Always await useAccountSession
If this is not done the session is not properly loaded during server
side rendering, making it possible for missmatch and bugs to happen.
2025-05-23 21:33:48 +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
8329ff060b Update to nuxt 3.17.4 2025-05-23 21:28:58 +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
742be649eb Add /build-info page displaying
All checks were successful
/ build (push) Successful in 1m16s
/ deploy (push) Successful in 16s
Add page displaying information about the deployment for diagnostic
purposes.
2025-05-20 00:07:58 +02:00
ded212f03f Remove unused NODE_ENV variable
Nuxt forces the NODE_ENV environment variable to be set to production
when running a build, which means there's no point in specifying it
here.
2025-05-19 23:34:48 +02:00
81de90d4a6 Push container images to a private org
All checks were successful
/ build (push) Successful in 1m10s
/ deploy (push) Successful in 15s
The access permissions in Forgejo does not allow making packages
of a user private, the only options are hide the user completely
or make packages public.  Do a workaround for this by pushing to
a private org.
2025-05-19 18:55:59 +02:00
4a9a8cec85 Rewrite deployment for forge.hornwitser.no
All checks were successful
/ build (push) Successful in 1m13s
/ deploy (push) Successful in 16s
Replace docker with podman and kubernetes with the simple service
webhook in the forgejo workflow to make this compatible with my
new infrastructure.
2025-05-19 18:03:47 +02:00
399a4d2ca5 Add account based filtering of the schedule
Some checks failed
/ build (push) Has been cancelled
/ deploy (push) Has been cancelled
Implement personal filtering of the schedule based on events marked as
being interested in and filtering based on assigned crew for events.
2025-03-15 22:47:32 +01:00
89b1d2a547 Show crew on event cards when logged in as crew 2025-03-15 20:37:08 +01: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
0aff9cc94a Add editing of shifts 2025-03-15 17:06:23 +01:00
905ec8a38b Add editing of shift time slots 2025-03-15 16:45:02 +01:00
accc1690ff Add editing of roles for shifts 2025-03-15 15:10:42 +01:00
27d853d102 Disable editing of public events in UI for crew 2025-03-15 14:28:27 +01:00
b22d32dada Add editing of events 2025-03-15 14:20:38 +01:00
262a691ed6 Move toId to shared/utils/functions.ts 2025-03-15 13:46:13 +01:00
02be8a37a5 Implement editing of time slots
Render the timeslots as an editable table of times with associated
event.  When the event it's linked to is edited the time slot is removed
from the original event it belonged to and added to the possibly new
event it now belongs to.  This gives a somewhat intutive editing
experience when editing time slots linked to events with multiple times.
2025-03-14 18:19:58 +01:00
3cdfceb037 Reconfigure VsCode to not remove dead code
I have no idea why this is even a thing.  Removing dead code on save is
stupid.
2025-03-14 17:51:07 +01:00
d0ee6a40eb Pass schedule as a prop to Timetable 2025-03-14 17:38:01 +01:00
f550ca921b Share utility functions from Timetable
Move the genereic pairs, enumerate and setEquals functions from
Timetable to shared/utils/functions to make them available for reuse.
2025-03-12 14:44:06 +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