summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* index.go, ws.go: Fix race condition surrounding coursesRunxi Yu7 days2-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.
* courses.go: Propagate course.Selected when setting up coursesRunxi Yu7 days1-2/+7
|
* ws.go: Decrement course.Selected counter on commit failuresRunxi Yu7 days1-0/+6
|
* ws.go: Reaffirm course choice when duplicate is requestedRunxi Yu7 days1-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.
* ws.go: propagateCouldFail -> propagateIgnoreFailuresRunxi Yu7 days1-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".
* ws.go, schema.sql: Enforce uniqueness of course choicesRunxi Yu7 days2-43/+65
| | | | References: https://todo.sr.ht/~runxiyu/cca/1
* lint.sh: Disable yet another cyclomatic complexity checkerRunxi Yu7 days1-1/+1
|
* ws.go, *.sql: Add course choices to the databaseRunxi Yu7 days3-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
* postgres_run.sh: Run in debug level 2Runxi Yu7 days1-1/+1
| | | | | This allows SQL statements to be logged which makes debugging much easier. Also "$@" is added so any extra arguments may be passed.
* ws.go: propagate -> propagateCouldFailRunxi Yu7 days1-3/+8
|
* ws.go: propagate course number updates in another goroutineRunxi Yu7 days1-1/+1
|
* auth.go: Add TODO about INSERTRunxi Yu7 days1-0/+7
|
* admin_handbook: List configuration caveatsRunxi Yu8 days1-3/+7
|
* iadocs: cover_page.{html->htm}Runxi Yu8 days2-353/+352
| | | | Cgit was kinda broken in serving HTML, it was a caching issue
* docs, iadocs: RevampRunxi Yu8 days6-352/+544
|
* docs: TeXinfo kinda sucks, removingRunxi Yu8 days3-57/+0
|
* ws.go: Separate c.Write calls into writeText()Runxi Yu8 days1-25/+17
|
* utils.go, auth.go: Rename random to randomBytesRunxi Yu8 days2-3/+3
|
* main.go: Actually repsect config.Perf.ReadHeaderTimeoutRunxi Yu8 days1-1/+1
|
* style.css: Misc enhancementsRunxi Yu8 days1-29/+25
|
* style.css: Break element specifiers onto its own line when longRunxi Yu8 days1-6/+12
|
* style.css: Rename --boxbg to --boxRunxi Yu8 days1-13/+11
|
* style.css: Add a dark themeRunxi Yu8 days1-8/+28
|
* style.css: Remove poorly-framed comment on --x-contrast colorsRunxi Yu8 days1-5/+0
|
* ws.go, utils.go: Document some synchronization design choicesRunxi Yu8 days2-1/+21
| | | | Also use TryLock in setupChanPool, and fail when not successful.
* index.html: Disable checkbox initially when .Selected >= MaxRunxi Yu8 days1-0/+4
|
* main.js: Move connect(s) to the event listener directlyRunxi Yu8 days1-6/+2
|
* {config,index}.go, cca.scfg.example, style.css, *.html: Link to sourceRunxi Yu8 days6-14/+17
|
* *: Change license to AGPL-3.0-or-laterRunxi Yu8 days13-238/+787
|
* index.go: Correct typoRunxi Yu8 days1-1/+1
|
* auth.go, config.go, cca.scfg.example: Issue expiring cookiesRunxi Yu8 days3-2/+13
|
* {auth,index,ws}.go, schema.sql: Move session cookie into the user tableRunxi Yu8 days4-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
* utils.go: Better logging for wstr()Runxi Yu8 days1-1/+1
|
* main.js: Disable boxes when fullRunxi Yu8 days1-0/+8
|
* main.js: Fix the IRC-style message parserRunxi Yu8 days1-0/+4
| | | | | Previously, if it receives a message like "a b :c", it returns "["a", "b", "c "]" which is erroneous.
* index.html, main.js, ws.go: Enhance course selection rejection messageRunxi Yu8 days3-5/+9
|
* main.js: Handle "Y" (course selection approved)Runxi Yu9 days1-0/+4
|
* style.css: Remove styling for preformatted textRunxi Yu9 days1-9/+0
|
* ws.go, config.go, config.scfg.example: Attempt to fix deadlockRunxi Yu8 days3-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.
* main.js: Handle number updatesRunxi Yu8 days1-0/+3
|
* main.js: Relocate a comment and remove a blank lineRunxi Yu8 days1-2/+1
|
* ws.go: Attempt to propagate messagesRunxi Yu8 days1-1/+11
|
* ws.go: Implement course choice limitsRunxi Yu9 days1-0/+31
|
* pre-commit hook: Use && to chain lint.sh and eslint.shRunxi Yu9 days1-2/+1
|
* main.js: Add stub case "R" for course selection rejectedRunxi Yu9 days1-0/+5
|
* main.js: Comments should be /* */ rather than //Runxi Yu9 days1-2/+2
|
* main.js: Remove command "A" (authentication)Runxi Yu9 days1-3/+0
| | | | | Authentication is handled during the HTTP request that establishes the WebSocket connection since the cookie is passed there anyway.
* auth.go: Document why we use a hybrid auth flowRunxi Yu9 days1-1/+12
|
* ws.go: protocolError is now its own functionRunxi Yu9 days1-28/+15
|
* index.html: Remind user to report connection closed errorsRunxi Yu9 days1-0/+3
|