profile reads getuserhome.php (power/level/alliance); news and info hit public getsite_new.php / getindex.php. Store private endpoints authenticate with the UID alone as Usertoken — no password needed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2.2 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Commands
# Install dependencies
pip install -r requirements.txt
# Run the CLI
python giftcenter.py login # account info (gift center)
python giftcenter.py redeem <gift_code> # redeem a gift code
python giftcenter.py profile # full profile: power/level/alliance
python giftcenter.py news # game announcements (no UID needed)
python giftcenter.py info # region / latest APK url (no UID needed)
# Override UID without editing .env (on login/redeem/profile)
python giftcenter.py --uid <uid> profile
Configuration
UID is read from the UID environment variable, typically set in .env. The --uid flag on any subcommand overrides it.
Architecture
Single-file Python CLI (giftcenter.py) using argparse subcommands across two backends:
giftcenter.last-z.com (helper: inline requests calls):
login→cmd_login()— GET/getcodeuser.php?uid=..., displays account inforedeem <code>→cmd_redeem()— GET/code.phpwithUsertokenheader anduid/codeparams
store.last-z.com (STORE_URL):
profile→cmd_profile()—store_auth("getuserhome.php", uid), prints fields fromPROFILE_FIELDSnews→cmd_news()—store_post("getsite_new.php")(public, no auth)info→cmd_info()—store_post("getindex.php")(public, no auth)
Two store helpers: store_post(endpoint) for public endpoints (empty POST body), and
store_auth(endpoint, uid) for private ones. Store "auth" is just the UID — sent as both the
Usertoken header and the {uid} POST body; there is no password. (getuser.php is the exception —
it needs a recaptcha loginToken + AES signature, so profile uses getuserhome.php instead.)
Adding more store reads (getmail.php, getuseritem.php, gettask_new.php) is a one-liner via store_auth.
API responses use numeric error codes (code field) for login and string error codes (errorCode
field, value "ok" on success) for redemption. Error mappings are in LOGIN_ERRORS and
REDEEM_ERRORS constants. UI text is in Traditional Chinese.