add wellknown pages

Signed-off-by: Christine Dodrill <me@christine.website>
This commit is contained in:
Cadey Ratio 2021-01-10 12:01:22 -05:00
parent 8afb9d2391
commit b816e73bf3
7 changed files with 27 additions and 6 deletions

View File

@ -13,10 +13,7 @@ use rocket_prometheus::PrometheusMetrics;
use ::mi::{api, frontend, paseto, rocket_trace::*, web::*, MainDatabase, APPLICATION_NAME};
#[get("/.within/botinfo")]
fn botinfo() -> &'static str {
include_str!("./botinfo.txt")
}
mod wellknown;
fn main() -> Result<()> {
color_eyre::install()?;
@ -62,11 +59,15 @@ fn main() -> Result<()> {
if let Ok(ref mut n) = sdnotify::SdNotify::from_env() {
let _ = n
.notify_ready()
.map_err(|why| error!("can't signal readiness to systemd: {}", why));
.map_err(|why| error!("can't signal readiness to systemd: {}", why))
.unwrap();
}
}))
.mount("/metrics", prometheus)
.mount("/", routes![botinfo])
.mount(
"/",
routes![wellknown::botinfo, wellknown::robots, wellknown::security],
)
.mount(
"/api",
routes![

View File

@ -0,0 +1,14 @@
#[get("/.within/botinfo")]
fn botinfo() -> &'static str {
include_str!("./botinfo.txt")
}
#[get("/robots.txt")]
fn robots() -> String {
include_str!("./robots.txt").into_string()
}
#[get("/security.txt")]
fn security() -> String {
include_str!("./security.txt").into_string()
}

View File

@ -0,0 +1,2 @@
User-agent: *
Disallow: /

View File

@ -0,0 +1,2 @@
Contact: mailto:me@christine.website
Preferred-Languages: en

View File

@ -4,6 +4,7 @@
<title>{{ title }}</title>
<link rel="stylesheet" href="/static/gruvbox.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="noindex" />
<link rel="icon" type="image/png" href="/static/favicon.png"/>
<link rel="icon" href="/static/favicon.ico" type="image/x-icon"/>
<link rel="manifest" href="/static/manifest.json" />

View File

@ -4,6 +4,7 @@
<title>{{ title }}</title>
<link rel="stylesheet" href="/static/gruvbox.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="noindex" />
<link rel="icon" type="image/png" href="/static/favicon.png"/>
<link rel="icon" href="/static/favicon.ico" type="image/x-icon"/>
</head>