From 70bb63be8d905b87df882d74ecdc43e95d54691d Mon Sep 17 00:00:00 2001 From: milky0217 Date: Mon, 20 Jul 2026 09:33:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20robots.txt?= =?UTF-8?q?=EF=BC=88=E5=B1=8F=E8=94=BD=E7=88=AC=E8=99=AB=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=20API/=E6=94=AF=E4=BB=98=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.rs | 2 ++ static/robots.txt | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 static/robots.txt diff --git a/src/main.rs b/src/main.rs index 9c2cd9a..65e446b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -85,6 +85,8 @@ fn create_server_config( .service(alipay_notify) // POST /payment/notify(支付宝异步回调) .service(alipay_refund_notify) // POST /payment/refund-notify(支付宝退款回调) .service(payment_login_status) // GET /payment/login-status(网页轮询) + // robots.txt(无需认证) + .route("/robots.txt", web::get().to(|| async { serve_static_files(web::Path::from("robots.txt".to_string())).await })) // 静态文件(无需认证) .service(web::resource("/static/{tail:.*}").route(web::get().to(serve_static_files))) // API 接口 diff --git a/static/robots.txt b/static/robots.txt new file mode 100644 index 0000000..516e62c --- /dev/null +++ b/static/robots.txt @@ -0,0 +1,11 @@ +User-agent: * +Disallow: /payment +Disallow: /api +Disallow: /weather +Disallow: /static + +# Allow root (status page) +Allow: /$ + +# Allow health check +Allow: /health$