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:
@@ -44,7 +44,8 @@ def install_license_gate(app: Flask) -> None:
|
||||
def _license_redeem_api():
|
||||
data = request.get_json(silent=True) or {}
|
||||
code = (data.get("code") or request.form.get("code") or "").strip()
|
||||
return jsonify(redeem_code(code))
|
||||
ckey = (data.get("client_api_key") or request.form.get("client_api_key") or "").strip()
|
||||
return jsonify(redeem_code(code, client_api_key=ckey or None))
|
||||
|
||||
@app.post("/api/license/validate")
|
||||
def _license_validate_api():
|
||||
@@ -56,7 +57,8 @@ def install_license_gate(app: Flask) -> None:
|
||||
err = ""
|
||||
if request.method == "POST":
|
||||
code = (request.form.get("code") or "").strip()
|
||||
result = redeem_code(code)
|
||||
ckey = (request.form.get("client_api_key") or "").strip()
|
||||
result = redeem_code(code, client_api_key=ckey or None)
|
||||
if result.get("ok"):
|
||||
msg = result.get("message") or "激活成功"
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user