~bigbes/core-go

156c5e26 — Adnan Maolood 3 years ago
s3: Import middleware from pages.sr.ht

Closes: https://todo.sr.ht/~sircmpwn/pages.sr.ht/19
89b1b489 — Simon Ser 3 years ago
auth/middleware: make auth scheme case-insensitive

According to RFC 7235 section 2.1, the auth scheme is
case-insensitive.
209e1a86 — Simon Ser 3 years ago
database/middleware: do not recover/panic in defer

defer always runs after a panic. There is no need to recover and
re-panic, we can just unconditionally tx.Rollback() (it will
silently error out if the transaction has already been committed or
rolled back).

This fixes the stack trace of the panic being incorrect. It points
to this function instead of the real culprit.
1f6fac1d — Simon Ser 3 years ago
go mod tidy

Fixes the following error when running `go test`:

    ../../go/pkg/mod/github.com/prometheus/client_golang@v1.14.0/prometheus/internal/metric.go:19:2: missing go.sum entry for module providing package github.com/prometheus/client_model/go (imported by github.com/prometheus/client_golang/prometheus); to add:
    	go get github.com/prometheus/client_golang/prometheus@v1.14.0
ca47b9fe — Simon Ser 3 years ago
server/directives: handle auth.AUTH_ANON_INTERNAL in Access
78b6f723 — Conrad Hoffmann 3 years ago
email: remove content headers of passed-in message

The email has already been parsed according to the headers, but they are
still present. However, signing or encrypting the email will change the
content format, so remove any such headers before continuing.
144fc447 — Drew DeVault 3 years ago
server: register SQL collector

Missed this step
fa27910a — Drew DeVault 3 years ago
Add prometheus SQL connection stats

Also updates the prometheus client_go library
57524862 — Dennis Schön 3 years ago
auth: fix invalid json tag in InternalAuth
2fd72e9f — Dennis Schön 3 years ago
email: handle error from Enqueue() in EnqueueStd()
b1540a22 — Conrad Hoffmann 3 years ago
Update pq (Postgres driver) to latest version
3e69641e — Adnan Maolood 4 years ago
auth: Use canonical user IDs

When adding users to the database, use the canonical user ID from
meta.sr.ht.
bb33e3e7 — Simon Ser 3 years ago
email/worker: add more context to errors

For instance, failure to open the private PGP key would just fail
with an unhelpful "panic: open : no such file or directory" error.
8110e635 — Conrad Hoffmann 3 years ago
database: add helpers to fetch all columns

The current solution of fetching columns based on the GraphQL context
has some limits. While probably not the solution for all use-cases, it
sometimes can be desirable to simply fetch all columns from the database
when retrieving objects.

This commit adds two simple functions doing just that. They can be used
when building SQL queries, like

    query := database.SelectAll(new(model.Email))

and

    rows.Scan(database.ScanAll(&email)...)
12000f49 — Drew DeVault 3 years ago
Revert "auth: Use canonical user IDs"

This reverts commit 6c1036e2705d93e1cb71476ac78499ae27f0d326.
236879ae — Conrad Hoffmann 3 years ago
Run `go fmt`
6c1036e2 — Adnan Maolood 4 years ago
auth: Use canonical user IDs

When adding users to the database, use the canonical user ID from
meta.sr.ht.
d0bf1153 — Adnan Maolood 4 years ago
webhooks.FilterWebhooks: Filter by user_id
0b2fef24 — Conrad Hoffmann 4 years ago
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
8c2729f4 — Adnan Maolood 4 years ago
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.
Next