mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2024-12-02 13:06:58 +01:00
Use if let
more
This commit is contained in:
parent
ea57dc3bc9
commit
a8138be69b
3 changed files with 17 additions and 15 deletions
|
@ -139,12 +139,10 @@ fn register(data: JsonUpcase<RegisterData>, conn: DbConn) -> EmptyResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
user.last_verifying_at = Some(user.created_at);
|
user.last_verifying_at = Some(user.created_at);
|
||||||
} else {
|
} else if let Err(e) = mail::send_welcome(&user.email) {
|
||||||
if let Err(e) = mail::send_welcome(&user.email) {
|
|
||||||
error!("Error sending welcome email: {:#?}", e);
|
error!("Error sending welcome email: {:#?}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
user.save(&conn)
|
user.save(&conn)
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,14 +352,16 @@ fn get_favicons_node(node: &std::rc::Rc<markup5ever_rcdom::Node>, icons: &mut Ve
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if has_rel && href.is_some() {
|
if has_rel {
|
||||||
if let Ok(full_href) = url.join(&href.unwrap()).map(|h| h.into_string()) {
|
if let Some(inner_href) = href {
|
||||||
|
if let Ok(full_href) = url.join(&inner_href).map(|h| h.into_string()) {
|
||||||
let priority = get_icon_priority(&full_href, sizes);
|
let priority = get_icon_priority(&full_href, sizes);
|
||||||
icons.push(Icon::new(priority, full_href));
|
icons.push(Icon::new(priority, full_href));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Might want to limit the recursion depth?
|
// TODO: Might want to limit the recursion depth?
|
||||||
for child in node.children.borrow().iter() {
|
for child in node.children.borrow().iter() {
|
||||||
|
|
|
@ -166,8 +166,8 @@ impl WSHandler {
|
||||||
if let Some(params) = path.split('?').nth(1) {
|
if let Some(params) = path.split('?').nth(1) {
|
||||||
let params_iter = params.split('&').take(1);
|
let params_iter = params.split('&').take(1);
|
||||||
for val in params_iter {
|
for val in params_iter {
|
||||||
if val.starts_with(ACCESS_TOKEN_KEY) {
|
if let Some(stripped) = val.strip_prefix(ACCESS_TOKEN_KEY) {
|
||||||
return Some(val[ACCESS_TOKEN_KEY.len()..].into());
|
return Some(stripped.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -410,10 +410,12 @@ pub fn start_notification_server() -> WebSocketUsers {
|
||||||
|
|
||||||
if CONFIG.websocket_enabled() {
|
if CONFIG.websocket_enabled() {
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
let mut settings = ws::Settings::default();
|
let settings = ws::Settings {
|
||||||
settings.max_connections = 500;
|
max_connections: 500,
|
||||||
settings.queue_size = 2;
|
queue_size: 2,
|
||||||
settings.panic_on_internal = false;
|
panic_on_internal: false,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
|
||||||
ws::Builder::new()
|
ws::Builder::new()
|
||||||
.with_settings(settings)
|
.with_settings(settings)
|
||||||
|
|
Loading…
Reference in a new issue