pinakes-server: update remaining route imports and handlers
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I67206fd813d514f8903041eea0a4cd266a6a6964
This commit is contained in:
parent
2b2c1830a1
commit
eb6c0a3577
20 changed files with 169 additions and 87 deletions
|
|
@ -19,6 +19,7 @@ use pinakes_core::{
|
|||
ManagedStorageConfig,
|
||||
PhotoConfig,
|
||||
PluginsConfig,
|
||||
RateLimitConfig,
|
||||
ScanningConfig,
|
||||
ServerConfig,
|
||||
SharingConfig,
|
||||
|
|
@ -40,12 +41,12 @@ use pinakes_core::{
|
|||
use tokio::sync::RwLock;
|
||||
use tower::ServiceExt;
|
||||
|
||||
/// Fake socket address for tests (governor needs ConnectInfo<SocketAddr>)
|
||||
/// Fake socket address for tests (governor needs `ConnectInfo`<SocketAddr>)
|
||||
fn test_addr() -> ConnectInfo<SocketAddr> {
|
||||
ConnectInfo("127.0.0.1:9999".parse().unwrap())
|
||||
}
|
||||
|
||||
/// Build a GET request with ConnectInfo for rate limiter compatibility
|
||||
/// Build a GET request with `ConnectInfo` for rate limiter compatibility
|
||||
fn get(uri: &str) -> Request<Body> {
|
||||
let mut req = Request::builder().uri(uri).body(Body::empty()).unwrap();
|
||||
req.extensions_mut().insert(test_addr());
|
||||
|
|
@ -103,7 +104,10 @@ async fn setup_app_with_plugins()
|
|||
api_key: None,
|
||||
tls: TlsConfig::default(),
|
||||
authentication_disabled: true,
|
||||
cors_enabled: false,
|
||||
cors_origins: vec![],
|
||||
},
|
||||
rate_limits: RateLimitConfig::default(),
|
||||
ui: UiConfig::default(),
|
||||
accounts: AccountsConfig::default(),
|
||||
jobs: JobsConfig::default(),
|
||||
|
|
@ -123,7 +127,7 @@ async fn setup_app_with_plugins()
|
|||
};
|
||||
|
||||
let job_queue =
|
||||
JobQueue::new(1, |_id, _kind, _cancel, _jobs| tokio::spawn(async {}));
|
||||
JobQueue::new(1, 0, |_id, _kind, _cancel, _jobs| tokio::spawn(async {}));
|
||||
let config = Arc::new(RwLock::new(config));
|
||||
let scheduler = pinakes_core::scheduler::TaskScheduler::new(
|
||||
job_queue.clone(),
|
||||
|
|
@ -145,9 +149,11 @@ async fn setup_app_with_plugins()
|
|||
managed_storage: None,
|
||||
chunked_upload_manager: None,
|
||||
session_semaphore: Arc::new(tokio::sync::Semaphore::new(64)),
|
||||
webhook_dispatcher: None,
|
||||
};
|
||||
|
||||
let router = pinakes_server::app::create_router(state);
|
||||
let router =
|
||||
pinakes_server::app::create_router(state, &RateLimitConfig::default());
|
||||
(router, plugin_manager, temp_dir)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue