Commit Graph

147 Commits

Author SHA1 Message Date
Drew DeVault 9feefe7f63 Update to Alpine 3.19 2024-03-20 13:16:47 +01:00
Drew DeVault 4b20996b8c Upgrade dependencies 2024-03-19 11:49:19 +01:00
Drew DeVault 40ac341ba9 .builds: drop arch, debian 2024-02-09 10:21:10 +01:00
Simon Ser 74efe776fb Upgrade chi to v5 2024-01-24 15:22:10 +01:00
Simon Ser c1961c8d39 Upgrade core-go 2024-01-24 15:21:43 +01:00
наб 46a6f46461 delete: fix spacing after paste name
As it stands, it says "paste, ~nab2/a.md . This ";
with this patch, it says "paste, ~nab2/a.md. This ".
2023-10-24 13:34:25 +02:00
Conrad Hoffmann 627ba61ee3 Always set proper visibility value for template
The "new-paste" template expects `visibility` to be of the proper enum
type. However, in the error path, the value for visibility comes from
`valid.kwargs`, where it is a plain string. This causes the template to
not set a value for visibility (no radio button selected). This will
cause an exception when the user submits the paste.

Reproduction is e.g. trying to submit an empty paste, then filling in
some data but not selecting a visibility. This can be annoying, as the
user potentially looses the already prepared files.

To fix it, always pass the real visibility value to the template
rendering and remove it from the kwargs.

Thanks to xenrox on IRC for providing the reproduction steps.

Signed-off-by: Conrad Hoffmann <ch@bitfehler.net>
2023-10-24 13:34:23 +02:00
Simon Ser 75d510d8f1 api/graph: drop @access from enum values
The expectation with the @access directive is that permission
checks are automatically performed by core-go. However this is
actually a no-op for enum values.

Drop the enum value directives to make it clearer that permission
checks must be performed manually.
2023-10-24 13:34:15 +02:00
Adnan Maolood 907fb2e104 Move go.mod to root 2023-06-01 12:28:02 +02:00
Drew DeVault 48b0c02122 Upgrade to Alpine 3.17 2023-03-22 12:27:04 +01:00
Adnan Maolood 0fb8803a60 API: implement user account deletion 2022-11-01 16:35:22 +01:00
Adnan Maolood a26c7a828d schema.sql: Add missing cascades
These cascades were added in the ID unification migration.
2022-11-01 16:35:19 +01:00
Adnan Maolood dede02bda9 pastesrht: Use canonical user IDs
Update user IDs across paste.sr.ht to match those of meta.sr.ht.
2022-10-26 10:49:37 +02:00
Drew DeVault 2eca3bd693 API: update gqlgen 2022-10-20 15:24:13 +02:00
Drew DeVault 93011d0c01 Add schema.sql 2022-08-16 15:06:49 +02:00
Vlad-Stefan Harbuz 2251ea9547 fix horizontal overflow on paste page
Signed-off-by: Vlad-Stefan Harbuz <vlad@vladh.net>
2022-08-15 15:44:31 +02:00
Adnan Maolood 3c856afbc0 Update gqlgen 2022-07-01 09:19:20 +02:00
Drew DeVault ecdeab6096 Update core-go 2022-06-30 12:34:25 +02:00
Adnan Maolood 907980513a pastesrht: Use GraphQL for paste CRUD operations 2022-06-29 17:14:43 +02:00
Adnan Maolood f9571a8868 api/graph: Implement GraphQL-native user webhooks
Implement GraphQL-native user webhooks for paste CRUD operations.
2022-06-29 17:14:42 +02:00
Thorben Günther c80a1a3e12 Fix deprecated imports from jinja2
For the escape change see [1].

[1]: https://github.com/pallets/jinja/issues/1626
2022-05-30 13:46:20 +02:00
Conrad Hoffmann 28102cc5ef Add api-origin to example config
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 (and
require less documentation).
2022-05-10 10:31:16 +02:00
Drew DeVault 32a94d2478 Remove models_gen.go 2022-03-24 14:43:14 +01:00
Drew DeVault f5a92e69c5 API: overhaul build 2022-03-24 14:24:23 +01:00
Drew DeVault 9d20bb2417 .builds/alpine.yml: upgrade to 3.15 2022-02-21 18:17:27 +01:00
Simon Ser 1331c0179e go generate 2022-01-11 09:38:42 +01:00
Simon Ser 8000340edf go fmt 2022-01-11 09:38:42 +01:00
Simon Ser e369a0723e api/graph: add missing non-null types
Entries of the list cannot be null.
2022-01-11 09:38:40 +01:00
Simon Ser 4674be77d9 api: import github.com/99designs/gqlgen
Create a new generate.go file which imports github.com/99designs/gqlgen.
This fixes this kind of error because go mod now knows about the
dependency:

    /home/simon/go/pkg/mod/github.com/99designs/gqlgen@v0.13.0/cmd/gen.go:9:2: missing go.sum entry for module providing package github.com/urfave/cli/v2 (imported by github.com/99designs/gqlgen/cmd); to add:
    	go get github.com/99designs/gqlgen/cmd@v0.13.0
    /home/simon/go/pkg/mod/github.com/99designs/gqlgen@v0.13.0/internal/imports/prune.go:15:2: missing go.sum entry for module providing package golang.org/x/tools/go/ast/astutil (imported by github.com/99designs/gqlgen/internal/imports); to add:
    	go get github.com/99designs/gqlgen/internal/imports@v0.13.0
    /home/simon/go/pkg/mod/github.com/99designs/gqlgen@v0.13.0/internal/code/packages.go:8:2: missing go.sum entry for module providing package golang.org/x/tools/go/packages (imported by github.com/99designs/gqlgen/internal/code); to add:
    	go get github.com/99designs/gqlgen/internal/code@v0.13.0
    /home/simon/go/pkg/mod/github.com/99designs/gqlgen@v0.13.0/internal/imports/prune.go:16:2: missing go.sum entry for module providing package golang.org/x/tools/imports (imported by github.com/99designs/gqlgen/internal/imports); to add:
    	go get github.com/99designs/gqlgen/internal/imports@v0.13.0
    graph/resolver.go:7: running "go": exit status 1
    missing go.sum entry for module providing package github.com/vektah/dataloaden; to add:
    	go mod download github.com/vektah/dataloaden
    loaders/middleware.go:3: running "./gen": exit status 1
2022-01-11 09:38:39 +01:00
Simon Ser 03d622b369 api/graph: use GraphQL descriptions for docs 2022-01-11 09:38:38 +01:00
Drew DeVault 816bbee5f5 default_query: write ops are now supported 2021-09-22 09:48:06 +02:00
Drew DeVault f9ccb57940 API: Fix case with abandoned partial paste
It is possible to abandon a paste while editing it on the web UI,
causing the database to have a state that the API was not expecting.
This filters out such pastes.

When we rewrite the paste.sr.ht frontend to work via GraphQL, we should
change the column to non-nullable and remove this where clause.
2021-09-22 09:20:29 +02:00
Drew DeVault de46f494b0 API: Handle null filenames properly
In the future we might want to normalize the database on empty strings
instead of null to represent this case.
2021-09-22 09:12:38 +02:00
Drew DeVault 0838d1e3ff API: update core-go 2021-09-22 09:05:04 +02:00
Drew DeVault a38f6136fd Add GraphQL riggings to Python module 2021-09-22 08:53:59 +02:00
Drew DeVault 4618c7ad8b API: Rename sha => hash 2021-09-22 08:53:07 +02:00
Drew DeVault e2e7c70802 API: update go.* 2021-09-22 08:33:47 +02:00
Drew DeVault df35add13b API: Add note about leaking blobs on delete
We can address this later, it's not really a big deal.
2021-09-21 14:53:11 +02:00
Drew DeVault 48e2e8e288 Drop legacy webhooks
No one is using these in production.
2021-09-21 14:48:48 +02:00
Drew DeVault 3bbdbf08de API: Rig up mutation { delete } 2021-09-21 14:41:42 +02:00
Drew DeVault f54633537b API: Rig up mutation { update } 2021-09-21 14:36:48 +02:00
Drew DeVault 898db2a4eb API: Rig up mutation { create } 2021-09-21 14:28:11 +02:00
Drew DeVault fa643487fd API: Rig up file { contents } 2021-09-21 11:57:17 +02:00
Drew DeVault ec9bcf7fae API: Rig up File { sha } 2021-09-21 11:43:10 +02:00
Drew DeVault dd5dbf3240 API: Rig up paste { files } 2021-09-21 11:26:49 +02:00
Drew DeVault fb6d90961a API: Rig up query { paste } 2021-09-21 10:25:19 +02:00
Drew DeVault 62ec9ea04a API: Rig up Paste { user } 2021-09-21 10:19:37 +02:00
Drew DeVault 3f391d7d48 API: Rig up user { pastes } 2021-09-21 10:14:44 +02:00
Drew DeVault 80518d74f4 API: Rig up query { pastes } 2021-09-21 10:09:21 +02:00
Drew DeVault 606a523585 API: Rig up loaders, query { user } 2021-09-21 09:06:23 +02:00