From 6605af7bedb980c02eebf8cc6af9aa2fe68d28c5 Mon Sep 17 00:00:00 2001 From: notplants Date: Mon, 8 Nov 2021 16:55:58 +0100 Subject: [PATCH] Fix clippy errors --- peach-lib/src/password_utils.rs | 4 +- peach-web/src/routes/authentication.rs | 14 +++--- peach-web/src/routes/device.rs | 12 ++--- peach-web/src/routes/index.rs | 2 +- peach-web/src/routes/ping.rs | 8 +-- peach-web/src/routes/scuttlebutt.rs | 6 +-- peach-web/src/routes/settings/admin.rs | 8 +-- peach-web/src/routes/settings/dns.rs | 6 +-- peach-web/src/routes/settings/network.rs | 62 ++++++++++++------------ peach-web/src/utils.rs | 2 +- 10 files changed, 62 insertions(+), 62 deletions(-) diff --git a/peach-lib/src/password_utils.rs b/peach-lib/src/password_utils.rs index f0e84b9..8612329 100644 --- a/peach-lib/src/password_utils.rs +++ b/peach-lib/src/password_utils.rs @@ -45,7 +45,7 @@ pub fn set_new_password(new_password: &str) -> Result<(), PeachError> { Ok(_) => { Ok(()) }, - Err(err) => { + Err(_err) => { Err(PeachError::FailedToSetNewPassword { msg: "failed to save password hash".to_string() }) } } @@ -67,7 +67,7 @@ pub fn set_new_temporary_password(new_password: &str) -> Result<(), PeachError> Ok(_) => { Ok(()) }, - Err(err) => { + Err(_err) => { Err(PeachError::FailedToSetNewPassword { msg: "failed to save temporary password hash".to_string() }) } } diff --git a/peach-web/src/routes/authentication.rs b/peach-web/src/routes/authentication.rs index 9bcdf2d..3e0670a 100644 --- a/peach-web/src/routes/authentication.rs +++ b/peach-web/src/routes/authentication.rs @@ -1,4 +1,4 @@ -use log::{debug, info}; +use log::{info}; use rocket::request::{FlashMessage}; use rocket::form::{Form, FromForm}; use rocket::response::{Flash, Redirect}; @@ -15,8 +15,8 @@ use crate::utils::{build_json_response, TemplateOrRedirect}; use rocket::serde::json::Value; use rocket::request::{self, FromRequest, Request}; use rocket::http::{Cookie, CookieJar, Status}; -use rocket::outcome::IntoOutcome; -use websocket::futures::future::Ok; + + // HELPERS AND STRUCTS FOR AUTHENTICATION WITH COOKIES @@ -47,7 +47,7 @@ impl<'r> FromRequest<'r> for Authenticated { .cookies() .get_private(AUTH_COOKIE_KEY) .and_then(|cookie| cookie.value().parse().ok()) - .map(|value: String| { Authenticated { is_authenticated: true } }); + .map(|_value: String| { Authenticated { is_authenticated: true } }); match authenticated { Some(auth) => { request::Outcome::Success(auth) @@ -373,7 +373,7 @@ pub fn save_password_form(password_form: PasswordForm) -> Result<(), PeachWebErr /// Change password request handler. This is used by a user who is already logged in. #[get("/settings/change_password")] -pub fn change_password(flash: Option, auth: Authenticated) -> Template { +pub fn change_password(flash: Option, _auth: Authenticated) -> Template { let mut context = ChangePasswordContext::build(); // set back icon link to network route context.back = Some("/network".to_string()); @@ -389,7 +389,7 @@ pub fn change_password(flash: Option, auth: Authenticated) -> Temp /// Change password form request handler. This route is used by a user who is already logged in. #[post("/settings/change_password", data = "")] -pub fn change_password_post(password_form: Form, auth: Authenticated) -> Template { +pub fn change_password_post(password_form: Form, _auth: Authenticated) -> Template { let result = save_password_form(password_form.into_inner()); match result { Ok(_) => { @@ -416,7 +416,7 @@ pub fn change_password_post(password_form: Form, auth: Authenticat /// JSON change password form request handler. #[post("/api/v1/settings/change_password", data = "")] -pub fn save_password_form_endpoint(password_form: Json, auth: Authenticated) -> Value { +pub fn save_password_form_endpoint(password_form: Json, _auth: Authenticated) -> Value { let result = save_password_form(password_form.into_inner()); match result { Ok(_) => { diff --git a/peach-web/src/routes/device.rs b/peach-web/src/routes/device.rs index ef5af99..d06983b 100644 --- a/peach-web/src/routes/device.rs +++ b/peach-web/src/routes/device.rs @@ -151,7 +151,7 @@ impl DeviceContext { } #[get("/device")] -pub fn device_stats(flash: Option, auth: Authenticated) -> Template { +pub fn device_stats(flash: Option, _auth: Authenticated) -> Template { // assign context through context_builder call let mut context = DeviceContext::build(); context.back = Some("/".to_string()); @@ -182,7 +182,7 @@ pub fn reboot() -> io::Result { } #[get("/device/reboot")] -pub fn reboot_cmd(auth: Authenticated) -> Flash { +pub fn reboot_cmd(_auth: Authenticated) -> Flash { match reboot() { Ok(_) => Flash::success(Redirect::to("/shutdown"), "Rebooting the device"), Err(_) => Flash::error(Redirect::to("/shutdown"), "Failed to reboot the device"), @@ -191,7 +191,7 @@ pub fn reboot_cmd(auth: Authenticated) -> Flash { /// JSON request handler for device reboot. #[post("/api/v1/device/reboot")] -pub fn reboot_device(auth: Authenticated) -> Value { +pub fn reboot_device(_auth: Authenticated) -> Value { match reboot() { Ok(_) => { debug!("Going down for reboot..."); @@ -220,7 +220,7 @@ pub fn shutdown() -> io::Result { } #[get("/device/shutdown")] -pub fn shutdown_cmd(auth: Authenticated) -> Flash { +pub fn shutdown_cmd(_auth: Authenticated) -> Flash { match shutdown() { Ok(_) => Flash::success(Redirect::to("/shutdown"), "Shutting down the device"), Err(_) => Flash::error(Redirect::to("/shutdown"), "Failed to shutdown the device"), @@ -229,7 +229,7 @@ pub fn shutdown_cmd(auth: Authenticated) -> Flash { // shutdown the device #[post("/api/v1/device/shutdown")] -pub fn shutdown_device(auth: Authenticated) -> Value { +pub fn shutdown_device(_auth: Authenticated) -> Value { match shutdown() { Ok(_) => { debug!("Going down for shutdown..."); @@ -268,7 +268,7 @@ impl ShutdownContext { } #[get("/shutdown")] -pub fn shutdown_menu(flash: Option, auth: Authenticated) -> Template { +pub fn shutdown_menu(flash: Option, _auth: Authenticated) -> Template { let mut context = ShutdownContext::build(); context.back = Some("/".to_string()); context.title = Some("Shutdown Device".to_string()); diff --git a/peach-web/src/routes/index.rs b/peach-web/src/routes/index.rs index 2d976f5..1ca4443 100644 --- a/peach-web/src/routes/index.rs +++ b/peach-web/src/routes/index.rs @@ -24,7 +24,7 @@ impl HomeContext { } #[get("/")] -pub fn index(auth: Authenticated) -> Template { +pub fn index(_auth: Authenticated) -> Template { let context = HomeContext { flash_name: None, flash_msg: None, diff --git a/peach-web/src/routes/ping.rs b/peach-web/src/routes/ping.rs index 0c94141..aed39ec 100644 --- a/peach-web/src/routes/ping.rs +++ b/peach-web/src/routes/ping.rs @@ -12,7 +12,7 @@ use crate::routes::authentication::Authenticated; /// Status route: useful for checking connectivity from web client. #[get("/api/v1/ping")] -pub fn ping_pong(auth: Authenticated) -> Value { +pub fn ping_pong(_auth: Authenticated) -> Value { //pub fn ping_pong() -> Value { // ping pong let status = "success".to_string(); @@ -22,7 +22,7 @@ pub fn ping_pong(auth: Authenticated) -> Value { /// Status route: check availability of `peach-network` microservice. #[get("/api/v1/ping/network")] -pub fn ping_network(auth: Authenticated) -> Value { +pub fn ping_network(_auth: Authenticated) -> Value { match network_client::ping() { Ok(_) => { debug!("peach-network responded successfully"); @@ -41,7 +41,7 @@ pub fn ping_network(auth: Authenticated) -> Value { /// Status route: check availability of `peach-oled` microservice. #[get("/api/v1/ping/oled")] -pub fn ping_oled(auth: Authenticated) -> Value { +pub fn ping_oled(_auth: Authenticated) -> Value { match oled_client::ping() { Ok(_) => { debug!("peach-oled responded successfully"); @@ -60,7 +60,7 @@ pub fn ping_oled(auth: Authenticated) -> Value { /// Status route: check availability of `peach-stats` microservice. #[get("/api/v1/ping/stats")] -pub fn ping_stats(auth: Authenticated) -> Value { +pub fn ping_stats(_auth: Authenticated) -> Value { match stats_client::ping() { Ok(_) => { debug!("peach-stats responded successfully"); diff --git a/peach-web/src/routes/scuttlebutt.rs b/peach-web/src/routes/scuttlebutt.rs index 1934ce7..7e9200d 100644 --- a/peach-web/src/routes/scuttlebutt.rs +++ b/peach-web/src/routes/scuttlebutt.rs @@ -28,7 +28,7 @@ impl MessageContext { } #[get("/messages")] -pub fn messages(flash: Option, auth: Authenticated) -> Template { +pub fn messages(flash: Option, _auth: Authenticated) -> Template { let mut context = MessageContext::build(); context.back = Some("/".to_string()); context.title = Some("Private Messages".to_string()); @@ -63,7 +63,7 @@ impl PeerContext { } #[get("/peers")] -pub fn peers(flash: Option, auth: Authenticated) -> Template { +pub fn peers(flash: Option, _auth: Authenticated) -> Template { let mut context = PeerContext::build(); context.back = Some("/".to_string()); context.title = Some("Scuttlebutt Peers".to_string()); @@ -98,7 +98,7 @@ impl ProfileContext { } #[get("/profile")] -pub fn profile(flash: Option, auth: Authenticated) -> Template { +pub fn profile(flash: Option, _auth: Authenticated) -> Template { let mut context = ProfileContext::build(); context.back = Some("/".to_string()); context.title = Some("Profile".to_string()); diff --git a/peach-web/src/routes/settings/admin.rs b/peach-web/src/routes/settings/admin.rs index 899c2f8..4f8980a 100644 --- a/peach-web/src/routes/settings/admin.rs +++ b/peach-web/src/routes/settings/admin.rs @@ -41,7 +41,7 @@ impl ConfigureAdminContext { /// View and delete currently configured admin. #[get("/settings/configure_admin")] -pub fn configure_admin(flash: Option, auth: Authenticated) -> Template { +pub fn configure_admin(flash: Option, _auth: Authenticated) -> Template { let mut context = ConfigureAdminContext::build(); // set back icon link to network route context.back = Some("/network".to_string()); @@ -88,7 +88,7 @@ pub fn save_add_admin_form(admin_form: AddAdminForm) -> Result<(), PeachWebError } #[get("/settings/admin/add")] -pub fn add_admin(flash: Option, auth: Authenticated) -> Template { +pub fn add_admin(flash: Option, _auth: Authenticated) -> Template { let mut context = AddAdminContext::build(); context.back = Some("/settings/configure_admin".to_string()); context.title = Some("Add Admin".to_string()); @@ -103,7 +103,7 @@ pub fn add_admin(flash: Option, auth: Authenticated) -> Template { } #[post("/settings/admin/add", data = "")] -pub fn add_admin_post(add_admin_form: Form, auth: Authenticated) -> Flash { +pub fn add_admin_post(add_admin_form: Form, _auth: Authenticated) -> Flash { let result = save_add_admin_form(add_admin_form.into_inner()); let url = uri!(configure_admin); match result { @@ -120,7 +120,7 @@ pub struct DeleteAdminForm { } #[post("/settings/admin/delete", data = "")] -pub fn delete_admin_post(delete_admin_form: Form, auth: Authenticated) -> Flash { +pub fn delete_admin_post(delete_admin_form: Form, _auth: Authenticated) -> Flash { let result = config_manager::delete_ssb_admin_id(&delete_admin_form.ssb_id); let url = uri!(configure_admin); match result { diff --git a/peach-web/src/routes/settings/dns.rs b/peach-web/src/routes/settings/dns.rs index 5b3df65..7bca89c 100644 --- a/peach-web/src/routes/settings/dns.rs +++ b/peach-web/src/routes/settings/dns.rs @@ -114,7 +114,7 @@ impl ConfigureDNSContext { } #[get("/network/dns")] -pub fn configure_dns(flash: Option, auth: Authenticated) -> Template { +pub fn configure_dns(flash: Option, _auth: Authenticated) -> Template { let mut context = ConfigureDNSContext::build(); // set back icon link to network route context.back = Some("/network".to_string()); @@ -129,7 +129,7 @@ pub fn configure_dns(flash: Option, auth: Authenticated) -> Templa } #[post("/network/dns", data = "")] -pub fn configure_dns_post(dns: Form, auth: Authenticated) -> Template { +pub fn configure_dns_post(dns: Form, _auth: Authenticated) -> Template { let result = save_dns_configuration(dns.into_inner()); match result { Ok(_) => { @@ -154,7 +154,7 @@ pub fn configure_dns_post(dns: Form, auth: Authenticated) -> Template { } #[post("/api/v1/dns/configure", data = "")] -pub fn save_dns_configuration_endpoint(dns_form: Json, auth: Authenticated) -> Value { +pub fn save_dns_configuration_endpoint(dns_form: Json, _auth: Authenticated) -> Value { let result = save_dns_configuration(dns_form.into_inner()); match result { Ok(_) => { diff --git a/peach-web/src/routes/settings/network.rs b/peach-web/src/routes/settings/network.rs index 0c07092..9b80a37 100644 --- a/peach-web/src/routes/settings/network.rs +++ b/peach-web/src/routes/settings/network.rs @@ -39,7 +39,7 @@ pub struct WiFi { // HELPERS AND ROUTES FOR /network/wifi/usage/reset #[get("/network/wifi/usage/reset")] -pub fn wifi_usage_reset(auth: Authenticated) -> Flash { +pub fn wifi_usage_reset(_auth: Authenticated) -> Flash { let url = uri!(wifi_usage); match monitor::reset_data() { Ok(_) => Flash::success(Redirect::to(url), "Reset stored network traffic total"), @@ -51,7 +51,7 @@ pub fn wifi_usage_reset(auth: Authenticated) -> Flash { } #[post("/network/wifi/connect", data = "")] -pub fn connect_wifi(network: Form, auth: Authenticated) -> Flash { +pub fn connect_wifi(network: Form, _auth: Authenticated) -> Flash { let ssid = &network.ssid; let url = uri!(network_detail(ssid = ssid)); match network_client::id("wlan0", ssid) { @@ -64,7 +64,7 @@ pub fn connect_wifi(network: Form, auth: Authenticated) -> Flash } #[post("/network/wifi/disconnect", data = "")] -pub fn disconnect_wifi(network: Form, auth: Authenticated) -> Flash { +pub fn disconnect_wifi(network: Form, _auth: Authenticated) -> Flash { let ssid = &network.ssid; let url = uri!(network_home); match network_client::disable("wlan0", ssid) { @@ -74,7 +74,7 @@ pub fn disconnect_wifi(network: Form, auth: Authenticated) -> Flash, auth: Authenticated) -> Flash { +pub fn forget_wifi(network: Form, _auth: Authenticated) -> Flash { let ssid = &network.ssid; let url = uri!(network_home); match network_client::forget("wlan0", ssid) { @@ -87,7 +87,7 @@ pub fn forget_wifi(network: Form, auth: Authenticated) -> Flash } #[get("/network/wifi/modify?")] -pub fn wifi_password(ssid: &str, flash: Option, auth: Authenticated) -> Template { +pub fn wifi_password(ssid: &str, flash: Option, _auth: Authenticated) -> Template { let mut context = NetworkAddContext { back: Some("/network/wifi".to_string()), flash_name: None, @@ -106,7 +106,7 @@ pub fn wifi_password(ssid: &str, flash: Option, auth: Authenticate } #[post("/network/wifi/modify", data = "")] -pub fn wifi_set_password(wifi: Form, auth: Authenticated) -> Flash { +pub fn wifi_set_password(wifi: Form, _auth: Authenticated) -> Flash { let ssid = &wifi.ssid; let pass = &wifi.pass; let url = uri!(network_detail(ssid = ssid)); @@ -274,7 +274,7 @@ impl NetworkContext { } #[get("/network")] -pub fn network_home(flash: Option, auth: Authenticated) -> Template { +pub fn network_home(flash: Option, _auth: Authenticated) -> Template { // assign context through context_builder call let mut context = NetworkContext::build(); // set back button (nav) url @@ -294,7 +294,7 @@ pub fn network_home(flash: Option, auth: Authenticated) -> Templat // HELPERS AND ROUTES FOR /network/ap/activate #[get("/network/ap/activate")] -pub fn deploy_ap(auth: Authenticated) -> Flash { +pub fn deploy_ap(_auth: Authenticated) -> Flash { // activate the wireless access point debug!("Activating WiFi access point."); match network_client::activate_ap() { @@ -376,7 +376,7 @@ impl NetworkListContext { } #[get("/network/wifi")] -pub fn wifi_list(flash: Option, auth: Authenticated) -> Template { +pub fn wifi_list(flash: Option, _auth: Authenticated) -> Template { // assign context through context_builder call let mut context = NetworkListContext::build(); context.back = Some("/network".to_string()); @@ -541,7 +541,7 @@ impl NetworkDetailContext { } #[get("/network/wifi?")] -pub fn network_detail(ssid: &str, flash: Option, auth: Authenticated) -> Template { +pub fn network_detail(ssid: &str, flash: Option, _auth: Authenticated) -> Template { // assign context through context_builder call let mut context = NetworkDetailContext::build(); context.back = Some("/network/wifi".to_string()); @@ -560,7 +560,7 @@ pub fn network_detail(ssid: &str, flash: Option, auth: Authenticat // HELPERS AND ROUTES FOR /network/wifi/activate #[get("/network/wifi/activate")] -pub fn deploy_client(auth: Authenticated) -> Flash { +pub fn deploy_client(_auth: Authenticated) -> Flash { // activate the wireless client debug!("Activating WiFi client mode."); match network_client::activate_client() { @@ -572,7 +572,7 @@ pub fn deploy_client(auth: Authenticated) -> Flash { // HELPERS AND ROUTES FOR /network/wifi/add #[get("/network/wifi/add")] -pub fn network_add_wifi(flash: Option, auth: Authenticated) -> Template { +pub fn network_add_wifi(flash: Option, _auth: Authenticated) -> Template { let mut context = NetworkContext::build(); // set back icon link to network route context.back = Some("/network".to_string()); @@ -610,7 +610,7 @@ impl NetworkAddContext { } #[get("/network/wifi/add?")] -pub fn network_add_ssid(ssid: &str, flash: Option, auth: Authenticated) -> Template { +pub fn network_add_ssid(ssid: &str, flash: Option, _auth: Authenticated) -> Template { let mut context = NetworkAddContext::build(); context.back = Some("/network/wifi".to_string()); context.selected = Some(ssid.to_string()); @@ -626,7 +626,7 @@ pub fn network_add_ssid(ssid: &str, flash: Option, auth: Authentic } #[post("/network/wifi/add", data = "")] -pub fn add_credentials(wifi: Form, auth: Authenticated) -> Template { +pub fn add_credentials(wifi: Form, _auth: Authenticated) -> Template { // check if the credentials already exist for this access point // note: this is nicer but it's an unstable feature: // if check_saved_aps(&wifi.ssid).contains(true) @@ -720,7 +720,7 @@ impl NetworkAlertContext { } #[get("/network/wifi/usage")] -pub fn wifi_usage(flash: Option, auth: Authenticated) -> Template { +pub fn wifi_usage(flash: Option, _auth: Authenticated) -> Template { let mut context = NetworkAlertContext::build(); // set back icon link to network route context.back = Some("/network".to_string()); @@ -736,7 +736,7 @@ pub fn wifi_usage(flash: Option, auth: Authenticated) -> Template } #[post("/network/wifi/usage", data = "")] -pub fn wifi_usage_alerts(thresholds: Form, auth: Authenticated) -> Flash { +pub fn wifi_usage_alerts(thresholds: Form, _auth: Authenticated) -> Flash { match monitor::update_store(thresholds.into_inner()) { Ok(_) => { debug!("WiFi data usage thresholds updated."); @@ -756,7 +756,7 @@ pub fn wifi_usage_alerts(thresholds: Form, auth: Authenticated) -> Fl } #[post("/api/v1/network/wifi/usage", data = "")] -pub fn update_wifi_alerts(thresholds: Json, auth: Authenticated) -> Value { +pub fn update_wifi_alerts(thresholds: Json, _auth: Authenticated) -> Value { match monitor::update_store(thresholds.into_inner()) { Ok(_) => { debug!("WiFi data usage thresholds updated."); @@ -774,7 +774,7 @@ pub fn update_wifi_alerts(thresholds: Json, auth: Authenticated) -> V } #[post("/api/v1/network/wifi/usage/reset")] -pub fn reset_data_total(auth: Authenticated) -> Value { +pub fn reset_data_total(_auth: Authenticated) -> Value { match monitor::reset_data() { Ok(_) => { debug!("Reset network data usage total."); @@ -806,7 +806,7 @@ pub fn reset_data_total(auth: Authenticated) -> Value { // HELPERS AND ROUTES FOR ACCESS POINT ACTIVATION #[post("/api/v1/network/activate_ap")] -pub fn activate_ap(auth: Authenticated) -> Value { +pub fn activate_ap(_auth: Authenticated) -> Value { // activate the wireless access point debug!("Activating WiFi access point."); match network_client::activate_ap() { @@ -825,7 +825,7 @@ pub fn activate_ap(auth: Authenticated) -> Value { // HELPERS AND ROUTES FOR WIFI CLIENT MANAGEMENT #[post("/api/v1/network/activate_client")] -pub fn activate_client(auth: Authenticated) -> Value { +pub fn activate_client(_auth: Authenticated) -> Value { // activate the wireless client debug!("Activating WiFi client mode."); match network_client::activate_client() { @@ -842,7 +842,7 @@ pub fn activate_client(auth: Authenticated) -> Value { } #[post("/api/v1/network/wifi", data = "")] -pub fn add_wifi(wifi: Json, auth: Authenticated) -> Value { +pub fn add_wifi(wifi: Json, _auth: Authenticated) -> Value { // generate and write wifi config to wpa_supplicant match network_client::add(&wifi.ssid, &wifi.pass) { Ok(_) => { @@ -868,7 +868,7 @@ pub fn add_wifi(wifi: Json, auth: Authenticated) -> Value { } #[post("/api/v1/network/wifi/connect", data = "")] -pub fn connect_ap(ssid: Json, auth: Authenticated) -> Value { +pub fn connect_ap(ssid: Json, _auth: Authenticated) -> Value { // retrieve the id for the given network ssid match network_client::id("wlan0", &ssid.ssid) { // attempt connection with the given network @@ -893,7 +893,7 @@ pub fn connect_ap(ssid: Json, auth: Authenticated) -> Value { } #[post("/api/v1/network/wifi/disconnect", data = "")] -pub fn disconnect_ap(ssid: Json, auth: Authenticated) -> Value { +pub fn disconnect_ap(ssid: Json, _auth: Authenticated) -> Value { // attempt to disable the current network for wlan0 interface match network_client::disable("wlan0", &ssid.ssid) { Ok(_) => { @@ -910,7 +910,7 @@ pub fn disconnect_ap(ssid: Json, auth: Authenticated) -> Value { } #[post("/api/v1/network/wifi/forget", data = "")] -pub fn forget_ap(network: Json, auth: Authenticated) -> Value { +pub fn forget_ap(network: Json, _auth: Authenticated) -> Value { let ssid = &network.ssid; match network_client::forget("wlan0", ssid) { Ok(_) => { @@ -929,7 +929,7 @@ pub fn forget_ap(network: Json, auth: Authenticated) -> Value { } #[post("/api/v1/network/wifi/modify", data = "")] -pub fn modify_password(wifi: Json, auth: Authenticated) -> Value { +pub fn modify_password(wifi: Json, _auth: Authenticated) -> Value { let ssid = &wifi.ssid; let pass = &wifi.pass; // we are using a helper function (`update`) to delete the old @@ -954,7 +954,7 @@ pub fn modify_password(wifi: Json, auth: Authenticated) -> Value { // HELPERS AND ROUTES FOR NETWORK STATE QUERIES #[get("/api/v1/network/ip")] -pub fn return_ip(auth: Authenticated) -> Value { +pub fn return_ip(_auth: Authenticated) -> Value { // retrieve ip for wlan0 or set to x.x.x.x if not found let wlan_ip = match network_client::ip("wlan0") { Ok(ip) => ip, @@ -974,7 +974,7 @@ pub fn return_ip(auth: Authenticated) -> Value { } #[get("/api/v1/network/rssi")] -pub fn return_rssi(auth: Authenticated) -> Value { +pub fn return_rssi(_auth: Authenticated) -> Value { // retrieve rssi for connected network match network_client::rssi("wlan0") { Ok(rssi) => { @@ -991,7 +991,7 @@ pub fn return_rssi(auth: Authenticated) -> Value { } #[get("/api/v1/network/ssid")] -pub fn return_ssid(auth: Authenticated) -> Value { +pub fn return_ssid(_auth: Authenticated) -> Value { // retrieve ssid for connected network match network_client::ssid("wlan0") { Ok(network) => { @@ -1008,7 +1008,7 @@ pub fn return_ssid(auth: Authenticated) -> Value { } #[get("/api/v1/network/state")] -pub fn return_state(auth: Authenticated) -> Value { +pub fn return_state(_auth: Authenticated) -> Value { // retrieve state of wlan0 or set to x.x.x.x if not found let wlan_state = match network_client::state("wlan0") { Ok(state) => state, @@ -1028,7 +1028,7 @@ pub fn return_state(auth: Authenticated) -> Value { } #[get("/api/v1/network/status")] -pub fn return_status(auth: Authenticated) -> Value { +pub fn return_status(_auth: Authenticated) -> Value { // retrieve status info for wlan0 interface match network_client::status("wlan0") { Ok(network) => { @@ -1045,7 +1045,7 @@ pub fn return_status(auth: Authenticated) -> Value { } #[get("/api/v1/network/wifi")] -pub fn scan_networks(auth: Authenticated) -> Value { +pub fn scan_networks(_auth: Authenticated) -> Value { // retrieve scan results for access-points within range of wlan0 match network_client::available_networks("wlan0") { Ok(networks) => { diff --git a/peach-web/src/utils.rs b/peach-web/src/utils.rs index ff4c883..8055473 100644 --- a/peach-web/src/utils.rs +++ b/peach-web/src/utils.rs @@ -1,7 +1,7 @@ pub mod monitor; use rocket_dyn_templates::Template; -use rocket::request::Request; + use rocket::response::{Redirect, Responder}; use rocket::serde::json::{Value, json}; use rocket::serde::{Serialize};