Refactor registration flow, update config, replace Turnstile patch

- Major refactor of grok_register_ttk.py: improved flow, error handling, logging
- Update config.example.json and config.json with new fields
- Replace turnstilePatch/content.js with new script.js approach
- Update start.sh for better Chromium/Turnstile handling
- Remove deprecated turnstilePatch/content.js
This commit is contained in:
chaos committed 2026-07-12 14:44:02 +08:00
1 parent 7a02453601
commit c87b01967f
7 files changed
+794 -425

No files matched your search

+24 -2
View File
@@ -419,9 +419,31 @@ _resolve_bin() {
return 1
}
find_playwright_chromium() {
# Playwright Chromium 无 snap AppArmor 限制,ReinerBRO/grok-register 同款优先路径
local root cand
for root in \
"${HOME}/.cache/ms-playwright" \
"${LOCALAPPDATA:-}/ms-playwright"; do
[ -d "$root" ] || continue
# 取最新 chromium-* 目录
cand=$(find "$root" -maxdepth 3 -type f \( -path '*/chrome-linux64/chrome' -o -path '*/chrome-linux/chrome' -o -path '*/chrome-win64/chrome.exe' \) 2>/dev/null | sort -r | head -1 || true)
if [ -n "$cand" ] && [ -x "$cand" ] || [ -f "$cand" ]; then
echo "$cand"
return 0
fi
done
return 1
}
find_chromium_bin() {
local candidate p
# 优先 deb/系统包路径,snap 放后面(且不 resolve 成 /usr/bin/snap)
# 1) Playwright Chromium(推荐,服务器无 AppArmor/snap 坑)
if p="$(find_playwright_chromium 2>/dev/null)"; then
echo "$p"
return 0
fi
# 2) deb/系统包路径,snap 放后面(且不 resolve 成 /usr/bin/snap)
for candidate in \
/usr/bin/chromium \
/usr/bin/chromium-browser \
@@ -439,7 +461,7 @@ find_chromium_bin() {
esac
# 必须像 chromium
case "$p" in
*chromium*|*Chromium*)
*chromium*|*Chromium*|*chrome-linux*)
echo "$p"
return 0
;;