fix(lint): Add ctx shim to routes/auth/totp

- Add credentialManager, totpConfig, saveTotpConfig, session to deps
- Create ctx shim for backward compatibility
- Fix hasOwnProperty anti-pattern (use Object.prototype.hasOwnProperty.call)

Result: 54 errors → 0 errors
This commit is contained in:
Krystie
2026-03-29 22:37:21 -07:00
parent 5baa97bbf9
commit a86546181e
3 changed files with 29 additions and 3 deletions

13
fix-ctx-routes.sh Normal file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
# Systematically fix ctx.* references in all route files
cd /root/.openclaw/agents/main/workspace/dashcaddy-work/dashcaddy-api
# Find all route files with ctx errors
echo "Finding routes with ctx errors..."
for file in $(find routes -name "*.js" -type f | grep -v index.js | grep -v helpers.js); do
errors=$(npx eslint "$file" 2>&1 | grep -c "'ctx' is not defined")
if [ "$errors" -gt 0 ]; then
echo "$errors errors in $file"
fi
done | sort -rn