Spaces:
Sleeping
Sleeping
| """Map module names to challenge types and back. | |
| The frontend uses ``module`` to route a row to the right editor. | |
| We keep two parallel maps and a single function for clarity. | |
| """ | |
| from .constants import WEB_EXPLOIT_MODULES | |
| def challenge_type_for_module(module: str) -> str: | |
| """Return challenge type for a module name. | |
| Supports canonical challenge types AND topic names. New challenge | |
| types are wired by extending this function — no caller change required. | |
| """ | |
| # Canonical challenge types | |
| if module in ("web-exploitation", "steganography"): | |
| return module | |
| # Topic names that map to web-exploitation | |
| if module in WEB_EXPLOIT_MODULES: | |
| return "web-exploitation" | |
| return "crypto" | |