feat: add URL hash support for loading SB3 projects from external URLs #392
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
This PR implements the ability to load SB3 project files directly from external URLs specified in the hash fragment of the page URL, addressing issue #390.
Users can now access SB3 projects using URLs like:
Implementation Details
Files Changed
src/lib/hash-parser-hoc.jsx
: Extended hash parsing to detect URLs starting withhttp://
orhttps://
src/lib/project-fetcher-hoc.jsx
: Added URL-based project fetching functionalityKey Features
fetch()
API to download SB3 files as ArrayBuffervm.loadProject()
method (same as file upload feature)#123
)Implementation Approach
Usage Examples
Google Drive Integration
Direct File URLs
Backward Compatibility (unchanged)
Error Handling
Testing Results
Lint Check
npm run test:lint # ✅ All lint checks passed
Unit Tests
Manual Testing Scenarios
Technical Notes
Dependencies
fetch()
API (modern browsers)Performance
Security
fetch()
with proper error handlingAddresses Issue
Fixes #390 - Enable loading SB3 projects from external URLs in hash fragment
This implementation provides a seamless way for educators to share Smalruby projects stored in Google Drive or other cloud services, improving the educational workflow significantly.
Breaking Changes
None. This is a fully backward-compatible enhancement.
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com