Commiting decryption/key extraction fixes before major refactor/new version.
This commit is contained in:
@@ -150,9 +150,12 @@ async fn run_bot() {
|
||||
|
||||
let config = Arc::new(Config::load().expect("Failed to load config"));
|
||||
|
||||
tokio::fs::create_dir_all("data").await.ok();
|
||||
|
||||
let db = Arc::new(Database::open("data/db.sqlite").expect("Failed to open database"));
|
||||
let db_path = std::path::PathBuf::from(&config.database_path);
|
||||
if let Some(parent) = db_path.parent() {
|
||||
tokio::fs::create_dir_all(parent).await.ok();
|
||||
}
|
||||
let db = Arc::new(Database::open(&db_path).expect("Failed to open database"));
|
||||
info!("Bot database opened at: {:?}", std::fs::canonicalize(&db_path).unwrap_or_else(|_| db_path.clone()));
|
||||
db.run_migrations().await.expect("Failed to run migrations");
|
||||
|
||||
let storage = Arc::new(CgcxStorage::new(config.storage.paths.clone()));
|
||||
@@ -741,10 +744,11 @@ async fn finalize_upload(
|
||||
}
|
||||
}
|
||||
|
||||
let content_id = ContentId::generate();
|
||||
let mut content_id = ContentId::generate();
|
||||
let repo = ContentRepo::new(ctx.db.conn());
|
||||
let mut attempts = 0;
|
||||
while repo.get(&content_id).await?.is_some() && attempts < 5 {
|
||||
content_id = ContentId::generate();
|
||||
attempts += 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user