Skip to content

Commit

Permalink
feat: robots.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
ozwaldorf committed Oct 15, 2024
1 parent 3b2c25f commit 3c427d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ fn handle_get(req: Request, nonce: usize) -> Result<Response, Error> {
}

let usage = get_usage(&host, false)?;
Ok(Response::from_body(usage).with_content_type(mime::TEXT_PLAIN_UTF_8))
Ok(Response::new().with_body_text_plain(&usage))
},

// Privacy policy page
Expand All @@ -265,7 +265,13 @@ fn handle_get(req: Request, nonce: usize) -> Result<Response, Error> {
}
}

Ok(Response::from_body(PRIVACY).with_content_type(mime::TEXT_PLAIN_UTF_8))
Ok(Response::new().with_body_text_plain(PRIVACY))
},

// Robots
Some("robots.txt") => {
const ROBOTS: &str = include_str!("static/robots.txt");
Ok(Response::new().with_body_text_plain(ROBOTS))
},

// Favicon
Expand Down
3 changes: 3 additions & 0 deletions src/static/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
User-agent: *
Disallow: /p/
Allow: /

0 comments on commit 3c427d8

Please sign in to comment.