Commit message (Collapse) | Author | Files | Lines | ||
---|---|---|---|---|---|
2024-10-01 | style.css: Switch the header to a grey theme | Runxi Yu | 1 | -4/+8 | |
2024-10-01 | style.css: Revert back to blue theme | Runxi Yu | 1 | -3/+5 | |
2024-10-01 | {ws,wsm}.go: Split message handlers into their own functions | Runxi Yu | 2 | -124/+182 | |
2024-10-01 | lint.sh: Disable dogsled and unparam | Runxi Yu | 1 | -1/+1 | |
dogsled forbids patterns such as "_, _, _ = a, b, c" for no reason. unparam warns about unused parameters even when I'm assigning them to _ to indicate that it's fine for them to be unused. | |||||
2024-10-01 | {auth,ws}.go: Remove unnecessary TODOs | Runxi Yu | 2 | -19/+2 | |
2024-10-01 | ws.go: Allow deselecting courses | Runxi Yu | 1 | -0/+34 | |
2024-10-01 | lint.sh: Disable yet another cyclomatic complexity checker | Runxi Yu | 1 | -1/+1 | |
2024-10-01 | ws.go: Fix logic error when reaffirming a course choice | Runxi Yu | 1 | -2/+2 | |
When a user has already chosen a course choice but sends a message to choose it again, a database error occurs as the uniqueness constraint is violated. In this case, we "reaffirm" the user's course choice, to hopefully get their client's state back in sync. However, we previously forgot to return back to the event loop after this reaffirmation, causing the control flow to fall into the course-increment and transaction-commit stage. The error is discovered at tx.Commit, where pgx raises a ErrTxCommitRollback, because in that case we're trying to commit a transaction that has already encountered an error. | |||||
2024-10-01 | {main,pw}.go, Makefile, index_login.html: Remove password auth stub | Runxi Yu | 4 | -92/+1 | |
I don't think password authentication is really useful, since Microsoft Entra ID is the "proper" way of doing authentication in our school system and there's just little reason to have a password login. I previously wanted to use password authentication for stress testing, but stress testing really could just use completely fake authentication and there's no need for any password whatsoever. | |||||
2024-10-01 | ws.go: protocolError instead of R on unexpected database errors | Runxi Yu | 1 | -23/+7 | |
When an unknown database error is encoutered, the connection should be considered broken and the error should be reported as a fatal error to the end user. Rejecting the course choice unsets the checkbox and lets the page to be continued to be used, which is not intended. | |||||
2024-10-01 | index.go, ws.go: Fix race condition surrounding courses | Runxi Yu | 2 | -13/+21 | |
handleIndex and handleConn used to access the courses map without RLock'ing coursesLock, which may cause issues if courses is being written to, by a function such as setupCourses. | |||||
2024-10-01 | courses.go: Propagate course.Selected when setting up courses | Runxi Yu | 1 | -2/+7 | |
2024-10-01 | ws.go: Decrement course.Selected counter on commit failures | Runxi Yu | 1 | -0/+6 | |
2024-10-01 | ws.go: Reaffirm course choice when duplicate is requested | Runxi Yu | 1 | -5/+13 | |
Laggy clients, extremely fast clicks, or other conditions could cause duplicate course choices to be sent, which would violate the uniqueness constraint. In this case the fact that the user has already chosen the course should be reaffirmed, rather than making it look like their choice was rejected. | |||||
2024-10-01 | ws.go: propagateCouldFail -> propagateIgnoreFailures | Runxi Yu | 1 | -2/+2 | |
I think the new name better reflects the fact that it just ignores failures when propagating to each channel. The old name sounds like "this function itself could fail". | |||||
2024-10-01 | ws.go, schema.sql: Enforce uniqueness of course choices | Runxi Yu | 2 | -43/+65 | |
References: https://todo.sr.ht/~runxiyu/cca/1 | |||||
2024-10-01 | lint.sh: Disable yet another cyclomatic complexity checker | Runxi Yu | 1 | -1/+1 | |
2024-10-01 | ws.go, *.sql: Add course choices to the database | Runxi Yu | 3 | -7/+47 | |
Note that this naive implementation currently allows users to submit multiple requests for the same course. See the TODO comment below: /* * TODO: Ensure that the user is not already enrolled in this course * and pay attention to relevant race conditions. It might be useful * to restructure this part, to begin a transaction that adds the user * to the database (and check the (currently not existing) uniqueness) * constraint at that exact moment, and abort the transaction if the * course limit is exceeded. * Or perhaps choices should be also stored in an internal data * structure, though that requires extra attention on consistency * issues between the internal data structure and the database. * (Sometime I should really go fix the LMDB bindings...) */ References: https://todo.sr.ht/~runxiyu/cca/1 | |||||
2024-10-01 | postgres_run.sh: Run in debug level 2 | Runxi Yu | 1 | -1/+1 | |
This allows SQL statements to be logged which makes debugging much easier. Also "$@" is added so any extra arguments may be passed. | |||||
2024-10-01 | ws.go: propagate -> propagateCouldFail | Runxi Yu | 1 | -3/+8 | |
2024-10-01 | ws.go: propagate course number updates in another goroutine | Runxi Yu | 1 | -1/+1 | |
2024-10-01 | auth.go: Add TODO about INSERT | Runxi Yu | 1 | -0/+7 | |
2024-09-30 | admin_handbook: List configuration caveats | Runxi Yu | 1 | -3/+7 | |
2024-09-30 | iadocs: cover_page.{html->htm} | Runxi Yu | 2 | -353/+352 | |
Cgit was kinda broken in serving HTML, it was a caching issue | |||||
2024-09-30 | docs, iadocs: Revamp | Runxi Yu | 6 | -352/+544 | |
2024-09-30 | docs: TeXinfo kinda sucks, removing | Runxi Yu | 3 | -57/+0 | |
2024-09-30 | ws.go: Separate c.Write calls into writeText() | Runxi Yu | 1 | -25/+17 | |
2024-09-30 | utils.go, auth.go: Rename random to randomBytes | Runxi Yu | 2 | -3/+3 | |
2024-09-30 | main.go: Actually repsect config.Perf.ReadHeaderTimeout | Runxi Yu | 1 | -1/+1 | |
2024-09-30 | style.css: Misc enhancements | Runxi Yu | 1 | -29/+25 | |
2024-09-30 | style.css: Break element specifiers onto its own line when long | Runxi Yu | 1 | -6/+12 | |
2024-09-30 | style.css: Rename --boxbg to --box | Runxi Yu | 1 | -13/+11 | |
2024-09-30 | style.css: Add a dark theme | Runxi Yu | 1 | -8/+28 | |
2024-09-30 | style.css: Remove poorly-framed comment on --x-contrast colors | Runxi Yu | 1 | -5/+0 | |
2024-09-30 | ws.go, utils.go: Document some synchronization design choices | Runxi Yu | 2 | -1/+21 | |
Also use TryLock in setupChanPool, and fail when not successful. | |||||
2024-09-30 | index.html: Disable checkbox initially when .Selected >= Max | Runxi Yu | 1 | -0/+4 | |
2024-09-30 | main.js: Move connect(s) to the event listener directly | Runxi Yu | 1 | -6/+2 | |
2024-09-30 | {config,index}.go, cca.scfg.example, style.css, *.html: Link to source | Runxi Yu | 6 | -14/+17 | |
2024-09-30 | *: Change license to AGPL-3.0-or-later | Runxi Yu | 13 | -238/+787 | |
2024-09-30 | index.go: Correct typo | Runxi Yu | 1 | -1/+1 | |
2024-09-30 | auth.go, config.go, cca.scfg.example: Issue expiring cookies | Runxi Yu | 3 | -2/+13 | |
2024-09-30 | {auth,index,ws}.go, schema.sql: Move session cookie into the user table | Runxi Yu | 4 | -55/+23 | |
One user shall only have one session at a time. This reduces the possibility of strange race conditions and simplifies the code a lot. References: https://todo.sr.ht/~runxiyu/cca/4 | |||||
2024-09-30 | utils.go: Better logging for wstr() | Runxi Yu | 1 | -1/+1 | |
2024-09-30 | main.js: Disable boxes when full | Runxi Yu | 1 | -0/+8 | |
2024-09-30 | main.js: Fix the IRC-style message parser | Runxi Yu | 1 | -0/+4 | |
Previously, if it receives a message like "a b :c", it returns "["a", "b", "c "]" which is erroneous. | |||||
2024-09-30 | index.html, main.js, ws.go: Enhance course selection rejection message | Runxi Yu | 3 | -5/+9 | |
2024-09-29 | main.js: Handle "Y" (course selection approved) | Runxi Yu | 1 | -0/+4 | |
2024-09-29 | style.css: Remove styling for preformatted text | Runxi Yu | 1 | -9/+0 | |
2024-09-29 | ws.go, config.go, config.scfg.example: Attempt to fix deadlock | Runxi Yu | 3 | -4/+14 | |
When propagate tries to propagate a message to a connection that actually called propagate, it deadlocks because the it tries to send to that connection's send channel in the same goroutine. This is an attempt at a fix. | |||||
2024-09-29 | main.js: Handle number updates | Runxi Yu | 1 | -0/+3 | |