-
Notifications
You must be signed in to change notification settings - Fork 544
Render markdown #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
kei9o
wants to merge
18
commits into
siteboon:main
Choose a base branch
from
kei9o:render-markdown
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Render markdown #125
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
d52a040
feat: Add dynamic port finding for server and development
kei9o fb267a9
🔧 chore: Add GitHub OAuth dependencies and configuration
kei9o 6847896
✨ feat: Create GitHub OAuth strategy with account restrictions
kei9o c5ab1a2
🗃️ feat: Update database schema and server for GitHub OAuth
kei9o 986df8b
✨ feat: Implement GitHub OAuth endpoints and middleware
kei9o 3a00cca
✨ feat: Add RequireGithubAuth component and API endpoints
kei9o bcc1830
♻️ refactor: Replace local auth with GitHub OAuth only
kei9o 3db22d5
✨ feat: Add logout functionality to Quick Settings panel
kei9o a413cf4
📝 docs: Add comprehensive GitHub OAuth setup guide
kei9o 408beeb
💄 style: Remove redundant authentication text
kei9o 7d2a8a5
🎨 style: Clean up GitHub auth implementation files
kei9o c387591
🔧 chore: Add final newlines to GitHub auth-related files
kei9o 370ed15
build: add react-syntax-highlighter dependency
kei9o 501b9be
feat: create markdown utilities for content extraction
kei9o 78ba4a7
feat: create CodeBlock component with syntax highlighting
kei9o d284ac1
feat: create lazy loading wrapper for CodeBlock
kei9o 09350a8
feat: create ToolResultRenderer for enhanced tool output
kei9o a39d9ba
refactor: integrate enhanced markdown rendering in ChatInterface
kei9o File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,4 +104,7 @@ temp/ | |
# Database files | ||
*.db | ||
*.sqlite | ||
*.sqlite3 | ||
*.sqlite3 | ||
|
||
# Runtime configuration | ||
.port-config.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# GitHub OAuth Setup Guide | ||
|
||
This guide explains how to set up and test the GitHub OAuth integration for Claude Code UI. | ||
|
||
## Prerequisites | ||
|
||
1. A GitHub account | ||
2. Access to create OAuth Apps in GitHub | ||
|
||
## Setup Instructions | ||
|
||
### 1. Create a GitHub OAuth App | ||
|
||
1. Go to https://github.com/settings/developers | ||
2. Click "New OAuth App" | ||
3. Fill in the application details: | ||
- **Application name**: Claude Code UI (or your preferred name) | ||
- **Homepage URL**: `http://localhost:3009` | ||
- **Authorization callback URL**: `http://localhost:3008/api/auth/github/callback` | ||
4. Click "Register application" | ||
5. Copy the Client ID and generate a new Client Secret | ||
|
||
### 2. Configure Environment Variables | ||
|
||
Create a `.env` file in the project root (copy from `.env.example`): | ||
|
||
```bash | ||
cp .env.example .env | ||
``` | ||
|
||
Update the `.env` file with your GitHub OAuth credentials: | ||
|
||
```env | ||
# Server ports | ||
PORT=3008 | ||
VITE_PORT=3009 | ||
|
||
# GitHub OAuth configuration | ||
GITHUB_CLIENT_ID=your_actual_client_id | ||
GITHUB_CLIENT_SECRET=your_actual_client_secret | ||
GITHUB_CALLBACK_URL=http://localhost:3008/api/auth/github/callback | ||
|
||
# Allowed GitHub usernames (comma-separated) | ||
GITHUB_ALLOWED_USERS=your-github-username,other-allowed-username | ||
|
||
# Session secret (generate a random string) | ||
SESSION_SECRET=your-random-session-secret-here | ||
``` | ||
|
||
### 3. Clear Existing Database (if needed) | ||
|
||
If you have an existing database, you may need to delete it to test the new schema: | ||
|
||
```bash | ||
rm server/database/auth.db | ||
rm server/database/sessions.db | ||
``` | ||
|
||
### 4. Start the Application | ||
|
||
```bash | ||
npm run dev | ||
``` | ||
|
||
## Testing the OAuth Flow | ||
|
||
### Test 1: Initial Setup with GitHub | ||
|
||
1. Open http://localhost:3009 | ||
2. You should see the setup screen with a "Sign in with GitHub" button | ||
3. Click the GitHub button | ||
4. You'll be redirected to GitHub for authorization | ||
5. After authorizing, you'll be redirected back and logged in | ||
|
||
### Test 2: Allowed Users Only | ||
|
||
1. Try logging in with a GitHub account that's in the `GITHUB_ALLOWED_USERS` list | ||
- Should succeed | ||
2. Try logging in with a GitHub account that's NOT in the list | ||
- Should be rejected with an error message | ||
|
||
### Test 3: Mixed Authentication | ||
|
||
1. First, sign in with GitHub | ||
2. Log out | ||
3. Create a local account (if no users exist) | ||
4. Verify both authentication methods work | ||
|
||
### Test 4: Token Persistence | ||
|
||
1. Log in with GitHub | ||
2. Refresh the page | ||
3. You should remain logged in | ||
4. Check that the token is stored in localStorage | ||
|
||
## Troubleshooting | ||
|
||
### Common Issues | ||
|
||
1. **"GitHub authentication required" error** | ||
- Ensure your GitHub OAuth app is properly configured | ||
- Check that environment variables are set correctly | ||
|
||
2. **Redirect URI mismatch** | ||
- Make sure the callback URL in your GitHub app matches exactly: `http://localhost:3008/api/auth/github/callback` | ||
|
||
3. **User not authorized** | ||
- Verify the GitHub username is in the `GITHUB_ALLOWED_USERS` environment variable | ||
- Usernames are case-sensitive | ||
|
||
4. **Session errors** | ||
- Check that `SESSION_SECRET` is set in your environment | ||
- Ensure the `server/database` directory exists and is writable | ||
|
||
### Debug Mode | ||
|
||
To see more detailed logs: | ||
|
||
1. Check server console for authentication logs | ||
2. Check browser console for client-side errors | ||
3. Monitor network tab for OAuth flow requests | ||
|
||
## Security Considerations | ||
|
||
1. **Never commit `.env` file** - It contains sensitive credentials | ||
2. **Use HTTPS in production** - OAuth requires secure connections | ||
3. **Restrict allowed users** - Only add trusted GitHub usernames | ||
4. **Rotate secrets regularly** - Change CLIENT_SECRET and SESSION_SECRET periodically | ||
|
||
## Production Deployment | ||
|
||
For production deployment: | ||
|
||
1. Update OAuth App URLs to your production domain | ||
2. Set `NODE_ENV=production` | ||
3. Use proper HTTPS certificates | ||
4. Store secrets in environment variables, not in code | ||
5. Consider using a proper session store (Redis, etc.) instead of SQLite |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.port--config.json
@Anthropic-AI?claude
server?utils