From c00547c8437b992aa073378ab165aa40b073e1b4 Mon Sep 17 00:00:00 2001 From: Vika Date: Fri, 15 Jul 2022 02:18:14 +0300 Subject: PoC for modularity and WIP built-in Micropub client rework 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). --- kittybox-rs/src/frontend/onboarding.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'kittybox-rs/src/frontend') diff --git a/kittybox-rs/src/frontend/onboarding.rs b/kittybox-rs/src/frontend/onboarding.rs index 08a05ee..e9eceb2 100644 --- a/kittybox-rs/src/frontend/onboarding.rs +++ b/kittybox-rs/src/frontend/onboarding.rs @@ -145,3 +145,10 @@ pub async fn post( } } } + +pub fn router(database: S, http: reqwest::Client) -> axum::routing::MethodRouter { + axum::routing::get(get) + .post(post::) + .layer(axum::Extension(database)) + .layer(axum::Extension(http)) +} -- cgit 1.4.1