about summary refs log tree commit diff
path: root/src/database
Commit message (Collapse)AuthorAgeFilesLines
* Fix the current-thread runtime tests w/ sqlxVika2024-09-191-0/+3
| | | | Tracked upstream as https://github.com/launchbadge/sqlx/issues/3510
* Introduce `Storage::update_with`Vika2024-08-284-7/+54
| | | | | | | | | This function takes a closure that modifies the post. This could be useful in maintenance utilities that scan and fixup posts. For now this isn't used anywhere within Kittybox, but once all backends implement this correctly, this could replace `Storage::update_post` calls. For supporting backends, `Storage::update_post` is implemented in terms of `Storage::update_with`.
* Make Micropub update logic self-containedVika2024-08-282-34/+4
| | | | | | This allows for a separation of concerns between database backends and Micropub, unless such backend have special requirements, like the file backend storing children of a feed in an array.
* Set MSRV to 1.75, remove #[async_trait] declarations whenever possibleVika2024-08-265-40/+33
| | | | | | | Axum still uses `async_trait`, let them do whatever they want. I will no longer be subject to the humiliation of trying to dig through lifetime errors and unreadable declarations. Also I don't fucking care about MSRV, I'm not a library. If you don't have modern Rust, get one.
* Appease most clippy warningsVika2024-08-262-70/+6
| | | | | | The warnings only remain in places where I need them to remain, because I either need a reminder to implement something, or I need to refactor and simplify the code in question.
* FileStorage: appease clippy and use block_in_place for rewinding feedsVika2024-08-262-10/+15
| | | | | Using `tokio::task::block_in_place` downgrades the thread temporarily to avoid starvation.
* Fix private posts with no defined audience not being shown in feedsVika2024-08-231-4/+7
|
* kittybox-util: 0.1.0 -> 0.2.0Vika2024-08-202-2/+2
| | | | Micropub types are now more coherent and gathered in one place.
* feat: logins!!Vika2024-08-181-1/+1
| | | | | | | | yes you can finally sign in this is also supposed to show private posts intended for you! maybe i can also reveal my email to those who sign in! :3
* Upgrade dependencies and fix deprecated functionalityVika2024-08-021-2/+2
| | | | | | | I think I managed to not lose any functionality from my dependencies. sqlparser remains unupgraded, but that's mostly because it is only used in one example and it's not worth it to upgrade right now.
* treewide: create a common method for state initializationVika2024-08-014-45/+30
| | | | | Now the database objects can be uniformly created from a URI. They can also optionally do sanity checks and one-time initialization.
* database: use Url to represent user authoritiesVika2024-07-094-59/+57
| | | | This makes the interface more consistent and resistant to misuse.
* Support ?q=category queriesVika2024-03-044-1/+37
| | | | Warning, untested. But hopefully works!
* lint: no extra whitespace on line endingsVika2024-01-291-3/+3
|
* Moved the entire Kittybox tree into the rootVika2023-07-296-0/+2682
|
* flake.nix: reorganizeVika2022-05-245-1843/+0
| | | | | | | | | | | | - Kittybox's source code is moved to a subfolder - This improves build caching by Nix since it doesn't take changes to other files into account - Package and test definitions were spun into separate files - This makes my flake.nix much easier to navigate - This also makes it somewhat possible to use without flakes (but it is still not easy, so use flakes!) - Some attributes were moved in compliance with Nix 2.8's changes to flake schema
* database, frontend: code cleanup so clippy doesn't complainVika2022-05-102-19/+17
|
* FileStorage: only compile tests when neededVika2022-05-101-0/+1
|
* FileStorage: fixes and regression tests for read_feed_with_limitVika2022-05-102-41/+141
| | | | Now I will know if something breaks horribly again.
* FileStorage: fix the item in `after` being emitted as the firstVika2022-05-101-8/+11
| | | | | | Iterator::skip_while() returns the last item. Reimplement the combinator that I need using a loop over Iterator::by_ref() instead. This will terminate after the end is reached.
* FileStorage: code cleanupVika2022-05-101-14/+11
|
* FileStorage: fix the hang when "after" isn't listed in the feedVika2022-05-101-9/+8
| | | | Closes #4.
* Split into different cratesVika2022-05-071-9/+1
| | | | | | | | | Templates and utility types are now separate crates to speed up compilation, linting and potential reuse/replacement. Potentially more crates could be split out/modularized, resulting in speedups, smaller binaries (whenever features are excluded) and even more reuse capabilities.
* chore: code cleanupVika2022-05-011-10/+6
|
* FileStorage: fix writing settings on empty fileVika2022-05-011-8/+12
|
* FileStorage: lockless reads and atomic writesVika2022-05-012-221/+161
| | | | | | | | | | | | | | | | | | | - Reads don't lock anymore. At all. - Writes create a temporary file and use `rename(2)` to atomically replace it - since OpenOptions::create_new(true) is used, tempfile creation is atomic (and since tempfile names are per-post, a post can only be edited by one request at a time) - Since written files get atomically replaced, readers can't read a corrupted file Potential pitfalls: 1. This approach is not covered by unit tests (yet) 2. Stale tempfiles can prevent editing posts (can be solved by throwing out tempfiles that are older than, say, a day) 3. Crashed edits can leave stale tempfiles (honestly that sounds better than corrupting the whole database, doesn't sound like a bug to me at all!)
* Make the settings in the database a strong typeVika2022-03-233-10/+28
|
* FileStorage: add lints to catch panicking inside locked code sectionsVika2022-03-071-149/+168
|
* Restored most of the functionality (except onboarding and some queries)Vika2022-03-062-13/+20
|
* database: code cleanupVika2022-03-022-26/+58
|
* database/memory: restore, it is useful in test scenariosVika2022-02-212-0/+198
|
* database: code cleanupVika2022-02-212-48/+29
|
* database/file: use Authority instead of origin for directoriesVika2022-02-211-4/+4
|
* WIP: convert to Tokio and WarpVika2022-02-152-58/+31
| | | | | | | | | | | Warp allows requests to be applied as "filters", allowing to flexibly split up logic and have it work in a functional style, similar to pipes. Tokio is just an alternative runtime. I thought that maybe switching runtimes and refactoring the code might allow me to fish out that pesky bug with the whole application hanging after a certain amount of requests...
* FileBackend: introduce timeouts on operationsVika2021-12-311-34/+51
| | | | | | This is to prevent spinning in a loop waiting for a lock. This hangs often, though I suspect this should have been fixed in the previous commit.
* FileBackend: don't transfer locks over async boundariesVika2021-12-311-169/+188
| | | | | | | This may or may not be the cause for the app hanging while waiting for a lock. Now the operations with locks are never performed over an async boundary, excluding any shenanigans that can happen when accidentally leaving a file locked over async boundaries.
* Add protected locations that are visible only to logged-in usersVika2021-12-071-1/+3
|
* Make rustfmt and clippy happyVika2021-12-061-11/+13
|
* Added support for IndieAuth client sign inVika2021-12-061-1/+1
| | | | | | | This will allow readers to view private posts intended just for them. Additionally fixed bugs in patterns due to which webmentions might not have been sent.
* Code cleanup and small bugfixing in templatesVika2021-12-052-70/+139
|
* Added author mini-cards on h-entriesVika2021-12-051-37/+69
|
* frontend: Added listing feeds to the header barVika2021-12-052-10/+6
|
* Get rid of the unsafe codeVika2021-12-021-7/+4
| | | | | | Thanks to @Kloenk I was able to get rid of the unsafety and tell the compiler how to properly check what I needed for the StorageError to be declared thread-safe.
* Deprecated Redis backend and added a database migration tool (untested, beware)Vika2021-10-273-20/+50
|
* Modified the module to use BACKEND_URIVika2021-09-281-0/+2
|
* Code cleanup and Cargo.lock updatesVika2021-09-272-4/+6
|
* Fix a bug in the error middlewareVika2021-09-271-0/+1
| | | | | | When an error is found, the site name passed to Storage::get_setting in the error handler is incorrect. The ASCII serialisation of the hostname should get used.
* Implemented support for channelsVika2021-09-273-65/+172
|
* Implemented FileStorage::delete_postVika2021-09-271-1/+4
|
* Finally figured out how to read without a BufReaderVika2021-09-271-14/+6
| | | | | BufReader was really unneccesary here, since I was batch-reading all of this in one go.