about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
...
* kittybox-indieauth: axum helpers for responsesVika2022-07-222-13/+53
| | | | Some responses need to set Cache-Control and Pragma: no-cache headers according to RFC 6749.
* media: improve Metadata typingVika2022-07-213-14/+24
| | | | | | | | | | | | | content_type is now optional; if not specified, it will remain empty. `application/octet-stream` will be put on read in the frontend. Length is now represented as NonZeroUsize - why would you upload a zero-byte file when you can just conjure one from the void whenever you need one? This should save me a little bit of memory. Representing content_type as a typed MIME value would be the next logical step.
* .gitignore build artifacts and test dataVika2022-07-191-2/+3
|
* media: fix small files not being saved to disk properlyVika2022-07-193-11/+46
| | | | | It turns out that BufWriter requires calling `flush()` manually and doesn't do it on `drop()`. I forgot about that.
* indieauth: Indicate refresh token grant as supportedVika2022-07-191-1/+1
|
* kittybox-indieauth: convert Error into axum::response::ResponseVika2022-07-195-22/+52
| | | | | | This requires the `axum` feature to be enabled, to prevent unwanted dependencies (e.g. in client apps or when using a different framework, since the library doesn't concern itself with I/O)
* indieauth: improve security checksVika2022-07-191-2/+29
| | | | | Client ID and the redirect URI must match those that were used to create the grant.
* Implement /.well-known/oauth-authorization-serverVika2022-07-192-24/+39
| | | | | This may help non-IndieAuth-aware clients to integrate better into the flow.
* kittybox-indieauth: improve docs and the Error typeVika2022-07-193-36/+157
| | | | | | | `kittybox_indieauth::Error` now represents errors in the IndieAuth process itself. `IndieAuthError` got renamed to `ResourceErrorKind` to reflect errors that a resource server (i.e. IndieAuth consumer) might return to a client who somehow didn't authorize themselves properly.
* Catch panics on requestsVika2022-07-192-4/+5
| | | | | | | | | This will allow to display a prettier error page in the future. There is a possibility of instantiating the panic handler per-module to allow for custom panic messages expressed in the same form the module itself gives error messages (e.g. pretty HTML for frontend, MicropubError for Micropub messages etc.)
* PoC for modularity and WIP built-in Micropub client reworkVika2022-07-1510-244/+402
| | | | | | | | | | | | | | | | | | | | | | | | | This is the living, breathing proof that Kittybox can be split into independent components without sacrificing any functionality. Just make sure all neccesary backing storage components are available to the modules that need them. Also the Micropub client was split into several files, because it's about to get much bigger and more full-featured. Yes, I am going to write it in vanilla JavaScript. I don't trust anything from NPM to run on my computer. Not anymore. Not after the node-ipc malware fiasco. And I am definitely not going to spin up a VM or a Docker container (who uses Docker containers as a security measure?) to hack on my own code. Cargo can at least be sandboxed inside Nix, where it can't do much harm. NPM basically requires unrestricted network access to download dependencies, and it runs arbitrary code upon **downloading** them. Cargo and rust-analyzer, on the other hand, can be configured to not trust the source code and its dependencies (for example, Cargo doesn't execute code on fetching dependencies - only on building, and rust-analyzer's proc-macro expansion support can be sacrificed for more security).
* README.md: Update according to current project statusVika2022-07-151-7/+6
|
* WIP: IndieAuth progressVika2022-07-155-4/+398
| | | | | | | | | | | | - Some kittybox-indieauth crate bugs were fixed - Things should mostly work... - ...if you somehow supply your own backend store - YES I MADE IT MODULAR AGAIN - NO I AM NOT SORRY - YOU WILL THANK ME LATER - DO NOT DENY THE HEAVENLY GIFT OF GENERICS IN RUST - Retrieving profiles doesn't work for now because I am unsure how to implement it best
* Add enum for requests that the authorization endpoint may encounterVika2022-07-151-1/+8
| | | | | | Really, it should be `Either<AuthorizationRequest, GrantRequest>` but either serde or axum got iffy about me deserializing it from a form. Not sure which one.
* kittybox-indieauth: add From impls for TokenIntrospectionResponseVika2022-07-151-0/+16
| | | | | | | | | This makes converting Option<TokenData> into a response and vice versa a breeze, and hide the complexity of TokenIntrospectionResponse forced upon this library by the IndieAuth standard. Really, this type should've been represented as Option<TokenData>, I just don't know how to add the "active" field to it properly.
* media: buffer disk I/O and add debug loggingVika2022-07-142-11/+36
| | | | It looks like buffering reads can double my performance. Nice.
* kittybox-indieauth: improve types and make more of them publicVika2022-07-105-15/+51
|
* kittybox-indieauth: implement FromStr for ScopesVika2022-07-101-3/+12
|
* media: fix failing testVika2022-07-101-1/+1
|
* Security bugfix: fix Scopes::has_all() incorrectly checking scopesVika2022-07-101-2/+15
| | | | | Turns out it was comparing the list of required scopes with **itself**. Oops, that's a major security issue.
* kittybox-indieauth: initVika2022-07-106-2/+535
| | | | | | | | | | This crate is the base framework-agnostic implementation of all data structures and methods required for IndieAuth protocol. Anything that can deserialize HTTP request payloads with serde can utilize this crate. This is a good candidate to independently release on crates.io when the interface becomes stable enough.
* database: use .path().to_path_buf() to prevent dropping the tempdirVika2022-07-101-1/+3
| | | | | I'm afraid this might've caused me to do some weird stuff with the tempdir. Better do it like this.
* micropub: handle invalid/empty query properlyVika2022-07-101-6/+16
| | | | On query parsing error, this will return a MicropubError.
* micropub: move MicropubError into kittybox-utilVika2022-07-106-87/+112
| | | | | Looks like this shared data structure will be useful to me later when splitting off the media endpoint into its own crate.
* indieauth: rename to tokenauthVika2022-07-107-12/+12
| | | | | | | | | | | | This frees up the name for the future in-house IndieAuth implementation and also clarifies the purpose of this module. Its future is uncertain - most probably when the token endpoint gets finished, it will transform into a way to query that token endpoint. But then, the media endpoint also depends on it, so I might have to copy that implementation (that queries an external token endpoint) and make it generic enough so I could both query an external endpoint or use internal data.
* media: media endpoint PoCVika2022-07-108-154/+350
| | | | | | | | | | Supported features: - Streaming upload - Content-addressed storage - Metadata - MIME type (taken from Content-Type) - Length (I could use stat() for this one tho) - filename (for Content-Disposition: attachment, WIP)
* .envrc: watch shell.nix for changesVika2022-07-071-0/+1
|
* .envrc: update nix-direnv install invocationVika2022-07-071-3/+6
|
* Add rustfmt to shell.nixVika2022-07-071-2/+2
|
* format using rustfmtVika2022-07-0712-202/+228
|
* treewide: rewrite using AxumVika2022-07-0718-2859/+2075
| | | | | | | | | | | | | | Axum has streaming bodies and allows to write simpler code. It also helps enforce stronger types and looks much more neat. This allows me to progress on the media endpoint and add streaming reads and writes to the MediaStore trait. Metrics are temporarily not implemented. Everything else was preserved, and the tests still pass, after adjusting for new calling conventions. TODO: create method routers for protocol endpoints
* flake.lock: UpdateVika2022-07-071-9/+9
| | | | | | | | | | | | | | Flake lock file updates: • Updated input 'flake-utils': 'github:numtide/flake-utils/f7e004a55b120c02ecb6219596820fcd32ca8772' (2021-06-16) → 'github:numtide/flake-utils/7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249' (2022-07-04) • Updated input 'naersk': 'github:nmattia/naersk/f21309b38e1da0d61b881b6b6d41b81c1aed4e1d' (2022-05-03) → 'github:nmattia/naersk/cddffb5aa211f50c4b8750adbec0bbbdfb26bb9f' (2022-06-12) • Updated input 'nixpkgs': 'github:nixos/nixpkgs/dfd82985c273aac6eced03625f454b334daae2e8' (2022-05-20) → 'github:nixos/nixpkgs/71a4f0dc3d80ba76f437c888c1c3d59f1df98163' (2022-07-05)
* feat: group endpoints under `.kittybox`Vika2022-06-026-74/+57
| | | | | Actually got the idea from https://xeiaso.net/, who groups xer website's endpoints under the `.within` folder.
* direnv: move .envrc to kittybox-rsVika2022-05-281-0/+0
|
* frontend: fix onboarding sending the request to the wrong placeVika2022-05-261-2/+2
|
* flake.nix: move the devShell into its own fileVika2022-05-262-13/+20
|
* Remove redundant naersk-lib overrideVika2022-05-262-6/+5
|
* flake.nix: reorganizeVika2022-05-2441-281/+275
| | | | | | | | | | | | - 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
* flake.nix: use rustc from nixpkgs every timeVika2022-05-242-60/+6
|
* flake.lock: UpdateVika2022-05-241-4/+4
| | | | | | | | Flake lock file updates: • Updated input 'nixpkgs': 'github:vikanezrimaya/nixpkgs/bf819aeeb2f0954506a748ff117962edc8cf732d' (2022-03-28) → 'github:nixos/nixpkgs/dfd82985c273aac6eced03625f454b334daae2e8' (2022-05-20)
* flake.nix: make a test for distributed KittyboxVika2022-05-242-4/+105
| | | | | | | | | | | I said some boastful words about Kittybox being able to horizontally scale and I wanted to prove them. This is the proof. This test creates an NFS file server, then spawns three VMs. Provisioning a website on one of them, it then queries the website on all of the three machines. This shows that a shared backing store can make Kittybox infinitely scale horizontally depending on how much traffic you're getting.
* gitignore: ignore token fileVika2022-05-231-0/+1
|
* templates: prepare for facepiles a bit betterVika2022-05-231-16/+29
| | | | | | | | This bit of code is still disabled for now though. I need to actually gather and render facepiles. Additionally, now details won't even show if there were no reactions to the post, which saves space.
* templates: render like and bookmark posts correctlyVika2022-05-232-1/+109
| | | | | | | | | | | | | They really use the same framework, so for now a unit test for like posts is sufficient. Of course, for proper coverage, one can introduce tests for bookmarks too, especially if one chooses to render them differently. The logic will be pretty much the same though. Replies might use the same logic, since those are also Webmention-oriented posts. (It looks like another way to classify MF2 documents is slowly forming in my brain. Maybe I should write about it on my blog.)
* templates: simplify logicVika2022-05-231-24/+29
| | | | | | | There were lots of unneccesary Option::unwrap() invocations that could be replaced with `if let` statements. This makes the code cleaner and less likely to panic in case a corrupted, incomplete or manually injected MF2-JSON document needs to be rendered.
* templates: add a banner for Kittybox in the footerVika2022-05-232-0/+10
| | | | Now everyone will know where to get my software if they see it.
* templates: add unit test for articlesVika2022-05-231-45/+116
| | | | | | It mostly checks the same old things as with notes, but does check for a name (and as it's explicitly provided, it does work with the buggy version of the `microformats` crate.
* templates: more MF2 generatorsVika2022-05-231-5/+62
| | | | | | | | | | New generators include: - Articles (h-entry with a name) - Replies (notes with an in-reply-to) - Likes (h-entries with a like-of) For replies and likes, there are variants with an h-cite (full reply context) or a link (partial reply context).
* templates: introduce unit testsVika2022-05-233-0/+165
| | | | | | | | | | | | | | | These unit tests generate a random MF2-JSON post, convert it to MF2-HTML using the template and then read it back using the `microformats` crate. The only problem is that it has a nasty bug with overstuffing implied properties. This is being worked on: https://gitlab.com/maxburon/microformats-parser/-/issues/7 For now the tests marked as ignored because they fail. But the function itself that generates them should remain here for documentation and potential code sharing with the `microformats` crate, potentially even migrating to a subcrate there.
* chore: code cleanup in main.rsVika2022-05-141-8/+6
|