fix(auth): wire GUI CPA export hook

This commit is contained in:
github-actions[bot]
2026-07-14 12:45:41 +00:00
parent 5a31b7d6fe
commit 00bf5819b3
3 changed files with 7 additions and 59 deletions
@@ -1,34 +0,0 @@
name: Temporary GUI CPA hook patch v2
on:
issues:
types:
- edited
permissions:
contents: write
jobs:
apply-upgrade:
if: github.event.issue.number == 7
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Apply GUI CPA hook v2
run: python tools/apply_gui_cpa_hook_v2.py
- name: Commit patch and clean temporary files
shell: bash
run: |
rm -f tools/apply_gui_cpa_hook_v2.py
rm -f .github/workflows/temp-gui-cpa-hook-v2.yml
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add grok_register_ttk.py tools/apply_gui_cpa_hook_v2.py .github/workflows/temp-gui-cpa-hook-v2.yml
git commit -m "fix(auth): wire GUI CPA export hook"
git push origin HEAD:main
+7
View File
@@ -3406,6 +3406,13 @@ class GrokRegisterGUI:
except Exception as file_exc: except Exception as file_exc:
self.log(f"[Debug] 保存账号文件失败: {file_exc}") self.log(f"[Debug] 保存账号文件失败: {file_exc}")
add_token_to_grok2api_pools(sso, email=email, log_callback=self.log) add_token_to_grok2api_pools(sso, email=email, log_callback=self.log)
maybe_export_cpa_xai_after_success(
email=email,
password=profile.get("password", ""),
sso=sso,
log_callback=self.log,
cancel_callback=self.should_stop,
)
self.success_count += 1 self.success_count += 1
retry_count_for_slot = 0 retry_count_for_slot = 0
i += 1 i += 1
-25
View File
@@ -1,25 +0,0 @@
#!/usr/bin/env python3
import ast
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
APP_PATH = ROOT / "grok_register_ttk.py"
app = APP_PATH.read_text(encoding="utf-8-sig")
old = ' add_token_to_grok2api_pools(sso, email=email, log_callback=self.log)\n self.success_count += 1'
new = ''' add_token_to_grok2api_pools(sso, email=email, log_callback=self.log)
maybe_export_cpa_xai_after_success(
email=email,
password=profile.get("password", ""),
sso=sso,
log_callback=self.log,
cancel_callback=self.should_stop,
)
self.success_count += 1'''
if old in app:
app = app.replace(old, new, 1)
elif new not in app:
raise RuntimeError("GUI CPA hook anchor not found")
ast.parse(app)
APP_PATH.write_text(app, encoding="utf-8-sig")
print("GUI CPA hook applied.")