Add tenant-scoped Studio backend primitives and static asset allowlist

This commit is contained in:
khondokartowsif171
2026-10-18 20:21:08 +06:00
parent d5c004a27e
commit 3847a5e6a1
8 changed files with 511 additions and 4 deletions
+16
View File
@@ -7,3 +7,19 @@ The runtime includes substantial poster-renderer changes not represented by main
The running Nginx service serves /api/get-synced-stores through its HTML fallback. A fresh no-cache GET reproduced HTML rather than JSON. This is the standalone Studio endpoint, not the separate Aura Admin URL-sync or Client catalog path.
Do not blindly enable serve.js: it uses one shared store file and contains invented price/compare-price fallbacks. A production repair must retain tenant boundaries, real product values and existing client behavior. No Meta 1-Click flow is included in this reconciliation.
## Backend candidate modules — not yet routed or deployed
server/workspace.cjs uses the existing Auth active-account endpoint and Client workspace endpoint. Browser client IDs are not accepted as storage identity. An owner must select a workspace explicitly; the Client gate owns the canonical workspace and catalog permission decisions. No database superuser credential or signing key is copied into these modules.
server/store.cjs persists per-canonical-workspace data using hashed namespace directories, serialized updates, atomic replacement and fsync. It does not load the prototype shared store file into a new tenant. Corrupt saved data fails instead of being silently replaced with an empty list. This store is for a single server process; a multi-replica deployment needs a shared transactional store or cross-process locking before use.
server/products.cjs maps structured Shopify, Woo Store API and schema.org data without guessed prices, discounts or currencies. It preserves variant/SKU distinctions and zero prices. Missing selling prices remain unknown; an aggregate starting price or strikethrough price alone is not presented as an exact current selling price.
The Nginx Dockerfile now copies an explicit static asset set instead of publishing all repository files. These candidate modules are not enabled by the static image. HTTP routing, bounded outbound fetching, request protection and frontend integration remain required before claiming that the Studio sync endpoint is repaired.
Verification: 17 tests pass on Windows and in an isolated Linux Node 22 container. They exercise canonical tenant selection, active-account rejection, shared owner/staff workspace storage, cross-workspace isolation, concurrent writes, corruption preservation, variant IDs and non-invented prices. Identity replies and product data in these tests are explicit fixtures, not production account/provider results.
A separate offline Nginx image build reproduces all 11 current web asset files after line-ending normalization and omits backend/test/configuration sentinel files. The candidate Nginx configuration validates. No candidate HTTP backend is running in production.
Price format reference: https://developer.woocommerce.com/docs/apis/store-api/resources-endpoints/products/ documents Store API currency/minor-unit fields. https://schema.org/PriceSpecification defines structured price specifications. A parent/range amount remains distinct from a selected variation's selling price.