Repository navigation
Validate upstream scenes and support authenticated browser project sharing - #3
Merged
Merged
Conversation
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.
The project API now accepts the actual editor draft and core scene formats instead of arbitrary JSON. It reuses immutable upstream loaders: pace_core at 1aa2b36 for scene v1, and the extracted pace_editor_format crate in pace_app at 1dd8f4d for editor draft v1. Accepted payloads are still stored and downloaded byte-for-byte, with the existing transactional ETag/If-Match concurrency and authorization checks.
The upload limit now matches the editor's 64 MiB file limit so embedded backgrounds can travel with a project. Invalid versions, unknown fields, malformed structures and duplicate IDs are rejected; core scenes also receive semantic reference/geometry validation. Editor drafts preserve their existing ability to save incomplete references. No draft-to-core conversion or scene envelope is introduced.
PACE_ALLOWED_ORIGINS enables explicitly configured browser origins, exposes ETag/Location, and permits authenticated project preflights. It defaults to no cross-origin access and rejects wildcard/path/credential origins. Validation runs off the async executor. Documentation covers both formats, browser configuration and the distinction between snapshot sharing and real-time co-editing.
This completes the server side of client integration after the merged storage and authentication PRs (#1 and #2). The companion app PR is pace-kit/pace_app#4, which extracts the shared format without changing it and adds the browser UI and real-server browser tests.
Validation: all 20 server integration tests pass, along with cargo fmt --check and cargo clippy --locked --all-targets -- -D warnings. Tests cover original-byte round trips through both canonical loaders, schema failures, stale/concurrent writes, authorization/revocation, process kill/restart persistence, exact and oversized/chunked limits, and CORS. The app's two-browser test also passed against this server, including image-preserving save/upload/download/save, explicit conflict reconciliation and denied access.
Compatibility: Rust 1.97.1+ is now required by the pinned core dependency. Previously stored arbitrary JSON remains downloadable; new writes require a supported format. Runtime save slots and core export/preview in the draft editor are outside project sharing.