Files
twurscandxmv97 ed72c65a88 feat(applink): 支持官网扫码配对与下载兜底 (#1541)
- 服务端 qr_payload 改为 https://work.baizhi.cloud/app-link/scan/
- 落地页新增 /app-link/scan/,按平台显示下载入口并支持打开 App
- 增加 iOS/Android/HarmonyOS 的 .well-known 关联文件
- Caddy 补充 AASA Content-Type 与无尾斜杠兼容
- 更新 API 文档与落地页测试

Co-authored-by: xmv97 <xm209562v97@protonmail.com>
2026-11-17 15:01:42 +08:00

88 lines
1.6 KiB
Caddyfile

{
servers {
protocols h1 h2
}
log default {
output file /var/log/caddy/error.log {
mode 0640
roll_size 100MiB
roll_keep 10
roll_keep_for 720h
}
format json
level ERROR
}
}
http://127.0.0.1:8080 {
route {
handle /healthz {
root * /srv
rewrite * /index.html
file_server
}
handle {
respond 404
}
}
}
{$SITE_ADDRESS:jiying.chat} {
encode zstd gzip
log {
output file /var/log/caddy/access.log {
mode 0640
roll_size 100MiB
roll_keep 10
roll_keep_for 720h
}
format json
}
@immutable path /_astro/*
header @immutable Cache-Control "public, max-age=31536000, immutable"
@releaseManifest path /releases/version.json
header @releaseManifest {
Access-Control-Allow-Origin "*"
Cache-Control "no-store, no-cache, must-revalidate"
}
@releasePackages path /releases/jiying.exe /releases/jiying.dmg /releases/jiying.amd.AppImage /releases/jiying.arm.AppImage /releases/jiying.apk
header @releasePackages Cache-Control "no-cache"
# AASA 没有扩展名,显式声明 JSON,否则 iOS 可能拒绝解析。
@aasa path /.well-known/apple-app-site-association
header @aasa Content-Type application/json
header {
Referrer-Policy "strict-origin-when-cross-origin"
X-Content-Type-Options "nosniff"
X-Frame-Options "DENY"
}
route {
handle /healthz {
respond "ok" 200
}
handle_path /releases/* {
root * /srv/releases
file_server
}
# 兼容无尾斜杠的旧链接:直接返回页面而不是 308,避免丢掉配对 query。
handle /app-link/scan {
root * /srv
rewrite * /app-link/scan/index.html
file_server
}
handle {
root * /srv
file_server
}
}
}