Skip to content

Commit 4505cbe

Browse files
committed
remove some warnings
1 parent a5f1ec4 commit 4505cbe

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

backend/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::commands::command_executor_service::{ChatMessage, CommandExecutorServ
22
use twitch::twitch_service::{TwitchConfig, TwitchService};
33
use crate::db::ProdDB;
44
use serde::{Deserialize, Serialize};
5-
use service_oauth::oauth_service::OAuthService;
65
use sqlx::MySqlPool;
76
use std::str::FromStr;
87
use std::sync::{Arc, OnceLock, RwLock};
@@ -11,6 +10,8 @@ use tokio::runtime::Handle;
1110
use tokio::sync::broadcast::error::RecvError;
1211
use url::Url;
1312
use state::{FullState, L1State, L2State, WebserverState};
13+
use crate::service_oauth::oauth_service::OAuthService;
14+
use crate::session_service::SessionService;
1415

1516
mod webserver_authentication;
1617
mod axum;
@@ -42,8 +43,8 @@ pub async fn start() {
4243
panel_auth_twitch_client_id: "zmxjjn3xmncg8ewew6tjk08tub26bb".to_string()
4344
}),
4445
command_executor_service: CommandExecutorService::new(&prod_db).await,
45-
oauth_service: Default::default(),
46-
session_service: Default::default(),
46+
oauth_service: OAuthService::new(),
47+
session_service: SessionService::new(),
4748
prod_db,
4849
});
4950

backend/src/service_oauth/oauth_endpoint.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use axum::response::IntoResponse;
66
use axum::response::Result as AxResult;
77
use axum::Json;
88
use log::error;
9-
use reqwest::StatusCode;
109
use serde::Deserialize;
1110
use crate::state::L1Arc;
1211

backend/src/service_oauth/oauth_service.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ struct OauthRequest {
1212
return_channel: Sender<String>,
1313
}
1414

15-
#[derive(Default)]
1615
pub struct OAuthService {
1716
active_requests: RwLock<Vec<OauthRequest>>,
1817
}
@@ -35,6 +34,12 @@ pub type OauthState = str;
3534
pub type AuthorizationUrlBuilder = dyn (for<'a> Fn(&'a RedirectUrl, &'a OauthState) -> AuthorizationUrl) + Send + Sync;
3635

3736
impl OAuthService {
37+
pub fn new() -> OAuthService {
38+
OAuthService {
39+
active_requests: RwLock::new(Vec::new()),
40+
}
41+
}
42+
3843
pub fn new_oauth_request<B>(&self, service_name: impl Into<String>, account_name: impl Into<String>, authorization_url: B) -> String
3944
where B: (for<'a> Fn(&'a RedirectUrl, &'a OauthState) -> AuthorizationUrl) + Send + Sync + Clone + 'static,
4045
{

backend/src/twitch/twitch_service.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use log::{info, warn};
1212
use tokio::runtime::Handle;
1313
use tokio::sync::{Mutex, RwLock};
1414
use twitch_highway::TwitchAPI;
15-
use crate::service_oauth::oauth_service::{AuthorizationUrlBuilder, OauthState, RedirectUrl};
1615

1716
#[derive(Default, Deserialize, Clone)]
1817
pub(crate) struct OauthCredential {
@@ -136,7 +135,6 @@ impl TwitchService {
136135

137136
async fn check_or_get_oauth(cred: &OauthCredential, _db: &ProdDB, twitch_config: &TwitchConfig) -> Result<TwitchCredentialStatus, anyhow::Error> {
138137
const FINAL_ERROR: &str = "Could not get new oauth token, bad credentials, needs reauthentication";
139-
// is first thread, do validation/refreshing
140138
let mut errors = vec![];
141139
match validate_token(cred.access_token.as_str()).await {
142140
Ok(Some(_validation)) => {

0 commit comments

Comments
 (0)