summaryrefslogtreecommitdiff
path: root/internal
AgeCommit message (Collapse)AuthorFiles
2024-03-06[feature/chore] Add Move database functions + cache (#2647)Libravatar tobi16
* [feature/chore] Add Move database functions + cache * add move mem ratio to envparsing.sh * update comment
2024-03-06[feature] Filters v1 (#2594)Libravatar Vyr Cossont44
* Implement client-side v1 filters * Exclude linter false positives * Update test/envparsing.sh * Fix minor Swagger, style, and Bun usage issues * Regenerate Swagger * De-generify filter keywords * Remove updating filter statuses This is an operation that the Mastodon v2 filter API doesn't actually have, because filter statuses, unlike keywords, don't have options: the only info they contain is the status ID to be filtered. * Add a test for filter statuses specifically * De-generify filter statuses * Inline FilterEntry * Use vertical style for Bun operations consistently * Add comment on Filter DB interface * Remove GoLand linter control comments Our existing linters should catch these, or they don't matter very much * Reduce memory ratio for filters
2024-03-04[chore]: Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 (#2714)v0.14.0Libravatar dependabot[bot]1
* [chore]: Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.4 to 1.9.0. - [Release notes](https://github.com/stretchr/testify/releases) - [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0) --- updated-dependencies: - dependency-name: github.com/stretchr/testify dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * cast the exxpected test values as float32 to bypass (possible) testify suite regression --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: kim <grufwub@gmail.com>
2024-03-04[bugfix] check remote status permissibility (#2703)Libravatar kim7
* add more stringent checks for remote status permissibility * add check for inreplyto of a remote status being a boost * do not permit inReplyTo boost wrapper statuses * change comment wording * fix calls to NewFederator() * add code comments for NotPermitted() and SetNotPermitted() * improve comment * check that existing != nil before attempting delete * ensure replying account isn't suspended * use a debug log instead of info. check for boost using ID * shorten log string length. make info level * add note that replying to boost wrapper status shouldn't be able to happen anyways * update to use onFail() function
2024-03-04[bugfix] Sanitize incoming PropertyValue fields (#2722)v0.14.0-rc3Libravatar tobi3
2024-03-04[bugfix/tracing] fix broken tracing due to conflicting schema url (#2712)Libravatar Milas Bowman1
The OpenTelemetry SDK is very strict about the schema version when the `Resource` is initialized. Specifically, different schema versions _CANNOT_ be mixed, and since the default SDK resource (which is merged with the user-defined one) defines a schema URL, the `semconv` imports are really prone to being out-of-sync. The best way to avoid this is to merge a _schemaless_ resource. This is fine...there's plenty of other ways to get `semconv` out of sync, and the core service attributes (e.g. `service.name`) should not ever change. Additionally, any errors here are now propagated so that they'll be visible instead of silently swallowed.
2024-03-03[bugfix] update postgresqlstmt to correctly use postgres err hook (#2711)Libravatar kim1
2024-02-29[bugfix] unwrap boosts when checking in-reply-to status (#2702)Libravatar kim2
* add stronger checks on status being replied to * update error code test is expecting
2024-02-29[chore] Disable the syslog long message over Unix datagram socket test on ↵Libravatar Vyr Cossont2
macOS (#2700)
2024-02-28[chore] re-add `statuses_account_id_id_idx` if removed (#2699)v0.14.0-rc2Libravatar tobi2
* [chore] re-add `statuses_account_id_id_idx` if removed * if not exists
2024-02-27[chore] add log line about lengthy reindex migration (#2695)v0.14.0-rc1Libravatar tobi1
2024-02-27[bugfix] Account timeline: exclude self-replies that mention other accounts ↵Libravatar Vyr Cossont4
(#2670) * Account timeline: exclude self-replies that mention other accounts * Add index for querying unmentioned statuses * remove now unused statuses_account_id_id_idx --------- Co-authored-by: tobi <tobi.smethurst@protonmail.com>
2024-02-27[feature/oidc] Add support for very basic RBAC (#2642)Libravatar 9p44
* Add support for very basic RBAC * Add some small tests for allowedGroup and adminGroup * Switch to table-driven tests
2024-02-27[feature] Block Amazonbot (#2692)Libravatar Daenney1
Blocks the Amazon crawler bot. Closes: #2686
2024-02-27[feature] Add experimental `instance-federation-spam-filter` option (#2685)Libravatar tobi70
* [chore] Move `visibility` to `filter/visibility` * [feature] Add experimental instance-federation-spam-filter option
2024-02-23[chore] Increase default max image description to 1500 chars, collapse cw ↵Libravatar tobi5
char count into status (#2682) * [chore] Make default max image description 1500 chars, collapse cw char count into status * oops * tests
2024-02-23[bugfix] 2643 bug search for account url doesnt always work when redirected ↵Libravatar kim17
(#2673) * update activity library so dereferencer returns full response and checks *final* link to allow for redirects * temporarily add bodged fixed library * remove unused code * update getAccountFeatured() to use dereferenceCollectionPage() * make sure to release map * perform a 2nd decode to ensure reader is empty after primary decode * add comment explaining choice of using Decode() instead of Unmarshal() * update embedded activity library to latest matching https://github.com/superseriousbusiness/activity/pull/21 * add checks to look for changed URI and re-check database if redirected * update max iteration count to 512, add checks during dereferenceAncestors() for indirect URLs * remove doubled-up code * fix use of status instead of current * use URIs for checking equality for security * use the latest known URI for boost_of_uri in case original was an indirect * add dereferenceCollection() function for dereferenceAccountFeatured() * pull in latest github.com/superseriousbusiness/activity version (and remove the bodge!!) * fix typo in code comments * update decodeType() to accept a readcloser and handle body closing * switch to checking using BoostOfID and add note why not using BoostOfURI * ensure InReplyTo gets unset when deleting status parent in case currently stubbed * add tests for Collection and CollectionPage iterators
2024-02-21[chore] Rename frontend.tmpl to settings.tmpl, remove unused "lightgray" ↵Libravatar tobi1
class (#2674)
2024-02-20[bugfix] fix possible mutex lockup during streaming code (#2633)Libravatar kim14
* rewrite Stream{} to use much less mutex locking, update related code * use new context for the stream context * ensure stream gets closed on return of writeTo / readFrom WSConn() * ensure stream write timeout gets cancelled * remove embedded context type from Stream{}, reformat log messages for consistency * use c.Request.Context() for context passed into Stream().Open() * only return 1 boolean, fix tests to expect multiple stream types in messages * changes to ping logic * further improved ping logic * don't export unused function types, update message sending to only include relevant stream type * ensure stream gets closed :facepalm: * update to error log on failed json marshal (instead of panic) * inverse websocket read error checking to _ignore_ expected close errors
2024-02-20[feature] Add `requested_by` to relationship model (#2672)Libravatar tobi8
* [feature] Add `requested_by` to relationship model * whoops, missed some tests
2024-02-20[bugfix] use start + end line in regex when validating emoji via API (#2671)Libravatar tobi3
2024-02-19[bugfix] Use ptr for instance stats entries to avoid skipping 0 values (#2666)Libravatar tobi2
* [bugfix] Use ptr for instance stats entries to avoid skipping 0 values * comment explaining why stats values are pointers
2024-02-19[bugfix] Ensure local statuses always get a threadID so they can be muted ↵Libravatar tobi2
(#2665) * [chore/bugfix] Ensure threadID always set on local statuses * test
2024-02-19[feature] Add Mastodon-compatible HTTP signature fallback (#2659)Libravatar Milas Bowman3
On outgoing `GET` requests that are signed (e.g. authorized fetch), if the initial request fails with `401`, try again, but _without_ the query parameters included in the HTTP signature. This is primarily useful for compatibility with Mastodon; though hopefully this can be removed in the not-too-distant future, as they've started changing their behavior here. Signed-off-by: Milas Bowman <devnull@milas.dev>
2024-02-19[bugfix] Refactor parse mention, fix local mention bug (#2657)Libravatar tobi8
* [bugfix] Refactor parse mention, fix local mention bug * originAccount -> originAcct
2024-02-18[chore] Comment out silly, frequently-failing `GetStatusTwice` test (#2656)Libravatar tobi1
* [chore] Comment out silly, frequently-failing `GetStatusTwice` test * lord
2024-02-18[bugfix] Fix dereferencing ancestors on new status create (#2652)Libravatar tobi4
* [bugfix] Pass `latest` to dereferenceThread instead of barebones status * only mark status orphaned if visibility suggests parent is really deleted * tone down "not deref'd" warnings, since they represent a legit visibility situation * remove FAQ entry for "status not deref'd yet"
2024-02-17[chore] Disable Move API endpoints for now until Move is fully implemented ↵Libravatar tobi2
in the backend (#2650) * [chore] Disable Move API endpoints for now until Move is fully implemented in the backend * disable other form fields * clarify that moving to GtS also isn't implemented yet
2024-02-17[chore] refactor extractFromCtx a bit (#2646)Libravatar tobi8
2024-02-17[chore] Simplify the User-Agent string (#2645)Libravatar Daenney1
* [chore] Simplify the User-Agent string RFC 9110[1] includes a definition for the format of a user-agent header: User-Agent = product *( RWS ( product / comment ) ) product = token ["/" product-version] product-version = token comment = "(" *( ctext / quoted-pair / comment ) ")" ctext = HTAB / SP / %x21-27 / %x2A-5B / %x5D-7E / obs-text An example given in the RFC: User-Agent: CERN-LineMode/2.15 libwww/2.17b3 The idea is typically start with the most important product/version, add a (comment) if necessary and then include any auxilliary products. However, the RFC warns against including too many auxiliary products as those can be unnecessarily revealing. For automated systems (i.e not a browser), the common and recommended format is <product></version> (+uri-for-contact), followed with any additional <product>/<version> pairs that are relevant. This changes our UA to match that convention more closely. This makes it easier for administrators who do user-agent parsing for statistics or other purposes to correctly identify the version of GoToSocial. Currently tools tend to get confused by the lack of a /<version> on the start of our string. [1]: https://www.rfc-editor.org/rfc/rfc9110.html#name-user-agents * [chore] Don't use app name in UA From all the GtS UAs I've collected, nobody seems to set/change this, so we might as well use the static string. The main usefulness for this is when you have multilpe GtS instances connecting to the same DB, so they can identify as different instances by changing the application name (though it should already be obvious from having different usernames).
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 kim13
objects (#2639) * add stricter checks during all stages of dereferencing remote AS objects * a comment
2024-02-14[feature] Add metrics for instance user count, statuses count and federating ↵Libravatar Tsuribori2
instances count (#2592) Co-authored-by: Tsuribori <none@example.org>
2024-02-13remove the execer and queryer conformance requirements (#2636)Libravatar kim1
2024-02-12[performance] temporarily cache account status counts to reduce no. account ↵Libravatar kim5
counts (#2620) * temporarily cache account status counts to reduce no. account counts * whoops, forgot to initAccountCounts() * use already fetched cache capacity value * make cache a ptr type * whoops, use count instead of just select * fix to correctly use the transaction * properly wrap that tx :innocent: * correctly wrap both tx types * outline retryOnBusy() to allow the fast path to be inlined * return err on context cancelled * remove unnecessary storage of context in stmt, fix Exec and Query interface implementations * shutup linter
2024-02-09use pointer for freshness window (#2614)Libravatar tobi15
2024-02-09[chore] Move `DoOnce` func wrapper to util (#2613)Libravatar tobi5
2024-02-07[feature/performance] sqlite pragma optimize on close (#2596)Libravatar kim31
* wrap database drivers in order to handle error processing, hooks, etc * remove dead code * add code comment, remove unused blank imports
2024-02-06[bugfix] Ensure activities sender always = activities actor (#2608)Libravatar tobi6
2024-02-06[feature] serdes for moved/also_known_as (#2600)Libravatar tobi9
* [feature] serdes for moved/also_known_as * document `alsoKnownAs` and `movedTo` properties * only implicitly populate AKA uris from DB for local accounts * don't let remotes store more than 20 AKA uris to avoid shenanigans
2024-02-01stop paged endpoints returning null for empty items (#2597)Libravatar kim2
2024-01-31[feature] Try HTTP signature validation with and without query params for ↵Libravatar tobi6
incoming requests (#2591) * [feature] Verify signatures both with + without query params * Bump to tagged version
2024-01-31Improve context descendant sorting (#2579)Libravatar Vyr Cossont2
* Improve context descendant sorting Topologically sort replies, then move self-replies to top of list * Unify descendant sort passes * Correct test package name * Preallocate maps
2024-01-31[bugfix] fix possible infinite loops in media / emoji cleanup (#2590)Libravatar kim7
* update media / emoji cleaner funcs to use new paging package, check for same returned maxID * fix other calls of getattachments and getmojis not using paging * use alternative order-by function
2024-01-31[bugfix] parent status replied to status not dereferenced sometimes (#2587)Libravatar kim6
* much simplified DereferenceStatusAncestors(), also handles edge cases now * perform status acceptibility check before handling even as forward * don't further dereference ancestors if they're up to date * call enrichStatusSafely() directly to ensure we get error messages * change getStatusByURI() semantics to return error + old model on failed update, fix deref ancestor to check for staleness before refetch * perform a nil-check on the status.Local variable, in case it hasn't been set on new status attempting refresh * more consistently set returned parent status, don't check if updated * only home-timeline statuses if explicitly visible AND not explicitly invisible! * fix broken test now that status acceptibility checks happen on forwarded statuses
2024-01-29[bugfix] Fix Postgres emoji delete, emoji category change (#2570)Libravatar tobi15
* [bugfix] Fix Postgres emoji delete, emoji category change * revert trace logging * caching issue * update tests
2024-01-28[chore] Add a couple tests for updating list entries (#2580)Libravatar tobi2
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
2024-01-26[bugfix] Don't return Account or Status if new and dereferencing failed, ↵Libravatar tobi13
other small fixes (#2563) * tidy up account, status, webfingering logic a wee bit * go fmt * invert published check * alter resp initialization * get Published from account in typeutils * don't instantiate error for no darn good reason * shadow err * don't repeat error codes in wrapped errors * don't wrap error unnecessarily
2024-01-22[feature] Ratelimit + serve emoji images on separate router group (#2548)Libravatar tobi2
* [feature] Serve + rate limit emoji files separately from attachments * add a wee little warning about uploading loads of emojis