about summary refs log tree commit diff
path: root/src/frontend/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/mod.rs')
-rw-r--r--src/frontend/mod.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/frontend/mod.rs b/src/frontend/mod.rs
index 28c4c15..a92d769 100644
--- a/src/frontend/mod.rs
+++ b/src/frontend/mod.rs
@@ -703,12 +703,15 @@ struct OnboardingData {
 pub async fn onboarding_receiver<S: Storage>(mut req: Request<ApplicationState<S>>) -> Result {
     use serde_json::json;
 
+    <AsMut<tide::http::Request>>::as_mut(&mut req).url_mut().set_scheme("https");
+
     let body = req.body_json::<OnboardingData>().await?;
     let backend = &req.state().storage;
+
     #[cfg(any(not(debug_assertions), test))]
     let me = req.url();
     #[cfg(all(debug_assertions, not(test)))]
-    let me = url::Url::parse("http://localhost:8080/").unwrap();
+    let me = url::Url::parse("https://localhost:8080/").unwrap();
 
     if get_post_from_database(backend, me.as_str(), None, &None)
         .await
@@ -778,7 +781,8 @@ pub async fn coffee<S: Storage>(_: Request<ApplicationState<S>>) -> Result {
     .into())
 }
 
-pub async fn mainpage<S: Storage>(req: Request<ApplicationState<S>>) -> Result {
+pub async fn mainpage<S: Storage>(mut req: Request<ApplicationState<S>>) -> Result {
+    <AsMut<tide::http::Request>>::as_mut(&mut req).url_mut().set_scheme("https");
     let backend = &req.state().storage;
     let query = req.query::<QueryParams>()?;
     let authorization_endpoint = req.state().authorization_endpoint.to_string();
@@ -788,7 +792,7 @@ pub async fn mainpage<S: Storage>(req: Request<ApplicationState<S>>) -> Result {
     #[cfg(any(not(debug_assertions), test))]
     let url = req.url();
     #[cfg(all(debug_assertions, not(test)))]
-    let url = url::Url::parse("http://localhost:8080/").unwrap();
+    let url = url::Url::parse("https://localhost:8080/").unwrap();
 
     info!("Request at {}", url);
     let hcard_url = url.as_str();
@@ -852,16 +856,17 @@ pub async fn mainpage<S: Storage>(req: Request<ApplicationState<S>>) -> Result {
     }
 }
 
-pub async fn render_post<S: Storage>(req: Request<ApplicationState<S>>) -> Result {
+pub async fn render_post<S: Storage>(mut req: Request<ApplicationState<S>>) -> Result {
     let query = req.query::<QueryParams>()?;
     let authorization_endpoint = req.state().authorization_endpoint.to_string();
     let token_endpoint = req.state().token_endpoint.to_string();
     let user: Option<String> = None;
 
+    <AsMut<tide::http::Request>>::as_mut(&mut req).url_mut().set_scheme("https");
     #[cfg(any(not(debug_assertions), test))]
     let url = req.url();
     #[cfg(all(debug_assertions, not(test)))]
-    let url = url::Url::parse("http://localhost:8080/")
+    let url = url::Url::parse("https://localhost:8080/")
         .unwrap()
         .join(req.url().path())
         .unwrap();