Serve content files from the connetto-server executable - #28
Conversation
… under its CORS layer with one ticket keypair and sweep on a cadence
There was a problem hiding this comment.
Sorry @LucaCappelletti94, you've used your own review budget of 250,000 diff characters for the last 7 days.
You can request another review in 4 days and 14 hours by commenting @sourcery-ai review. Upgrade to get a review now.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository: LucaCappelletti94/coderabbit/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Reviewer's GuideThe executable now optionally serves R69 content files from the auth listener: when configured, startup parses the content backend, initializes a ticket keypair and file-server pools, runs schema preflight, mounts the four file routes under the existing CORS layer, wires ticket minting into sessions, and schedules retention sweeps; builds without content or without a content URL retain the previous no-file behavior. Sequence diagram for configured content startup and file accesssequenceDiagram
participant Server as connetto-server
participant DB as Database
participant Store as ContentStore
participant FileServer as FileServer
participant Client as BrowserClient
Server->>Server: build_content()
Server->>Store: open_store()
Server->>Server: ticket_keypair()
Server->>FileServer: serve(Config)
FileServer->>DB: Schema preflight
FileServer-->>Server: file_router
Server->>Server: mount_on_auth_listener()
Server->>Client: Auth listener with CORS and file routes
Client->>Server: Content ticket request
Server->>Server: ContentTicketSigner::mint()
Server-->>Client: Ticket URL
Client->>FileServer: File route request with ticket
FileServer->>Store: Read or write chunks
Store-->>FileServer: Content response
FileServer-->>Client: File response
State diagram for content feature and configuration behaviorstateDiagram-v2
[*] --> NoContent
NoContent: ServerSigner::None
NoContent: No file router
[*] --> ContentDisabled
ContentDisabled: Built without content feature
ContentDisabled: Warn if CONNETTO_CONTENT_URL is set
ContentDisabled: No file routes
[*] --> ContentConfigured
ContentConfigured: Parse store and keypair
ContentConfigured: Run file-server preflight
ContentConfigured: Mount routes under CORS
ContentConfigured: Start retention sweep
NoContent --> ContentConfigured: CONNETTO_CONTENT_URL set
ContentDisabled --> ContentConfigured: Rebuild with content feature
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 811a6e6a90
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Some(path) => Some(std::fs::read(&path).with_context(|| format!("reading {path}"))?), | ||
| None => None, | ||
| }; | ||
| let (signer, public) = ticket_keypair(der.as_deref(), base_url.clone(), ttl, read_ceiling)?; |
There was a problem hiding this comment.
Normalize the configured ticket base before minting
When CONNETTO_CONTENT_URL ends with / or contains a path/query, it passes URL validation and is handed unchanged to TicketSigner, whose mint implementation appends /files/... textually. For example, the natural value https://files.example/ yields https://files.example//files/..., while the merged router only serves /files/..., so every minted grant fails unless an intermediary happens to normalize it. Strip/reject unsupported URL components before constructing the signer.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in b00a296 and a93220d. The signer now normalizes the base in both constructors, trailing slashes are trimmed and a base carrying a query or a fragment is refused with a new TicketError::AmbiguousBase naming the base, and connetto-server refuses CONNETTO_CONTENT_URL values with a query or fragment before the signer is built.
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
|



The server binary can now serve the file side of R69. With the
contentfeature the executable mints one ticket keypair at boot, mounts the four file routes on the auth listener inside its CORS layer, and sweeps retired content on a fixed cadence, so a single process holds the database, the sync listener and the file endpoint the deployment recipe promises.The routes reuse the file-server crate unchanged, the signer and store are the same objects the feature tests drive directly, and the sweep is the crate's own retention pass on a timer. Configuration rides the existing
CONNETTO_FILE_*environment names, and with the feature off the binary behaves exactly as before.The browser-stack harness still needs the content publication wiring, and that waits on the schema branch, so it is deliberately not included here.
Summary by Sourcery
Enable the server executable to serve authenticated content files alongside its existing database, sync, and authentication services.
New Features:
Bug Fixes:
Enhancements:
Build:
Deployment:
Documentation:
Tests: