From 847fba4fb3adc6e02b464b0db9b3c4798a7bb37f Mon Sep 17 00:00:00 2001 From: mokuro <82637350+Finkyky@users.noreply.github.com> Date: Thu, 12 Mar 2026 13:00:06 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0render=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index cae2caf..f8e2fd0 100644 --- a/main.go +++ b/main.go @@ -36,7 +36,7 @@ func main() { // 禁用 Gin 的调试信息输出 gin.DisableConsoleColor() - + // 创建路由器(使用 gin.New() 而不是 gin.Default() 以避免默认日志) router := gin.New() @@ -57,7 +57,7 @@ func main() { // 创建HTTP服务器 server := &http.Server{ - Addr: fmt.Sprintf(":%d", cfg.Port), + Addr: fmt.Sprintf("0.0.0.0:%d", cfg.Port), Handler: router, } @@ -122,9 +122,13 @@ func printStartupBanner(cfg *config.Config) { ` fmt.Println(banner) - fmt.Printf("🚀 服务地址: http://localhost:%d\n", cfg.Port) - fmt.Printf("📚 API 文档: http://localhost:%d/\n", cfg.Port) - fmt.Printf("💊 健康检查: http://localhost:%d/health\n", cfg.Port) + host := os.Getenv("RENDER_EXTERNAL_URL") + if host == "" { + host = fmt.Sprintf("http://localhost:%d", cfg.Port) + } + fmt.Printf("🚀 服务地址: %s\n", host) + fmt.Printf("📚 API 文档: %s/\n", host) + fmt.Printf("💊 健康检查: %s/health\n", host) fmt.Printf("🔑 API 密钥: %s\n", maskAPIKey(cfg.APIKey)) modelList := cfg.GetModels() From 1f473c0a19c618dbcba237799c71aeabf5915601 Mon Sep 17 00:00:00 2001 From: mokuro <82637350+Finkyky@users.noreply.github.com> Date: Thu, 12 Mar 2026 13:02:35 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0render=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- render.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 render.yaml diff --git a/render.yaml b/render.yaml new file mode 100644 index 0000000..7e85d1e --- /dev/null +++ b/render.yaml @@ -0,0 +1,27 @@ +services: + - type: web + name: cursor2api-go + env: docker + plan: free + healthCheckPath: /health + envVars: + - key: PORT + value: 10000 + - key: DEBUG + value: false + - key: API_KEY + generateValue: true + - key: MODELS + value: claude-sonnet-4.6 + - key: TIMEOUT + value: 60 + - key: MAX_INPUT_LENGTH + value: 200000 + - key: USER_AGENT + value: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 + - key: UNMASKED_VENDOR_WEBGL + value: Google Inc. (Intel) + - key: UNMASKED_RENDERER_WEBGL + value: ANGLE (Intel, Intel(R) UHD Graphics 620 Direct3D11 vs_5_0 ps_5_0, D3D11) + - key: SCRIPT_URL + value: https://cursor.com/_next/static/chunks/pages/_app.js From 0e026f4567ac17cc94fe676405daadf65dc0a415 Mon Sep 17 00:00:00 2001 From: mokuro <82637350+Finkyky@users.noreply.github.com> Date: Thu, 12 Mar 2026 13:07:06 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0render=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- render.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/render.yaml b/render.yaml index 7e85d1e..8dab4b6 100644 --- a/render.yaml +++ b/render.yaml @@ -12,7 +12,7 @@ services: - key: API_KEY generateValue: true - key: MODELS - value: claude-sonnet-4.6 + value: gpt-5.1,gpt-5,gpt-5-codex,gpt-5-mini,gpt-5-nano,gpt-4.1,gpt-4o,claude-3.5-sonnet,claude-3.5-haiku,claude-3.7-sonnet,claude-4-sonnet,claude-4.5-sonnet,claude-4-opus,claude-4.1-opus,gemini-2.5-pro,gemini-2.5-flash,gemini-3.0-pro,o3,o4-mini,deepseek-r1,deepseek-v3.1,kimi-k2-instruct,grok-3 - key: TIMEOUT value: 60 - key: MAX_INPUT_LENGTH @@ -24,4 +24,4 @@ services: - key: UNMASKED_RENDERER_WEBGL value: ANGLE (Intel, Intel(R) UHD Graphics 620 Direct3D11 vs_5_0 ps_5_0, D3D11) - key: SCRIPT_URL - value: https://cursor.com/_next/static/chunks/pages/_app.js + value: https://cursor.com/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/a-4-a/c.js?i=0^&v=3^&h=cursor.com From 2fd7ebab1e23c1d31821501aed7a0ae157a853ef Mon Sep 17 00:00:00 2001 From: mokuro <82637350+Finkyky@users.noreply.github.com> Date: Thu, 12 Mar 2026 13:12:00 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0render=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2789a82..dec62ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,12 +43,13 @@ RUN chown -R appuser:appuser /root/ # 切换到非root用户 USER appuser -# 暴露端口 +# 暴露端口(Render 会通过 PORT 环境变量指定) EXPOSE 8002 +EXPOSE 10000 -# 健康检查 +# 健康检查(使用环境变量 PORT) HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ - CMD node -e "require('http').get('http://localhost:8002/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))" || exit 1 + CMD node -e "const port = process.env.PORT || 8002; require('http').get('http://localhost:' + port + '/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))" || exit 1 # 启动应用 CMD ["./cursor2api-go"] \ No newline at end of file From a61b49e39b015c8f000f21b032fd1ca974591a7d Mon Sep 17 00:00:00 2001 From: mokuro <82637350+Finkyky@users.noreply.github.com> Date: Thu, 12 Mar 2026 13:19:15 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0render=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index f8e2fd0..2c76140 100644 --- a/main.go +++ b/main.go @@ -129,7 +129,7 @@ func printStartupBanner(cfg *config.Config) { fmt.Printf("🚀 服务地址: %s\n", host) fmt.Printf("📚 API 文档: %s/\n", host) fmt.Printf("💊 健康检查: %s/health\n", host) - fmt.Printf("🔑 API 密钥: %s\n", maskAPIKey(cfg.APIKey)) + fmt.Printf("🔑 API 密钥: %s\n", cfg.APIKey) modelList := cfg.GetModels() fmt.Printf("\n🤖 支持模型 (%d 个):\n", len(modelList))