@@ -185,6 +185,7 @@ async fn serve_payjoin_directory(
185185 ( Method :: GET , [ "" , "ohttp-keys" ] ) => get_ohttp_keys ( & ohttp) . await ,
186186 ( Method :: POST , [ "" , id] ) => post_fallback_v1 ( id, query, body, pool) . await ,
187187 ( Method :: GET , [ "" , "health" ] ) => health_check ( ) . await ,
188+ ( Method :: GET , [ "" , "" ] ) => handle_directory_home_path ( ) . await ,
188189 _ => Ok ( not_found ( ) ) ,
189190 }
190191 . unwrap_or_else ( |e| e. to_response ( ) ) ;
@@ -267,6 +268,59 @@ async fn health_check() -> Result<Response<BoxBody<Bytes, hyper::Error>>, Handle
267268 Ok ( Response :: new ( empty ( ) ) )
268269}
269270
271+ async fn handle_directory_home_path ( ) -> Result < Response < BoxBody < Bytes , hyper:: Error > > , HandlerError >
272+ {
273+ let mut res = Response :: new ( empty ( ) ) ;
274+ * res. status_mut ( ) = StatusCode :: OK ;
275+ res. headers_mut ( ) . insert ( CONTENT_TYPE , HeaderValue :: from_static ( "text/html" ) ) ;
276+
277+ let html = r#"
278+ <!DOCTYPE html>
279+ <html lang="en">
280+ <head>
281+ <meta charset="UTF-8">
282+ <title>Payjoin Directory</title>
283+ <style>
284+ body {
285+ background-color: #0f0f0f;
286+ color: #eaeaea;
287+ font-family: 'Courier New', Courier, monospace;
288+ padding: 2rem;
289+ display: flex;
290+ justify-content: center;
291+ align-items: center;
292+ height: 100vh;
293+ }
294+ .container {
295+ background: #1a1a1a;
296+ border: 1px solid #333;
297+ border-radius: 8px;
298+ padding: 2rem;
299+ box-shadow: 0 0 10px rgba(0, 170, 255, 0.2);
300+ text-align: center;
301+ }
302+ h1 {
303+ color: #00aaff;
304+ margin-bottom: 1rem;
305+ }
306+ p {
307+ color: #ccc;
308+ }
309+ </style>
310+ </head>
311+ <body>
312+ <div class="container">
313+ <h1>Payjoin Directory</h1>
314+ <p>this is a directory used to facilitate asynchronous payments between supporting Bitcoin wallets.</p>
315+ </div>
316+ </body>
317+ </html>
318+ "# ;
319+
320+ * res. body_mut ( ) = full ( html) ;
321+ Ok ( res)
322+ }
323+
270324#[ derive( Debug ) ]
271325enum HandlerError {
272326 PayloadTooLarge ,
0 commit comments