v0.01: 修复死锁Bug + DNS-01默认 + 超时调整

此提交包含在:
2026-05-13 10:58:29 +08:00
父節點 3fa77d9bc0
當前提交 a9842e9212
共有 7 個檔案被更改,包括 114 行新增51 行删除
+12 -16
查看文件
@@ -34,10 +34,8 @@ func main() {
// Serve static files for frontend
r.Static("/assets", "./dist/assets")
r.StaticFile("/favicon.ico", "./dist/favicon.ico")
r.StaticFile("/favicon.svg", "./dist/favicon.svg")
r.StaticFile("/", "./dist/index.html")
r.NoRoute(func(c *gin.Context) {
c.File("./dist/index.html")
})
// API routes
api := r.Group("/api")
@@ -58,6 +56,10 @@ func main() {
api.GET("/stats", certHandler.Stats)
}
r.NoRoute(func(c *gin.Context) {
c.File("./dist/index.html")
})
// Setup cron for auto-renewal (runs daily at 3:00 AM)
c := cron.New()
c.AddFunc("0 3 * * *", func() {
@@ -80,20 +82,14 @@ func main() {
})
c.Start()
// Setup HTTP server for ACME HTTP-01 challenges (port 80)
httpPort := os.Getenv("HTTP_PORT")
if httpPort == "" {
httpPort = "80"
// Set ACME HTTP-01 challenge port from env (default 8082)
// Nginx on port 80 should proxy .well-known/acme-challenge/ to this port
acmePort := os.Getenv("ACME_PORT")
if acmePort == "" {
acmePort = "8082"
}
go func() {
acme := gin.New()
acme.Use(gin.Recovery())
// HTTP-01 challenge handler from lego
log.Printf("ACME HTTP challenge server listening on :%s", httpPort)
if err := acme.Run(":" + httpPort); err != nil {
log.Printf("ACME HTTP server (port %s) exited: %v", httpPort, err)
}
}()
services.SetHTTP01Port(acmePort)
log.Printf("ACME HTTP-01 challenge port: %s (nginx should proxy .well-known/acme-challenge/ to this port)", acmePort)
log.Printf("AutoSSL server starting on :%s", cfg.Port)
if err := r.Run(":" + cfg.Port); err != nil {