chore: code-quality pass — extract dashboard, agent loop, rate-limit login#86
Open
victalejo wants to merge 1 commit into
Open
chore: code-quality pass — extract dashboard, agent loop, rate-limit login#86victalejo wants to merge 1 commit into
victalejo wants to merge 1 commit into
Conversation
…es and implement rate limiting for login requests - Deleted unused files: riona-tweet.js, Twitter.ts, Github.ts, server.ts, twitterAgent.js - Added agentLoop.ts to manage Instagram agent iterations with error handling and re-login logic - Introduced rate limiting for login endpoint in api.ts to prevent abuse - Created a new dashboard view in dashboard.ts for better status monitoring - Added tests for API routes in api.test.ts and rate limiting functionality in rateLimit.test.ts - Updated app.ts to serve the new dashboard and integrate agent functionality
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
app.tsintosrc/views/dashboard.ts; move the Instagram agent loop out ofapp.ts(it was a module-load side-effect) intosrc/agentLoop.ts, started explicitly fromindex.ts.app.tsshrinks from 422 → 64 lines and is now safely importable in tests.src/utils/rateLimit.ts) and apply it toPOST /api/login(10 attempts / 15 min per IP). Returns 429 +Retry-Afterwhen exceeded.src/routes/api.test.ts) covering/api/status,/api/health,/api/me,/api/loginvalidation + rate limit, and/dashboard. +4 unit tests for the rate limiter. Total suite: 11 suites / 33 tests passing.eslint.config.js); drop deprecated.eslintrc.cjsand.eslintignore.@typescript-eslint/no-unsafe-function-typeerror inrequireAuth(Function→NextFunction).package.jsonscripts: splitbuild/serve/clean/dev;startnow just runsbuild && serve; addtest:coverage.jest.config.cjs: configurecollectCoverageFrom, excludeviews/,app.ts,index.ts, and the recaptcha subproject.src/server.ts,src/client/Twitter.ts,src/client/Github.ts,src/twitterAgent.js,riona-tweet.js.Why
app.tswas acting as entrypoint + dashboard view + agent runtime, which made it untestable and hard to read./api/loginhad no protection against brute-force.npm run lintfailed before any change could be vetted.