Skip to content

Commit

Permalink
bug fix: all down;
Browse files Browse the repository at this point in the history
  • Loading branch information
yhw2003 committed Dec 20, 2023
1 parent b1cfa47 commit 9ae9825
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,38 +78,40 @@ async fn clear_cookie() -> Result<(), io::Error> {
println!("Open sqlite file");
if input == "1" {
println!("Clearing cookies in Google Chrome of online.njtech.edu.cn");
let db_uri = format!("sqlite://{}", base_path_chrome.to_str().unwrap());
let pool = sqlx::SqlitePool::connect(&db_uri).await.unwrap();
let db_uri = format!("sqlite:file:{}?mode=rwc", base_path_chrome.to_str().unwrap());
let pool = sqlx::SqlitePool::connect(&db_uri).await.expect("Permission denied");
let _ = sqlx::query(
"
DELETE FROM cookies WHERE name = 'mars_token'
DELETE FROM cookies WHERE name = 'mars_token';
DELETE FROM cookies WHERE name = 'sso_validate_token';
",
)
.execute(&pool)
.await
.map_err(|e| panic!("Sqlite Error: {:?}", e));
.expect("sql error");
println!("Successe, press enter to continue");
std::io::stdin().read_line(&mut String::new())?;
return Ok(());
};
if input == "2" {
println!("Clearing cookies in FireFox of online.njtech.edu.cn");
println!("Open sqlite file");
if input == "1" {
println!("Clearing cookies in FireFox of online.njtech.edu.cn");
let db_uri = format!("sqlite://{}", base_path_firefox.to_str().unwrap());
let pool = sqlx::SqlitePool::connect(&db_uri).await.unwrap();
let _ = sqlx::query(
"
DELETE FROM moz_cookies WHERE name = 'mars_token'
",
)
.execute(&pool)
.await
.map_err(|e| panic!("Sqlite Error: {:?}", e));
return Ok(());
};
}
println!("Successe, press enter to continue\n You can also try to clear your browser cookies and restart it");
std::io::stdin().read_line(&mut String::new())?;
println!("Clearing cookies in FireFox of online.njtech.edu.cn");
let db_uri = format!("sqlite:file:{}?mode=rwc", base_path_firefox.to_str().unwrap());
let pool = sqlx::SqlitePool::connect(&db_uri).await.expect("Permission denied");
let _ = sqlx::query(
"
DELETE FROM moz_cookies WHERE name = 'mars_token';
DELETE FROM cookies WHERE name = 'sso_validate_token';
",
)
.execute(&pool)
.await
.expect("sql error");
println!("Successe, press enter to continue");
std::io::stdin().read_line(&mut String::new())?;
return Ok(());
};

Ok(())
}
Expand Down

1 comment on commit 9ae9825

@yhw2003
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean all down... QWQ

Please sign in to comment.