feat: route Heicode desktop login through code.xinghanlab.com Manager

Three concrete pieces:

1. Provider preset taijiaicloud now points at https://code.xinghanlab.com
   instead of the old api.taijiaicloud.com. Together with the stock
   resolveOAuthConfig fallback (<baseUrl>/heicode/oauth/authorize), this
   flips oauthEnabled on for the login card and turns the existing
   browser-redirect bridge into the default flow. Card name + promo
   updated to reflect that this is "log in via Heicode Manager".

2. loginAndActivate softens its model probe. /v1/models is best-effort:
   only hard 401/403 auth failures abort login. 5xx / panics / empty
   lists fall back to preset.defaultModels so the user lands inside the
   app even if the gateway transiently misbehaves; they can re-pick
   models from Settings later.

3. heicode_oauth.go fallback page: /login → /sign-in (matches the
   actual SPA route), title/copy de-branded from "HeiCode/新 API 控制台"
   to plain "Heicode 控制台".

Also picks up the prior unstaged Windows polish: WindowControls (min/
max/close + drag region) on the login screen, ProviderLoginCard +
globals.css refinements that landed in earlier MSI builds.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-07 13:55:57 +08:00
co-authored by Claude Opus 4.7
parent 7ec7778c18
commit 4665f88921
9 changed files with 127 additions and 72 deletions
+5 -5
View File
@@ -152,14 +152,14 @@ func renderHeicodeLoginRequired(c *gin.Context, state, redirectURI, providerID s
url.QueryEscape(redirectURI),
url.QueryEscape(providerID),
)
loginURL := "/login"
loginURL := "/sign-in"
body := fmt.Sprintf(`<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>HeiCode 登录授权</title>
<title>Heicode 登录授权</title>
<style>
:root { color-scheme: light dark; }
html,body { margin:0; padding:0; }
@@ -175,11 +175,11 @@ func renderHeicodeLoginRequired(c *gin.Context, state, redirectURI, providerID s
</head>
<body>
<div class="card">
<h1>请先登录新 API 控制台</h1>
<p>HeiCode 客户端正在等待你完成授权。请在新打开的页面中登录到 <strong>%s</strong>,登录成功后本页会自动跳转回 HeiCode。</p>
<h1>请先登录 Heicode 控制台</h1>
<p>Heicode 桌面端正在等待你完成授权。请在新打开的页面中登录到 <strong>%s</strong>,登录成功后本页会自动跳转回客户端。</p>
<a id="goLogin" class="btn" href="%s" target="_blank" rel="noopener">打开登录页</a>
<p class="muted">如果浏览器没有自动跳转,请手动在登录后回到此页面,或刷新本页。</p>
<p class="muted">提供方:<code>%s</code></p>
<p class="muted">租户:<code>%s</code></p>
</div>
<script>
(function(){