127 Commits

Author SHA1 Message Date
698e5bf22a refactor(scraper): convert input-value extractions to helper 2026-05-02 17:54:58 +08:00
b7bc534681 feat(scraper): add ScraperError + _dump_html + _find_input_value helpers 2026-05-02 17:54:21 +08:00
9ec0d2ade4 Add implementation plan for R3 (scraper resilience) 2026-05-02 17:52:58 +08:00
d4ab9f9c49 Add design spec for R3 (cm_bot.py scraper resilience) 2026-05-02 17:50:27 +08:00
f6505c1d1d docs(plan): fix Task 9 step 3 — rebuild with override, run with base 2026-05-02 17:43:05 +08:00
614718cd43 docs: add aaPanel hardening guide (C3/C4/C7 + dev vhost) 2026-05-02 17:39:35 +08:00
145f071ca4 docs(agents): drop stale 'hardcoded credentials' note (moved to env in 45303d0) 2026-05-02 17:38:35 +08:00
86b329340c chore(compose): drop api-server host port from base (internal only) 2026-05-02 17:38:26 +08:00
5c8483fa09 feat(compose): keep Flask dev server in dev override; expose api-server on localhost 2026-05-02 17:38:15 +08:00
1d4ecadfaa feat(docker): swap Flask dev server for gunicorn in api and web images 2026-05-02 17:38:01 +08:00
231ae69eef fix(hal): set_security_pin_api returns dict; cm_telegram now correct 2026-05-02 17:37:50 +08:00
d32e4ba58b feat(api): add create_app factory for gunicorn entrypoint 2026-05-02 17:37:13 +08:00
74d496b2bc build: add gunicorn 23.0.0 to requirements 2026-05-02 17:36:56 +08:00
6e2ec78418 Add implementation plan for prod hardening C1+C5+C6
9 bite-sized tasks: gunicorn dep, create_app() factory + tests, HAL
dict-return contract fix + bot_cli simplification, Dockerfile CMD
swaps, dev override (Flask dev server preserved), api-server host
port drop in base, AGENTS.md cleanup, aapanel-hardening.md (lifted
from spec appendix), integration verification deferred.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 17:36:26 +08:00
e7ab6b1325 Add design spec for prod hardening (C1+C5+C6) and aaPanel guide
Bundles three independent prod-side improvements: replace Flask dev
server with gunicorn (C1), drop api-server's host port (C5), fix the
HAL set_security_pin_api bool/dict contract bug + clean up stale
AGENTS.md note (C6). Appendix is a hand-over guide for the aaPanel
operator (C3 basic auth, C4 rate-limit + scanner deflection, C7 host
firewall) including a vhost for heng.04080616.xyz routing to the dev
PC. Auth path locked to G3 (basic auth + iOS/Android keychain).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 17:28:45 +08:00
8b8978831b Normalize rex/siong envs to .env.example + gitignore pattern
Untracks envs/rex/.env and envs/siong/.env (kept on disk so existing
deploys keep working) and adds matching .env.example templates so a
fresh clone has something to copy from. .gitignore widens from
envs/dev/.env to envs/*/.env to cover all three deployments.

Per-deployment secrets are no longer committed; rotation deemed
unnecessary because the repo is hosted on a private self-hosted Gitea
instance.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 17:12:56 +08:00
dff8be829c feat(seed): add 'done' acc rows and matching user records 2026-05-02 17:09:54 +08:00
6126430a3e docs(agents): document the local-as-dev tier and bot CLI 2026-05-02 17:03:33 +08:00
918243ee8b feat(envs): add dev .env.example and gitignore the filled-in copy 2026-05-02 17:03:08 +08:00
23c697d6fe feat(scripts): add bot_cli.sh wrapper, fix dev.sh help routing 2026-05-02 17:02:49 +08:00
48e5adbccd feat(scripts): add dev.sh lifecycle wrapper 2026-05-02 17:02:08 +08:00
57d4a8a68d feat(compose): add dev mysql service, init scripts, profile-gate bots 2026-05-02 17:01:48 +08:00
7011c6bada feat(bot_cli): implement interactive TUI menu and add subparser entry 2026-05-02 17:00:40 +08:00
f472a94916 feat(bot_cli): add monitor-once subcommand 2026-05-02 16:59:55 +08:00
e2eb32dacb feat(bot_cli): add credit and transfer subcommands 2026-05-02 16:59:32 +08:00
5844d7598a feat(bot_cli): add insert-user subcommand (Telegram /3 analog) 2026-05-02 16:59:10 +08:00
66d5feaea1 feat(bot_cli): add set-pin subcommand with local name resolution 2026-05-02 16:58:46 +08:00
f5d4a554d6 feat(bot_cli): add register subcommand (Telegram /1 analog) 2026-05-02 16:58:24 +08:00
c6e49c6240 feat(bot_cli): add module skeleton with parser sanity tests 2026-05-02 16:58:05 +08:00
c6742d1537 Add implementation plan for local-as-dev tier
13 bite-sized tasks: 7 TDD tasks for app/bot_cli.py (parser, six
subcommands, TUI), then mysql + init scripts, dev.sh + bot_cli.sh,
envs/dev/.env.example, AGENTS.md, and integration verification. Uses
unittest stdlib + unittest.mock; no new deps.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 16:57:17 +08:00
94ef5595ea Add design spec for local-as-dev tier (sub-project A)
Adds containerized MySQL to docker-compose.override.yml, gates
telegram/transfer bots behind a 'bots' profile, and introduces a local
Python bot CLI with a stdlib TUI menu that mirrors Telegram's /1, /2,
/3 plus operational subcommands. CLI runs from .venv against
127.0.0.1:3306 (mysql published to localhost only).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 16:49:12 +08:00
9db3980304 feat(scripts): add verify_debug.sh to test CM_DEBUG hotfix in dev 2026-05-02 16:28:35 +08:00
a2351c96f6 docs(agents): note CM_DEBUG default and intent 2026-05-02 16:23:17 +08:00
72ec2177db docs(env): document CM_DEBUG in .env.example 2026-05-02 16:23:10 +08:00
353af79e8b chore(compose): pass CM_DEBUG into api-server and web-view 2026-05-02 16:23:02 +08:00
c3f02b36b9 feat(api): make Werkzeug debug opt-in via CM_DEBUG 2026-05-02 16:22:23 +08:00
7cea119ad7 feat(web): make Werkzeug debug opt-in via CM_DEBUG 2026-05-02 16:21:51 +08:00
34f5398bff test: add CM_DEBUG helper parity test (failing) 2026-05-02 16:21:30 +08:00
40c3a76c13 Add implementation plan for debug-mode hotfix
Bite-sized TDD-style plan: failing helper test, two implementation
tasks (web then api), compose plumbing, doc updates, integration
verification. Uses unittest stdlib so no new deps.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 16:20:50 +08:00
97dbb79977 Add design spec for debug-mode hotfix (env-driven CM_DEBUG)
Documents the env-driven debug toggle that replaces the hardcoded
debug=True in cm_api.py and cm_web_view.py. Default off so the
Werkzeug debugger isn't reachable in rex/siong containers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 16:15:43 +08:00
45303d00aa Refactor: externalize all hardcoded config to env vars, add multi-deployment support
- Remove all hardcoded credentials and config from Python source code:
  - db.py: DB host/user/password/name/port → env vars with connection retry support
  - cm_bot_hal.py: prefix, agent_id, agent_password, security_pin → env vars
  - cm_bot.py: base_url → env var, fix register_user return values
  - cm_web_view.py: hardcoded '13c' prefix → configurable CM_PREFIX_PATTERN
  - cm_telegram.py: hardcoded 'Sky533535' pin → env var CM_SECURITY_PIN

- Parameterize docker-compose.yml for multi-deployment on same host:
  - Container names use ${CM_DEPLOY_NAME} prefix (e.g. rex-cm-*, siong-cm-*)
  - Network name uses ${CM_DEPLOY_NAME}-network
  - Web view port configurable via ${CM_WEB_HOST_PORT}
  - All service config passed as env vars (not baked into image)

- Add per-deployment env configs:
  - envs/rex/.env (port 8001, prefix 13c, DB rex_cm)
  - envs/siong/.env (port 8005, prefix 13sa, DB siong_cm)
  - .env.example as template for new deployments
  - Remove .env from .gitignore (local server, safe to commit)

- Improve telegram bot reliability:
  - Add retry logic for polling with exponential backoff
  - Add error handlers for Conflict, RetryAfter, NetworkError, TimedOut
  - Add /9 command to show chat ID
  - Add telegram_notifier.py for alert notifications
  - Fix error handling in /2 and /3 command handlers

- Fix db.py cursor cleanup (close cursor before connection in finally blocks)
- Fix docker-compose.override.yml environment syntax (list → mapping)
- Update README with multi-deployment instructions
- Add AGENTS.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 22:25:40 +08:00
d73439698a Refactor Docker layout for Gitea publishing
- move Python sources into app package and switch services to module entrypoints
- relocate Dockerfiles under docker/, add buildx publish script, override compose for local builds
- configure images to pull from gitea.04080616.xyz/yiekheng with env-driven tags and limits
- harden installs and transfer worker logging/concurrency for cleaner container output
2025-10-19 22:22:55 +08:00
d354601329 Trial for portainer 2025-10-19 10:32:43 +08:00
yiekheng
3fb2786506 + Update transfer speed
+ Add error handler for getting credit
2025-10-19 10:18:55 +08:00
Wong Yiek Heng
d191821a6a transfer bot date folder hot fix 2025-10-13 07:20:39 +08:00
Wong Yiek Heng
1b24c0c47a + More thread and delay 2025-10-08 20:15:22 +08:00
Wong Yiek Heng
278e1a80e7 + Update log path
+ Close html printing
2025-10-08 20:12:25 +08:00
Wong Yiek Heng
312a384d03 - Trial for rounding credit to 2 decimal 2025-10-06 08:01:39 +08:00
Wong Yiek Heng
33119d26cd - Remove transfer credit html 2025-10-06 07:48:13 +08:00
Wong Yiek Heng
6b6299ac06 + Fix credit rounding 2025-10-06 07:41:11 +08:00