Error fixes

This commit is contained in:
murmeldin 2024-08-05 19:29:02 +02:00 committed by murmeldin
parent 8f09feb0fc
commit c4fc33bc50
4 changed files with 31 additions and 28 deletions

View file

@ -1,10 +1,12 @@
use crate::config_spec::{CfgField, CfgGroup};
use std::error::Error;
use lettre::{Message, SmtpTransport, Transport};
use lettre::message::{header, SinglePart};
use lettre::transport::smtp::authentication::Credentials;
use lettre::{Message, SmtpTransport, Transport};
use std::error::Error;
use uuid::Uuid;
use crate::config_spec::{CfgField, CfgGroup};
pub const CONFIG: CfgGroup<'static> = CfgGroup {
name: "email",
description: "Sending emails.",
@ -24,7 +26,7 @@ pub const CONFIG: CfgGroup<'static> = CfgGroup {
description: "Password for authenticating with the mail server.",
},
CfgField::Default {
key: "sender",
key: "from",
default: "Plenumsbot <plenum-bot@berlin.ccc.de>",
description: "Email address to use for \"From:\".",
},

View file

@ -1,3 +1,17 @@
use std::borrow::Cow;
use std::env;
use std::error::Error;
use chrono::{Datelike, Local, NaiveDate, Weekday};
use clap::{Arg, Command};
use regex::Regex;
use reqwest::blocking::Client;
use config_spec::{CfgField, CfgGroup, CfgSpec};
use email::{Email, SimpleEmail};
use hedgedoc::HedgeDoc;
use key_value::KeyValueStore as KV;
// Dies ist der Plenumsbot vom Chaos Computer Club Berlin.
/*
Plenumsbot
@ -34,29 +48,15 @@ future improvements:
*/
// Import other .rs files as modules
mod key_value;
use key_value::KeyValueStore as KV;
mod config_spec;
use config_spec::{CfgField, CfgGroup, CfgSpec};
mod template;
pub mod variables_and_settings;
mod email;
use email::{Email, SimpleEmail};
mod hedgedoc;
use hedgedoc::HedgeDoc;
mod mediawiki;
use std::borrow::Cow;
use std::env;
use std::error::Error;
use chrono::{Datelike, Local, NaiveDate, Weekday};
use clap::{Arg, Command};
use regex::Regex;
use reqwest::blocking::Client;
const FALLBACK_TEMPLATE: &str = variables_and_settings::FALLBACK_TEMPLATE;
/* ***** Config Spec ***** */
@ -217,7 +217,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let top_anzahl: i32 = 0; // Muss noch gecodet werden
let yesterday_was_plenum = true; // Das ist nur zu Testzwecken, kommt noch weg
let auth_result = mediawiki::get_login_token(&Client::new(), &config.get("wiki-http-user").expect("HTML User not found DB!"), &config.get("wiki-http-pass").expect("HTML Password not found DB!"))?;
let auth_result = mediawiki::get_login_token(&Client::new(), &config.get("wiki-http-user").expect("HTTP User not found DB!"), &config.get("wiki-http-password").expect("HTTP Password not found DB!"))?;
println!("---AUTH RESULT:---\n{}\n-----------", auth_result);
// TEMPORÄR ENDE

View file

@ -1,13 +1,14 @@
use crate::config_spec::{CfgField, CfgGroup};
use pandoc::{PandocError, PandocOutput};
use reqwest;
use reqwest::blocking::Client;
use reqwest::tls;
use serde::Deserialize;
use std::error::Error;
use std::fs::File;
use std::io::Read;
use pandoc::{PandocError, PandocOutput};
use reqwest;
use reqwest::blocking::Client;
use serde::Deserialize;
use crate::config_spec::{CfgField, CfgGroup};
pub const CONFIG: CfgGroup<'static> = CfgGroup {
name: "wiki",
description: "API Settings for Mediawiki",