summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/browser.rs4
-rw-r--r--src/config.rs1
-rw-r--r--src/main.rs2
3 files changed, 4 insertions, 3 deletions
diff --git a/src/browser.rs b/src/browser.rs
index de7efaf..4900f6c 100644
--- a/src/browser.rs
+++ b/src/browser.rs
@@ -5,8 +5,8 @@ use thirtyfour::{FirefoxCapabilities, WebDriver, WebDriverCommands};
const LOGIN_URL: &str = "https://studenti.smartedu.unict.it/WorkFlow2011/Logon/Logon.aspx";
-pub async fn init() -> WebDriver {
- let driver = match WebDriver::new("http://localhost:4444", FirefoxCapabilities::new()).await {
+pub async fn init(driver_url: &String) -> WebDriver {
+ let driver = match WebDriver::new(driver_url, FirefoxCapabilities::new()).await {
Ok(driver) => driver,
Err(_) => {
panic!("Firefox can't be opened");
diff --git a/src/config.rs b/src/config.rs
index 83ed7bd..3199c62 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -5,6 +5,7 @@ use serde::Deserialize;
pub struct Config {
pub cf: String,
pub password: String,
+ pub driver_url: String,
}
impl Config {
diff --git a/src/main.rs b/src/main.rs
index 5dc7607..b854f49 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -18,7 +18,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
let bot = Bot::from_env().auto_send();
let config = Config::from_env().unwrap();
- let driver: WebDriver = browser::init().await;
+ let driver: WebDriver = browser::init(&config.driver_url).await;
match browser::login(&driver, &config).await {
Ok(_) => {}
Err(e) => {