summaryrefslogtreecommitdiff
path: root/internal/api/util
AgeCommit message (Collapse)AuthorFiles
2025-02-24[feature] Use ETag for robots.txt to prevent mishaps (#3829)v0.18.1Libravatar tobi1
* [feature] Use ETag for robots.txt to prevent mishaps * check incoming if-none-match header
2025-02-20[feature] Add page-specific class per template (#3814)v0.18.0-rc3Libravatar tobi1
* [feature] Add page-specific class per template * cheeky bit cheaper
2025-02-11[bug] respect `X-Robots-Tag` and `robots.txt` on api/v1/instance and ↵Libravatar alemi.dev1
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-05[feature] Use `X-Robots-Tag` headers to instruct scrapers/crawlers (#3737)Libravatar tobi1
* [feature] Use `X-Robots-Tag` headers to instruct scrapers/crawlers * use switch for RobotsHeaders
2025-01-27[chore] skip `trusted-proxies` warning if ip excepted from rate limiting (#3699)Libravatar tobi1
* [chore] skip `trusted-proxies` warning if ip excepted from rate limiting * weep * typo * fix env parsing test
2025-01-26[chore] Allow suppressing trusted-proxies warning by disabling rate limiting ↵Libravatar tobi1
(#3686)
2025-01-23[feature] Add warning about `trusted-proxies` to make config easier (#3675)Libravatar tobi1
* [feature] Add warning about `trusted-proxies` to make config easier * thank you linter, hugs and kisses to you
2024-12-23[feature] add support for clients editing statuses and fetching status ↵Libravatar kim1
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-11-27[bugfix] Log + ignore unknown notification types (#3577)Libravatar tobi1
* [bugfix] Log + ignore unknown notification types * pass context to ParseNotificationTypes
2024-11-26[bugfix] Allow unsetting filter expiration dates (#3560)Libravatar Vyr Cossont1
* 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-25[performance] convert enum strings to ints (#3558)Libravatar kim1
* 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-21[feature] Add domain permission drafts and excludes (#3547)Libravatar tobi1
* [feature] Add domain permission drafts and excludes * fix typescript complaining * lint * make filenames more consistent * test own domain excluded
2024-11-05[bugfix] Fix setting immediate `expires_at` value on filter endpoints (#3513)v0.17.2Libravatar tobi1
* [bugfix] Fix setting immediate `expires_at` value on filter endpoints * update wording * update wording * oh my
2024-08-24[feature] Interaction requests client api + settings panel (#3215)Libravatar tobi1
* [feature] Interaction requests client api + settings panel * test accept / reject * fmt * don't pin rejected interaction * use single db model for interaction accept, reject, and request * swaggor * env sharting * append errors * remove ErrNoEntries checks * change intReqID to reqID * rename "pend" to "request" * markIntsPending -> mark interactionsPending * use log instead of returning error when rejecting interaction * empty migration * jolly renaming * make interactionURI unique again * swag grr * remove unnecessary locks * invalidate as last step
2024-07-31[feature] Allow users to export data via the settings panel (#3140)Libravatar tobi3
* [feature] Allow users to export data via the settings panel * rename/move some stuff
2024-07-21[feature/frontend] Respect `prefers-reduced-motion` for avatars, headers, ↵Libravatar tobi2
and emojis (#3118) * [feature/frontend] Respect `prefers-reduced-motion` for avatars, headers, and emojis * go fmt * fix tests * use static version of instance thumbnail when appropriate * use prefers-reduced-motion * simplify account conversion a bit * fix c&p error
2024-07-12[feature/frontend] Better visual separation between "main" thread and ↵Libravatar tobi1
"replies" (#3093) * [feature/frontend] Better web threading model * fix test * bwap * tweaks * more tweaks to wording * typo * indenting * adjust wording * aaa
2024-06-18[feature/frontend] Reports frontend v2 (#3022)Libravatar tobi1
* use apiutil + paging in admin processor+handlers * we're making it happen * fix little whoopsie * styling for report list * don't youuuu forget about meee don't don't don't don't * last bits * sanitize content before showing in report statuses * update report docs
2024-05-31[feature] Add from: search operator and account_id query param (#2943)Libravatar Vyr Cossont1
* Add from: search operator * Fix whitespace in Swagger YAML comment * Move query parsing into its own method * Document search * Clarify post search scope
2024-04-13[feature] Admin accounts endpoints; approve/reject sign-ups (#2826)Libravatar tobi1
* update settings panels, add pending overview + approve/deny functions * add admin accounts get, approve, reject * send approved/rejected emails * use signup URL * docs! * email * swagger * web linting * fix email tests * wee lil fixerinos * use new paging logic for GetAccounts() series of admin endpoints, small changes to query building * shuffle useAccountIDIn check *before* adding to query * fix parse from toot react error * use `netip.Addr` * put valid slices in globals * optimistic updates for account state --------- Co-authored-by: kim <grufwub@gmail.com>
2024-04-04fix possible nil panic (#2809)Libravatar kim1
2024-03-13[feature] Process outgoing Move from clientAPI (#2750)Libravatar tobi1
* prevent moved accounts from taking create-type actions * update move logic * federate move out * indicate on web profile when an account has moved * [docs] Add migration docs section * lock while checking + setting move state * use redirectFollowers func for clientAPI as well * comment typo * linter? i barely know 'er! * Update internal/uris/uri.go Co-authored-by: Daenney <daenney@users.noreply.github.com> * add a couple tests for move * fix little mistake exposed by tests (thanks tests) * ensure Move marked as successful * attach shared util funcs to struct * lock whole account when doing move * move moving check to after error check * replace repeated text with error func * linterrrrrr!!!! * catch self follow case --------- Co-authored-by: Daenney <daenney@users.noreply.github.com>
2024-02-14[chore] also allow text/xml in place of application/xml (#2640)Libravatar kim1
2024-02-14[bugfix] add stricter checks during all stages of dereferencing remote AS ↵Libravatar kim2
objects (#2639) * add stricter checks during all stages of dereferencing remote AS objects * a comment
2024-01-28[bugfix] Fix EmptyJSONObject/EmptyJSONArray (#2576)Libravatar Vyr Cossont1
* Fix EmptyJSONObject/EmptyJSONArray These are meant to be the bytes representing an empty object and array in JSON: `{}` and `[]`. They are actually the strings `"{}"` and `"[]"`. This causes clients expecting an object or array to not be able to parse the response. * Use json.RawMessage instead of []byte
2023-12-27[chore] Refactor HTML templates and CSS (#2480)Libravatar tobi4
* [chore] Refactor HTML templates and CSS * eslint * ignore "Local" * rss tests * fiddle with OG just a tiny bit * dick around with polls a bit more so SR stops saying "clickable" * remove break * oh lord * don't lazy load avatar * fix ogmeta tests * clean up some cruft * catch remaining calls to c.HTML * fix error rendering + stack overflow in tag * allow templating attributes * fix indent * set aria-hidden on status complementary content, since it's already present in the label anyway * tidy up templating calls a little * try to make styling a bit more consistent + readable * fix up some remaining CSS issues * fix up reports
2023-12-18[feature] request blocking by http headers (#2409)Libravatar kim1
2023-12-16[performance] simpler throttling logic (#2407)Libravatar kim1
* reduce complexity of throttling logic to use 1 queue and an atomic int * use atomic add instead of CAS, add throttling test
2023-11-27[performance] http response encoding / writing improvements (#2374)Libravatar kim5
2023-11-20[bugfix] self-referencing collection pages for status replies (#2364)Libravatar kim1
2023-11-13[feature/performance] Wrap incoming HTTP requests in timeout handler (#2353)Libravatar tobi1
* deinterface router, start messing about with deadlines * weeeee * thanks linter (thinter) * write Connection: close when timing out requests * update wording * don't replace req * don't bother with fancy Cause functions (I'll use them one day...)
2023-11-08[feature] add support for polls + receiving federated status edits (#2330)Libravatar kim1
2023-09-21[feature] Implement explicit domain allows + allowlist federation mode (#2200)Libravatar tobi1
* love like winter! wohoah, wohoah * domain allow side effects * tests! logging! unallow! * document federation modes * linty linterson * test * further adventures in documentation * finish up domain block documentation (i think) * change wording a wee little bit * docs, example * consolidate shared domainPermission code * call mode once * fetch federation mode within domain blocked func * read domain perm import in streaming manner * don't use pointer to slice for domain perms * don't bother copying blocks + allows before deleting * admonish! * change wording just a scooch * update docs
2023-07-31[feature] Hashtag federation (in/out), hashtag client API endpoints (#2032)Libravatar tobi1
* update go-fed * do the things * remove unused columns from tags * update to latest lingo from main * further tag shenanigans * serve stub page at tag endpoint * we did it lads * tests, oh tests, ohhh tests, oh tests (doo doo doo doo) * swagger docs * document hashtag usage + federation * instanceGet * don't bother parsing tag href * rename whereStartsWith -> whereStartsLike * remove GetOrCreateTag * dont cache status tag timelineability
2023-07-21[bugfix] Return all accounts when list accounts limit <= 0 (#2014)v0.10.0Libravatar tobi1
2023-07-18[bugfix] more robust list timeline invalidation (#1995)v0.10.0-rc3Libravatar kim1
2023-07-13[bugfix] Set Vary header correctly on cache-control (#1988)v0.10.0-rc2Libravatar tobi1
* [bugfix] Set Vary header correctly on cache-control * Prefer activitypub types on AP endpoints * use immutable on file server, vary by range * vary auth on Accept
2023-07-07[bugfix] Reorder web view logic, other small fixes (#1954)Libravatar tobi1
2023-07-07[chore/bugfix] Domain block tidying up, Implement first pass of `207 ↵Libravatar tobi1
Multi-Status` (#1886) * [chore/refactor] update domain block processing * expose domain block import errors a lil better * move/remove unused query keys
2023-06-21[feature] Add partial text search for accounts + statuses (#1836)Libravatar tobi1
2023-06-13[chore] Refactor AP authentication, other small bits of tidying up (#1874)Libravatar tobi1
2023-06-03[chore] Update versions, fix lint errors (#1860)Libravatar tobi1
2023-06-02[bugfix] Overwrite API client closed errors with `499 - Client Closed ↵Libravatar tobi1
Request` (#1857) * [bugfix] Overwrite client closed errors with 499 * bleep bloop * review changes
2023-05-25[feature] Add List functionality (#1802)Libravatar tobi1
* start working on lists * further list work * test list db functions nicely * more work on lists * peepoopeepoo * poke * start list timeline func * we're getting there lads * couldn't be me working on stuff... could it? * hook up handlers * fiddling * weeee * woah * screaming, pissing * fix streaming being a whiny baby * lint, small test fix, swagger * tidying up, testing * fucked! by the linter * move timelines to state like a boss * add timeline start to tests using state * invalidate lists
2023-05-16[bugfix] Fix NegotiateFormat with multiple accept headers (#1797)Libravatar Daenney2
* [bugfix] Fix NegotiateAccept with multi accept There's a bug in Gin's NegotiateFormat that doesn't handle the presence of multilpe accept headers. This lifts the code from the PR @tsmethurst sent a year ago to Gin into our codebase to fix the issue. * [bugfix] Concat accept header in webfinger Some implementations bug out when there's multiple accept headers, including Gin (see 7050112af1ccc935ec542cb41fa8b07f7357539d). But things seem to work reliably with a single accept header with multiple parts. Fixes: #1793
2023-05-12[chore] Prefer JSON errors in API endpoints (#1766)Libravatar Natsu Kagami2
* Default to JSON over HTML for error handling * Change the default error display for web endpoints to html
2023-05-04[bugfix] Serve correct 'application/jrd+json' content type for webfinger ↵Libravatar tobi2
requests (#1738) * [bugfix] Return `application/jrd+json` from webfinger queries * update finger req content-type
2023-04-28[performance] improved request batching (removes need for queueing) (#1687)Libravatar kim1
* revamp http client to not limit requests, instead use sender worker Signed-off-by: kim <grufwub@gmail.com> * remove separate sender worker pool, spawn 2*GOMAXPROCS batch senders each time, no need for transport cache sweeping Signed-off-by: kim <grufwub@gmail.com> * improve batch senders to keep popping recipients until remote URL found Signed-off-by: kim <grufwub@gmail.com> * fix recipient looping issue Signed-off-by: kim <grufwub@gmail.com> * fix missing mutex unlock Signed-off-by: kim <grufwub@gmail.com> * move request id ctx key to gtscontext, finish filling out more code comments, add basic support for not logging client IP Signed-off-by: kim <grufwub@gmail.com> * slight code reformatting Signed-off-by: kim <grufwub@gmail.com> * a whitespace Signed-off-by: kim <grufwub@gmail.com> * remove unused code Signed-off-by: kim <grufwub@gmail.com> * add missing license headers Signed-off-by: kim <grufwub@gmail.com> * fix request backoff calculation Signed-off-by: kim <grufwub@gmail.com> --------- Signed-off-by: kim <grufwub@gmail.com>
2023-03-12[chore] Improve copyright header handling (#1608)Libravatar Daenney4
* [chore] Remove years from all license headers Years or year ranges aren't required in license headers. Many projects have removed them in recent years and it avoids a bit of yearly toil. In many cases our copyright claim was also a bit dodgy since we added the 2021-2023 header to files created after 2021 but you can't claim copyright into the past that way. * [chore] Add license header check This ensures a license header is always added to any new file. This avoids maintainers/reviewers needing to remember to check for and ask for it in case a contribution doesn't include it. * [chore] Add missing license headers * [chore] Further updates to license header * Use the more common // indentend comment format * Remove the hack we had for the linter now that we use the // format * Add SPDX license identifier
2023-03-09[feature] Provide .well-known/host-meta endpoint (#1604)Libravatar Daenney2
* [feature] Provide .well-known/host-meta endpoint This adds the host-meta endpoint as Mastodon clients use this to discover the API domain to use when the host and account domains aren't the same. * Address review comments