更新 main.go
This commit is contained in:
37
main.go
37
main.go
@@ -175,7 +175,7 @@ func handleRoot(w http.ResponseWriter, r *http.Request) {
|
||||
statusIPv6 = "🟡"
|
||||
}
|
||||
|
||||
// 🔥 自动检测访问协议和地址
|
||||
// 自动检测访问协议和地址
|
||||
protocol := "http"
|
||||
if r.TLS != nil || r.Header.Get("X-Forwarded-Proto") == "https" {
|
||||
protocol = "https"
|
||||
@@ -266,18 +266,18 @@ func handleRoot(w http.ResponseWriter, r *http.Request) {
|
||||
font-size: 2.5em;
|
||||
margin-bottom: 10px;
|
||||
position: relative;
|
||||
/* 🔥 先设置普通颜色作为基础 */
|
||||
color: #667eea;
|
||||
}
|
||||
/* 只在支持的浏览器上应用渐变 */
|
||||
|
||||
@supports (background-clip: text) or (-webkit-background-clip: text) {
|
||||
h1 {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
background: linear-gradient(135deg, #667eea 0%%, #764ba2 100%%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
h1 {
|
||||
color: #818cf8;
|
||||
@@ -285,7 +285,7 @@ func handleRoot(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@supports (background-clip: text) or (-webkit-background-clip: text) {
|
||||
h1 {
|
||||
background: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
|
||||
background: linear-gradient(135deg, #818cf8 0%%, #a78bfa 100%%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
@@ -511,8 +511,8 @@ func handleRoot(w http.ResponseWriter, r *http.Request) {
|
||||
<body>
|
||||
<div class="container">
|
||||
<header>
|
||||
<h1>CHNRoute RSC 服务</h1>
|
||||
<p class="subtitle">自动转换 IP 列表为 RouterOS 可导入格式</p>
|
||||
<h1>🇨🇳 CHNRoute RSC 服务</h1>
|
||||
<p class="subtitle">自动转换中国 IP 列表为 RouterOS 可导入格式</p>
|
||||
</header>
|
||||
|
||||
<!-- 下载区域 -->
|
||||
@@ -588,12 +588,12 @@ func handleRoot(w http.ResponseWriter, r *http.Request) {
|
||||
<div class="status-item">
|
||||
<div class="status-icon">%s</div>
|
||||
<div class="status-label">IPv4 缓存</div>
|
||||
<div class="status-time">已缓存 %s</div>
|
||||
<div class="status-time">已缓存 %v</div>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<div class="status-icon">%s</div>
|
||||
<div class="status-label">IPv6 缓存</div>
|
||||
<div class="status-time">已缓存 %s</div>
|
||||
<div class="status-time">已缓存 %v</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -634,21 +634,20 @@ func handleRoot(w http.ResponseWriter, r *http.Request) {
|
||||
</script>
|
||||
</body>
|
||||
</html>`,
|
||||
baseURL, baseURL, // 下载地址 IPv4
|
||||
baseURL, baseURL, // 下载地址 IPv6
|
||||
protocolBadge, // 协议徽章
|
||||
protocolNote, // 协议提示
|
||||
baseURL, fetchMode, // 一键导入
|
||||
baseURL, fetchMode, // 自动更新
|
||||
baseURL, fetchMode, // IPv6 导入
|
||||
statusIPv4, cacheAgeIPv4, // 状态 IPv4
|
||||
statusIPv6, cacheAgeIPv6) // 状态 IPv6
|
||||
baseURL, baseURL, // 1-2: 下载地址 IPv4 (href + 显示文本)
|
||||
baseURL, baseURL, // 3-4: 下载地址 IPv6 (href + 显示文本)
|
||||
protocolBadge, // 5: 协议徽章
|
||||
protocolNote, // 6: 协议提示
|
||||
baseURL, fetchMode, // 7-8: 一键导入 (url + mode)
|
||||
baseURL, fetchMode, // 9-10: 自动更新 (url + mode)
|
||||
baseURL, fetchMode, // 11-12: IPv6 导入 (url + mode)
|
||||
statusIPv4, cacheAgeIPv4, // 13-14: IPv4 状态图标 + 缓存时间
|
||||
statusIPv6, cacheAgeIPv6) // 15-16: IPv6 状态图标 + 缓存时间
|
||||
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
w.Write([]byte(html))
|
||||
}
|
||||
|
||||
|
||||
func main() {
|
||||
// 启动时预热缓存
|
||||
go func() {
|
||||
|
||||
Reference in New Issue
Block a user