feat: remove API documentation tab and update README for deployment instructions

This commit is contained in:
zuoban
2025-06-29 11:49:53 +08:00
parent 3073ee8908
commit 1edb4273dd
5 changed files with 8 additions and 791 deletions

View File

@@ -47,24 +47,3 @@ func (h *PagesHandler) HandleIndex(c *gin.Context) {
return
}
}
// HandleAPIDoc 处理API文档请求
func (h *PagesHandler) HandleAPIDoc(c *gin.Context) {
// 准备模板数据
data := map[string]interface{}{
"BasePath": h.config.Server.BasePath,
"DefaultVoice": h.config.TTS.DefaultVoice,
"DefaultRate": h.config.TTS.DefaultRate,
"DefaultPitch": h.config.TTS.DefaultPitch,
"DefaultFormat": h.config.TTS.DefaultFormat,
}
// 设置内容类型
c.Header("Content-Type", "text/html; charset=utf-8")
// 渲染模板
if err := h.templates.ExecuteTemplate(c.Writer, "api-doc.html", data); err != nil {
c.AbortWithStatusJSON(500, gin.H{"error": "模板渲染失败: " + err.Error()})
return
}
}

View File

@@ -43,9 +43,6 @@ func SetupRoutes(cfg *config.Config, ttsService tts.Service) (*gin.Engine, error
// 设置主页路由
baseRouter.GET("/", pagesHandler.HandleIndex)
// 设置API文档路由
baseRouter.GET("/api-doc", pagesHandler.HandleAPIDoc)
// 设置TTS API路由 - 添加认证中间件
baseRouter.POST("/tts", middleware.TTSAuth(cfg.TTS.ApiKey), ttsHandler.HandleTTS)