server: add AnonRouter function To expose anonymous (unauthenticated) routing to downstream core-go users.
server: fix playground on config.Debug A recent change made it so that the playground required authentication to access in debug mode; this moves it under the other auth-free endpoints.
server: use routing groups Instead of hardcoding some exceptions in the auth middleware, use a different routing group for routes that do not require auth. Makes the auth middleware more generic and also removes a lot of unneccessary middleware processing from routes that don't need it. For now, the added group is not accessible from outside the module, but if the need arises, this might be an option.
Migrate to chi v5 v1 is not maintained anymore.
server: register SQL collector Missed this step
Add prometheus SQL connection stats Also updates the prometheus client_go library
Normalize remote address before saving to context One cause for https://todo.sr.ht/~sircmpwn/meta.sr.ht/193 was that code performing this sanitization was in multiple places, and a fix was not applied in all places. There is no reasonable expectation for the port to be present anyways, e.g. if the address is taken from a trusted reverse proxy's header. Hence, perform the normalization here, so that the code doing this in applications can be simplified. Note that this does not yet fix the below ticket, it will just make the fix easier. References: https://todo.sr.ht/~sircmpwn/meta.sr.ht/193
email.EnqueueStd: Don't overwrite headers Sometimes we need to specify the Message-Id, From, and Reply-To headers (e.g. for todo.sr.ht ticket notifications). Don't overwrite these headers if they are present.
server: move auth middlware ahead of RealIP So that @internal auth can correctly test against internal-ipnet.
Remove %e formatting verbs %e is not valid for formatting error values: > %e scientific notation, e.g. -1.234456e+78 Instead, use %w when using fmt.Errorf (for error wrapping) and %v when using log.Printf (%w is not valid in that context).
Enforce complexity limit on webhook payload
Configure server to manage mail queue This also sets up the recovery function for webhooks, so we get emailed when we panic during a webhook query.
server: add server reference to context
server: set max upload size to 1 GiB
Stash remote address in context
Add legacy webhooks worker implementation
Expand context for work queues
server: use SO_REUSEADDR for main listener
server: add /query/api-meta.json, docs
server: incorporate queue management