Most URLs ending with a trailing slash currently 404, because the strict
mode is not properly disabled in the app.
The strict_slashes value must be set before adding the routes.
After this patch, requesting URLs with a trailing slash will work as
expected (eg git.sr.ht/~sircmpwn/git.sr.ht/)
If the service is not behind a reverse proxy (e.g. during local
development/testing) then this is needed by meta.sr.ht for API discovery
for all services that have a seperate API component. Add this (commented
out) to the example config, to make it easier to discover this (and
require less documentation).
Fix canonical_name, which was wrongly named canonicalName, in user
resources returned by the legacy API.
Also take the opportunity to refactor the GraphQL queries such that each
query retrieves only the data it needs.
This allows having a per-branch filter for build jobs. Use-cases
include a build badge which only displays status for the default
branch, or a getting the latest build artifacts only for the
default branch.
Right now repos log page is the slowest page on git.sr.ht, and a big
reason for that is that it currently averages on 19 queries per view,
most of them coming from the template looking up users to show links to
their user pages. We can get all the users we have before that, and pass
that on to the template. With these changes, a page view always takes 5
queries consistently.
Add a 'visibility' enum type to the database and use it for the
repository.visibility column.
This required changes to scm.sr.ht code. Instead of updating scm.sr.ht,
most of the scm.sr.ht code that git.sr.ht uses was moved to git.sr.ht.
This adds two new columns to the database: clone_status and clone_error,
which are used to store the clone status as well as any error that
occurs. The error is then displayed to the user in the frontend.
Upon deleting a repository, gather a list of all the artifacts
associated with it and schedule their deletion in a background task.
Fixes: https://todo.sr.ht/~sircmpwn/git.sr.ht/356
Execute GraphQL webhook queries after the repository has been deleted
from the database, but before the files have been removed from the
filesystem. This prevents filesystem errors during query execution.
We don't need to execute the query before the repository is deleted from
the database since all the information we need from the database has
been retrieved.
References: https://todo.sr.ht/~sircmpwn/sr.ht/301
Only update repository information when a new description or visibility
is specified in the push options. This prevents an extraneous
REPO_UPDATE event from being triggered on every push.
Also remove the updateVisibility function, as this is taken care of by
the GraphQL API.
Add a HEAD field to the RepoInput type to allow setting the default
branch name with the updateRepository GraphQL mutation. Also modify the
frontend to use the HEAD field for the repository settings page.
Implements: https://todo.sr.ht/~sircmpwn/git.sr.ht/358