Panel: SCOPENET Map storage and endpoints; Vantage proxy removed

This commit is contained in:
Claude committed 2026-10-01 00:20:04 +00:00
1 parent c0daa0507a
commit 9102e2fc52
15 files changed
+751 -1286

No files matched your search

+18 -3
View File
@@ -39,9 +39,6 @@ pub async fn setup_with(tweak: impl FnOnce(&mut Config, &std::path::Path)) -> Te
max_upload_mb: 64,
public_url: Some("https://panel.test".into()),
trusted_proxies: vec!["127.0.0.1".parse().unwrap()],
vantage_bin: None,
vantage_assets: None,
vantage_args: vec![],
};
tweak(&mut cfg, dir.path());
let pool = db::connect_memory().await.unwrap();
@@ -66,6 +63,24 @@ impl TestApp {
self.send(req).await
}
/// POST raw bytes (binary uploads).
pub async fn call_raw(&self, method: &str, uri: &str, token: Option<&str>, body: Vec<u8>) -> (StatusCode, Value) {
let mut req = Request::builder().method(method).uri(uri).header("content-type", "application/octet-stream");
if let Some(t) = token {
req = req.header("authorization", format!("Bearer {t}"));
}
self.send(req.body(Body::from(body)).unwrap()).await
}
/// GET and keep the raw bytes (images).
pub async fn fetch(&self, uri: &str) -> (StatusCode, Vec<u8>) {
let mut req = Request::builder().method("GET").uri(uri).body(Body::empty()).unwrap();
req.extensions_mut().insert(axum::extract::ConnectInfo("127.0.0.1:12345".parse::<std::net::SocketAddr>().unwrap()));
let resp = self.router.clone().oneshot(req).await.unwrap();
let status = resp.status();
(status, axum::body::to_bytes(resp.into_body(), usize::MAX).await.unwrap().to_vec())
}
pub async fn send(&self, mut req: Request<Body>) -> (StatusCode, Value) {
if req.extensions().get::<axum::extract::ConnectInfo<std::net::SocketAddr>>().is_none() {
req.extensions_mut().insert(axum::extract::ConnectInfo("127.0.0.1:12345".parse::<std::net::SocketAddr>().unwrap()));