summaryrefslogtreecommitdiff
path: root/wsm.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Implement course selection started/stopped statesRunxi Yu6 days1-0/+30
| | | | Implements: https://todo.sr.ht/~runxiyu/cca/13
* *.go: Update commentsRunxi Yu7 days1-2/+3
|
* *.go: Use sync.Map instead of map[int]*courseT for coursesRunxi Yu8 days1-17/+36
| | | | I'm not sure whether this is actually better than locking.
* {courses,wsc,wsm}.go: map[courseGroupT](bool->struct{})Runxi Yu8 days1-4/+4
| | | | | This makes it use slightly less memory. Approximately courseGroupT bits per connection!
* *.go: Further wrap errorsRunxi Yu9 days1-11/+24
|
* {courses,wsm,wsp}.go: Make course.Selected atomicRunxi Yu9 days1-1/+7
|
* {config,wsm}.go, cca.scfg.example: Configurable immediate propagationRunxi Yu10 days1-6/+9
|
* *.go: Limit to approximately 80 characters per lineRunxi Yu10 days1-19/+84
|
* wsm.go: "R" on multiple choices in group rather than closing connectionRunxi Yu10 days1-4/+5
|
* wsm.go: Check course group constraint first when choosingRunxi Yu11 days1-13/+15
|
* {courses,wsc,wsm,wsp}.go: Send course number immediately on user interactionRunxi Yu11 days1-3/+16
|
* *: Overhaul structure again and embed everythingRunxi Yu11 days1-0/+224
| | | | | | | | - Remove sub-Makefiles; recursive make is annoying - Just use one top-level Makefile that builds everything - Embed templates and minified static resources into the binary - Embed all compiled documentation into the binary and serve - Embed all source into the binary and serve
* *.go: Move to backendRunxi Yu11 days1-224/+0
| | | | And adjust Makefiles, admin handbook, and lint.sh accordingly.
* {courses,wsm}.go: Use in-memory structure to fetch cgroup, not SQLRunxi Yu12 days1-9/+12
|
* wsm.go: Omit comparison to bool constantRunxi Yu12 days1-1/+1
|
* wsm.go: Report error when course doesn't existRunxi Yu11 days1-0/+8
| | | | | Luckily we encounter a database error before we have the chance to dereference a null pointer. But it's still good practice to check.
* {courses,sem,ws,wsm}.go: Second step towards an efficient state propagatorRunxi Yu11 days1-1/+1
| | | | References: https://todo.sr.ht/~runxiyu/cca/7
* {courses,wsm}.go: Add getCourseByIDRunxi Yu11 days1-10/+2
| | | | This also deduplicates some code.
* {courses,wsm}.go: Add (*courseT).decrementSelectedAndPropagateRunxi Yu11 days1-24/+4
| | | | This is being done quite a few times, so let's make it a function.
* {courses,ws,wsm}.go: Update userCourseGroups during choose/unchooseRunxi Yu11 days1-2/+30
|
* {ws,wsm}.go: Handle context cancellationsRunxi Yu13 days1-0/+20
|
* {main,ws,wsm}.go: Attempt to cancel old sessionsRunxi Yu13 days1-15/+15
| | | | | | | | | | | | | | | | | | | When beginning to handle a WebSocket connection, we shall create a new context, with the request context as its parent. We use the new context for everything from now on, except for reporting error messages, which is handled by creating a reportError function in a closure in makeReportError and passing it along to command-handling functions. Note that if one user attempts to rapidly launch WebSocket connections, there might still be a race condition where the old connection hasn't been completely established yet (i.e. an entry hasn't been added to cancelPool) and the new connection isn't able to cancel the old connection. I'm a bit tired to think of a solution now but it could probably be solved by moving the cancellation registration and cancelling sooner during the initial handshake. Note that more parts of the event loop needs to select from ctx.Done (from newCtx) for this to work reliably.
* wsm.go, main.js: Use M for number, N for deselectRunxi Yu2024-10-021-3/+3
| | | | | | | Previously both commands used N, and deselection wasn't really implemented on the JavaScript side. It worked and didn't throw an exception but it's technically wrong and the user could see an empty number field for a split second.
* {auth,db,wsm}.go: Make 23505 (uniqueness violation) a constantRunxi Yu2024-10-011-1/+1
|
* wsm.go, main.js: Display the user's selected courses on first runv0.1.0Runxi Yu2024-10-011-2/+18
| | | | | It's done in the WebSocket routines rather than in the template maker because it's relatively easier to write the logic this way.
* {ws,wsm}.go: Split message handlers into their own functionsRunxi Yu2024-10-011-0/+177