Skip to content

Add URL query string handling to bluesky-thread.html#114

Merged
simonw merged 1 commit intomainfrom
claude/add-url-query-handling-012ykgeuMM3eKqsfcKBbYQFP
Nov 26, 2025
Merged

Add URL query string handling to bluesky-thread.html#114
simonw merged 1 commit intomainfrom
claude/add-url-query-handling-012ykgeuMM3eKqsfcKBbYQFP

Conversation

@simonw
Copy link
Owner

@simonw simonw commented Nov 26, 2025

  • When form is submitted, update page URL to include ?url=... parameter
  • On page load, check for ?url= query parameter and auto-populate/submit form
  • Enables sharing direct links to specific Bluesky threads

Claude code for web prompt:

Modify bluesky-thread.html so when the form is submitted it updates the page URL to include ?url=… and when the page loads of that query string is present it populates the form field and submits the form

- When form is submitted, update page URL to include ?url=... parameter
- On page load, check for ?url= query parameter and auto-populate/submit form
- Enables sharing direct links to specific Bluesky threads
@claude
Copy link
Contributor

claude bot commented Nov 26, 2025

Claude finished @simonw's task —— View job


Code Review Complete ✅

Reviewing the URL query string handling implementation in bluesky-thread.html.

Todo List:

  • Check for repository guidelines (CLAUDE.md)
  • Read and analyze the modified bluesky-thread.html file
  • Review code quality and best practices
  • Check for potential bugs or issues
  • Evaluate performance considerations
  • Assess security concerns
  • Evaluate test coverage needs
  • Provide comprehensive feedback

Review Feedback

Code Quality & Best Practices

The implementation is clean and follows good practices:

  • Uses modern JavaScript APIs (URLSearchParams, URL)
  • Proper separation of concerns between URL handling and existing functionality
  • Consistent code style with the existing codebase
  • Good use of history.replaceState to update browser history

Implementation Details

The added functionality (lines 195-261) correctly implements the requirements:

  • Form submission updates URL with ?url= parameter using history.replaceState()
  • Page load checks for ?url= parameter and auto-populates/submits form
  • Enables shareable links to specific Bluesky threads

⚠️ Minor Issues & Suggestions

  1. URL Parameter Validation (lines 195-198):

    const newUrl = new URL(window.location);
    newUrl.searchParams.set('url', postUrl.value.trim());

    Consider validating that postUrl.value.trim() is not empty before updating the URL to avoid creating URLs like ?url=.

  2. Error Handling: The existing validation on lines 200-203 is good, but the URL parameter loading doesn't have error handling. If an invalid URL is in the query parameter, it will trigger form submission and show an error, which is acceptable behavior.

Performance Considerations

  • No performance concerns identified
  • history.replaceState() is more appropriate than pushState() for this use case
  • URL parsing and parameter setting are lightweight operations

Security Considerations

  • URL validation: Good hostname check ensures only bsky.app URLs are processed (line 201)
  • XSS protection: No dynamic HTML generation from URL parameters - values go through proper validation
  • No data persistence: Query parameters are client-side only, no server-side storage concerns

📝 Test Coverage

Since this is a client-side HTML file, consider manual testing scenarios:

  • Valid Bluesky URL in query parameter
  • Invalid URL in query parameter
  • Empty URL in query parameter
  • Form submission with various URL formats
  • Browser back/forward navigation behavior

🎯 Overall Assessment

This is a solid implementation that cleanly adds the requested functionality without disrupting existing code. The approach is straightforward, secure, and user-friendly. The code maintains the existing style and structure of the application.

Recommendation: ✅ Approve - Ready to merge with optional consideration of the minor URL validation enhancement.


@simonw
Copy link
Owner Author

simonw commented Nov 26, 2025

@simonw simonw merged commit d570867 into main Nov 26, 2025
4 checks passed
@simonw simonw deleted the claude/add-url-query-handling-012ykgeuMM3eKqsfcKBbYQFP branch November 26, 2025 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants