feat: accept CLIENT_API_KEY on /license page.

Users can paste the key from the seller instead of editing license.env; it persists in license_state.json.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-17 17:20:47 +08:00
parent 863da10d1f
commit 8eefc6cfd5
6 changed files with 91 additions and 32 deletions
+8 -2
View File
@@ -43,7 +43,7 @@
font-family: ui-monospace, Consolas, monospace;
font-size: 0.85rem;
}
input[type=text] {
input[type=text], input[type=password] {
width: 100%;
padding: 10px 12px;
border-radius: 8px;
@@ -67,12 +67,13 @@
.err { color: #ff7b8a; margin: 10px 0; font-size: 0.9rem; }
.meta { margin-top: 16px; font-size: 0.85rem; color: #9aa0b4; line-height: 1.6; }
a { color: #7ec8ff; }
.hint { color: #6a7088; font-size: 0.78rem; margin-top: 4px; }
</style>
</head>
<body>
<div class="box">
<h1>软件授权</h1>
<p class="muted">复制下方设备 ID,联系微信 <strong>{{ wechat }}</strong> 购买激活码后粘贴兑换。授权站:{{ api_url }}</p>
<p class="muted">复制设备 ID,联系微信 <strong>{{ wechat }}</strong> 获取 <strong>CLIENT_API_KEY</strong> 与激活码。授权站:{{ api_url }}</p>
{% if message %}<p class="ok">{{ message }}</p>{% endif %}
{% if error %}<p class="err">{{ error }}</p>{% endif %}
@@ -83,6 +84,11 @@
</div>
<form method="post" action="/license">
<div class="row">
<label>CLIENT_API_KEY</label>
<input type="text" name="client_api_key" placeholder="{% if status.has_client_key %}已保存 {{ status.client_key_masked }},可留空或填写新密钥{% else %}粘贴卖家提供的 CLIENT_API_KEY{% endif %}" autocomplete="off" {% if not status.has_client_key %}required{% endif %}>
<div class="hint">与授权站后台「系统设置」中的密钥一致,本地保存后下次可留空。</div>
</div>
<div class="row">
<label>激活码</label>
<input type="text" name="code" placeholder="粘贴激活码" autocomplete="off" required>