Commit graph

1349 commits

Author SHA1 Message Date
tobi
35e94c8abd
[bugfix] Fix length for type varchar must be at least 1 on Postgres (#3885) 2025-03-09 16:44:12 +01:00
tobi
d8113c11e4
[feature] Parse content warning to HTML, serialize via client API as plaintext (#3876)
* [feature] Parse content warning as HTML, serialize via API to plaintext

* tidy up some cruft

* whoops

* oops

* i'm da joker baybee

* clemency muy lorde

* rename some of the text functions for clarity

* jiggle the opts

* fiddle de deee

* hopefully the last test fix i ever have to do in my beautiful life
2025-03-07 14:04:34 +00:00
ewwwin
424f62dd70
[bugfix] Store and expose status content type (#3870)
* Add ContentType to internal models

* Add ContentType to API models StatusSource and StatusEdit

* Add helpers to convert between API/internal StatusContentType

* Write status content type on create/edit

* Add migration

* Update API docs

go run github.com/go-swagger/go-swagger/cmd/swagger generate spec --scan-models --exclude-deps --output docs/api/swagger.yaml

* ensure ContentType is updated anywhere Text is

* Update docs, take care of TODOs

* Set ContentType in more places where Text is set

* We don't actually use ContentType on the API status model

* Update StatusSource test

* Remove unused helper function I copied

* Revert change to StatusContentType swagger annotation

I'm going to include this in a follow-on PR instead.

* Add test for updating content type in edits

* Return a value from processContentType instead of modifying the existing status

Fixes an issue that was caught by the test I just added - the recorded edit would be marked with the *new* content type instead of the old one, which is obviously bad

* Add test for handling of statuses with no stored content type

* repurpose an existing test status instead of adding a new one to avoid breaking other tests

* Add test to ensure newly created statuses always have content type saved

* Do include content type on status API model actually

This is mostly important when deleting and redrafting.

The comment on `apimodel.Status.Text` implies that it's not sent except in response to status deletion, but actually this doesn't seem to be the case; it also appears to be present in responses to creations and normal fetches and stuff. So I'm treating `ContentType` the same here.

* Update new tests to check content type on API statuses

* Check content type of API statuses in all tests where text is checked

* update other api tests with status content type field

* Add test ensuring text and content type are returned when deleting a status

* Convert processContentType to free function and remove unused parameter

* check for the correct value in the deletion test

* Be explicit about this test status having an empty content type

* Use omitempty consistently on API models

* clean up the final diff a bit

* one more swagger regen for the road

* Handle nil statuses in processContentType

* Don't pass processContentType the entire edit form, it doesn't need it

* Move processContentType to common.go and use for creation as well

* Remove unused parameters to ContentTypeToAPIContentType
2025-03-06 16:31:52 +00:00
tobi
69461c461b
[bugfix] Return useful err on server start failure (#3879)
* [bugfix] Return useful err on `server start` failure

* remove scheduler started func

* remove tryUntil
2025-03-05 19:12:53 +01:00
tobi
829143d263
[feature] Add token review / delete to backend + settings panel (#3845) 2025-03-04 10:01:25 +00:00
tobi
ab7ec43988
[bugfix] Fix app migration (#3868)
* [bugfix] Fix app migration

* use temporary index during migration

* create temporary index for the migration

* include local = true in temporary index

* tweak migration a bit for SPEED
2025-03-03 19:00:44 +01:00
kim
24da574684
[bugfix] fix refreshed additional media info being ignored (#3867)
* fix refreshed additional media info being ignored when force flag already set

* also update to always iterate through all additional info fields

* make similar changes for emoji, even if not necessary, just to keep in-sync
2025-03-03 16:14:27 +00:00
tobi
1b37944f8b
[feature] Refactor tokens, allow multiple app redirect_uris (#3849)
* [feature] Refactor tokens, allow multiple app redirect_uris

* move + tweak handlers a bit

* return error for unset oauth2.ClientStore funcs

* wrap UpdateToken with cache

* panic handling

* cheeky little time optimization

* unlock on error
2025-03-03 15:03:36 +00:00
tobi
8488ac9286
[chore] migrate oauth2 -> codeberg (#3857) 2025-03-02 16:42:51 +01:00
tobi
5d0e3d9c35
[chore] github.com/superseriousbusiness/httpsig -> codeberg.org/superseriousbusiness/httpsig (#3854) 2025-03-02 13:28:38 +01:00
tobi
e2e185d10b
[chore] github.com/superseriousbusiness/activity -> codeberg.org/superseriousbusiness/activity (#3853) 2025-03-02 12:48:00 +01:00
tobi
4c9901fc03
[chore] little frontend tweaks (#3852)
* [chore] little frontend tweaks

* beep boop

* poke

* clarify server time
2025-03-02 11:27:30 +01:00
Xavier Vello
0118e03cda
[feature] Implement CSV import for mutes (#3696)
* Implement CSV import for mutes

* update swagger.yaml

* update documentation

* add ImportTestSuite.TestImportMutes

* fix comment typo
2025-03-01 11:37:40 +01:00
tobi
eb720241da
[feature] Enforce OAuth token scopes (#3835)
* move tokenauth to apiutil

* enforce scopes

* docs

* update test models, remove deprecated "follow"

* file header

* tests

* tweak scope matcher

* simplify...

* fix tests

* log user out of settings panel in case of oauth error
2025-02-26 13:04:55 +01:00
mkljczk
96d39155f2
[docs] Fix swagger operation descriptions (#3830)
* Fix swagger operation descriptions

Signed-off-by: mkljczk <git@mkljczk.pl>

* generate a swagger file

Signed-off-by: mkljczk <git@mkljczk.pl>

---------

Signed-off-by: mkljczk <git@mkljczk.pl>
2025-02-25 12:47:48 +01:00
tobi
fd670c6a27
[feature] Use ETag for robots.txt to prevent mishaps (#3829)
* [feature] Use ETag for robots.txt to prevent mishaps

* check incoming if-none-match header
2025-02-24 11:17:18 +01:00
tobi
8829ee187a
[feature] Add page-specific class per template (#3814)
* [feature] Add page-specific class per template

* cheeky bit cheaper
2025-02-20 15:09:28 +01:00
kim
a03a35a5d6
[bugfix] update fedi api to support multiple separate votes in same multiple choice poll (#3809) 2025-02-20 11:13:07 +01:00
tobi
96716e4f43
[feature] Forward-compatibility with Approval objects (#3807)
* vendor

* [feature] Forward-compatibility with Approval objects

* vendor the thing

* fix leetle bug

* lil syntax tweak for beloved kimb
2025-02-19 18:09:54 +01:00
kim
e220c6a894
adds more code comments and some small code formatting tweaks (#3799) 2025-02-17 11:44:41 +00:00
tobi
5dc8009e30
[chore/performance] Batch migration queries (#3798)
* separate enum migrations into their own individual transactions

* pee poo

* some performance tweaks and adding more comments

* batch

---------

Co-authored-by: kim <grufwub@gmail.com>
2025-02-15 12:43:12 +01:00
tobi
879ca2d2f8
[bugfix] Drop status indices AFTER updating visibility (#3795)
* [bugfix] Drop status indices AFTER updating visibility

* rename to status vis indices just to indicate they're only used in the statuses hook func

---------

Co-authored-by: kim <grufwub@gmail.com>
2025-02-14 12:52:04 +00:00
tobi
dfcb7862a9
[bugfix] Return 404 when web context target status hidden (#3792) 2025-02-13 14:10:13 +01:00
Vyr Cossont
fccb0bc102
[feature] Implement backfilling statuses thru scheduled_at (#3685)
* Implement backfilling statuses thru scheduled_at

* Forbid mentioning others in backfills

* Update error messages & codes

* Add new tests for backfilled statuses

* Test that backfilling doesn't timeline or notify

* Fix check for absence of notification

* Test that backfills do not cause federation

* Fix type of apimodel.StatusCreateRequest.ScheduledAt in tests

* Add config file switch and min date check
2025-02-12 09:49:33 -08:00
kim
37dbf319b1
[performance] improved enum migrations (#3782)
* updates the enum migration to perform a singular update for all values, using an SQL case statement

* fix logging

* fix code comment

* well i guess we'll get rid of the useful but unused function then, linter. fine, i see how it is!

* append to byte buffer instead of WriteString() to shut the linter up (i know you're reading this, linter)
2025-02-11 16:58:44 +01:00
alemi.dev
d0de3ad492
[bug] respect X-Robots-Tag and robots.txt on api/v1/instance and nodeinfo (#3756)
* feat: check X-Robots-Tag

when accessing /api/v1/instance or /nodeinfo endpoints respect
X-Robots-Tag

* chore: go fmt ./...

* Check robots.txt as well, add tests

---------

Co-authored-by: tobi <tobi.smethurst@protonmail.com>
2025-02-11 13:16:14 +01:00
tobi
2c95fd4115
[bugfix] Suggest lowercase username when creating via OIDC (#3780) 2025-02-11 09:42:35 +01:00
tobi
787bdc1488
[feature] make account sign-up / backlog limits configurable (#3768) 2025-02-10 15:46:36 +01:00
tobi
ce7ba8f498
[bugfix] Fix POST to create account endpoint (#3767) 2025-02-09 13:52:52 +01:00
Vyr Cossont
a6d1f5bf2c
[bugfix] Reduce Web Push record size (#3762) 2025-02-09 11:13:28 +01:00
pnwmatt
e10de8464a
[bug] Add missing group property to the Account model (#3746)
* Stub out account's Group parameter

* Fix typo in Contributing documentation

* Update swagger and match style

* Update the swagger command to mimic test/swagger.sh

* Fix tests for new `group` param in Account model

* More test changes for new `group` param in Account

* Continuing test changes for `group` param stubbing

* Another round of `group` stubbing for tests
2025-02-08 13:04:30 +01:00
kim
1276cde4b3
temporary fix for tetratelabs/wazero#2365 armv8 compiler support bug (#3741) 2025-02-06 12:44:40 +00:00
Dominik Süß
dd094e4012
[chore] update otel libraries (#3740)
* chore: update otel dependencies

* refactor: combine tracing & metrics in observability package

* chore: update example tracing compose file
2025-02-06 12:14:37 +01:00
tobi
baed591a1d
[feature] Use X-Robots-Tag headers to instruct scrapers/crawlers (#3737)
* [feature] Use `X-Robots-Tag` headers to instruct scrapers/crawlers

* use switch for RobotsHeaders
2025-02-05 12:47:13 +01:00
tobi
bfb81f5bac
[bugfix] wrong nodeinfo version (tobi is a boob) (#3735) 2025-02-04 16:52:54 +00:00
tobi
07d2770995
[feature] Change instance-stats-randomize to instance-stats-mode with multiple options; implement nodeinfo 2.1 (#3734)
* [feature] Change `instance-stats-randomize` to `instance-stats-mode` with multiple options; implement nodeinfo 2.1

* swaggalaggadingdong
2025-02-04 16:52:42 +01:00
kim
e1781ff52e
adds support for build specifically without wasm ffmpeg (#3732) 2025-02-03 12:42:06 +00:00
tobi
053d820845
[bugfix] Don't panic on delivery of Activity with no object (#3730) 2025-02-03 11:52:24 +00:00
Vyr Cossont
27844b7da2
[feature] Implement Web Push notification policy (#3721)
* Web Push: add policy column to subscriptions

* Web Push: add policy to API

* Web Push: test notification policy

* go-fmt unrelated file (how did this get thru?)
2025-02-03 10:25:53 +00:00
jade arson.
77f25e21d7
[chore] disallow /nodeinfo/ too (#3729) 2025-02-03 10:09:14 +01:00
Vyr Cossont
f5eee56bb1
[bugfix] Swagger: fix media_ids[] param for creating statuses (#3722) 2025-02-01 17:14:49 -08:00
tobi
a55bd6d2bd
[feature] Add instance-stats-randomize config option (#3718)
* [feature] Add `instance-stats-randomize` config option

* don't use cache (overkill)
2025-01-31 19:27:18 +01:00
tobi
c47b9bd1d1
[chore] Add "object" uri to outgoing Accept + Reject messages (#3717) 2025-01-31 17:09:11 +01:00
Vyr Cossont
fc895ade02
[chore] Web Push: Use server URL for VAPID sub claim (#3716)
webpush-go now supports sending `https://` as well as `mailto:` URLs for VAPID sub claims, so we can revert 464d920cfd now and save fetching the instance contact email or making up a dummy email if there wasn't one configured.
2025-01-31 14:57:32 +00:00
tobi
8a9422aa78
[bugfix] shut down LE server nicely (#3714)
* [bugfix] shut down LE server nicely
2025-01-31 13:45:39 +01:00
Vyr Cossont
b9e0689359
[bugfix] Extend parser to handle more non-Latin hashtags (#3700)
* Allow marks after NFC normalization

Includes regression test for the Tamil example from #3618

* Disallow just numbers + marks + underscore as hashtag
2025-01-31 11:42:55 +01:00
Vyr Cossont
ab758cc233
[feature] Add system message wrappers for pending replies and placeholder attachments (#3713)
Fixes #3712
2025-01-31 11:40:39 +01:00
kim
493de5c005
[bugfix] fix boost of account ID check (#3709) 2025-01-30 18:14:35 +01:00
kim
527587155a
check boosted account ID when performing usermute checks (#3708) 2025-01-30 15:05:15 +00:00
kim
91cef3495d
[bugfix] Missing emoji urls (#3707)
* filter out emoji that are uncached when converting to frontend models

* some very small fixups

* remove TODO notice
2025-01-30 13:52:03 +01:00