~sircmpwn/git.sr.ht

Fix generation of Blame url

The Blame URLs returned by `url_for` currently return e.g. `b'master'`
for the ref component, breaking the "Blame" tab. Example:

https://git.sr.ht/~yyny/test/blame/b%27master%27/README.md

This patch fixes that.
Cap editorconfig line length to 256

Thanks to Naglis Jonaitis for pointing out the opportunity for a DoS
through this.

Signed-off-by: Drew DeVault <sir@cmpwn.com>
gitsrht-shell: use GraphQL API to fetch user suspension details
gitsrht-periodic: continue on FileNotFoundError

This can happen when the cronjob races other git stuff.

Signed-off-by: Drew DeVault <sir@cmpwn.com>
api: delete repositories asynchronously

Currently, a request to delete a repository is blocked until the
repository is completely removed from the filesystem. When CephFS is
under load and a user deletes a large-ish repo, this can cause signicant
request latency, making the user abort the request or even timing out
completely. The context gets canceled, causing the transaction to roll
back, even though the data is eventually wiped completely from storage,
leaving users with broken repositories on their profile.

Instead, simply do the deletion from storage asynchronously, so that the
user gets instant feedback. Even though the deletion itself blocks for
potentially a long time, experience has shown that it finishes even in
case of cancellation. As such, I expect that the deletion will go
through even if the go-routine were to be aborted (e.g. by a restart of
the API).
Upgrade to Alpine 3.19
Do not use bare `except:`

According to PEP8[1]:

> A bare `except:` clause will catch SystemExit and KeyboardInterrupt
> exceptions, making it harder to interrupt a program with Control-C,
> and can disguise other problems.

Use more specific exceptions or `contextlib.suppress()` in case of
`try: ... except: pass`.

[1]: https://peps.python.org/pep-0008/#programming-recommendations
gitsrht-update-hook: always enable secrets when submitting builds

Ensure secrets are enabled for all builds. This disables the
auto-detection done by default by builds.sr.ht when the secrets arg
is left unspecified.

While at it, remove the unbound $execute variable.
.builds: drop arch, debian
Use f-strings in `linecounter`

This is a bit simpler and has a marginal performance gain.
Fix undefined `ResponseError`

`ResponseError` is currently undefined. It manifests when an exception
is raised in the `try` block.

`ResponseError` was renamed[1] to `S3Error` in minio 7.0.0.

[1]: https://github.com/minio/minio-py/commit/b81883a98e6f8a09e2903609caabbf0956dd0ec9
api/graph: use core-go's s3.Enabled
makefile: add loaders to gqlgen deps

Without the loaders, gqlgen fails with:

    validation failed: packages.Load: /home/simon/src/todo.sr.ht/api/loaders/middleware.go:34:26: undefined: EntitiesByParticipantIDLoader
makefile: use grouped target for loaders

That way make will only run it once for the whole group.
makefile: don't re-generate if unchanged

Use make targets to skip "go generate" invocations when unnecessary.
Replace inline CSS with Bootstrap classes

This replaces occurrences of inline CSS that can be replaced directly
(equivalent style) with Bootstrap classes.

Inline styles are generally longer, are not cached, make implementing
CSP policies harder, etc.
Assert error is not nil before using it

Same as d70bfd1812b8 in page.sr.ht.
Add support for [objects]s3-insecure
Upgrade core-go
Fix repo visibility change API not working

During the upgrade to `gqlgen` version 1.17.42 a breaking change was
introduced, as `map[string]interface{}` values were changed to be type
checked in 1.17.40 (commit 74e918f9, PR
https://github.com/99designs/gqlgen/pull/2830).  As Emersion noted,
changing `OptionalString` to `Optional` fixes this.

Additionally, I replaced the "placeholder" error message with something
a bit more descriptive as a stopgap measure.
Next