checkpoint; logins broken somehow, maybe just from remote host
This commit is contained in:
parent
e93e43786f
commit
f58106ee36
4 changed files with 27 additions and 8 deletions
|
@ -46,7 +46,7 @@ pub async fn get_db_pool() -> SqlitePool {
|
|||
let conn_opts = SqliteConnectOptions::new()
|
||||
.foreign_keys(true)
|
||||
//.auto_vacuum(sqlx::sqlite::SqliteAutoVacuum::Incremental)
|
||||
.journal_mode(SqliteJournalMode::Memory)
|
||||
.journal_mode(SqliteJournalMode::Wal)
|
||||
.synchronous(sqlx::sqlite::SqliteSynchronous::Off)
|
||||
.filename(&db_filename)
|
||||
.busy_timeout(Duration::from_secs(TIMEOUT))
|
||||
|
@ -61,9 +61,9 @@ pub async fn get_db_pool() -> SqlitePool {
|
|||
.await
|
||||
.expect("can't connect to database");
|
||||
|
||||
let mut conn = pool.acquire().await.unwrap();
|
||||
conn.execute("PRAGMA cache_size = 1000000;").await.unwrap();
|
||||
conn.execute("PRAGMA temp_store = MEMORY;").await.unwrap();
|
||||
// let mut conn = pool.acquire().await.unwrap();
|
||||
// conn.execute("PRAGMA cache_size = 1000000;").await.unwrap();
|
||||
// conn.execute("PRAGMA temp_store = MEMORY;").await.unwrap();
|
||||
|
||||
// let the filesystem settle before trying anything
|
||||
// possibly not effective?
|
||||
|
|
16
src/db_id.rs
16
src/db_id.rs
|
@ -130,6 +130,22 @@ impl<'de> Visitor<'de> for DbIdVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
fn visit_string<E>(self, v: String) -> Result<Self::Value, E>
|
||||
where
|
||||
E: serde::de::Error,
|
||||
{
|
||||
DbId::from_string(&v)
|
||||
.map_err(|_| serde::de::Error::invalid_value(serde::de::Unexpected::Str(&v), &self))
|
||||
}
|
||||
|
||||
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
|
||||
where
|
||||
E: serde::de::Error,
|
||||
{
|
||||
DbId::from_string(v)
|
||||
.map_err(|_| serde::de::Error::invalid_value(serde::de::Unexpected::Str(v), &self))
|
||||
}
|
||||
|
||||
fn visit_byte_buf<E>(self, v: Vec<u8>) -> Result<Self::Value, E>
|
||||
where
|
||||
E: serde::de::Error,
|
||||
|
|
|
@ -70,9 +70,12 @@ pub async fn post_login(
|
|||
let pw = &login.password;
|
||||
let pw = pw.trim();
|
||||
|
||||
let user = User::try_get(username, &pool)
|
||||
.await
|
||||
.map_err(|_| LoginErrorKind::Unknown)?;
|
||||
let user = User::try_get(username, &pool).await.map_err(|e| {
|
||||
tracing::debug!("{e}");
|
||||
LoginErrorKind::Unknown
|
||||
})?;
|
||||
|
||||
dbg!(&user);
|
||||
|
||||
let verifier = Argon2::default();
|
||||
let hash = PasswordHash::new(&user.pwhash).map_err(|_| LoginErrorKind::Internal)?;
|
||||
|
|
|
@ -25,7 +25,7 @@ async fn main() {
|
|||
|
||||
let app = witch_watch::app(pool, &secret).await;
|
||||
|
||||
let addr: SocketAddr = ([127, 0, 0, 1], 3000).into();
|
||||
let addr: SocketAddr = ([0, 0, 0, 0], 3000).into();
|
||||
tracing::debug!("binding to {addr:?}");
|
||||
|
||||
axum::Server::bind(&addr)
|
||||
|
|
Loading…
Reference in a new issue