Skip to content

Commit

Permalink
✨ KoReader sync and API keys (#490)
Browse files Browse the repository at this point in the history
* start koreader sync effort

relates to #239

* add migration

* DEBUG: push unstable image

* wip: api keys

* wip: api key management

* wip: api key management

* wip: api key management table

* wip: build out create api key, fix middleware permissions

* i love coding on the plane

* wip: locale and new permission

* add migration

* refactor api params, wip docs improvements

* docs tweak, consume progress

* adjust doc comments

* oops

* wip: fix weird type issues

* fix drawer portable issue

* stop building image

* fix lints, add new option to scanner

* DEBUG: push unstable image

* tweak docs

* messing around

* stop building image

* persist koreader hash

* Revert "stop building image"

This reverts commit 060f0b7.

* update docs

* wip: more localization

* stop building image

* fix registered device table name

* use translations for api key root

* adjust docs, add basic tests

* update codegen

* push up last nights crude effort for force rebuild

* update docs

* add api_key middleware test, update docs
  • Loading branch information
aaronleopold authored Nov 9, 2024
1 parent 5935ed4 commit 4055495
Show file tree
Hide file tree
Showing 144 changed files with 4,154 additions and 651 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,8 @@ jobs:
tags: 'experimental'
load: ${{ github.event_name == 'pull_request' }}
push: ${{ github.event_name == 'push' }}
# tags: 'unstable'
# load: false
# push: true
archs: 'amd64'
discord-webhook: ${{ secrets.DISCORD_WEBHOOK }}
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
["cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
],
"tailwindCSS.classAttributes": ["class", "className", ".*ClassName", ".*CLASSES", ".*VARIANTS"],
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
37 changes: 33 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ lettre = { version = "0.11.4", default-features = false, features = [
"tracing",
"tokio1-rustls-tls",
] }
md5 = "0.7.0"
once_cell = "1.19.0"
prefixed-api-key = { version = "0.3.0", features = ["sha2"] }
prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust.git", tag = "0.6.11", features = [
"sqlite-create-many",
"migrations",
Expand All @@ -52,7 +54,7 @@ simple_crypt = "0.2.3"
specta = { version = "1.0.5", features = ["chrono", "url"] }
tempfile = "3.12.0"
thiserror = "1.0.63"
tokio = { version = "1.40.0", features = [
tokio = { version = "1.41.1", features = [
# Provides sender/reciever channels
"sync",
# Tells the Tokio runtime to use the multi-thread scheduler.
Expand Down
2 changes: 2 additions & 0 deletions apps/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jsonwebtoken = "9.3.0"
linemux = { git = "https://github.com/jmagnuson/linemux.git", rev = "acaafc602afac5d7a9cd3e087dafc937cac1e364" }
local-ip-address = "0.6.2"
once_cell = { workspace = true }
prefixed-api-key = { workspace = true}
prisma-client-rust = { workspace = true }
rand = "0.8.5"
reqwest = { workspace = true }
Expand Down Expand Up @@ -59,6 +60,7 @@ zip = { workspace = true }

[dev-dependencies]
axum-test = "15.3.1"
tokio = { workspace = true, features = ["full", "test-util"] }

[build-dependencies]
chrono = { workspace = true }
Expand Down
10 changes: 0 additions & 10 deletions apps/server/src/config/state.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
use std::sync::Arc;

use axum::extract::State;
use axum_macros::FromRequestParts;
use stump_core::Ctx;

// TODO: I don't feel like I need this module... Unless I add things to it..
pub type AppState = Arc<Ctx>;

// TODO: is this how to fix the FIXME note in auth extractor?
#[derive(FromRequestParts, Clone)]
pub struct _AppState {
#[allow(unused)]
core_ctx: State<AppState>,
}
6 changes: 6 additions & 0 deletions apps/server/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ impl From<MultipartError> for APIError {
}
}

impl From<prefixed_api_key::BuilderError> for APIError {
fn from(error: prefixed_api_key::BuilderError) -> Self {
APIError::InternalServerError(error.to_string())
}
}

impl From<reqwest::Error> for APIError {
fn from(error: reqwest::Error) -> Self {
APIError::InternalServerError(error.to_string())
Expand Down
Loading

0 comments on commit 4055495

Please sign in to comment.