summaryrefslogtreecommitdiff
path: root/LICENSE (unfollow)
Commit message (Collapse)AuthorFilesLines
4 daysstyle.css: Switch the header to a grey themeRunxi Yu1-4/+8
4 daysstyle.css: Revert back to blue themeRunxi Yu1-3/+5
4 days{ws,wsm}.go: Split message handlers into their own functionsRunxi Yu2-124/+182
4 dayslint.sh: Disable dogsled and unparamRunxi Yu1-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.
4 days{auth,ws}.go: Remove unnecessary TODOsRunxi Yu2-19/+2
4 daysws.go: Allow deselecting coursesRunxi Yu1-0/+34
4 dayslint.sh: Disable yet another cyclomatic complexity checkerRunxi Yu1-1/+1
4 daysws.go: Fix logic error when reaffirming a course choiceRunxi Yu1-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.
4 days{main,pw}.go, Makefile, index_login.html: Remove password auth stubRunxi Yu4-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.
4 daysws.go: protocolError instead of R on unexpected database errorsRunxi Yu1-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.
4 daysindex.go, ws.go: Fix race condition surrounding coursesRunxi Yu2-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.
4 dayscourses.go: Propagate course.Selected when setting up coursesRunxi Yu1-2/+7
4 daysws.go: Decrement course.Selected counter on commit failuresRunxi Yu1-0/+6
4 daysws.go: Reaffirm course choice when duplicate is requestedRunxi Yu1-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.
4 daysws.go: propagateCouldFail -> propagateIgnoreFailuresRunxi Yu1-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".
4 daysws.go, schema.sql: Enforce uniqueness of course choicesRunxi Yu2-43/+65
References: https://todo.sr.ht/~runxiyu/cca/1
4 dayslint.sh: Disable yet another cyclomatic complexity checkerRunxi Yu1-1/+1
4 daysws.go, *.sql: Add course choices to the databaseRunxi Yu3-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
4 dayspostgres_run.sh: Run in debug level 2Runxi Yu1-1/+1
This allows SQL statements to be logged which makes debugging much easier. Also "$@" is added so any extra arguments may be passed.
5 daysws.go: propagate -> propagateCouldFailRunxi Yu1-3/+8
5 daysws.go: propagate course number updates in another goroutineRunxi Yu1-1/+1
5 daysauth.go: Add TODO about INSERTRunxi Yu1-0/+7
6 daysadmin_handbook: List configuration caveatsRunxi Yu1-3/+7
6 daysiadocs: cover_page.{html->htm}Runxi Yu2-353/+352
Cgit was kinda broken in serving HTML, it was a caching issue
6 daysdocs, iadocs: RevampRunxi Yu6-352/+544
6 daysdocs: TeXinfo kinda sucks, removingRunxi Yu3-57/+0
6 daysws.go: Separate c.Write calls into writeText()Runxi Yu1-25/+17
6 daysutils.go, auth.go: Rename random to randomBytesRunxi Yu2-3/+3
6 daysmain.go: Actually repsect config.Perf.ReadHeaderTimeoutRunxi Yu1-1/+1
6 daysstyle.css: Misc enhancementsRunxi Yu1-29/+25
6 daysstyle.css: Break element specifiers onto its own line when longRunxi Yu1-6/+12
6 daysstyle.css: Rename --boxbg to --boxRunxi Yu1-13/+11
6 daysstyle.css: Add a dark themeRunxi Yu1-8/+28
6 daysstyle.css: Remove poorly-framed comment on --x-contrast colorsRunxi Yu1-5/+0
6 daysws.go, utils.go: Document some synchronization design choicesRunxi Yu2-1/+21
Also use TryLock in setupChanPool, and fail when not successful.
6 daysindex.html: Disable checkbox initially when .Selected >= MaxRunxi Yu1-0/+4
6 daysmain.js: Move connect(s) to the event listener directlyRunxi Yu1-6/+2
6 days{config,index}.go, cca.scfg.example, style.css, *.html: Link to sourceRunxi Yu6-14/+17
6 days*: Change license to AGPL-3.0-or-laterRunxi Yu13-238/+787
6 daysindex.go: Correct typoRunxi Yu1-1/+1
6 daysauth.go, config.go, cca.scfg.example: Issue expiring cookiesRunxi Yu3-2/+13
6 days{auth,index,ws}.go, schema.sql: Move session cookie into the user tableRunxi Yu4-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
6 daysutils.go: Better logging for wstr()Runxi Yu1-1/+1
6 daysmain.js: Disable boxes when fullRunxi Yu1-0/+8
6 daysmain.js: Fix the IRC-style message parserRunxi Yu1-0/+4
Previously, if it receives a message like "a b :c", it returns "["a", "b", "c "]" which is erroneous.
6 daysindex.html, main.js, ws.go: Enhance course selection rejection messageRunxi Yu3-5/+9
7 daysmain.js: Handle "Y" (course selection approved)Runxi Yu1-0/+4
7 daysstyle.css: Remove styling for preformatted textRunxi Yu1-9/+0
6 daysws.go, config.go, config.scfg.example: Attempt to fix deadlockRunxi Yu3-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.
6 daysmain.js: Handle number updatesRunxi Yu1-0/+3