Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions site/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
User-agent: *
Allow: /
Disallow: /admin/

Sitemap: https://questlog.cc/sitemap.xml
33 changes: 33 additions & 0 deletions site/public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://questlog.cc/</loc>
<lastmod>2026-10-22</lastmod>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://questlog.cc/builder</loc>
<lastmod>2026-10-22</lastmod>
<changefreq>weekly</changefreq>
<priority>0.9</priority>
</url>
<url>
<loc>https://questlog.cc/wiki</loc>
<lastmod>2026-10-22</lastmod>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://questlog.cc/cards</loc>
<lastmod>2026-10-22</lastmod>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<url>
<loc>https://questlog.cc/status</loc>
<lastmod>2026-10-22</lastmod>
<changefreq>daily</changefreq>
<priority>0.3</priority>
</url>
</urlset>
8 changes: 8 additions & 0 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ pub fn router<F: Fetcher>(app: Arc<App<F>>) -> Router {
.route("/builder", get(|| async { static_file("builder.html", PAGE) }))
.route("/status", get(|| async { static_file("status.html", PAGE) }))
.route("/cards", get(|| async { static_file("cards.html", PAGE) }))
.route("/robots.txt", get(|| async { static_file("robots.txt", PAGE) }))
.route("/sitemap.xml", get(|| async { static_file("sitemap.xml", PAGE) }))
.route("/admin/status", get(admin_status::<F>))
.route("/admin/health", get(admin_health::<F>))
// the admin page's shell is only served through its guarded address
Expand Down Expand Up @@ -435,6 +437,12 @@ mod tests {
assert_eq!(cc, if path == "/static/index.html" { ASSET } else { PAGE }, "{path}");
assert!(html && !body.is_empty());
}
for (path, ct, has) in [("/robots.txt", "text/plain; charset=utf-8", "Sitemap: https://questlog.cc/sitemap.xml"),
("/sitemap.xml", "application/xml; charset=utf-8", "<loc>https://questlog.cc/wiki</loc>")] {
let (st, got, _, body) = raw(&format!("{base}{path}")).await;
assert_eq!((st, got.as_str()), (200, ct), "{path}");
assert!(String::from_utf8_lossy(&body).contains(has), "{path}");
}
for bad in ["/static/missing.css", "/static/", "/static/%2e%2e/Cargo.toml", "/static/..%2fCargo.toml", "/static/../Cargo.toml"] {
assert_eq!(raw(&format!("{base}{bad}")).await.0, 404, "{bad}");
}
Expand Down
1 change: 1 addition & 0 deletions src/server/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub(super) fn content_type(path: &str) -> &'static str {
"css" => "text/css; charset=utf-8",
"js" => "text/javascript; charset=utf-8",
"json" => "application/json",
"xml" => "application/xml; charset=utf-8",
"txt" => "text/plain; charset=utf-8",
"png" => "image/png",
"webp" => "image/webp",
Expand Down
Loading