mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-10 02:41:14 +00:00
fix(app-store): harden App Store with auth, validation, bug fixes, and design compliance (#523)
* fix(app-store): harden App Store with auth, validation, bug fixes, and design compliance Add authMiddleware to GET /api/templates and POST /api/templates/deploy endpoints. Add isValidStackName and isPathWithinBase checks to the deploy endpoint. Replace fs.existsSync with async fsPromises.access. Extract FileSystemService to local variable to avoid repeated getInstance calls. Fix template mutation bug where PUID/PGID/TZ duplicated on re-open by working on a copy instead of mutating state. Make env_file conditional in generated compose YAML (only when env vars exist). Add port validation (range 1-65535) with visual feedback and deploy blocking. Add env key collision warning toast for custom variables. Replace any types with proper LSIO API interfaces. Change catch types from any to unknown with getErrorMessage. Add structured logging with [Templates] prefix and diagnostic logging gated behind Developer Mode. Align with design system: remove hardcoded bg-white and text-red-500, use ScrollArea, fix destructive button variant, add tabular-nums and strokeWidth 1.5, use cn() for conditional classes. Add empty-registry state distinct from no-search-results. Add 16 unit tests for TemplateService covering compose generation, conditional env_file, env string generation, and cache clearing. Update App Store docs with port validation and env collision details. * refactor(app-store): remove unused interface exports Remove export keyword from interfaces that are only used within their own file: TemplateEnv, TemplateVolume, and TemplatesResponse in TemplateService.ts; TemplateEnv and Template in AppStoreView.tsx. No external consumers import these types. * fix(app-store): remove unused fs default import The fs.existsSync call was replaced with fsPromises.access in the deploy endpoint, leaving the fs default import unused. Remove it to fix the ESLint no-unused-vars error in CI.
This commit is contained in:
@@ -46,7 +46,7 @@ Pre-filled with the template name in lowercase. You can change it; the same [nam
|
||||
|
||||
### Ports
|
||||
|
||||
For each exposed port, the sheet shows an editable **host port** field (left side) and the fixed **container port** (right side). Edit the host port to avoid conflicts with other services on the same machine.
|
||||
For each exposed port, the sheet shows an editable **host port** field (left side) and the fixed **container port** (right side). Edit the host port to avoid conflicts with other services on the same machine. Ports must be in the valid range (1 to 65535); invalid values are highlighted and block deployment.
|
||||
|
||||
### Volumes
|
||||
|
||||
@@ -62,12 +62,12 @@ Each template declares the variables it needs. Sencho pre-fills sensible default
|
||||
|
||||
### Custom variables
|
||||
|
||||
Below the template variables, an **Add Custom Variable** section lets you define arbitrary key-value pairs not declared by the template. Type a key and value, then click **+** to add it.
|
||||
Below the template variables, an **Add Custom Variable** section lets you define arbitrary key-value pairs not declared by the template. Type a key and value, then click **+** to add it. If you add a key that already exists in the template defaults, a warning will let you know your custom value will override the default.
|
||||
|
||||
### What happens on Deploy
|
||||
|
||||
1. Sencho creates a new stack directory in `COMPOSE_DIR`
|
||||
2. Writes the generated `compose.yaml` and `.env` file
|
||||
2. Writes the generated `compose.yaml` (and `.env` file if environment variables are configured)
|
||||
3. Runs `docker compose up -d`
|
||||
4. On success: switches you to the Editor view for that stack
|
||||
5. On failure: rolls back by running `docker compose down` and deleting the stack directory
|
||||
|
||||
Reference in New Issue
Block a user