~bigbes/core-go

33bc768c — Adnan Maolood 4 years ago
database: Remove Apply
ebf93be7 — Adnan Maolood 4 years ago
webhooks: Add middleware
7d6b202a — Adnan Maolood 4 years ago
webhooks: Execute GraphQL queries synchronously

Execute GraphQL webhook queries synchronously instead of in a background
task to avoid race conditions.
b2c8e81e — Conrad Hoffmann 4 years ago
Fix (some) user PGP key lookups from meta.sr.ht

The authForUsername() function uses a closure that is almost identical
to the LookupUser() function, but is missing the handling for the PGP
key if called from meta.sr.ht. This causes at least the email
notifications for new OAuth2 tokens to be sent unencrypted. This commit
fixes that (and reduces code duplication) by calling LookupUser()
instead.

This requires the context for the tests to have a value for the calling
service, so add that to the mock.
d56e2d79 — Adnan Maolood 4 years ago
valid: Add NullableString

Add a NullableString method to allow users to differentiate between the
absence of a field and an explicitly provided null value.
75dfa299 — Adnan Maolood 4 years ago
valid: Add Errorf function

Add an Errorf function to create GraphQL errors without a validation
context.
e7ae287d — Simon Ser 4 years ago
database: always include table name in SELECT

When JOINs are performed on the auto-generated SELECT query,
multiple tables may have the same field names. For instance, in
lists.sr.ht the "list" and "subscription" tables both have an "id"
column. When performing a "mailingLists" GraphQL query this results
in this error:

    pq: column reference "id" is ambiguous

The old query looks like this:

    SELECT "description", "name", "id", "owner_id", "updated", COALESCE(
    access.permissions,
    CASE WHEN list.owner_id = $1
    THEN $2
    ELSE CASE WHEN sub.id IS NOT NULL
    	THEN list.subscriber_permissions
    	ELSE null END
    END,
    list.nonsubscriber_permissions | list.account_permissions), access.id AS access_id, sub.id AS subscription_id FROM list LEFT JOIN access ON
    access.list_id = list.id AND
    access.user_id = $3 LEFT JOIN subscription sub ON
    sub.list_id = list.id AND
    sub.user_id = $4 WHERE list.owner_id = $5 ORDER BY "updated" DESC LIMIT 26

The new query looks like this:

    SELECT "description", "name", "list"."id", "list"."owner_id", "list"."updated", COALESCE(
    access.permissions,
    CASE WHEN list.owner_id = $1
    THEN $2
    ELSE CASE WHEN sub.id IS NOT NULL
    	THEN list.subscriber_permissions
    	ELSE null END
    END,
    list.nonsubscriber_permissions | list.account_permissions), access.id AS access_id, sub.id AS subscription_id FROM list LEFT JOIN access ON
    access.list_id = list.id AND
    access.user_id = $3 LEFT JOIN subscription sub ON
    sub.list_id = list.id AND
    sub.user_id = $4 WHERE list.owner_id = $5 ORDER BY "updated" DESC LIMIT 26
e28d47cf — Adnan Maolood 4 years ago
go fmt
87de6649 — Adnan Maolood 4 years ago
webhooks: Add FilterWebhooks function
21deda8c — Drew DeVault 4 years ago
valid: add OptionalBool
f762ad22 — Peter Sanchez 4 years ago
Bugfix, mail config placed in wrong setting.
dd20891a — Julien Moutinho 4 years ago
Replace x/crypto package by ProtonMail/go-crypto to support ed25519 OpenPGP keys
31e77bac — Peter Sanchez 4 years ago
Add support for mail setups that don't support TLS or Auth
d5f650da — Simon Ser 4 years ago
Allow AUTH_COOKIE to access @private fields
f9c34fc3 — Josh Junon 4 years ago
auth: fix nil reference in auth method check
378fedbc — Drew DeVault 4 years ago
Add @anoninternal support code

This is a slightly better approach to the previous commit.
3b553750 — Drew DeVault 4 years ago
webhooks: fix failing test
fbc8f491 — Drew DeVault 4 years ago
auth: implement internal anonymous authentication

This is used for meta.sr.ht's GraphQL user registration resolver, which
needs to run prior to the user's information being added to the database.
9f634ce0 — Drew DeVault 4 years ago
server/email: handle errors out of GQL context
46875256 — Drew DeVault 4 years ago
webhooks/legacy: fetch subscriptions upfront

This fixes a race condition when delivering webhooks for resource
deletion events, in which the subscriptions would be removed from the
delete cascade before the task to fetch them executes. This requires the
downstream code to call Queue before committing the delete transaction,
and updates the API to include a context argument for the connection
pool.
Next