From fbe8e4b85ddb2781bf24f9576479c384a204172c Mon Sep 17 00:00:00 2001 From: murmeldin Date: Sat, 3 Aug 2024 00:11:27 +0200 Subject: [PATCH] added mediawiki config --- src/config_check.rs | 12 +++++++++++- src/mediawiki.rs | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/config_check.rs b/src/config_check.rs index ecd688b..4340691 100644 --- a/src/config_check.rs +++ b/src/config_check.rs @@ -42,7 +42,17 @@ const CONFIG_SPEC: CfgSpec<'static> = CfgSpec { CfgField::Optional { key: "last-message-id", description: "Message-Id of last initial announcement to send In-Reply-To (if applicable)." } ], }, - // TODO: Matrix, Wiki + CfgGroup { name: "wiki", + description: "API Settings for Mediawiki", + fields: &[ + CfgField::Default { key: "http-user", default: "cccb-wiki", description: "Username that would be needed if you would access the wiki with your web browser" }, + CfgField::Password { key: "http-pass", description: "Password that would be needed if you would access the wiki with your web browser" }, + CfgField::Default { key: "api-user", default: "PlenumBot@PlenumBot-PW1", description: "API Username that was generated in the mediawiki by the PlenumBot-Account" }, + CfgField::Password { key: "api-secret", description: "API Secret that was generated in the mediawiki by the PlenumBot-Account. Example: \"PlenumBot-PW1@mgeg89bgit09q8bjblt5tn5ojj2d4gy\"" }, + CfgField::Default { key: "server-url", default: "https://wiki.berlin.ccc.de/" , description: "Link that is needed for getting the session token" } + ], + }, + // TODO: Matrix, CfgGroup { name: "text", description: "Various strings used.", fields: &[ diff --git a/src/mediawiki.rs b/src/mediawiki.rs index 59fd025..df7d3ff 100644 --- a/src/mediawiki.rs +++ b/src/mediawiki.rs @@ -1,6 +1,7 @@ use std::error::Error; use std::fs::File; use std::io::Read; +use reqwest; pub fn pad_ins_wiki(old_pad_content: String) { convert_markdown_to_mediawiki_and_save_as_txt(old_pad_content); @@ -59,3 +60,8 @@ fn login_to_mediawiki( */ Ok(String::from("unimplemented")) } + +/// Authenticate with username and password on http basic auth +fn auth() { + +} \ No newline at end of file