Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Mar 23, 2024
1 parent 916d51a commit 47c943d
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 21 deletions.
3 changes: 1 addition & 2 deletions warpgate-admin/src/api/tickets_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct CreateTicketRequest {
username: String,
target_name: String,
expiry: Option<DateTime<Utc>>,
number_of_uses: Option<i32>
number_of_uses: Option<i32>,
}

#[derive(Object)]
Expand Down Expand Up @@ -89,7 +89,6 @@ impl Api {
created: Set(chrono::Utc::now()),
expiry: Set(body.expiry),
uses_left: Set(body.number_of_uses),
..Default::default()
};

let ticket = values.insert(&*db).await.context("Error saving ticket")?;
Expand Down
2 changes: 1 addition & 1 deletion warpgate-core/src/auth_state_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl AuthStateStore {
.get_credential_policy(username, supported_credential_types)
.await?;
let Some(policy) = policy else {
return Err(WarpgateError::UserNotFound(username.into()))
return Err(WarpgateError::UserNotFound(username.into()));
};

let state = AuthState::new(
Expand Down
10 changes: 2 additions & 8 deletions warpgate-protocol-http/src/api/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,17 +333,11 @@ async fn get_auth_state(
) -> Option<Arc<Mutex<AuthState>>> {
let store = services.auth_state_store.lock().await;

let Some(auth) = auth else {
let SessionAuthorization::User(username) = auth? else {
return None;
};

let SessionAuthorization::User(username) = auth else {
return None;
};

let Some(state_arc) = store.get(id) else {
return None;
};
let state_arc = store.get(id)?;

{
let state = state_arc.lock().await;
Expand Down
2 changes: 1 addition & 1 deletion warpgate-protocol-http/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub async fn span_for_request(req: &Request) -> poem::Result<Span> {
Ok(ref handle) => {
let handle = handle.lock().await;
let ss = handle.session_state().lock().await;
match { ss.username.clone() } {
match ss.username.clone() {
Some(ref username) => {
info_span!("HTTP", session=%handle.id(), session_username=%username, %client_ip)
}
Expand Down
6 changes: 3 additions & 3 deletions warpgate-protocol-ssh/src/server/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ impl ServerSession {
}

async fn start_terminal_recording(&mut self, channel_id: Uuid, name: String) {
match async {
let recorder = async {
let mut recorder = self
.services
.recordings
Expand All @@ -1009,8 +1009,8 @@ impl ServerSession {
}
Ok::<_, recordings::Error>(recorder)
}
.await
{
.await;
match recorder {
Ok(recorder) => {
self.channel_recorders.insert(channel_id, recorder);
}
Expand Down
4 changes: 2 additions & 2 deletions warpgate-sso/src/sso.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ impl SsoClient {
} else {
None
};

let (auth_url, csrf_token, nonce) = auth_req.url();

Ok(SsoLoginRequest {
auth_url,
csrf_token,
Expand Down
2 changes: 1 addition & 1 deletion warpgate-web/src/admin/CreateTarget.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Alert, FormGroup } from 'sveltestrap'
let error: Error|null = null
let name = ''
let type: 'Ssh'|'MySql'|'Http' = 'Ssh'
let type: 'Http' | 'MySql' | 'Ssh' = 'Ssh'
async function create () {
if (!name || !type) {
Expand Down
2 changes: 1 addition & 1 deletion warpgate-web/src/admin/CreateTicket.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function create () {
username: selectedUser.username,
targetName: selectedTarget.name,
expiry: selectedExpiry ? new Date(selectedExpiry) : undefined,
numberOfUses: selectedNumberOfUses
numberOfUses: selectedNumberOfUses,
},
})
} catch (err) {
Expand Down
4 changes: 2 additions & 2 deletions warpgate-web/src/admin/player/TerminalRecordingPlayer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
let seekInputValue = 0
let duration = 0
let resizeObserver: ResizeObserver|undefined
let events: (SizeEvent | DataEvent | SnapshotEvent)[] = []
let events: (DataEvent | SizeEvent | SnapshotEvent)[] = []
let playing = false
let loading = true
let sessionIsLive: boolean|null = null
Expand Down Expand Up @@ -67,7 +67,7 @@
}
// eslint-disable-next-line @typescript-eslint/no-type-alias
type AsciiCastData = [number, 'o', string]
type AsciiCastItem = AsciiCastHeader | AsciiCastData
type AsciiCastItem = AsciiCastData | AsciiCastHeader
function isAsciiCastHeader (data: AsciiCastItem): data is AsciiCastHeader {
return 'version' in data
Expand Down

0 comments on commit 47c943d

Please sign in to comment.