Commit graph

1297 commits

Author SHA1 Message Date
Vyr Cossont 81993c6521 Make GetVAPIDKeyPair idempotent
and remove PutVAPIDKeyPair
2024-12-28 17:23:45 -08:00
Vyr Cossont 053bad3ca1 Add notification type for update notifications
Not used yet
2024-12-28 14:38:54 -08:00
Vyr Cossont 6ed26e0a93 Merge branch 'main' into push-notifications 2024-12-28 14:31:47 -08:00
Daenney 6b727404be
[bugfix] Advertise audio/mpeg as supported (#3632)
This will be either an mp1, mp2 or mp3 file. In practice it'll probably
be mp3, but this handles mp1 too for good measure. We don't advertise
audio/mp1 as a supported media type since best I can tell that was never
a MIME type that's been used.

This also changes the returned MIME-type for mp2 and mp3 to audio/mpeg,
to match what's expected and supported by most things nowadays.

Fixes: #3531
2024-12-28 11:02:12 +01:00
Vyr Cossont 9e479fbfdf Remove unused date columns 2024-12-26 18:23:39 -08:00
Vyr Cossont 25dc70e0df Merge branch 'main' into push-notifications 2024-12-25 17:42:56 -08:00
Vyr Cossont 4bbd76abcf Use packed notification flags 2024-12-25 17:40:23 -08:00
kim 0784aa3218
[bugfix] small editing tweaks (#3631)
* ensure edited_at isn't set on boost wrapper statuses

* improve handling of remote status updated_at to fix previous cases

* formatting

* add remote status published / updated field validation checks, handle appropriately in handleStatusEdit()

* specifically allowed updated to be equal to published

* only check creation date change when an existing status
2024-12-24 21:16:49 +00:00
kim fe8d5f2307
[feature] add support for clients editing statuses and fetching status revision history (#3628)
* start adding client support for making status edits and viewing history

* modify 'freshest' freshness window to be 5s, add typeutils test for status -> api edits

* only populate the status edits when specifically requested

* start adding some simple processor status edit tests

* add test editing status but adding a poll

* test edits appropriately adding poll expiry handlers

* finish adding status edit tests

* store both new and old revision emojis in status

* add code comment

* ensure the requester's account is populated before status edits

* add code comments for status edit tests

* update status edit form swagger comments

* remove unused function

* fix status source test

* add more code comments, move media description check back to media process in status create

* fix tests, add necessary form struct tag
2024-12-23 17:54:44 +00:00
Daenney 1aa7f70660
[chore] Stub /api/v1/announcements implementation (#3630)
* [chore] Stub /api/v1/announcements implementation

This implements the /api/v1/announcements endpoint by simply returning
an empty array. This indicates there are no instance announcements.

Some clients retrieve this endpoint and get surprised by a 404. It tends
to be harmless, but results in some unnecessary logging when trying to
debug other things.

* [fix] Forgot some swagger

* [fix] Fix swagger some more
2024-12-23 16:43:50 +01:00
Vyr Cossont 86c686b5d6 Fix malformed VAPID sub claim 2024-12-19 23:32:42 -08:00
CDN f78002f915
[bugfix] Load instance-wide custom css in page stylesheets template (#3601)
* [bugfix] Load instance-wide custom css in page stylesheets template

* [chore] remove redunt import
2024-12-18 10:47:17 +01:00
tobi acdd495c70
[chore] Log during potentially long migrations (#3613)
* [chore] Log during potentially long migrations

* remove unneeded log lines
2024-12-09 15:53:56 +01:00
tobi 9477fd7eba
[feature] Allow partial-word hashtags using non-breaking spaces (#3606)
* [feature] Allow partial-word hashtags using non-breaking spaces

* update docs
2024-12-08 16:03:00 +01:00
Patrycja 642f5230e6
[chore] stub /api/v1/accounts/{id}/featured_tags endpoint (#3598)
* [chore] stub /api/v1/accounts/{id}/featured_tags endpoint

* fix swagger parsing issue

---------

Co-authored-by: tobi <31960611+tsmethurst@users.noreply.github.com>
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
2024-12-08 13:47:07 +01:00
kim 23fc70f4e6
[feature] add support for receiving federated status edits (#3597)
* add support for extracting Updated field from Statusable implementers

* add support for status edits in the database, and update status dereferencer to handle them

* remove unused AdditionalInfo{}.CreatedAt

* remove unused AdditionalEmojiInfo{}.CreatedAt

* update new mention creation to use status.UpdatedAt

* remove mention.UpdatedAt, fixes related to NewULIDFromTime() change

* add migration to remove Mention{}.UpdatedAt field

* add migration to add the StatusEdit{} table

* start adding tests, add delete function for status edits

* add more of status edit migrations, fill in more of the necessary edit delete functionality

* remove unused function

* allow generating gotosocial compatible ulid via CLI with `go run ./cmd/gen-ulid`

* add StatusEdit{} test models

* fix new statusedits sql

* use model instead of table name

* actually remove the Mention.UpdatedAt field...

* fix tests now new models are added, add more status edit DB tests

* fix panic wording

* add test for deleting status edits

* don't automatically set `updated_at` field on updated statuses

* flesh out more of the dereferencer status edit tests, ensure updated at field set on outgoing AS statuses

* remove media_attachments.updated_at column

* fix up more tests, further complete the dereferencer status edit tests

* update more status serialization tests not expecting 'updated' AS property

* gah!! json serialization tests!!

* undo some gtscontext wrapping changes

* more serialization test fixing 🥲

* more test fixing, ensure the edit.status_id field is actually set 🤦

* fix status edit test

* grrr linter

* add edited_at field to apimodel status

* remove the choice of paging on the timeline public filtered test (otherwise it needs updating every time you add statuses ...)

* ensure that status.updated_at always fits chronologically

* fix more serialization tests ...

* add more code comments

* fix envparsing

* update swagger file

* properly handle media description changes during status edits

* slight formatting tweak

* code comment
2024-12-05 13:35:07 +00:00
kim 3e18d97a6e
[feature] unending polls (#3592)
* adds support for unending polls to be created locally

* remove unused argument
2024-12-04 10:35:48 +01:00
CDN 732b03a742
[bugfix] Load instance-wide custom css unconditionally in thread details page (#3595) 2024-12-03 15:21:47 +01:00
Victor Dyotte 9609c4550d
[feature] Add global instance CSS customization setting (#3352)
Allow instance admins to add custom CSS that will affect
every page of their instance.

This is done with a new CustomCSS instance setting that
works pretty much exactly like the Users CustomCSS property.
This custom CSS is then requested for every page load.
User styles/themes take precedence over this CSS.

Co-authored-by: tobi <tobi.smethurst@protonmail.com>
2024-12-02 12:24:48 +01:00
Vyr Cossont 74e30f06d2 Accept any 2xx code as a success 2024-12-01 21:25:55 -08:00
Vyr Cossont a356c860dd Send instance URL as Web Push JWT subject 2024-12-01 21:17:54 -08:00
Vyr Cossont dcac7f2035 Log Web Push server error messages 2024-12-01 20:41:27 -08:00
Vyr Cossont 79559933e0 Create web push subscriptions table with indexes 2024-12-01 20:22:02 -08:00
Vyr Cossont 74b0541e02 Fix GetVAPIDKeyPair 2024-12-01 20:02:00 -08:00
Vyr Cossont c8d213a9ef Fix enum to int migration 2024-12-01 20:01:51 -08:00
Vyr Cossont f663f56946 Update Swagger 2024-11-30 21:05:54 -08:00
Vyr Cossont 88dddd529f Linter fixes 2024-11-30 21:05:54 -08:00
Vyr Cossont b99ea8121c Implement push subscription API 2024-11-30 21:05:54 -08:00
Vyr Cossont 4ddfbad557 Delete Web Push subscriptions when account is deleted 2024-11-30 21:05:54 -08:00
Vyr Cossont 1d0e608c81 Test Web Push notifications from workers 2024-11-30 21:05:54 -08:00
Vyr Cossont 05b8156ba5 Add no-op push senders to most processor tests 2024-11-30 21:05:54 -08:00
Vyr Cossont ddb21cd515 Add Web Push sender (similar to email sender) 2024-11-30 21:05:54 -08:00
Vyr Cossont 17fd35661d Store Web Push subscriptions in DB 2024-11-30 21:05:41 -08:00
Vyr Cossont 5a2e8341a2 Return VAPID public key when registering an app 2024-11-30 21:00:06 -08:00
Vyr Cossont b082e53c8c Add VAPID public key to instance info API 2024-11-30 21:00:06 -08:00
Vyr Cossont 1ea57b398a Generate VAPID key pair during startup 2024-11-30 21:00:06 -08:00
Vyr Cossont 875517c324 Single-row table for storing instance's VAPID key pair 2024-11-30 21:00:06 -08:00
Vyr Cossont 2d0dcff754 Update push subscription API model to be Mastodon 4.0 compatible 2024-11-30 21:00:06 -08:00
kim c9d36f7e45
[performance] use new instance of bun.DB *after* migrations to reduce number of in-memory model schema (#3578)
* use new instance of bun.DB *after* migrations to reduce number of model schema in-memory

* update sqlite address comment
2024-11-29 15:03:10 +00:00
kim d9f67efae5
send out poll votes as separate create activities given that no other AP servers support multiple objects in a single activity (#3582) 2024-11-28 15:37:37 +00:00
kim 312cb8b9c7
[chore] rename New___(string) int signature functions to Parse___(string) int (#3580)
* rename New___(string) int {} signature functions to Parse___(string) int {}

* remove test output
2024-11-28 12:54:22 +01:00
tobi 65917f5bb9
[bugfix] Log + ignore unknown notification types (#3577)
* [bugfix] Log + ignore unknown notification types

* pass context to ParseNotificationTypes
2024-11-27 17:22:45 +00:00
Vyr Cossont 6a8af42647
[bugfix] Allow unsetting filter expiration dates (#3560)
* Regression tests for #3497 (v1 and v2)
* use Nullable type for v2 form.expires_in

---------

Co-authored-by: tobi <tobi.smethurst@protonmail.com>
2024-11-26 08:23:00 -08:00
kim a444adee97
[bugfix] notification types missing from link header (#3571)
* ensure notification types get included in link header query for notifications

* fix type query keys
2024-11-25 15:33:21 +00:00
tobi c454b1b488
[chore] Bump tooling versions, bump go -> v1.23.0 (#3258)
* [chore] Bump tooling versions, bump go -> v1.23.0

* undo silly change

* sign

* bump go version in go.mod

* allow overflow in imaging

* goreleaser deprecation notices

* bump versions

* undo accidental rebase change

* update container versions to just use latest major version

* update swagger to our release with go1.23 fix

* update goreleaser to use our vendored swagger version

---------

Co-authored-by: kim <grufwub@gmail.com>
2024-11-25 16:15:33 +01:00
kim cac9d65029
[performance] convert enum strings to ints (#3558)
* convert statuses.visibility and notifications.notification_type columns from type string -> int for performance / space savings

* fix test trying to compare string to int

* fix instance count query using string literal instead of gtsmodel const type

* ensure a default value is always set

* also migrate the account settings and sin bin status tables

* initialize maps outside loops and place into singular enum mapping creation func

* use int16 for enum types

* update sinbinstatus creation to be from a snapshot at initial creation

* add snapshot of poll type at creation time
2024-11-25 14:48:59 +01:00
tobi 301543616b
[feature] Add domain permission drafts and excludes (#3547)
* [feature] Add domain permission drafts and excludes

* fix typescript complaining

* lint

* make filenames more consistent

* test own domain excluded
2024-11-21 13:09:58 +00:00
tobi c2029df9bc
[feature] Allow emoji shortcode to be 1-character length (#3556)
* [feature] Allow emoji shortcode to be 1-character length

* testerino fixeroni

* spaghet
2024-11-21 12:13:55 +01:00
Jannis 9ace025da1
[bugfix] post counters should not include direct messages (#3554)
* [bugfix] post counters should not include direct messages #3504

The fix is relativly simple, it just adds a line to the relevant
function which excludes all private posts.

* Formating fix

* mb
2024-11-21 11:06:06 +01:00
kim e3c2b790fd
[performance] minimise log field allocations (#3529)
* when appending log field only do so by minimal amount

* move slice utils to separate package to fix import cycle, add GrowJust() and AppendJust() functions

* fix GrowJust() not returning slice of same length

* improved xslices tests

* make AppendJust() test check for slice contents, fix AppendJust() final copying behaviour

* add a +1 with field growth to try minimise allocation for log 'msg' field
2024-11-11 15:45:19 +00:00