fix: fixed PE infection
This commit is contained in:
@@ -3,26 +3,12 @@ pub mod user;
|
||||
|
||||
#[cfg(feature = "ssr")]
|
||||
pub fn get_db() -> Result<sqlx::SqlitePool, leptos::prelude::ServerFnError> {
|
||||
let owner = leptos::prelude::Owner::current().unwrap();
|
||||
tracing::debug!(
|
||||
"Getting DB; debug ID: {:?}; ancestry: {:?}; type ID: {:?}",
|
||||
owner.debug_id(),
|
||||
owner.ancestry(),
|
||||
std::any::TypeId::of::<sqlx::SqlitePool>(),
|
||||
);
|
||||
|
||||
use leptos::{prelude::*, server_fn::error::NoCustomError};
|
||||
|
||||
match use_context::<sqlx::SqlitePool>() {
|
||||
Some(v) => {
|
||||
tracing::debug!("Got db pool!");
|
||||
Ok(v)
|
||||
}
|
||||
None => {
|
||||
tracing::debug!("Didn't get db pool!");
|
||||
Err(ServerFnError::<NoCustomError>::ServerError(
|
||||
"Could not use database connection".to_string(),
|
||||
))
|
||||
}
|
||||
Some(v) => Ok(v),
|
||||
None => Err(ServerFnError::<NoCustomError>::ServerError(
|
||||
"Could not use database connection".to_string(),
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ pub async fn get_installer(btype: &str) -> Result<Vec<u8>, crate::error::Error>
|
||||
let path = match btype {
|
||||
"linux" => "target/x86_64-unknown-linux-musl/debug/sparse-unix-installer",
|
||||
"freebsd" => "target/x86_64-unknown-freebsd/debug/sparse-unix-installer",
|
||||
"windows" => "target/x86_64-pc-windows-gnu/debug/sparse-windows-installer",
|
||||
"windows" => "target/x86_64-pc-windows-gnu/debug/sparse-windows-installer.exe",
|
||||
other => {
|
||||
return Err(crate::error::Error::Generic(format!(
|
||||
"unknown beacon type: {other}"
|
||||
@@ -323,10 +323,6 @@ pub async fn serve_web(
|
||||
db: db.clone(),
|
||||
};
|
||||
|
||||
println!("{:?}", std::any::TypeId::of::<SqlitePool>());
|
||||
|
||||
dbg!(&routes);
|
||||
|
||||
let app = Router::new()
|
||||
.route(
|
||||
"/binaries/installer/:template_id",
|
||||
@@ -338,13 +334,6 @@ pub async fn serve_web(
|
||||
&state,
|
||||
routes,
|
||||
move || {
|
||||
let owner = leptos::prelude::Owner::current().unwrap();
|
||||
tracing::debug!(
|
||||
"Providing DB; debug ID: {:?}; ancestry: {:?}; type ID: {:?}",
|
||||
owner.debug_id(),
|
||||
owner.ancestry(),
|
||||
std::any::TypeId::of::<sqlx::SqlitePool>(),
|
||||
);
|
||||
provide_context(beacon_listeners.clone());
|
||||
provide_context(db.clone());
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user