Add AST cache files for AltchaService, API documentation, and AltchaService tests

- Created JSON representation of AltchaService class and its methods, including imports and relationships.
- Added documentation for the Captcha API, detailing endpoints and responses.
- Introduced test cases for AltchaService, covering various functionalities and edge cases.
This commit is contained in:
hamed
2026-07-10 11:42:23 +03:30
parent c3c520801d
commit ec184dfcc8
17 changed files with 1069 additions and 1039 deletions
+5 -2
View File
@@ -2,8 +2,11 @@
کپچای خودمیزبان مبتنی بر ALTCHA (Proof-of-Work، بدون تصویر، بدون سرویس خارجی). برای محافظت از endpointهای عمومی و بدون احراز هویت در برابر اسپم/بات.
- فعال/غیرفعال با `ALTCHA_ENABLED` (پیش‌فرض `false` در dev/test، در prod باید `true` شود).
- وقتی غیرفعال است، همه‌ی endpointها بدون فیلد `altcha` کار می‌کنند.
- فعال/غیرفعال از دو جا کنترل می‌شود:
1. **پنل ادمین** (`/admin/settings` → عمومی → کپچای امنیتی) — کلید `altcha_enabled` در `site_config`.
2. **متغیر محیطی** `ALTCHA_ENABLED` (پیش‌فرض/fallback).
- **اولویت:** اگر کلید پنل ست شده باشد مقدم است؛ در غیر این صورت به `ALTCHA_ENABLED` برمی‌گردد.
- وقتی غیرفعال است، همه‌ی endpointها بدون فیلد `altcha` کار می‌کنند و کلاینت‌ها (از `/altcha/config`) widget را نشان نمی‌دهند.
---