fix: add optionalAuth to public pages and fix Addie content creation#770
Merged
Conversation
- Add optionalAuth middleware to /latest/* routes so users show as logged in - Add optionalAuth middleware to /events/* routes for same reason - Extract proposeContentForUser function from HTTP route handler - Update Addie's propose_content tool to call function directly instead of HTTP - This fixes silent content creation failures caused by 401 Unauthorized errors The direct function call approach is more secure than adding ADMIN_API_KEY to internal HTTP requests, and avoids the auth header complexity entirely. Uses dynamic import to avoid pulling auth.ts at module load time which affected test suite initialization. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
bokelley
added a commit
that referenced
this pull request
Jan 16, 2026
…770) - Add optionalAuth middleware to /latest/* routes so users show as logged in - Add optionalAuth middleware to /events/* routes for same reason - Extract proposeContentForUser function from HTTP route handler - Update Addie's propose_content tool to call function directly instead of HTTP - This fixes silent content creation failures caused by 401 Unauthorized errors The direct function call approach is more secure than adding ADMIN_API_KEY to internal HTTP requests, and avoids the auth header complexity entirely. Uses dynamic import to avoid pulling auth.ts at module load time which affected test suite initialization. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
bokelley
added a commit
that referenced
this pull request
Jan 20, 2026
…770) - Add optionalAuth middleware to /latest/* routes so users show as logged in - Add optionalAuth middleware to /events/* routes for same reason - Extract proposeContentForUser function from HTTP route handler - Update Addie's propose_content tool to call function directly instead of HTTP - This fixes silent content creation failures caused by 401 Unauthorized errors The direct function call approach is more secure than adding ADMIN_API_KEY to internal HTTP requests, and avoids the auth header complexity entirely. Uses dynamic import to avoid pulling auth.ts at module load time which affected test suite initialization. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
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
optionalAuthmiddleware to/latest/*routes so users show as logged inoptionalAuthmiddleware to/events/*routes for same reasonproposeContentForUserfunction from HTTP route handlerpropose_contenttool to call function directly instead of HTTPBackground
/latest/research,/events) because those routes didn't haveoptionalAuthmiddlewarecallApimade HTTP requests without proper auth headers, resulting in 401 errorsImplementation
The direct function call approach is more secure than adding ADMIN_API_KEY to internal HTTP requests:
Uses dynamic import to avoid pulling
auth.tsat module load time which affected test suite initialization.Test plan
/latest/research🤖 Generated with Claude Code