|
@@ -37,11 +37,11 @@ pub struct CloseChannelForm {
|
|
|
|
|
|
|
|
pub async fn channels_page(State(_state): State<AppState>) -> Result<Response, StatusCode> {
|
|
pub async fn channels_page(State(_state): State<AppState>) -> Result<Response, StatusCode> {
|
|
|
// Redirect to the balance page since channels are now part of the Lightning section
|
|
// Redirect to the balance page since channels are now part of the Lightning section
|
|
|
- Ok(Response::builder()
|
|
|
|
|
|
|
+ Response::builder()
|
|
|
.status(StatusCode::FOUND)
|
|
.status(StatusCode::FOUND)
|
|
|
.header("Location", "/balance")
|
|
.header("Location", "/balance")
|
|
|
.body(Body::empty())
|
|
.body(Body::empty())
|
|
|
- .unwrap())
|
|
|
|
|
|
|
+ .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pub async fn open_channel_page(State(state): State<AppState>) -> Result<Html<String>, StatusCode> {
|
|
pub async fn open_channel_page(State(state): State<AppState>) -> Result<Html<String>, StatusCode> {
|
|
@@ -106,13 +106,13 @@ pub async fn post_open_channel(
|
|
|
a href="/channels/open" { button { "← Try Again" } }
|
|
a href="/channels/open" { button { "← Try Again" } }
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
- return Ok(Response::builder()
|
|
|
|
|
|
|
+ return Response::builder()
|
|
|
.status(StatusCode::BAD_REQUEST)
|
|
.status(StatusCode::BAD_REQUEST)
|
|
|
.header("content-type", "text/html")
|
|
.header("content-type", "text/html")
|
|
|
.body(Body::from(
|
|
.body(Body::from(
|
|
|
layout_with_status("Open Channel Error", content, true).into_string(),
|
|
layout_with_status("Open Channel Error", content, true).into_string(),
|
|
|
))
|
|
))
|
|
|
- .unwrap());
|
|
|
|
|
|
|
+ .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -126,13 +126,13 @@ pub async fn post_open_channel(
|
|
|
a href="/channels/open" { button { "← Try Again" } }
|
|
a href="/channels/open" { button { "← Try Again" } }
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
- return Ok(Response::builder()
|
|
|
|
|
|
|
+ return Response::builder()
|
|
|
.status(StatusCode::BAD_REQUEST)
|
|
.status(StatusCode::BAD_REQUEST)
|
|
|
.header("content-type", "text/html")
|
|
.header("content-type", "text/html")
|
|
|
.body(Body::from(
|
|
.body(Body::from(
|
|
|
layout_with_status("Open Channel Error", content, true).into_string(),
|
|
layout_with_status("Open Channel Error", content, true).into_string(),
|
|
|
))
|
|
))
|
|
|
- .unwrap());
|
|
|
|
|
|
|
+ .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -150,13 +150,13 @@ pub async fn post_open_channel(
|
|
|
a href="/channels/open" { button { "← Try Again" } }
|
|
a href="/channels/open" { button { "← Try Again" } }
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
- return Ok(Response::builder()
|
|
|
|
|
|
|
+ return Response::builder()
|
|
|
.status(StatusCode::INTERNAL_SERVER_ERROR)
|
|
.status(StatusCode::INTERNAL_SERVER_ERROR)
|
|
|
.header("content-type", "text/html")
|
|
.header("content-type", "text/html")
|
|
|
.body(Body::from(
|
|
.body(Body::from(
|
|
|
layout_with_status("Open Channel Error", content, true).into_string(),
|
|
layout_with_status("Open Channel Error", content, true).into_string(),
|
|
|
))
|
|
))
|
|
|
- .unwrap());
|
|
|
|
|
|
|
+ .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Then open the channel
|
|
// Then open the channel
|
|
@@ -209,12 +209,12 @@ pub async fn post_open_channel(
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- Ok(Response::builder()
|
|
|
|
|
|
|
+ Response::builder()
|
|
|
.header("content-type", "text/html")
|
|
.header("content-type", "text/html")
|
|
|
.body(Body::from(
|
|
.body(Body::from(
|
|
|
layout_with_status("Open Channel Result", content, true).into_string(),
|
|
layout_with_status("Open Channel Result", content, true).into_string(),
|
|
|
))
|
|
))
|
|
|
- .unwrap())
|
|
|
|
|
|
|
+ .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pub async fn close_channel_page(
|
|
pub async fn close_channel_page(
|
|
@@ -374,13 +374,13 @@ pub async fn post_close_channel(
|
|
|
a href="/channels" { button { "← Back to Channels" } }
|
|
a href="/channels" { button { "← Back to Channels" } }
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
- return Ok(Response::builder()
|
|
|
|
|
|
|
+ return Response::builder()
|
|
|
.status(StatusCode::BAD_REQUEST)
|
|
.status(StatusCode::BAD_REQUEST)
|
|
|
.header("content-type", "text/html")
|
|
.header("content-type", "text/html")
|
|
|
.body(Body::from(
|
|
.body(Body::from(
|
|
|
layout_with_status("Close Channel Error", content, true).into_string(),
|
|
layout_with_status("Close Channel Error", content, true).into_string(),
|
|
|
))
|
|
))
|
|
|
- .unwrap());
|
|
|
|
|
|
|
+ .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -394,13 +394,13 @@ pub async fn post_close_channel(
|
|
|
a href="/channels" { button { "← Back to Channels" } }
|
|
a href="/channels" { button { "← Back to Channels" } }
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
- return Ok(Response::builder()
|
|
|
|
|
|
|
+ return Response::builder()
|
|
|
.status(StatusCode::BAD_REQUEST)
|
|
.status(StatusCode::BAD_REQUEST)
|
|
|
.header("content-type", "text/html")
|
|
.header("content-type", "text/html")
|
|
|
.body(Body::from(
|
|
.body(Body::from(
|
|
|
layout_with_status("Close Channel Error", content, true).into_string(),
|
|
layout_with_status("Close Channel Error", content, true).into_string(),
|
|
|
))
|
|
))
|
|
|
- .unwrap());
|
|
|
|
|
|
|
+ .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -446,12 +446,12 @@ pub async fn post_close_channel(
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- Ok(Response::builder()
|
|
|
|
|
|
|
+ Response::builder()
|
|
|
.header("content-type", "text/html")
|
|
.header("content-type", "text/html")
|
|
|
.body(Body::from(
|
|
.body(Body::from(
|
|
|
layout_with_status("Close Channel Result", content, true).into_string(),
|
|
layout_with_status("Close Channel Result", content, true).into_string(),
|
|
|
))
|
|
))
|
|
|
- .unwrap())
|
|
|
|
|
|
|
+ .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
pub async fn post_force_close_channel(
|
|
pub async fn post_force_close_channel(
|
|
@@ -477,13 +477,13 @@ pub async fn post_force_close_channel(
|
|
|
a href="/channels" { button { "← Back to Channels" } }
|
|
a href="/channels" { button { "← Back to Channels" } }
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
- return Ok(Response::builder()
|
|
|
|
|
|
|
+ return Response::builder()
|
|
|
.status(StatusCode::BAD_REQUEST)
|
|
.status(StatusCode::BAD_REQUEST)
|
|
|
.header("content-type", "text/html")
|
|
.header("content-type", "text/html")
|
|
|
.body(Body::from(
|
|
.body(Body::from(
|
|
|
layout_with_status("Force Close Channel Error", content, true).into_string(),
|
|
layout_with_status("Force Close Channel Error", content, true).into_string(),
|
|
|
))
|
|
))
|
|
|
- .unwrap());
|
|
|
|
|
|
|
+ .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -497,13 +497,13 @@ pub async fn post_force_close_channel(
|
|
|
a href="/channels" { button { "← Back to Channels" } }
|
|
a href="/channels" { button { "← Back to Channels" } }
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
- return Ok(Response::builder()
|
|
|
|
|
|
|
+ return Response::builder()
|
|
|
.status(StatusCode::BAD_REQUEST)
|
|
.status(StatusCode::BAD_REQUEST)
|
|
|
.header("content-type", "text/html")
|
|
.header("content-type", "text/html")
|
|
|
.body(Body::from(
|
|
.body(Body::from(
|
|
|
layout_with_status("Force Close Channel Error", content, true).into_string(),
|
|
layout_with_status("Force Close Channel Error", content, true).into_string(),
|
|
|
))
|
|
))
|
|
|
- .unwrap());
|
|
|
|
|
|
|
+ .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -551,10 +551,10 @@ pub async fn post_force_close_channel(
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- Ok(Response::builder()
|
|
|
|
|
|
|
+ Response::builder()
|
|
|
.header("content-type", "text/html")
|
|
.header("content-type", "text/html")
|
|
|
.body(Body::from(
|
|
.body(Body::from(
|
|
|
layout_with_status("Force Close Channel Result", content, true).into_string(),
|
|
layout_with_status("Force Close Channel Result", content, true).into_string(),
|
|
|
))
|
|
))
|
|
|
- .unwrap())
|
|
|
|
|
|
|
+ .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)
|
|
|
}
|
|
}
|