summaryrefslogtreecommitdiff
path: root/internal/db
AgeCommit message (Collapse)AuthorFiles
2024-07-26[feature] Federate interaction policies + Accepts; enforce policies (#3138)Libravatar tobi1
* [feature] Federate interaction policies + Accepts; enforce policies * use Acceptable type * fix index * remove appendIRIStrs * add GetAccept federatingdb function * lock on object IRI
2024-07-24[chore] renames the `GTS` caches to `DB` caches (#3127)Libravatar kim32
* renames the `GTS` caches to `DB` caches, as it better references what they are * change remaining Caches.GTS uses to Caches.DB
2024-07-23[chore] Add some log lines to recent migrations warning not to interrupt (#3134)Libravatar tobi3
* [chore] Add some log lines to recent migrations warning not to interrupt * arse
2024-07-23Remove content and related fields from boosts (#3131)Libravatar Vyr Cossont1
These duplicate the content of the target and aren't necessary for anything. - Stops copying some fields from target when boosting or processing a remote boost - Adds a migration to null out existing duplicate data - Updates tests
2024-07-23[feature] Conversations API (#3013)Libravatar Vyr Cossont12
* Implement conversations API * Sort and page conversations by last status ID * Appease linter * Fix deleting conversations and statuses * Refactor to make migrations automatic * Lint * Update tests post-merge * Fixes from live-fire testing * Linter caught a format problem * Refactor tests, fix cache * Negative test for non-DMs * Run conversations advanced migration on testrig startup as well as regular server startup * Document (lack of) side effects of API method for deleting a conversation * Make not-found check less nested for readability * Rename PutConversation to UpsertConversation * Use util.Ptr instead of IIFE * Reduce cache used by conversations * Remove unnecessary TableExpr/ColumnExpr * Use struct tags for both unique constraints on Conversation * Make it clear how paging with GetDirectStatusIDsBatch should be used * Let conversation paging skip conversations it can't render * Use Bun NewDropTable * Convert delete raw query to Bun * Convert update raw query to Bun * Convert latestConversationStatusesTempTable raw query partially to Bun * Convert conversationStatusesTempTable raw query partially to Bun * Rename field used to store result of MaxDirectStatusID * Move advanced migrations to their own tiny processor * Catch up util function name with main * Remove json.… wrappers * Remove redundant check * Combine error checks * Replace map with slice of structs * Address processor/type converter comments - Add context info for errors - Extract some common processor code into shared methods - Move conversation eligibility check ahead of populating conversation * Add error context when dropping temp tables
2024-07-17[chore] media pipeline improvements (#3110)Libravatar kim4
* don't set emoji / media image paths on failed download, migrate FileType from string to integer * fix incorrect uses of util.PtrOr, fix returned frontend media * fix migration not setting arguments correctly in where clause * fix not providing default with not null column * whoops * ensure a default gets set for media attachment file type * remove the exclusive flag from writing files in disk storage * rename PtrOr -> PtrOrZero, and rename PtrValueOr -> PtrOrValue to match * slight wording changes * use singular / plural word forms (no parentheses), is better for screen readers * update testmodels with unknown media type to have unset file details, update attachment focus handling converting to frontend, update tests * store first instance in ffmpeg wasm pool, fill remaining with closed instances
2024-07-15[feature/frontend] Add player for audio files; use thumbnail for `poster` ↵Libravatar tobi5
(#3099) * [feature/frontend] Audio player for audio media types * use video preview images for previews instead of video itself * don't preload * update tests for new zork status * collapse media gallery into single row when small
2024-07-15[chore] add step-by-step logging to long migration (#3102)Libravatar tobi1
2024-07-11[chore] Add interaction policy gtsmodels (#3075)Libravatar tobi11
* [chore] introduce interaction policy gts models * update migration a smidge * fix copy paste typo * update migration * use int for InteractionType
2024-07-10[bugfix] Don't throw error when parent statuses are missing (#2011) (#3088)Libravatar snow1
* [bugfix] Don't throw error when parent statuses are missing (#2011) * Split missing parent status case from error check
2024-06-29[feature] Default to WASM-based SQLite driver (#3053)Libravatar Daenney4
* [feature] Default to WASM-based SQLite driver With 0.16 out this switches our default SQLite driver to the WASM-based solution instead. So far the driver seems to perform just as well. Switching our default should result in it getting a bit more testing during the 0.17 development cycle. * add the ol' john hancock --------- Co-authored-by: tobi <tobi.smethurst@protonmail.com>
2024-06-26[chore] media and emoji refactoring (#3000)Libravatar kim4
* start updating media manager interface ready for storing attachments / emoji right away * store emoji and media as uncached immediately, then (re-)cache on Processing{}.Load() * remove now unused media workers * fix tests and issues * fix another test! * fix emoji activitypub uri setting behaviour, fix remainder of test compilation issues * fix more tests * fix (most of) remaining tests, add debouncing to repeatedly failing media / emojis * whoops, rebase issue * remove kim's whacky experiments * do some reshuffling, ensure emoji uri gets set * ensure marked as not cached on cleanup * tweaks to media / emoji processing to handle context canceled better * ensure newly fetched emojis actually get set in returned slice * use different varnames to be a bit more obvious * move emoji refresh rate limiting to dereferencer * add exported dereferencer functions for remote media, use these for recaching in processor * add check for nil attachment in updateAttachment() * remove unused emoji and media fields + columns * see previous commit * fix old migrations expecting image_updated_at to exists (from copies of old models) * remove freshness checking code (seems to be broken...) * fix error arg causing nil ptr exception * finish documentating functions with comments, slight tweaks to media / emoji deref error logic * remove some extra unneeded boolean checking * finish writing documentation (code comments) for exported media manager methods * undo changes to migration snapshot gtsmodels, updated failing migration to have its own snapshot * move doesColumnExist() to util.go in migrations package
2024-06-18[bugfix] rename `include_types[]` to `types[]` (#3023)Libravatar tobi2
2024-06-18[feature/frontend] Reports frontend v2 (#3022)Libravatar tobi3
* 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-06-17[feature] Implement types[] param for notifications (#3009)Libravatar Vyr Cossont3
Counterpart of exclude_types[]. Also updates Swagger spec for types[] to use the correct param name and enumerate possible values. Fixes #3003
2024-06-14[bugfix] avoid v. long notification clear query (#3007)v0.16.0-rc3Libravatar tobi2
2024-06-11[bugfix] Deref stats async, serve stub collections if handshaking (#2990)v0.16.0-rc2Libravatar tobi3
* [bugfix] Deref stats async, allow peek if handshaking * don't return totalItems when handshaking or hiding collections * use GetLimit() * use StubAccountStats
2024-06-10[bugfix] boost and account recursion (#2982)Libravatar kim2
* fix possible infinite recursion if moved accounts are self-referential * adds a defensive check for a boost being a boost of a boost wrapper * add checks on input for a boost of a boost * remove unnecessary check * add protections on account move to prevent move recursion loops * separate status conversion without boost logic into separate function to remove risk of recursion * move boost check to boost function itself * formatting * use error 422 instead of 500 * use gtserror not standard errors package for error creation
2024-06-06[feature] User muting (#2960)Libravatar Vyr Cossont5
* User muting * Address review feedback * Rename uniqueness constraint on user_mutes to match convention * Remove unused account_id from where clause * Add UserMute to NewTestDB * Update test/envparsing.sh with new and fixed cache stuff * Address tobi's review comments * Make compiledUserMuteListEntry.expired consistent with UserMute.Expired * Make sure mute_expires_at is serialized as an explicit null for indefinite mutes --------- Co-authored-by: tobi <tobi.smethurst@protonmail.com>
2024-06-06[feature] do not uncache status / emoji media if attached status is ↵Libravatar kim5
bookmarked (#2956) * do not uncache status / emoji media if attached status is bookmarked * add status bookmark and bookmark IDs caches * update status bookmark tests * move IsStatusBookmarkedBy() to StatusBookmark{} interface, rely on cache * fix envparsing.sh test
2024-06-05[chore] Fiddle with CI tests; use wasmsqlite3 for CI tests (#2966)Libravatar tobi1
* [chore] Update CI test stuff * don't bother with ldflags * use wasmsqlite3
2024-06-04Compile filter keyword regexps when touched through PutFilter or ↵Libravatar Vyr Cossont1
UpdateFilter (#2951) Followup to #2903
2024-05-31[feature] Add from: search operator and account_id query param (#2943)Libravatar Vyr Cossont3
* Add from: search operator * Fix whitespace in Swagger YAML comment * Move query parsing into its own method * Document search * Clarify post search scope
2024-05-31[feature] Implement Filter API v2 (#2936)Libravatar Vyr Cossont3
* Use correct entity name * We support server-side filters now * Document filter v1 methods that can throw a 409 * Validate v1 filter phrase as filter title * Always check v1 filter API status codes in tests * Document keyword minimum requirement on filter API v1 * Make it possible to specify filter keyword update columns per filter keyword * Implement v2 filter API * Fix lint and tests * Update Swagger spec * Fix filter update test * Update Swagger spec *correctly* * Update actual files Swagger spec was generated from * Remove keywords_attributes and statuses_attributes * Add test for serialization of empty filter * More helpful messages when object is owned by wrong account
2024-05-27[experiment] add alternative wasm sqlite3 implementation available via ↵Libravatar kim13
build-tag (#2863) This allows for building GoToSocial with [SQLite transpiled to WASM](https://github.com/ncruces/go-sqlite3) and accessed through [Wazero](https://wazero.io/).
2024-05-22[performance] update storage backend and make use of seek syscall when ↵Libravatar kim1
available (#2924) * update to use go-storage/ instead of go-store/v2/storage/ * pull in latest version from codeberg * remove test output :innocent: * add code comments * set the exclusive bit when creating new files in disk config * bump to actual release version * bump to v0.1.1 (tis a simple no-logic change) * update readme * only use a temporary read seeker when decoding video if required (should only be S3 now) * use fastcopy library to use memory pooled buffers when calling TempFileSeeker() * update to use seek call in serveFileRange()
2024-05-21[performance] cache v2 filter keyword regular expressions (#2903)Libravatar kim1
* add caching of filterkeyword regular expressions * formatting * fix WholeWord nil check
2024-05-01[feature] Page through accounts as moderator (#2881)Libravatar tobi3
* [feature] Page through accounts as moderator * aaaaa * use COLLATE "C" for Postgres to ensure same ordering as SQLite * fix typo, test paging up * don't show moderation / info for our instance acct
2024-04-16[bugfix] fix get all tokens (#2841)Libravatar tobi2
2024-04-16[feature/performance] Store account stats in separate table (#2831)Libravatar tobi8
* [feature/performance] Store account stats in separate table, get stats from remote * test account stats * add some missing increment / decrement calls * change stats function signatures * rejig logging a bit * use lock when updating stats
2024-04-15[performance] cached oauth database types (#2838)Libravatar kim3
* update token + client code to use struct caches * add code comments * slight tweak to default mem ratios * fix envparsing * add appropriate invalidate hooks * update the tokenstore sweeping function to rely on caches * update to use PutClient() * add ClientID to list of token struct indices
2024-04-13[feature] Admin accounts endpoints; approve/reject sign-ups (#2826)Libravatar tobi5
* 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-13[performance] update GetAccountsByIDs() to use the new multi cache loader ↵Libravatar kim1
endpoint (#2828) * update GetAccountsByIDs() to use the new multi cache loader endpoint * fix broken import
2024-04-11[feature] New user sign-up via web page (#2796)Libravatar tobi9
* [feature] User sign-up form and admin notifs * add chosen + filtered languages to migration * remove stray comment * chosen languages schmosen schmanguages * proper error on local account missing
2024-04-03[bugfix] Sort follows chronologically (#2801)Libravatar Daenney1
The id on the follows table is not a ULID, but a random ID. Sorting on them results in a completely random order. Instead, sort on created_at, which sould result in a stable and intended sort order. Fixes: #2769 Co-authored-by: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>
2024-04-02[bugfix] Set domain for empty-domain Friendica accounts (#2800)v0.15.0-rc1Libravatar tobi1
2024-04-02[chore] bump go structr cache version -> v0.6.0 (#2773)Libravatar kim16
* update go-structr library -> v0.6.0, add necessary wrapping types + code changes to support these changes * update readme with go-structr package changes * improved wrapping of the SliceCache type * add code comments for the cache wrapper types * remove test.out :innocent: --------- Co-authored-by: tobi <31960611+tsmethurst@users.noreply.github.com>
2024-03-25[feature] User-selectable preset CSS themes for accounts (#2777)Libravatar tobi1
* [feature] User-selectable preset themes * docs, more theme stuff * lint, tests * fix css name * correct some little issues * add another theme * fix poll background * okay last theme i swear * make retrieval of apimodel themes more conventional * preallocate stylesheet slices
2024-03-25[feature] Add healthcheck endpoints `/livez` and `/readyz` (#2783)Libravatar tobi2
* [feature] Add healthcheck endpoints `/livez` and `/readyz` * use select that returns no data
2024-03-22[chore] Move local account settings to separate db table (#2770)Libravatar tobi6
* [chore] Move local account settings to separate database model * don't use separate settings_id
2024-03-22[bugfix] add all possible busy result codes to the sqlite errBusy catching ↵Libravatar kim1
check (#2775)
2024-03-14[docs] Add database maintenance section; update info message on ANALYZE run ↵Libravatar tobi1
(sqlite) (#2756) * [chore] Limit size of ANALYZE run after migration (sqlite) * add basic db maintenance tips * update docs, analyze * amend info message a wee bit * update docs/admin/database_maintenance.md wording Co-authored-by: Daenney <daenney@users.noreply.github.com> --------- Co-authored-by: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Co-authored-by: Daenney <daenney@users.noreply.github.com>
2024-03-13[feature] Process outgoing Move from clientAPI (#2750)Libravatar tobi2
* 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-03-10[bugfix] Fix whitespace move_id issue (#2742)Libravatar tobi1
2024-03-10[bugfix] Don't error when populating MovedTo if account not found (#2741)Libravatar tobi2
* [bugfix] Don't error when populating MovedTo if account not found * test the thing
2024-03-07[bugfix] add workaround for Xsqlite_interrupt() permanently breaking ↵Libravatar kim1
connection (#2731)
2024-03-06[chore/bugfix] Little DB fixes (#2726)Libravatar tobi2
2024-03-06[feature/chore] Add Move database functions + cache (#2647)Libravatar tobi7
* [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 Cossont11
* 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-03[bugfix] update postgresqlstmt to correctly use postgres err hook (#2711)Libravatar kim1