Move username and password to config file

This commit is contained in:
Neshura 2023-12-29 14:35:07 +01:00
parent 654bc5c7f8
commit 8d75aaa4f7
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C
6 changed files with 46 additions and 27 deletions
src/post_history

View file

@ -12,7 +12,12 @@ pub(crate) struct SeriesHistory {
impl SeriesHistory {
pub(crate) fn load_history() -> Result<Self, String> {
match Path::new("history.toml").exists() {
let path = confy::get_configuration_file_path(env!("CARGO_PKG_NAME"), "config").expect("Something went wrong with confy");
let config_dir = path.parent().expect("Something went wrong with confy");
match Path::new(format!("{}/history.toml", config_dir.to_str().expect("Conversion to str should not fail for a dir")).as_str()).exists() {
true => {
let file_contents: String = match fs::read_to_string("history.toml") {
Ok(data) => data,