openvibers/openvibe.design Commits
OpenVibe.Design v1: the theme studio (gallery, previews on Live, Chat and a shop with colour-vision views, a six-colour editor with WCAG checks that gate Use, sharing, History with Restore), Network sign-in and the theme API proxy
Changes
nnew file mode 100644@@@ -0,0 +1,25 @@++# OpenVibe.Design — environment (production: /etc/openvibe/design.env). Names only; never commit values.++++NODE_ENV=production++PORT=5090++HOST=127.0.0.1++BASE_URL=https://openvibe.design++TRUST_PROXY=2++++# OpenVibe.Network: the theme API this service proxies, sign-in (OAuth client `design`, PKCE S256) and its JWKS.++OV_NETWORK_INTERNAL_URL=http://127.0.0.1:4000++OV_OAUTH_CLIENT_ID=design++OV_OAUTH_CLIENT_SECRET=++# The browser is sent to the public origin; the token exchange and the JWKS use the internal one above.++# OV_NETWORK_URL=https://openvibe.network++# OV_NETWORK_ISSUER=https://openvibe.network++# OV_OAUTH_REDIRECT_URI=https://openvibe.design/auth/callback++# OV_SESSION_AUDIENCE=openvibe.network++++# Optional: the public catalogue's in-process cache (default 5 minutes), the Network timeout, the per-IP limit.++# DESIGN_THEME_CACHE_MS=300000++# DESIGN_UPSTREAM_TIMEOUT_MS=8000++# DESIGN_RATE_LIMIT_PER_MIN=120++++# optional: defaults to true in production++# COOKIE_SECURE=truennew file mode 100644@@@ -0,0 +1,16 @@++name: ci++on:++ push:++ branches: [main]++ pull_request:++jobs:++ # install, node --check and npm test: the shared test job (Track Q).++ test:++ uses: OpenVibers/OpenVibe.Shared/.github/workflows/test.yml@423fe519b5fe9594cc81b670e5ba5cb9f21f6176++ with:++ syntax-dirs: server test++ # No database, no Valkey, no Events: every test runs against an in-process Network stand-in.++ test: OV_ALLOW_SUITE=1 npm test++ # Secret scan (gitleaks) and dependency audit, shared by every OpenVibers repo (Track Q).++ security:++ uses: OpenVibers/OpenVibe.Shared/.github/workflows/security.yml@423fe519b5fe9594cc81b670e5ba5cb9f21f6176nnew file mode 100644@@@ -0,0 +1,12 @@++node_modules/++data/++dist/++.env++.env.*++!.env.example++*.log++*.pem++*.key++.npm-cache/++.ref/++.npm-cachennew file mode 100644@@@ -0,0 +1,31 @@++# Changelog++++What changed in OpenVibe.Design, newest first. Each site also publishes its patch notes at /updates.++++## 0.1.0 — 2026-10-28++++The service skeleton: sign-in and the theme API proxy.++++- **Sign-in with OpenVibe.Network** (`server/auth/sso.js`, OAuth client `design`): authorization code with PKCE++ S256, a state check, a server-side code exchange, httpOnly `design_at` and `design_rt` cookies++ (SameSite=Lax, Secure in production), the `design_oauth` flow cookie, and `sanitizeNext` (this site's own origin++ only, no control characters or backslashes). `/auth/login`, `/auth/callback`, `/auth/logout`, `/auth/me`.++- **The theme API proxy** (`server/http/api.js`): all calls go to OpenVibe.Network's `/api/themes` with the++ person's access token from the cookie as a Bearer. `GET /api/themes` is the public catalogue, cached in memory++ for 5 minutes; `GET /api/themes/:idOrSlug` is one public theme; `GET`/`PUT /api/me/theme` read and save the++ person's theme (`source: 'studio'`); `GET /api/me/theme/history` and `POST /api/me/theme/history/:id/restore`++ read and roll back the history; `POST /api/themes/submit` submits a theme to the gallery. Writes need the++ request's Origin to be this site's own origin, otherwise 403 `design.cross_site`. Network 4xx answers pass++ through; a Network failure is 502; `/api/me/*` is `private, no-store`.++- **Pages** (`server/http/pages.js`, `server/views/index.js`): `/`, `/studio`, `/t/:slug` and `/developers`, all++ server-rendered through the OpenVibe Frame and complete without JavaScript, plus a 404. The views are plain++ placeholders here: the main session designs the pages and writes `public/js/studio.js`.++- **Plumbing** (`server/app.js`): helmet with the network's CSP, content-hashed `/css` and `/js`, `/api/health`,++ `/api/ready` (degraded when Network does not answer), `/release.json`, `/release-metrics`, `/shared/*`,++ `/robots.txt`, `/sitemap.xml` (the public themes), `/llms.txt`, a 120/min per-IP limit on `/api` and `/auth`,++ and a graceful stop.++- **Deploy:** `deploy/systemd/openvibe-design.service` (port 5090, `/etc/openvibe/design.env`) and++ `deploy/nginx/openvibe.design.conf` (TLS for openvibe.design, www → apex, GET/POST/PUT on `/api`, GET on++ `/auth`).++- **Tests:** `test/sso.test.js`, `test/proxy.test.js` and `test/pages.test.js`, each against an in-process++ OpenVibe.Network stand-in with a real RS256 key pair.nnew file mode 100644@@@ -0,0 +1,661 @@++ GNU AFFERO GENERAL PUBLIC LICENSE++ Version 3, 19 November 2007++++ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>++ Everyone is permitted to copy and distribute verbatim copies++ of this license document, but changing it is not allowed.++++ Preamble++++ The GNU Affero General Public License is a free, copyleft license for++software and other kinds of works, specifically designed to ensure++cooperation with the community in the case of network server software.++++ The licenses for most software and other practical works are designed++to take away your freedom to share and change the works. By contrast,++our General Public Licenses are intended to guarantee your freedom to++share and change all versions of a program--to make sure it remains free++software for all its users.++++ When we speak of free software, we are referring to freedom, not++price. Our General Public Licenses are designed to make sure that you++have the freedom to distribute copies of free software (and charge for++them if you wish), that you receive source code or can get it if you++want it, that you can change the software or use pieces of it in new++free programs, and that you know you can do these things.++++ Developers that use our General Public Licenses protect your rights++with two steps: (1) assert copyright on the software, and (2) offer++you this License which gives you legal permission to copy, distribute++and/or modify the software.++++ A secondary benefit of defending all users' freedom is that++improvements made in alternate versions of the program, if they++receive widespread use, become available for other developers to++incorporate. Many developers of free software are heartened and++encouraged by the resulting cooperation. However, in the case of++software used on network servers, this result may fail to come about.++The GNU General Public License permits making a modified version and++letting the public access it on a server without ever releasing its++source code to the public.++++ The GNU Affero General Public License is designed specifically to++ensure that, in such cases, the modified source code becomes available++to the community. It requires the operator of a network server to++provide the source code of the modified version running there to the++users of that server. Therefore, public use of a modified version, on++a publicly accessible server, gives the public access to the source++code of the modified version.++++ An older license, called the Affero General Public License and++published by Affero, was designed to accomplish similar goals. This is++a different license, not a version of the Affero GPL, but Affero has++released a new version of the Affero GPL which permits relicensing under++this license.++++ The precise terms and conditions for copying, distribution and++modification follow.++++ TERMS AND CONDITIONS++++ 0. Definitions.++++ "This License" refers to version 3 of the GNU Affero General Public License.++++ "Copyright" also means copyright-like laws that apply to other kinds of++works, such as semiconductor masks.++++ "The Program" refers to any copyrightable work licensed under this++License. Each licensee is addressed as "you". "Licensees" and++"recipients" may be individuals or organizations.++++ To "modify" a work means to copy from or adapt all or part of the work++in a fashion requiring copyright permission, other than the making of an++exact copy. The resulting work is called a "modified version" of the++earlier work or a work "based on" the earlier work.++++ A "covered work" means either the unmodified Program or a work based++on the Program.++++ To "propagate" a work means to do anything with it that, without++permission, would make you directly or secondarily liable for++infringement under applicable copyright law, except executing it on a++computer or modifying a private copy. Propagation includes copying,++distribution (with or without modification), making available to the++public, and in some countries other activities as well.++++ To "convey" a work means any kind of propagation that enables other++parties to make or receive copies. Mere interaction with a user through++a computer network, with no transfer of a copy, is not conveying.++++ An interactive user interface displays "Appropriate Legal Notices"++to the extent that it includes a convenient and prominently visible++feature that (1) displays an appropriate copyright notice, and (2)++tells the user that there is no warranty for the work (except to the++extent that warranties are provided), that licensees may convey the++work under this License, and how to view a copy of this License. If++the interface presents a list of user commands or options, such as a++menu, a prominent item in the list meets this criterion.++++ 1. Source Code.++++ The "source code" for a work means the preferred form of the work++for making modifications to it. "Object code" means any non-source++form of a work.++++ A "Standard Interface" means an interface that either is an official++standard defined by a recognized standards body, or, in the case of++interfaces specified for a particular programming language, one that++is widely used among developers working in that language.++++ The "System Libraries" of an executable work include anything, other++than the work as a whole, that (a) is included in the normal form of++packaging a Major Component, but which is not part of that Major++Component, and (b) serves only to enable use of the work with that++Major Component, or to implement a Standard Interface for which an++implementation is available to the public in source code form. A++"Major Component", in this context, means a major essential component++(kernel, window system, and so on) of the specific operating system++(if any) on which the executable work runs, or a compiler used to++produce the work, or an object code interpreter used to run it.++++ The "Corresponding Source" for a work in object code form means all++the source code needed to generate, install, and (for an executable++work) run the object code and to modify the work, including scripts to++control those activities. However, it does not include the work's++System Libraries, or general-purpose tools or generally available free++programs which are used unmodified in performing those activities but++which are not part of the work. For example, Corresponding Source++includes interface definition files associated with source files for++the work, and the source code for shared libraries and dynamically++linked subprograms that the work is specifically designed to require,++such as by intimate data communication or control flow between those++subprograms and other parts of the work.++++ The Corresponding Source need not include anything that users++can regenerate automatically from other parts of the Corresponding++Source.++++ The Corresponding Source for a work in source code form is that++same work.++++ 2. Basic Permissions.++++ All rights granted under this License are granted for the term of++copyright on the Program, and are irrevocable provided the stated++conditions are met. This License explicitly affirms your unlimited++permission to run the unmodified Program. The output from running a++covered work is covered by this License only if the output, given its++content, constitutes a covered work. This License acknowledges your++rights of fair use or other equivalent, as provided by copyright law.++++ You may make, run and propagate covered works that you do not++convey, without conditions so long as your license otherwise remains++in force. You may convey covered works to others for the sole purpose++of having them make modifications exclusively for you, or provide you++with facilities for running those works, provided that you comply with++the terms of this License in conveying all material for which you do++not control copyright. Those thus making or running the covered works++for you must do so exclusively on your behalf, under your direction++and control, on terms that prohibit them from making any copies of++your copyrighted material outside their relationship with you.++++ Conveying under any other circumstances is permitted solely under++the conditions stated below. Sublicensing is not allowed; section 10++makes it unnecessary.++++ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.++++ No covered work shall be deemed part of an effective technological++measure under any applicable law fulfilling obligations under article++11 of the WIPO copyright treaty adopted on 20 December 1996, or++similar laws prohibiting or restricting circumvention of such++measures.++++ When you convey a covered work, you waive any legal power to forbid++circumvention of technological measures to the extent such circumvention++is effected by exercising rights under this License with respect to++the covered work, and you disclaim any intention to limit operation or++modification of the work as a means of enforcing, against the work's++users, your or third parties' legal rights to forbid circumvention of++technological measures.++++ 4. Conveying Verbatim Copies.++++ You may convey verbatim copies of the Program's source code as you++receive it, in any medium, provided that you conspicuously and++appropriately publish on each copy an appropriate copyright notice;++keep intact all notices stating that this License and any++non-permissive terms added in accord with section 7 apply to the code;++keep intact all notices of the absence of any warranty; and give all++recipients a copy of this License along with the Program.++++ You may charge any price or no price for each copy that you convey,++and you may offer support or warranty protection for a fee.++++ 5. Conveying Modified Source Versions.++++ You may convey a work based on the Program, or the modifications to++produce it from the Program, in the form of source code under the++terms of section 4, provided that you also meet all of these conditions:++++ a) The work must carry prominent notices stating that you modified++ it, and giving a relevant date.++++ b) The work must carry prominent notices stating that it is++ released under this License and any conditions added under section++ 7. This requirement modifies the requirement in section 4 to++ "keep intact all notices".++++ c) You must license the entire work, as a whole, under this++ License to anyone who comes into possession of a copy. This++ License will therefore apply, along with any applicable section 7++ additional terms, to the whole of the work, and all its parts,++ regardless of how they are packaged. This License gives no++ permission to license the work in any other way, but it does not++ invalidate such permission if you have separately received it.++++ d) If the work has interactive user interfaces, each must display++ Appropriate Legal Notices; however, if the Program has interactive++ interfaces that do not display Appropriate Legal Notices, your++ work need not make them do so.++++ A compilation of a covered work with other separate and independent++works, which are not by their nature extensions of the covered work,++and which are not combined with it such as to form a larger program,++in or on a volume of a storage or distribution medium, is called an++"aggregate" if the compilation and its resulting copyright are not++used to limit the access or legal rights of the compilation's users++beyond what the individual works permit. Inclusion of a covered work++in an aggregate does not cause this License to apply to the other++parts of the aggregate.++++ 6. Conveying Non-Source Forms.++++ You may convey a covered work in object code form under the terms++of sections 4 and 5, provided that you also convey the++machine-readable Corresponding Source under the terms of this License,++in one of these ways:++++ a) Convey the object code in, or embodied in, a physical product++ (including a physical distribution medium), accompanied by the++ Corresponding Source fixed on a durable physical medium++ customarily used for software interchange.++++ b) Convey the object code in, or embodied in, a physical product++ (including a physical distribution medium), accompanied by a++ written offer, valid for at least three years and valid for as++ long as you offer spare parts or customer support for that product++ model, to give anyone who possesses the object code either (1) a++ copy of the Corresponding Source for all the software in the++ product that is covered by this License, on a durable physical++ medium customarily used for software interchange, for a price no++ more than your reasonable cost of physically performing this++ conveying of source, or (2) access to copy the++ Corresponding Source from a network server at no charge.++++ c) Convey individual copies of the object code with a copy of the++ written offer to provide the Corresponding Source. This++ alternative is allowed only occasionally and noncommercially, and++ only if you received the object code with such an offer, in accord++ with subsection 6b.++++ d) Convey the object code by offering access from a designated++ place (gratis or for a charge), and offer equivalent access to the++ Corresponding Source in the same way through the same place at no++ further charge. You need not require recipients to copy the++ Corresponding Source along with the object code. If the place to++ copy the object code is a network server, the Corresponding Source++ may be on a different server (operated by you or a third party)++ that supports equivalent copying facilities, provided you maintain++ clear directions next to the object code saying where to find the++ Corresponding Source. Regardless of what server hosts the++ Corresponding Source, you remain obligated to ensure that it is++ available for as long as needed to satisfy these requirements.++++ e) Convey the object code using peer-to-peer transmission, provided++ you inform other peers where the object code and Corresponding++ Source of the work are being offered to the general public at no++ charge under subsection 6d.++++ A separable portion of the object code, whose source code is excluded++from the Corresponding Source as a System Library, need not be++included in conveying the object code work.++++ A "User Product" is either (1) a "consumer product", which means any++tangible personal property which is normally used for personal, family,++or household purposes, or (2) anything designed or sold for incorporation++into a dwelling. In determining whether a product is a consumer product,++doubtful cases shall be resolved in favor of coverage. For a particular++product received by a particular user, "normally used" refers to a++typical or common use of that class of product, regardless of the status++of the particular user or of the way in which the particular user++actually uses, or expects or is expected to use, the product. A product++is a consumer product regardless of whether the product has substantial++commercial, industrial or non-consumer uses, unless such uses represent++the only significant mode of use of the product.++++ "Installation Information" for a User Product means any methods,++procedures, authorization keys, or other information required to install++and execute modified versions of a covered work in that User Product from++a modified version of its Corresponding Source. The information must++suffice to ensure that the continued functioning of the modified object++code is in no case prevented or interfered with solely because++modification has been made.++++ If you convey an object code work under this section in, or with, or++specifically for use in, a User Product, and the conveying occurs as++part of a transaction in which the right of possession and use of the++User Product is transferred to the recipient in perpetuity or for a++fixed term (regardless of how the transaction is characterized), the++Corresponding Source conveyed under this section must be accompanied++by the Installation Information. But this requirement does not apply++if neither you nor any third party retains the ability to install++modified object code on the User Product (for example, the work has++been installed in ROM).++++ The requirement to provide Installation Information does not include a++requirement to continue to provide support service, warranty, or updates++for a work that has been modified or installed by the recipient, or for++the User Product in which it has been modified or installed. Access to a++network may be denied when the modification itself materially and++adversely affects the operation of the network or violates the rules and++protocols for communication across the network.++++ Corresponding Source conveyed, and Installation Information provided,++in accord with this section must be in a format that is publicly++documented (and with an implementation available to the public in++source code form), and must require no special password or key for++unpacking, reading or copying.++++ 7. Additional Terms.++++ "Additional permissions" are terms that supplement the terms of this++License by making exceptions from one or more of its conditions.++Additional permissions that are applicable to the entire Program shall++be treated as though they were included in this License, to the extent++that they are valid under applicable law. If additional permissions++apply only to part of the Program, that part may be used separately++under those permissions, but the entire Program remains governed by++this License without regard to the additional permissions.++++ When you convey a copy of a covered work, you may at your option++remove any additional permissions from that copy, or from any part of++it. (Additional permissions may be written to require their own++removal in certain cases when you modify the work.) You may place++additional permissions on material, added by you to a covered work,++for which you have or can give appropriate copyright permission.++++ Notwithstanding any other provision of this License, for material you++add to a covered work, you may (if authorized by the copyright holders of++that material) supplement the terms of this License with terms:++++ a) Disclaiming warranty or limiting liability differently from the++ terms of sections 15 and 16 of this License; or++++ b) Requiring preservation of specified reasonable legal notices or++ author attributions in that material or in the Appropriate Legal++ Notices displayed by works containing it; or++++ c) Prohibiting misrepresentation of the origin of that material, or++ requiring that modified versions of such material be marked in++ reasonable ways as different from the original version; or++++ d) Limiting the use for publicity purposes of names of licensors or++ authors of the material; or++++ e) Declining to grant rights under trademark law for use of some++ trade names, trademarks, or service marks; or++++ f) Requiring indemnification of licensors and authors of that++ material by anyone who conveys the material (or modified versions of++ it) with contractual assumptions of liability to the recipient, for++ any liability that these contractual assumptions directly impose on++ those licensors and authors.++++ All other non-permissive additional terms are considered "further++restrictions" within the meaning of section 10. If the Program as you++received it, or any part of it, contains a notice stating that it is++governed by this License along with a term that is a further++restriction, you may remove that term. If a license document contains++a further restriction but permits relicensing or conveying under this++License, you may add to a covered work material governed by the terms++of that license document, provided that the further restriction does++not survive such relicensing or conveying.++++ If you add terms to a covered work in accord with this section, you++must place, in the relevant source files, a statement of the++additional terms that apply to those files, or a notice indicating++where to find the applicable terms.++++ Additional terms, permissive or non-permissive, may be stated in the++form of a separately written license, or stated as exceptions;++the above requirements apply either way.++++ 8. Termination.++++ You may not propagate or modify a covered work except as expressly++provided under this License. Any attempt otherwise to propagate or++modify it is void, and will automatically terminate your rights under++this License (including any patent licenses granted under the third++paragraph of section 11).++++ However, if you cease all violation of this License, then your++license from a particular copyright holder is reinstated (a)++provisionally, unless and until the copyright holder explicitly and++finally terminates your license, and (b) permanently, if the copyright++holder fails to notify you of the violation by some reasonable means++prior to 60 days after the cessation.++++ Moreover, your license from a particular copyright holder is++reinstated permanently if the copyright holder notifies you of the++violation by some reasonable means, this is the first time you have++received notice of violation of this License (for any work) from that++copyright holder, and you cure the violation prior to 30 days after++your receipt of the notice.++++ Termination of your rights under this section does not terminate the++licenses of parties who have received copies or rights from you under++this License. If your rights have been terminated and not permanently++reinstated, you do not qualify to receive new licenses for the same++material under section 10.++++ 9. Acceptance Not Required for Having Copies.++++ You are not required to accept this License in order to receive or++run a copy of the Program. Ancillary propagation of a covered work++occurring solely as a consequence of using peer-to-peer transmission++to receive a copy likewise does not require acceptance. However,++nothing other than this License grants you permission to propagate or++modify any covered work. These actions infringe copyright if you do++not accept this License. Therefore, by modifying or propagating a++covered work, you indicate your acceptance of this License to do so.++++ 10. Automatic Licensing of Downstream Recipients.++++ Each time you convey a covered work, the recipient automatically++receives a license from the original licensors, to run, modify and++propagate that work, subject to this License. You are not responsible++for enforcing compliance by third parties with this License.++++ An "entity transaction" is a transaction transferring control of an++organization, or substantially all assets of one, or subdividing an++organization, or merging organizations. If propagation of a covered++work results from an entity transaction, each party to that++transaction who receives a copy of the work also receives whatever++licenses to the work the party's predecessor in interest had or could++give under the previous paragraph, plus a right to possession of the++Corresponding Source of the work from the predecessor in interest, if++the predecessor has it or can get it with reasonable efforts.++++ You may not impose any further restrictions on the exercise of the++rights granted or affirmed under this License. For example, you may++not impose a license fee, royalty, or other charge for exercise of++rights granted under this License, and you may not initiate litigation++(including a cross-claim or counterclaim in a lawsuit) alleging that++any patent claim is infringed by making, using, selling, offering for++sale, or importing the Program or any portion of it.++++ 11. Patents.++++ A "contributor" is a copyright holder who authorizes use under this++License of the Program or a work on which the Program is based. The++work thus licensed is called the contributor's "contributor version".++++ A contributor's "essential patent claims" are all patent claims++owned or controlled by the contributor, whether already acquired or++hereafter acquired, that would be infringed by some manner, permitted++by this License, of making, using, or selling its contributor version,++but do not include claims that would be infringed only as a++consequence of further modification of the contributor version. For++purposes of this definition, "control" includes the right to grant++patent sublicenses in a manner consistent with the requirements of++this License.++++ Each contributor grants you a non-exclusive, worldwide, royalty-free++patent license under the contributor's essential patent claims, to++make, use, sell, offer for sale, import and otherwise run, modify and++propagate the contents of its contributor version.++++ In the following three paragraphs, a "patent license" is any express++agreement or commitment, however denominated, not to enforce a patent++(such as an express permission to practice a patent or covenant not to++sue for patent infringement). To "grant" such a patent license to a++party means to make such an agreement or commitment not to enforce a++patent against the party.++++ If you convey a covered work, knowingly relying on a patent license,++and the Corresponding Source of the work is not available for anyone++to copy, free of charge and under the terms of this License, through a++publicly available network server or other readily accessible means,++then you must either (1) cause the Corresponding Source to be so++available, or (2) arrange to deprive yourself of the benefit of the++patent license for this particular work, or (3) arrange, in a manner++consistent with the requirements of this License, to extend the patent++license to downstream recipients. "Knowingly relying" means you have++actual knowledge that, but for the patent license, your conveying the++covered work in a country, or your recipient's use of the covered work++in a country, would infringe one or more identifiable patents in that++country that you have reason to believe are valid.++++ If, pursuant to or in connection with a single transaction or++arrangement, you convey, or propagate by procuring conveyance of, a++covered work, and grant a patent license to some of the parties++receiving the covered work authorizing them to use, propagate, modify++or convey a specific copy of the covered work, then the patent license++you grant is automatically extended to all recipients of the covered++work and works based on it.++++ A patent license is "discriminatory" if it does not include within++the scope of its coverage, prohibits the exercise of, or is++conditioned on the non-exercise of one or more of the rights that are++specifically granted under this License. You may not convey a covered++work if you are a party to an arrangement with a third party that is++in the business of distributing software, under which you make payment++to the third party based on the extent of your activity of conveying++the work, and under which the third party grants, to any of the++parties who would receive the covered work from you, a discriminatory++patent license (a) in connection with copies of the covered work++conveyed by you (or copies made from those copies), or (b) primarily++for and in connection with specific products or compilations that++contain the covered work, unless you entered into that arrangement,++or that patent license was granted, prior to 28 March 2007.++++ Nothing in this License shall be construed as excluding or limiting++any implied license or other defenses to infringement that may++otherwise be available to you under applicable patent law.++++ 12. No Surrender of Others' Freedom.++++ If conditions are imposed on you (whether by court order, agreement or++otherwise) that contradict the conditions of this License, they do not++excuse you from the conditions of this License. If you cannot convey a++covered work so as to satisfy simultaneously your obligations under this++License and any other pertinent obligations, then as a consequence you may++not convey it at all. For example, if you agree to terms that obligate you++to collect a royalty for further conveying from those to whom you convey++the Program, the only way you could satisfy both those terms and this++License would be to refrain entirely from conveying the Program.++++ 13. Remote Network Interaction; Use with the GNU General Public License.++++ Notwithstanding any other provision of this License, if you modify the++Program, your modified version must prominently offer all users++interacting with it remotely through a computer network (if your version++supports such interaction) an opportunity to receive the Corresponding++Source of your version by providing access to the Corresponding Source++from a network server at no charge, through some standard or customary++means of facilitating copying of software. This Corresponding Source++shall include the Corresponding Source for any work covered by version 3++of the GNU General Public License that is incorporated pursuant to the++following paragraph.++++ Notwithstanding any other provision of this License, you have++permission to link or combine any covered work with a work licensed++under version 3 of the GNU General Public License into a single++combined work, and to convey the resulting work. The terms of this++License will continue to apply to the part which is the covered work,++but the work with which it is combined will remain governed by version++3 of the GNU General Public License.++++ 14. Revised Versions of this License.++++ The Free Software Foundation may publish revised and/or new versions of++the GNU Affero General Public License from time to time. Such new versions++will be similar in spirit to the present version, but may differ in detail to++address new problems or concerns.++++ Each version is given a distinguishing version number. If the++Program specifies that a certain numbered version of the GNU Affero General++Public License "or any later version" applies to it, you have the++option of following the terms and conditions either of that numbered++version or of any later version published by the Free Software++Foundation. If the Program does not specify a version number of the++GNU Affero General Public License, you may choose any version ever published++by the Free Software Foundation.++++ If the Program specifies that a proxy can decide which future++versions of the GNU Affero General Public License can be used, that proxy's++public statement of acceptance of a version permanently authorizes you++to choose that version for the Program.++++ Later license versions may give you additional or different++permissions. However, no additional obligations are imposed on any++author or copyright holder as a result of your choosing to follow a++later version.++++ 15. Disclaimer of Warranty.++++ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY++APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT++HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY++OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,++THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR++PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM++IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF++ALL NECESSARY SERVICING, REPAIR OR CORRECTION.++++ 16. Limitation of Liability.++++ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING++WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS++THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY++GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE++USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF++DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD++PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),++EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF++SUCH DAMAGES.++++ 17. Interpretation of Sections 15 and 16.++++ If the disclaimer of warranty and limitation of liability provided++above cannot be given local legal effect according to their terms,++reviewing courts shall apply local law that most closely approximates++an absolute waiver of all civil liability in connection with the++Program, unless a warranty or assumption of liability accompanies a++copy of the Program in return for a fee.++++ END OF TERMS AND CONDITIONS++++ How to Apply These Terms to Your New Programs++++ If you develop a new program, and you want it to be of the greatest++possible use to the public, the best way to achieve this is to make it++free software which everyone can redistribute and change under these terms.++++ To do so, attach the following notices to the program. It is safest++to attach them to the start of each source file to most effectively++state the exclusion of warranty; and each file should have at least++the "copyright" line and a pointer to where the full notice is found.++++ <one line to give the program's name and a brief idea of what it does.>++ Copyright (C) <year> <name of author>++++ This program is free software: you can redistribute it and/or modify++ it under the terms of the GNU Affero General Public License as published++ by the Free Software Foundation, either version 3 of the License, or++ (at your option) any later version.++++ This program is distributed in the hope that it will be useful,++ but WITHOUT ANY WARRANTY; without even the implied warranty of++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the++ GNU Affero General Public License for more details.++++ You should have received a copy of the GNU Affero General Public License++ along with this program. If not, see <https://www.gnu.org/licenses/>.++++Also add information on how to contact you by electronic and paper mail.++++ If your software can interact with users remotely through a computer++network, you should also make sure that it provides a way for users to++get its source. For example, if your program is a web application, its++interface could display a "Source" link that leads users to an archive++of the code. There are many ways you could offer source, and different++solutions will be better for different programs; see section 13 for the++specific requirements.++++ You should also get your employer (if you work as a programmer) or school,++if any, to sign a "copyright disclaimer" for the program, if necessary.++For more information on this, and how to apply and follow the GNU AGPL, see++<https://www.gnu.org/licenses/>.nnew file mode 100644@@@ -0,0 +1,142 @@++# OpenVibe.Design++++> Make it yours, find the best AI designer.++++**Status:** v1, the theme studio (v0.1.0, see [STATUS.json](STATUS.json)).++**Domain:** `openvibe.design` · **Port:** 5090 · **Service id:** `design` · **Env prefix:** `DESIGN`++**License:** AGPL-3.0-only (the same as every OpenVibe service).++++OpenVibe.Design is the Design room: the theme studio where a person browses OpenVibe's themes, tries them on++previews, edits one with contrast checks, uses it, submits it to the gallery, and rolls back to any earlier++setting. Theme selection stays in OpenVibe.Network; this service signs the person in and proxies their calls to++the Network's theme API.++++## What it is++++- **Identity:** service id `design`, name OpenVibe.Design, port 5090, host 127.0.0.1. It stores no accounts, no++ database and no tokens: the person's Network session lives in httpOnly cookies and their theme lives in++ OpenVibe.Network.++- **Sign-in:** an OAuth 2 client of OpenVibe.Network (`design`), authorization code with PKCE S256, a state check++ and a server-side code exchange.++- **The theme API proxy:** every theme read and write goes to OpenVibe.Network's `/api/themes`, with the person's++ access token from the `design_at` cookie as a Bearer. The proxy never logs, renders or echoes the token.++++## The studio++++- **Gallery:** every theme in the catalogue, filtered by dark or light; picking one paints the previews.++- **Previews:** the theme is tried on three sites at once: a Live channel, a Chat room and a shop's grid. They read++ only theme tokens, so they look exactly as the sites will. *See it as* repaints them as people with protanopia,++ deuteranopia or tritanopia see them (SVG colour matrices).++- **Editor:** six colours (background, surface, text, muted text, accent, lines); [public/js/studio.js](public/js/studio.js)++ derives the full token set from them, the same tokens Network's validator accepts.++- **Checks:** WCAG contrast for text on the background and on cards, muted text, button text and links. Every++ required check must pass before *Use this theme* is enabled; *Lines against cards* is advisory.++- **Use, share, roll back:** *Use* is `PUT /api/me/theme` (source `studio`), *Share it in the gallery* submits the++ theme for review, and *History* lists the person's earlier looks with a one-tap *Restore*.++++## Pages++++| Route | What it is |++|---|---|++| `/` | the theme catalogue's front door |++| `/studio` | the theme studio; includes `/js/studio.js` and `/css/design.css` |++| `/t/:slug` | one public theme (Network 404 → the 404 page) |++| `/developers` | the API, for people and agents |++| anything else | the 404 page |++++All of them are server-rendered through the OpenVibe Frame (`openvibe-shared/shell`) and readable without++JavaScript. A page rendered for a signed-in person is `private, no-store`; a public page is++`public, max-age=120` with `Vary: Cookie`.++++## API++++Everything is proxied to `config.networkUrl` (`OV_NETWORK_INTERNAL_URL`, default `http://127.0.0.1:4000`) under++`/api/themes`. Errors are RFC 9457 `application/problem+json`. Reads are public; writes need the session and this++site's own `Origin` header.++++| Route | Auth | What it does |++|---|---|---|++| `GET /api/themes` | none | the public catalogue; cached in memory 5 minutes |++| `GET /api/themes/:idOrSlug` | none | one public theme |++| `GET /api/me/theme` | cookie | Network `GET /api/themes/me/active` → `{ theme_id, theme, custom_variables }`; 401 when signed out |++| `PUT /api/me/theme` | cookie + Origin | Network `PUT /api/themes/me` with `{ theme_id, custom_variables, source: "studio" }` |++| `GET /api/me/theme/history` | cookie | Network `GET /api/themes/me/history` |++| `POST /api/me/theme/history/:id/restore` | cookie + Origin | Network's restore; `id` must be a positive integer, else 400 |++| `POST /api/themes/submit` | cookie + Origin | Network `POST /api/themes` with `{ name, slug, description, mode, variables, tags }` |++++- A Network **4xx** answer passes through with its status and body; a Network failure (no answer, timeout, 5xx)++ is a `502 network.unavailable` problem.++- Every write (`PUT`, `POST`) whose `Origin` is not this site's own origin is refused with `403 design.cross_site`.++- Everything under `/api/me/*` carries `Cache-Control: private, no-store`.++++Plumbing: `GET /api/health`, `GET /api/ready` (200 `ready` or `degraded`; Network, JWKS and the OAuth client are++optional checks), `GET /release.json`, `POST /release-metrics`, `/shared/*` (the pinned Frame), `/css/*` and++`/js/*` (content-hashed `?v=` → immutable), `GET /robots.txt`, `GET /sitemap.xml` (the public themes),++`GET /llms.txt` and `GET /metrics` (loopback only).++++## Sign-in++++`server/auth/sso.js` is OpenVibe.Help's module with this site's names:++++- `GET /auth/login?next=/studio[&silent=1]` mints a state and a PKCE S256 verifier/challenge, stores them (and the++ sanitized `next`) in the httpOnly `design_oauth` flow cookie scoped to `/auth`, and redirects to++ `${OV_NETWORK_URL}/oauth/authorize` with `client_id=design` and `redirect_uri=${BASE_URL}/auth/callback`.++- `GET /auth/callback` checks the state in constant time, exchanges the code at the Network's internal++ `/oauth/token` with the client secret and the code verifier, and sets `design_at` (24 h) and `design_rt` (30 d):++ httpOnly, SameSite=Lax, Secure in production, Path=/.++- `GET /auth/logout` clears them and revokes the refresh token (best effort); `GET /auth/me` answers `{ user }` or++ `{ user: null }` for the shared navbar. A FedCM assertion or an app/service token never becomes a session.++- `sanitizeNext` accepts same-site relative paths only. An absolute URL on this site's own origin counts as its++ path; another origin, `//evil`, a control character or a backslash goes to `/`.++++The Network signs the access token (RS256); `server/auth/keys.js` fetches and refreshes its JWKS from++`${OV_NETWORK_INTERNAL_URL}/api/.well-known/jwks` through `openvibe-sdk/auth`.++++## Configuration++++See [.env.example](.env.example). Required in production: `BASE_URL` and `OV_OAUTH_CLIENT_SECRET` (the `design`++OAuth client on the Network). Optional: `OV_NETWORK_URL` (default `https://openvibe.network`),++`OV_NETWORK_INTERNAL_URL` (default `http://127.0.0.1:4000`), `OV_NETWORK_ISSUER`, `OV_OAUTH_REDIRECT_URI`,++`DESIGN_THEME_CACHE_MS`, `DESIGN_UPSTREAM_TIMEOUT_MS`, `DESIGN_RATE_LIMIT_PER_MIN` and `COOKIE_SECURE`.++++## How to run++++```bash++npm install++npm run dev # http://localhost:5090++OV_ALLOW_SUITE=1 npm test++```++++`npm test` runs every `test/*.test.js` in its own process with an in-process OpenVibe.Network stand-in++(`test/helpers/network.js`): a real RS256 key pair, the JWKS, the OAuth token endpoint, the theme catalogue and++the person's theme routes. Nothing calls the real internet. `OV_ALLOW_SUITE=1` is the suite opt-in the shared++test runner expects.++++## Deploy (for the lead)++++- **Deploy:** `sudo ovhost deploy design` on the host (checkout at `/opt/openvibe.design`, unit++ `openvibe-design.service` on 127.0.0.1:5090, env `/etc/openvibe/design.env`).++- **nginx:** [deploy/nginx/openvibe.design.conf](deploy/nginx/openvibe.design.conf), installed with++ `ov-vhost-install`. It allows GET/POST/PUT on `/api` and GET on `/auth`.++- **Readiness:** `/api/ready` reports `degraded` (HTTP 200) when OpenVibe.Network does not answer; the process++ still serves the pages and the crawl artifacts.++++## Security (threat notes)++++Reporting a vulnerability: [SECURITY.md](SECURITY.md).++++- Session tokens are httpOnly cookies; no script can read them and nothing renders or logs them. The only place++ they go is the `Authorization` header of a request to the configured Network origin.++- A theme write must come from this site's own origin (the `Origin` header), so another site cannot make a++ signed-in visitor change their theme.++- `next` after sign-in is this site's own path only; control characters and backslashes are refused because++ browsers drop or rewrite them.++- Every dynamic value in the placeholder views goes through the shared `esc`; the views are plain and show model++ text escaped.++- Secrets live only in the environment file; only variable names appear in code and docs, and no secret or token++ is logged.++++---++++Part of the [OpenVibe network](https://openvibe.network). Built in the open by++[OpenVibers](https://github.com/OpenVibers).nnew file mode 100644@@@ -0,0 +1,21 @@++# Security policy++++OpenVibe is run in the open, and we want to hear about security problems before anyone else does.++++## Reporting a vulnerability++++Email **[email protected]** with "security" in the subject. Please include what you found, where (URL,++repository, file), how to reproduce it, and what an attacker could do with it. Do not open a public GitHub issue for++a vulnerability, and do not test against other people's accounts, data or streams.++++We reply within 7 days, keep you updated while we fix it, and credit you when the fix ships if you would like.++++## Scope++++Every OpenVibe service and site (openvibe.design, openvibe.live, openvibe.network, openvibe.tools, openvibe.media,++openvibe.community, openvibe.games and the other openvibe.* domains) and every repository under++github.com/OpenVibers. Machine-readable contact details are at `/.well-known/security.txt` on each site.++++## Supported versions++++Only the current `main` branch, which is what runs in production, receives fixes.nnew file mode 100644@@@ -0,0 +1,50 @@++{++ "repository": "OpenVibers/OpenVibe.Design",++ "version": "0.1.0",++ "stage": "v1",++ "code": true,++ "wave": "W20",++ "plan": "OpenVibe.Design: the Design room's theme studio. Browse OpenVibe's themes, try them on previews, edit one with contrast checks, use it, submit it to the gallery, and roll back to any earlier setting. Theme selection stays in OpenVibe.Network; this service signs the person in and proxies their calls.",++ "runtime": "node 22, express 4, openvibe-shared/shell; stateless (no database, no Valkey, no Events)",++ "port": "5090",++ "domain": "openvibe.design",++ "contracts": "openvibe-contracts v0.227.0",++ "sdk": "openvibe-sdk v0.70.0",++ "shared": "openvibe-shared v4.29.2",++ "packages": [++ "openvibe-contracts v0.227.0",++ "openvibe-sdk v0.70.0",++ "openvibe-shared v4.29.2"++ ],++ "summary": "The service skeleton for openvibe.design: Network sign-in as OAuth client `design` (PKCE S256, httpOnly design_at/design_rt cookies) and a theme API proxy to OpenVibe.Network's /api/themes. The proxy serves the public catalogue (cached 5 minutes), one theme, the person's active theme and custom variables, saving a theme with source 'studio', its history and a restore by id, and a submission to the gallery. Writes need this site's own Origin; Network 4xx answers pass through and a Network failure is 502. The studio is designed: a gallery, previews on a Live channel, a Chat room and a shop's grid (with colour-vision views), a six-colour editor that derives the full token set, WCAG checks that gate Use, sharing to the gallery, and History with Restore.",++ "works": [++ "Sign-in with OpenVibe.Network: OAuth 2 authorization code, PKCE S256, state check, server-side exchange, httpOnly design_at/design_rt cookies, sanitizeNext (own origins only, no control characters or backslashes)",++ "The theme API proxy: GET /api/themes (5-minute in-memory cache), GET /api/themes/:idOrSlug, GET/PUT /api/me/theme, GET /api/me/theme/history, POST /api/me/theme/history/:id/restore, POST /api/themes/submit",++ "Same-origin CSRF on every proxied write (403 design.cross_site), 401 problem when signed out, Network 4xx pass-through, 502 on a Network failure, private, no-store on /api/me/*",++ "Server-rendered pages: /, /studio (the shell for public/js/studio.js), /t/:slug, /developers and a 404",++ "Crawl artifacts (robots.txt, sitemap.xml with the public themes, llms.txt), /api/health, /api/ready (degraded when Network does not answer), /release.json, /release-metrics, /shared/*",++ "Helmet with the network's CSP, per-IP 120/min on /api and /auth, content-hashed /css and /js, graceful stop",++ "Deploy files: openvibe-design.service, nginx vhost for openvibe.design on 127.0.0.1:5090",++ "Tests: sanitizeNext, the login redirect and callback, /auth/me, the proxy (cache, 401, CSRF, pass-through, down), the pages and the crawl artifacts, health and readiness"++ ],++ "notYet": [++ "The pages' design and public/js/studio.js: the main session writes them; today the views are plain placeholders and design.css and studio.js are one-comment files",++ "A Design service manifest and capabilities in OpenVibe.Contracts: this service has no capability of its own and no other service calls it",++ "Deployment: the deploy files are written, but the service is not deployed yet"++ ],++ "capabilitiesRegistered": false,++ "serviceManifestRegistered": false,++ "deployed": false,++ "placeholderInSites": false,++ "features": [++ "Network sign-in (PKCE)",++ "theme API proxy",++ "theme history and restore",++ "theme submission",++ "server-rendered pages",++ "crawl artifacts",++ "limits and readiness",++ "deploy files"++ ],++ "updated": "2026-10-28"++}nnew file mode 100644@@@ -0,0 +1,101 @@++## ═══════════════════════════════════════════════════════════════++## openvibe.design — Nginx configuration (REFERENCE)++##++## Deployed to /etc/nginx/sites-available/openvibe.design.conf (ov-vhost-install) — keep them in sync and reload++## nginx after changing it. The Node app (port 5090, systemd unit openvibe-design) renders every page and serves++## the theme API proxy; nginx terminates TLS, redirects www → apex, rate-limits the API and sign-in, and compresses++## text.++##++## No proxy_cache: the app decides cacheability per response (public for a page rendered for an anonymous visitor;++## private, no-store for a person's theme and everything under /api/me). Never log request bodies here.++## ═══════════════════════════════════════════════════════════════++++limit_req_zone $binary_remote_addr zone=design_auth:10m rate=10r/m;++limit_req_zone $binary_remote_addr zone=design_api:10m rate=5r/s;++++server {++ listen 80;++ listen [::]:80;++ server_name openvibe.design www.openvibe.design;++++ location /.well-known/acme-challenge/ { root /var/www/certbot; }++ location / { return 301 https://openvibe.design$request_uri; }++}++++server {++ listen 443 ssl;++ listen [::]:443 ssl;++ http2 on;++ server_name www.openvibe.design;++++ ssl_certificate /etc/letsencrypt/live/openvibe.design/fullchain.pem;++ ssl_certificate_key /etc/letsencrypt/live/openvibe.design/privkey.pem;++ ssl_protocols TLSv1.2 TLSv1.3;++++ return 301 https://openvibe.design$request_uri;++}++++server {++ listen 443 ssl;++ listen [::]:443 ssl;++ http2 on;++ server_name openvibe.design;++++ ssl_certificate /etc/letsencrypt/live/openvibe.design/fullchain.pem;++ ssl_certificate_key /etc/letsencrypt/live/openvibe.design/privkey.pem;++ ssl_protocols TLSv1.2 TLSv1.3;++++ access_log /var/log/nginx/openvibe.design.access.log;++ error_log /var/log/nginx/openvibe.design.error.log;++++ # Theme variables and a submission are JSON; 128 KB leaves room for the headers.++ client_max_body_size 128k;++++ add_header X-Content-Type-Options nosniff always;++ add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;++++ gzip on;++ gzip_proxied any;++ gzip_vary on;++ gzip_comp_level 5;++ gzip_min_length 1024;++ gzip_types text/css application/javascript text/javascript application/json application/problem+json image/svg+xml text/plain application/xml;++++ proxy_http_version 1.1;++ proxy_set_header Host $host;++ proxy_set_header X-Real-IP $remote_addr;++ proxy_set_header X-Forwarded-For $remote_addr;++ proxy_set_header CF-Connecting-IP $remote_addr;++ proxy_set_header X-Forwarded-Proto $scheme;++++ # ── The theme API: reads, and the two writes it proxies (GET/POST/PUT) ──++ # DELETE, PATCH and everything else never reaches the app.++ location /api/ {++ limit_except GET POST PUT { deny all; }++ limit_req zone=design_api burst=20 nodelay;++ limit_req_status 429;++ proxy_pass http://127.0.0.1:5090;++ }++++ # ── Sign-in: GET only ───────────────────────────────────++ # /auth/login, /auth/callback, /auth/me and /auth/logout are all GETs here. The app's POST /auth/logout confirm++ # is defence in depth and is not exposed by nginx; a same-origin navigation signs out directly.++ location /auth/ {++ limit_except GET { deny all; }++ limit_req zone=design_auth burst=10 nodelay;++ limit_req_status 429;++ proxy_pass http://127.0.0.1:5090;++ }++++ # ── Prometheus metrics: host-local scrapers only (http://127.0.0.1:5090/metrics) ──++ location ~* ^/metrics(/|$) { return 404; }++++ # ── Pages, discovery, static assets, release.json ──────++ location / {++ proxy_pass http://127.0.0.1:5090;++ }++++ location ~ /\.(?!well-known) {++ deny all;++ }++}nnew file mode 100644@@@ -0,0 +1,30 @@++[Unit]++Description=OpenVibe.Design — Make it yours, find the best AI designer.++# Network (sign-in, JWKS, the theme API) should be up first, but OpenVibe.Design degrades honestly without it: the++# pages and the public catalogue serve, and sign-in waits for the signing key (see /api/ready).++After=network.target++Wants=openvibe-network.service++++[Service]++Type=simple++User=ubuntu++Group=ubuntu++WorkingDirectory=/opt/openvibe.design++EnvironmentFile=/etc/openvibe/design.env++Environment=NODE_ENV=production++Environment=PORT=5090++Environment=PATH=/usr/local/bin:/usr/bin:/bin++ExecStart=/usr/bin/env node /opt/openvibe.design/server/index.js++Restart=always++RestartSec=5++KillSignal=SIGTERM++# In-flight requests get the 10 s drain.++TimeoutStopSec=15++NoNewPrivileges=true++PrivateTmp=true++ProtectSystem=strict++ProtectHome=true++# Stateless: the code tree is read-only and nothing here writes to disk.++++[Install]++WantedBy=multi-user.targetnnew file mode 100644@@@ -0,0 +1,1143 @@++{++ "name": "openvibe-design",++ "version": "0.1.0",++ "lockfileVersion": 3,++ "requires": true,++ "packages": {++ "": {++ "name": "openvibe-design",++ "version": "0.1.0",++ "license": "AGPL-3.0-only",++ "dependencies": {++ "cookie-parser": "^1.4.7",++ "dotenv": "^16.4.7",++ "express": "^4.21.2",++ "express-rate-limit": "^7.5.0",++ "helmet": "^8.1.0",++ "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.227.0",++ "openvibe-sdk": "https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.70.0",++ "openvibe-shared": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.29.2"++ },++ "engines": {++ "node": ">=22.0.0"++ }++ },++ "node_modules/accepts": {++ "version": "1.3.8",++ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",++ "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",++ "license": "MIT",++ "dependencies": {++ "mime-types": "~2.1.34",++ "negotiator": "0.6.3"++ },++ "engines": {++ "node": ">= 0.6"++ }++ },++ "node_modules/ajv": {++ "version": "8.20.0",++ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz",++ "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==",++ "license": "MIT",++ "dependencies": {++ "fast-deep-equal": "^3.1.3",++ "fast-uri": "^3.0.1",++ "json-schema-traverse": "^1.0.0",++ "require-from-string": "^2.0.2"++ },++ "funding": {++ "type": "github",++ "url": "https://github.com/sponsors/epoberezkin"++ }++ },++ "node_modules/ajv-formats": {++ "version": "3.0.1",++ "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz",++ "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==",++ "license": "MIT",++ "dependencies": {++ "ajv": "^8.0.0"++ },++ "peerDependencies": {++ "ajv": "^8.0.0"++ },++ "peerDependenciesMeta": {++ "ajv": {++ "optional": true++ }++ }++ },++ "node_modules/array-flatten": {++ "version": "1.1.1",++ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",++ "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",++ "license": "MIT"++ },++ "node_modules/body-parser": {++ "version": "1.20.9",++ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.9.tgz",++ "integrity": "sha512-FISIQxV5u91Y9gvuFq3q/tA/qTqLJn3AhRcEvyozyhJTh5OBFFtv827AdHU7Rbyct4r+Ba1/99oFa1Y3yuFsdw==",++ "license": "MIT",++ "dependencies": {++ "bytes": "~3.1.2",++ "content-type": "~1.0.5",++ "debug": "2.6.9",++ "depd": "2.0.0",++ "destroy": "~1.2.0",++ "http-errors": "~2.0.1",++ "iconv-lite": "~0.4.24",++ "on-finished": "~2.4.1",++ "qs": "~6.16.0",++ "raw-body": "~2.5.3",++ "type-is": "~1.6.18",++ "unpipe": "~1.0.0"++ },++ "engines": {++ "node": ">= 0.8",++ "npm": "1.2.8000 || >= 1.4.16"++ }++ },++ "node_modules/buffer-equal-constant-time": {++ "version": "1.0.1",++ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",++ "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==",++ "license": "BSD-3-Clause"++ },++ "node_modules/bytes": {++ "version": "3.1.2",++ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",++ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.8"++ }++ },++ "node_modules/call-bind-apply-helpers": {++ "version": "1.0.2",++ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",++ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",++ "license": "MIT",++ "dependencies": {++ "es-errors": "^1.3.0",++ "function-bind": "^1.1.2"++ },++ "engines": {++ "node": ">= 0.4"++ }++ },++ "node_modules/call-bound": {++ "version": "1.0.4",++ "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",++ "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",++ "license": "MIT",++ "dependencies": {++ "call-bind-apply-helpers": "^1.0.2",++ "get-intrinsic": "^1.3.0"++ },++ "engines": {++ "node": ">= 0.4"++ },++ "funding": {++ "url": "https://github.com/sponsors/ljharb"++ }++ },++ "node_modules/content-disposition": {++ "version": "0.5.4",++ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",++ "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",++ "license": "MIT",++ "dependencies": {++ "safe-buffer": "5.2.1"++ },++ "engines": {++ "node": ">= 0.6"++ }++ },++ "node_modules/content-type": {++ "version": "1.0.5",++ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",++ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.6"++ }++ },++ "node_modules/cookie": {++ "version": "0.7.2",++ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",++ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.6"++ }++ },++ "node_modules/cookie-parser": {++ "version": "1.4.7",++ "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.7.tgz",++ "integrity": "sha512-nGUvgXnotP3BsjiLX2ypbQnWoGUPIIfHQNZkkC668ntrzGWEZVW70HDEB1qnNGMicPje6EttlIgzo51YSwNQGw==",++ "license": "MIT",++ "dependencies": {++ "cookie": "0.7.2",++ "cookie-signature": "1.0.6"++ },++ "engines": {++ "node": ">= 0.8.0"++ }++ },++ "node_modules/cookie-signature": {++ "version": "1.0.6",++ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",++ "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==",++ "license": "MIT"++ },++ "node_modules/debug": {++ "version": "2.6.9",++ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",++ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",++ "license": "MIT",++ "dependencies": {++ "ms": "2.0.0"++ }++ },++ "node_modules/depd": {++ "version": "2.0.0",++ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",++ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.8"++ }++ },++ "node_modules/destroy": {++ "version": "1.2.0",++ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",++ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.8",++ "npm": "1.2.8000 || >= 1.4.16"++ }++ },++ "node_modules/dotenv": {++ "version": "16.6.1",++ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",++ "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",++ "license": "BSD-2-Clause",++ "engines": {++ "node": ">=12"++ },++ "funding": {++ "url": "https://dotenvx.com"++ }++ },++ "node_modules/dunder-proto": {++ "version": "1.0.1",++ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",++ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",++ "license": "MIT",++ "dependencies": {++ "call-bind-apply-helpers": "^1.0.1",++ "es-errors": "^1.3.0",++ "gopd": "^1.2.0"++ },++ "engines": {++ "node": ">= 0.4"++ }++ },++ "node_modules/ecdsa-sig-formatter": {++ "version": "1.0.11",++ "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",++ "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",++ "license": "Apache-2.0",++ "dependencies": {++ "safe-buffer": "^5.0.1"++ }++ },++ "node_modules/ee-first": {++ "version": "1.1.1",++ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",++ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",++ "license": "MIT"++ },++ "node_modules/encodeurl": {++ "version": "2.0.0",++ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",++ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.8"++ }++ },++ "node_modules/es-define-property": {++ "version": "1.0.1",++ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",++ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.4"++ }++ },++ "node_modules/es-errors": {++ "version": "1.3.0",++ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",++ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.4"++ }++ },++ "node_modules/es-object-atoms": {++ "version": "1.1.2",++ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",++ "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",++ "license": "MIT",++ "dependencies": {++ "es-errors": "^1.3.0"++ },++ "engines": {++ "node": ">= 0.4"++ }++ },++ "node_modules/escape-html": {++ "version": "1.0.3",++ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",++ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",++ "license": "MIT"++ },++ "node_modules/etag": {++ "version": "1.8.1",++ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",++ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.6"++ }++ },++ "node_modules/express": {++ "version": "4.22.3",++ "resolved": "https://registry.npmjs.org/express/-/express-4.22.3.tgz",++ "integrity": "sha512-Bdcs4+3qlpVlx2NRn6fgX2Ue2/gGRaPeawebgclM0ERSCqDpA+owF1fdPwjJUTAJWMTuAaxjDf+hzb0/4eKvvw==",++ "license": "MIT",++ "dependencies": {++ "accepts": "~1.3.8",++ "array-flatten": "1.1.1",++ "body-parser": "~1.20.5",++ "content-disposition": "~0.5.4",++ "content-type": "~1.0.4",++ "cookie": "~0.7.1",++ "cookie-signature": "~1.0.6",++ "debug": "2.6.9",++ "depd": "2.0.0",++ "encodeurl": "~2.0.0",++ "escape-html": "~1.0.3",++ "etag": "~1.8.1",++ "finalhandler": "~1.3.1",++ "fresh": "~0.5.2",++ "http-errors": "~2.0.0",++ "merge-descriptors": "1.0.3",++ "methods": "~1.1.2",++ "on-finished": "~2.4.1",++ "parseurl": "~1.3.3",++ "path-to-regexp": "~0.1.13",++ "proxy-addr": "~2.0.7",++ "qs": "~6.16.0",++ "range-parser": "~1.2.1",++ "safe-buffer": "5.2.1",++ "send": "~0.19.0",++ "serve-static": "~1.16.2",++ "setprototypeof": "1.2.0",++ "statuses": "~2.0.1",++ "type-is": "~1.6.18",++ "utils-merge": "1.0.1",++ "vary": "~1.1.2"++ },++ "engines": {++ "node": ">= 0.10.0"++ },++ "funding": {++ "type": "opencollective",++ "url": "https://opencollective.com/express"++ }++ },++ "node_modules/express-rate-limit": {++ "version": "7.5.1",++ "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.5.1.tgz",++ "integrity": "sha512-7iN8iPMDzOMHPUYllBEsQdWVB6fPDMPqwjBaFrgr4Jgr/+okjvzAy+UHlYYL/Vs0OsOrMkwS6PJDkFlJwoxUnw==",++ "license": "MIT",++ "engines": {++ "node": ">= 16"++ },++ "funding": {++ "url": "https://github.com/sponsors/express-rate-limit"++ },++ "peerDependencies": {++ "express": ">= 4.11"++ }++ },++ "node_modules/fast-deep-equal": {++ "version": "3.1.3",++ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",++ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",++ "license": "MIT"++ },++ "node_modules/fast-uri": {++ "version": "3.1.9",++ "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz",++ "integrity": "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==",++ "funding": [++ {++ "type": "github",++ "url": "https://github.com/sponsors/fastify"++ },++ {++ "type": "opencollective",++ "url": "https://opencollective.com/fastify"++ }++ ],++ "license": "BSD-3-Clause"++ },++ "node_modules/finalhandler": {++ "version": "1.3.2",++ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",++ "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",++ "license": "MIT",++ "dependencies": {++ "debug": "2.6.9",++ "encodeurl": "~2.0.0",++ "escape-html": "~1.0.3",++ "on-finished": "~2.4.1",++ "parseurl": "~1.3.3",++ "statuses": "~2.0.2",++ "unpipe": "~1.0.0"++ },++ "engines": {++ "node": ">= 0.8"++ }++ },++ "node_modules/forwarded": {++ "version": "0.2.0",++ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",++ "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.6"++ }++ },++ "node_modules/fresh": {++ "version": "0.5.2",++ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",++ "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.6"++ }++ },++ "node_modules/function-bind": {++ "version": "1.1.2",++ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",++ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",++ "license": "MIT",++ "funding": {++ "url": "https://github.com/sponsors/ljharb"++ }++ },++ "node_modules/get-intrinsic": {++ "version": "1.3.0",++ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",++ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",++ "license": "MIT",++ "dependencies": {++ "call-bind-apply-helpers": "^1.0.2",++ "es-define-property": "^1.0.1",++ "es-errors": "^1.3.0",++ "es-object-atoms": "^1.1.1",++ "function-bind": "^1.1.2",++ "get-proto": "^1.0.1",++ "gopd": "^1.2.0",++ "has-symbols": "^1.1.0",++ "hasown": "^2.0.2",++ "math-intrinsics": "^1.1.0"++ },++ "engines": {++ "node": ">= 0.4"++ },++ "funding": {++ "url": "https://github.com/sponsors/ljharb"++ }++ },++ "node_modules/get-proto": {++ "version": "1.0.1",++ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",++ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",++ "license": "MIT",++ "dependencies": {++ "dunder-proto": "^1.0.1",++ "es-object-atoms": "^1.0.0"++ },++ "engines": {++ "node": ">= 0.4"++ }++ },++ "node_modules/gopd": {++ "version": "1.2.0",++ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",++ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.4"++ },++ "funding": {++ "url": "https://github.com/sponsors/ljharb"++ }++ },++ "node_modules/has-symbols": {++ "version": "1.1.0",++ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",++ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.4"++ },++ "funding": {++ "url": "https://github.com/sponsors/ljharb"++ }++ },++ "node_modules/hasown": {++ "version": "2.0.4",++ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",++ "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",++ "license": "MIT",++ "dependencies": {++ "function-bind": "^1.1.2"++ },++ "engines": {++ "node": ">= 0.4"++ }++ },++ "node_modules/helmet": {++ "version": "8.3.0",++ "resolved": "https://registry.npmjs.org/helmet/-/helmet-8.3.0.tgz",++ "integrity": "sha512-Qgpiaws3Sm30Av8Eah6sjMCZZwjlBu+E68rhpCWBshY1lb09HtLwj5GviX0OyQIn+ulUS0iX0AxN5n3tLZzz1w==",++ "license": "MIT",++ "engines": {++ "node": ">=18.0.0"++ },++ "funding": {++ "url": "https://github.com/sponsors/EvanHahn"++ }++ },++ "node_modules/http-errors": {++ "version": "2.0.1",++ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",++ "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",++ "license": "MIT",++ "dependencies": {++ "depd": "~2.0.0",++ "inherits": "~2.0.4",++ "setprototypeof": "~1.2.0",++ "statuses": "~2.0.2",++ "toidentifier": "~1.0.1"++ },++ "engines": {++ "node": ">= 0.8"++ },++ "funding": {++ "type": "opencollective",++ "url": "https://opencollective.com/express"++ }++ },++ "node_modules/iconv-lite": {++ "version": "0.4.24",++ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",++ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",++ "license": "MIT",++ "dependencies": {++ "safer-buffer": ">= 2.1.2 < 3"++ },++ "engines": {++ "node": ">=0.10.0"++ }++ },++ "node_modules/inherits": {++ "version": "2.0.4",++ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",++ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",++ "license": "ISC"++ },++ "node_modules/ipaddr.js": {++ "version": "1.9.1",++ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",++ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.10"++ }++ },++ "node_modules/json-schema-traverse": {++ "version": "1.0.0",++ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",++ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",++ "license": "MIT"++ },++ "node_modules/jsonwebtoken": {++ "version": "9.0.3",++ "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz",++ "integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==",++ "license": "MIT",++ "dependencies": {++ "jws": "^4.0.1",++ "lodash.includes": "^4.3.0",++ "lodash.isboolean": "^3.0.3",++ "lodash.isinteger": "^4.0.4",++ "lodash.isnumber": "^3.0.3",++ "lodash.isplainobject": "^4.0.6",++ "lodash.isstring": "^4.0.1",++ "lodash.once": "^4.0.0",++ "ms": "^2.1.1",++ "semver": "^7.5.4"++ },++ "engines": {++ "node": ">=12",++ "npm": ">=6"++ }++ },++ "node_modules/jsonwebtoken/node_modules/ms": {++ "version": "2.1.3",++ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",++ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",++ "license": "MIT"++ },++ "node_modules/jwa": {++ "version": "2.0.1",++ "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz",++ "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==",++ "license": "MIT",++ "dependencies": {++ "buffer-equal-constant-time": "^1.0.1",++ "ecdsa-sig-formatter": "1.0.11",++ "safe-buffer": "^5.0.1"++ }++ },++ "node_modules/jws": {++ "version": "4.0.1",++ "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz",++ "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==",++ "license": "MIT",++ "dependencies": {++ "jwa": "^2.0.1",++ "safe-buffer": "^5.0.1"++ }++ },++ "node_modules/lodash.includes": {++ "version": "4.3.0",++ "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",++ "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==",++ "license": "MIT"++ },++ "node_modules/lodash.isboolean": {++ "version": "3.0.3",++ "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",++ "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==",++ "license": "MIT"++ },++ "node_modules/lodash.isinteger": {++ "version": "4.0.4",++ "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",++ "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==",++ "license": "MIT"++ },++ "node_modules/lodash.isnumber": {++ "version": "3.0.3",++ "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",++ "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==",++ "license": "MIT"++ },++ "node_modules/lodash.isplainobject": {++ "version": "4.0.6",++ "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",++ "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",++ "license": "MIT"++ },++ "node_modules/lodash.isstring": {++ "version": "4.0.1",++ "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",++ "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==",++ "license": "MIT"++ },++ "node_modules/lodash.once": {++ "version": "4.1.1",++ "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",++ "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==",++ "license": "MIT"++ },++ "node_modules/math-intrinsics": {++ "version": "1.1.0",++ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",++ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.4"++ }++ },++ "node_modules/media-typer": {++ "version": "0.3.0",++ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",++ "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.6"++ }++ },++ "node_modules/merge-descriptors": {++ "version": "1.0.3",++ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",++ "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",++ "license": "MIT",++ "funding": {++ "url": "https://github.com/sponsors/sindresorhus"++ }++ },++ "node_modules/methods": {++ "version": "1.1.2",++ "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",++ "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.6"++ }++ },++ "node_modules/mime": {++ "version": "1.6.0",++ "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",++ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",++ "license": "MIT",++ "bin": {++ "mime": "cli.js"++ },++ "engines": {++ "node": ">=4"++ }++ },++ "node_modules/mime-db": {++ "version": "1.52.0",++ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",++ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.6"++ }++ },++ "node_modules/mime-types": {++ "version": "2.1.35",++ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",++ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",++ "license": "MIT",++ "dependencies": {++ "mime-db": "1.52.0"++ },++ "engines": {++ "node": ">= 0.6"++ }++ },++ "node_modules/ms": {++ "version": "2.0.0",++ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",++ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",++ "license": "MIT"++ },++ "node_modules/negotiator": {++ "version": "0.6.3",++ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",++ "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.6"++ }++ },++ "node_modules/object-inspect": {++ "version": "1.13.4",++ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",++ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.4"++ },++ "funding": {++ "url": "https://github.com/sponsors/ljharb"++ }++ },++ "node_modules/on-finished": {++ "version": "2.4.2",++ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.2.tgz",++ "integrity": "sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ==",++ "license": "MIT",++ "dependencies": {++ "ee-first": "1.1.1"++ },++ "engines": {++ "node": ">= 0.8"++ },++ "funding": {++ "type": "opencollective",++ "url": "https://opencollective.com/express"++ }++ },++ "node_modules/openvibe-contracts": {++ "version": "0.227.0",++ "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.227.0",++ "integrity": "sha512-5B3PUpcN2+WGq/8tEai+fpTznza8PcPTTYKkmhkx8Vpn/nRuQV1DupZwAciSzGbZufgdaNI/28b4AVLtylwrAA==",++ "license": "AGPL-3.0-only",++ "dependencies": {++ "ajv": "^8.17.1",++ "ajv-formats": "^3.0.1"++ },++ "bin": {++ "openvibe-contracts-check": "bin/check-service.js"++ },++ "engines": {++ "node": ">=20"++ }++ },++ "node_modules/openvibe-sdk": {++ "version": "0.70.0",++ "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.70.0",++ "integrity": "sha512-iMNxlnRm0fmyj60nHiC/lKAaG3JAqiJgu42lShnkby4yF4dQJRG3G0trrqOoULZKBalrYHb/gjauRwNQYN/tog==",++ "license": "MIT",++ "bin": {++ "openvibe-download": "bin/openvibe-download.js"++ },++ "engines": {++ "node": ">=20"++ },++ "peerDependencies": {++ "@electric-sql/pglite": "^0.5.8",++ "iovalkey": "^0.4.0",++ "pg": "^8.23.0"++ },++ "peerDependenciesMeta": {++ "@electric-sql/pglite": {++ "optional": true++ },++ "iovalkey": {++ "optional": true++ },++ "pg": {++ "optional": true++ }++ }++ },++ "node_modules/openvibe-shared": {++ "version": "4.29.2",++ "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.29.2",++ "integrity": "sha512-d1D1WTysljk0hRP0ORc8c/RJqsdAcGSUyTQ3RwgZ0rtkvjJMsQh6ukslN88hbaG0xMK9WbqCyWYBBI+dDGDYYg==",++ "license": "MIT",++ "dependencies": {++ "jsonwebtoken": "^9.0.0"++ },++ "bin": {++ "openvibe-build-assets": "scripts/build-assets.js"++ }++ },++ "node_modules/parseurl": {++ "version": "1.3.3",++ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",++ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.8"++ }++ },++ "node_modules/path-to-regexp": {++ "version": "0.1.13",++ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",++ "integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==",++ "license": "MIT"++ },++ "node_modules/proxy-addr": {++ "version": "2.0.8",++ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz",++ "integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==",++ "license": "MIT",++ "dependencies": {++ "forwarded": "0.2.0",++ "ipaddr.js": "1.9.1"++ },++ "engines": {++ "node": ">= 0.10"++ },++ "funding": {++ "type": "opencollective",++ "url": "https://opencollective.com/express"++ }++ },++ "node_modules/qs": {++ "version": "6.16.2",++ "resolved": "https://registry.npmjs.org/qs/-/qs-6.16.2.tgz",++ "integrity": "sha512-VYdnB5S7/0IeXzBacUtwNAaM6d7Y/PgYnNC7bJCI6meqA/OgnsQbZMtVW8Dt2D1PHgbHGtYmhSoEIgvt7xZ2ZA==",++ "license": "BSD-3-Clause",++ "dependencies": {++ "es-define-property": "^1.0.1",++ "side-channel": "^1.1.1"++ },++ "engines": {++ "node": ">=0.6"++ },++ "funding": {++ "url": "https://github.com/sponsors/ljharb"++ }++ },++ "node_modules/range-parser": {++ "version": "1.2.1",++ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",++ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.6"++ }++ },++ "node_modules/raw-body": {++ "version": "2.5.3",++ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",++ "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",++ "license": "MIT",++ "dependencies": {++ "bytes": "~3.1.2",++ "http-errors": "~2.0.1",++ "iconv-lite": "~0.4.24",++ "unpipe": "~1.0.0"++ },++ "engines": {++ "node": ">= 0.8"++ }++ },++ "node_modules/require-from-string": {++ "version": "2.0.2",++ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",++ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",++ "license": "MIT",++ "engines": {++ "node": ">=0.10.0"++ }++ },++ "node_modules/safe-buffer": {++ "version": "5.2.1",++ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",++ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",++ "funding": [++ {++ "type": "github",++ "url": "https://github.com/sponsors/feross"++ },++ {++ "type": "patreon",++ "url": "https://www.patreon.com/feross"++ },++ {++ "type": "consulting",++ "url": "https://feross.org/support"++ }++ ],++ "license": "MIT"++ },++ "node_modules/safer-buffer": {++ "version": "2.1.2",++ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",++ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",++ "license": "MIT"++ },++ "node_modules/semver": {++ "version": "7.8.5",++ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",++ "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",++ "license": "ISC",++ "bin": {++ "semver": "bin/semver.js"++ },++ "engines": {++ "node": ">=10"++ }++ },++ "node_modules/send": {++ "version": "0.19.2",++ "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",++ "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",++ "license": "MIT",++ "dependencies": {++ "debug": "2.6.9",++ "depd": "2.0.0",++ "destroy": "1.2.0",++ "encodeurl": "~2.0.0",++ "escape-html": "~1.0.3",++ "etag": "~1.8.1",++ "fresh": "~0.5.2",++ "http-errors": "~2.0.1",++ "mime": "1.6.0",++ "ms": "2.1.3",++ "on-finished": "~2.4.1",++ "range-parser": "~1.2.1",++ "statuses": "~2.0.2"++ },++ "engines": {++ "node": ">= 0.8.0"++ }++ },++ "node_modules/send/node_modules/ms": {++ "version": "2.1.3",++ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",++ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",++ "license": "MIT"++ },++ "node_modules/serve-static": {++ "version": "1.16.3",++ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",++ "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",++ "license": "MIT",++ "dependencies": {++ "encodeurl": "~2.0.0",++ "escape-html": "~1.0.3",++ "parseurl": "~1.3.3",++ "send": "~0.19.1"++ },++ "engines": {++ "node": ">= 0.8.0"++ }++ },++ "node_modules/setprototypeof": {++ "version": "1.2.0",++ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",++ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",++ "license": "ISC"++ },++ "node_modules/side-channel": {++ "version": "1.1.1",++ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",++ "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",++ "license": "MIT",++ "dependencies": {++ "es-errors": "^1.3.0",++ "object-inspect": "^1.13.4",++ "side-channel-list": "^1.0.1",++ "side-channel-map": "^1.0.1",++ "side-channel-weakmap": "^1.0.2"++ },++ "engines": {++ "node": ">= 0.4"++ },++ "funding": {++ "url": "https://github.com/sponsors/ljharb"++ }++ },++ "node_modules/side-channel-list": {++ "version": "1.0.1",++ "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",++ "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",++ "license": "MIT",++ "dependencies": {++ "es-errors": "^1.3.0",++ "object-inspect": "^1.13.4"++ },++ "engines": {++ "node": ">= 0.4"++ },++ "funding": {++ "url": "https://github.com/sponsors/ljharb"++ }++ },++ "node_modules/side-channel-map": {++ "version": "1.0.1",++ "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",++ "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",++ "license": "MIT",++ "dependencies": {++ "call-bound": "^1.0.2",++ "es-errors": "^1.3.0",++ "get-intrinsic": "^1.2.5",++ "object-inspect": "^1.13.3"++ },++ "engines": {++ "node": ">= 0.4"++ },++ "funding": {++ "url": "https://github.com/sponsors/ljharb"++ }++ },++ "node_modules/side-channel-weakmap": {++ "version": "1.0.2",++ "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",++ "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",++ "license": "MIT",++ "dependencies": {++ "call-bound": "^1.0.2",++ "es-errors": "^1.3.0",++ "get-intrinsic": "^1.2.5",++ "object-inspect": "^1.13.3",++ "side-channel-map": "^1.0.1"++ },++ "engines": {++ "node": ">= 0.4"++ },++ "funding": {++ "url": "https://github.com/sponsors/ljharb"++ }++ },++ "node_modules/statuses": {++ "version": "2.0.2",++ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",++ "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.8"++ }++ },++ "node_modules/toidentifier": {++ "version": "1.0.1",++ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",++ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",++ "license": "MIT",++ "engines": {++ "node": ">=0.6"++ }++ },++ "node_modules/type-is": {++ "version": "1.6.18",++ "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",++ "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",++ "license": "MIT",++ "dependencies": {++ "media-typer": "0.3.0",++ "mime-types": "~2.1.24"++ },++ "engines": {++ "node": ">= 0.6"++ }++ },++ "node_modules/unpipe": {++ "version": "1.0.0",++ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",++ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.8"++ }++ },++ "node_modules/utils-merge": {++ "version": "1.0.1",++ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",++ "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.4.0"++ }++ },++ "node_modules/vary": {++ "version": "1.1.2",++ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",++ "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",++ "license": "MIT",++ "engines": {++ "node": ">= 0.8"++ }++ }++ }++}nnew file mode 100644@@@ -0,0 +1,30 @@++{++ "name": "openvibe-design",++ "version": "0.1.0",++ "private": true,++ "description": "OpenVibe.Design \u2014 Make it yours, find the best AI designer.",++ "main": "server/index.js",++ "scripts": {++ "start": "node server/index.js",++ "dev": "NODE_ENV=development node server/index.js",++ "test": "node test/run.js"++ },++ "keywords": [++ "openvibe"++ ],++ "author": "OpenVibers",++ "license": "AGPL-3.0-only",++ "dependencies": {++ "cookie-parser": "^1.4.7",++ "dotenv": "^16.4.7",++ "express": "^4.21.2",++ "express-rate-limit": "^7.5.0",++ "helmet": "^8.1.0",++ "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.227.0",++ "openvibe-sdk": "https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.70.0",++ "openvibe-shared": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.29.2"++ },++ "engines": {++ "node": ">=22.0.0"++ }++}nnew file mode 100644@@@ -0,0 +1,145 @@++/* OpenVibe.Design — the studio and the room's own pieces. The page wears the person's theme (theme-loader); the++ previews wear the theme being tried: studio.js sets its tokens on .ds-previews, and everything inside reads only++ var(--…), so a preview is exactly what an OpenVibe site would look like. Phone first: the studio stacks (gallery as a++ swipeable row, then the previews, then the editor); from 1100 px it is three columns. */++*, *::before, *::after { box-sizing: border-box; }++html, body { margin: 0; background: var(--bg-primary, #0a0f1c); color: var(--text-primary, #e6edf7); font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }++.skip { position: absolute; left: -9999px; }++.skip:focus { left: 12px; top: 12px; z-index: 99; padding: 8px 12px; border-radius: 10px; background: var(--bg-card, #0f1729); color: inherit; }++.ds-wrap { max-width: 1320px; margin: 0 auto; padding: 0 16px 64px; }++.ds a:not([class]) { color: var(--room-strong); }++.ds h2 { margin: 0 0 10px; font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }++.ds h3 { margin: 18px 0 8px; font-size: .78rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted, #7386a3); }++:where(.ds) .ovk-i { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }++.ds-kicker { margin: 0 0 4px; font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--room-strong); }++.ds-lede { margin: 8px 0 0; max-width: 720px; color: var(--text-secondary, #96a7c2); line-height: 1.55; }++.ds-fine { color: var(--text-muted, #7386a3); font-size: .84rem; line-height: 1.5; }++.ds-head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }++.ds-more { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; font-size: .9rem; text-decoration: none; color: var(--room-strong); }++.ds-more .ovk-i { width: 1em; height: 1em; }++.ds-page-h { padding-top: clamp(20px, 4vw, 40px); }++.ds-page-h h1, .ds-studio-h h1 { margin: 0; font-size: clamp(1.8rem, 4.4vw, 2.6rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.08; }++.ds-act { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }++.ds section { margin-top: clamp(26px, 4vw, 40px); }++++/* Swatches: a theme as four dots and its name. */++.ds-swatch { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border, #1f2d47); background: var(--bg-card, #0f1729); color: var(--text-primary, #e6edf7); font: inherit; font-size: .9rem; text-align: left; text-decoration: none; cursor: pointer; transition: border-color .15s, transform .15s; }++.ds-swatch:hover, .ds-swatch:focus-visible { border-color: var(--room-accent); outline: none; }++.ds-swatch[aria-pressed="true"] { border-color: var(--room-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--room-accent) 35%, transparent); }++.ds-dots { display: inline-flex; }++.ds-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--bg-card, #0f1729); margin-left: -5px; }++.ds-dots i:first-child { margin-left: 0; }++.ds-swatch-name { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }++.ds-swatch-mode { font-size: .72rem; color: var(--text-muted, #7386a3); }++.ds-strip { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 10px; }++++/* The studio. */++.ds-studio-h { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; padding: clamp(18px, 3vw, 32px) 0 14px; }++.ds-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }++.ds-gallery, .ds-stage, .ds-editor { min-width: 0; border-radius: 18px; border: 1px solid var(--border, #1f2d47); background: var(--bg-secondary, #101828); padding: 14px; }++.ds-gal-head, .ds-stage-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }++.ds-gal-head h2, .ds-stage-head h2 { margin: 0; }++.ds-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--bg-card, #0f1729); border: 1px solid var(--border, #1f2d47); }++.ds-seg button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--text-secondary, #96a7c2); font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; }++.ds-seg button[aria-pressed="true"] { background: var(--room-fill); color: var(--room-on); }++.ds-gal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }++.ds-gal-list li[hidden] { display: none; }++.ds-see { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--text-muted, #7386a3); }++.ds-see select, .ds-submit input, .ds-field input[type=text] { min-height: 36px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--border, #1f2d47); background: var(--bg-input, #0d1322); color: var(--text-primary, #e6edf7); font: inherit; font-size: .86rem; }++@media (max-width: 1099px) {++ .ds-gal-list { grid-auto-flow: column; grid-auto-columns: minmax(180px, 64%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: thin; }++ .ds-gal-list li { scroll-snap-align: start; }++}++@media (min-width: 1100px) {++ .ds-grid { grid-template-columns: 250px minmax(0, 1fr) 300px; align-items: start; }++ .ds-gallery { position: sticky; top: calc(var(--ovnav-real-h, 56px) + 12px); max-height: calc(100vh - var(--ovnav-real-h, 56px) - 24px); overflow-y: auto; }++ .ds-editor { position: sticky; top: calc(var(--ovnav-real-h, 56px) + 12px); }++}++++/* The previews: only var(--…) inside, so they wear the theme being tried. */++.ds-previews { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); transition: filter .2s; }++@media (min-width: 760px) { .ds-previews { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } .pv-shop { grid-column: 1 / -1; } }++.pv-frame { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 16px; background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border); min-width: 0; font-size: .86rem; }++.pv-label { margin: 0; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }++.pv-video { position: relative; aspect-ratio: 16 / 8; border-radius: 12px; background: radial-gradient(120% 120% at 70% 30%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 60%), linear-gradient(160deg, var(--bg-tertiary, var(--bg-card)), var(--bg-card)); }++.pv-badge { position: absolute; left: 8px; top: 8px; padding: 1px 7px; border-radius: 5px; background: var(--live-red, #e11d48); color: #fff; font-size: .68rem; font-weight: 800; }++.pv-viewers { position: absolute; right: 8px; bottom: 8px; padding: 1px 7px; border-radius: 5px; background: rgba(0, 0, 0, .6); color: #fff; font-size: .7rem; font-weight: 700; }++.pv-row { display: flex; align-items: center; gap: 10px; min-width: 0; }++.pv-col { display: flex; flex-direction: column; min-width: 0; flex: 1; }++.pv-col b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }++.pv-col small, .pv-muted { color: var(--text-muted); }++.pv-av { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: hsl(var(--h, 200) 55% 45%); color: #fff; font-size: .72rem; font-weight: 800; }++.pv-av-lg { width: 36px; height: 36px; }++.pv-btn { flex: none; min-height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--accent-strong, var(--accent)); color: var(--on-accent-strong, var(--on-accent, #fff)); font: inherit; font-weight: 800; font-size: .8rem; }++.pv-chat { list-style: none; margin: 0; padding: 10px; display: grid; gap: 8px; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border); }++.pv-chat li { display: flex; align-items: flex-start; gap: 8px; color: var(--text-secondary); line-height: 1.35; }++.pv-chat b { color: var(--text-primary); }++.pv-chat .pv-me { justify-content: flex-end; }++.pv-me span { padding: 5px 10px; border-radius: 12px 12px 4px 12px; background: var(--accent-strong, var(--accent)); color: var(--on-accent-strong, #fff); font-weight: 600; }++.pv-room { margin: 0; font-weight: 800; }++.pv-composer { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 4px 4px 4px 12px; border-radius: 999px; background: var(--bg-input, var(--bg-card)); border: 1px solid var(--border); color: var(--text-muted); }++.pv-send { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--accent-strong, var(--accent)); color: var(--on-accent-strong, #fff); }++.pv-send .ovk-i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; }++.pv-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }++.pv-chips span { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-secondary); font-size: .76rem; font-weight: 600; }++.pv-chips .is-on { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: var(--accent); color: var(--accent-light, var(--accent)); }++.pv-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }++.pv-shoe { display: flex; flex-direction: column; gap: 3px; padding: 8px; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border); }++.pv-shoe-pic { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 8px; background: var(--bg-secondary); color: var(--accent); }++.pv-shoe-pic .ovk-i { width: 40%; height: auto; aspect-ratio: 1; stroke-width: 1.6; }++.pv-price { font-weight: 800; color: var(--text-primary); }++.pv-price s { font-weight: 500; color: var(--text-muted); }++.pv-chip { width: fit-content; padding: 1px 7px; border-radius: 999px; font-style: normal; font-size: .66rem; font-weight: 800; color: var(--success-text, #16a34a); background: color-mix(in srgb, var(--success-text, #16a34a) 15%, transparent); }++++/* The editor. */++.ds-fields { display: grid; gap: 8px; }++.ds-field { display: grid; grid-template-columns: 1fr 42px 92px; align-items: center; gap: 8px; font-size: .86rem; font-weight: 600; }++.ds-field input[type=color] { width: 42px; height: 36px; padding: 2px; border-radius: 10px; border: 1px solid var(--border, #1f2d47); background: var(--bg-input, #0d1322); cursor: pointer; }++.ds-field input[type=text] { width: 92px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; }++.ds-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }++.ds-checks li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 10px; background: var(--bg-card, #0f1729); border: 1px solid var(--border, #1f2d47); font-size: .82rem; }++.ds-checks li b { font-weight: 600; }++.ds-checks li span { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }++.ds-checks li::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; margin-right: 2px; }++.ds-checks li b { flex: 1; }++.ds-checks .is-pass::before { background: var(--success, #22c55e); }++.ds-checks .is-fail { border-color: color-mix(in srgb, var(--danger, #ef4444) 55%, var(--border, #1f2d47)); }++.ds-checks .is-fail::before { background: var(--danger, #ef4444); }++.ds-checks .is-fail span { color: var(--danger-text, #f87171); }++.ds-checks .is-warn::before { background: var(--warning, #f59e0b); }++.ds-checks.is-demo { max-width: 420px; }++.ds-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }++.ds-status { min-height: 1.4em; margin: 10px 0 0; font-size: .86rem; color: var(--text-secondary, #96a7c2); }++.ds-submit, .ds-history { margin-top: 14px; border-top: 1px solid var(--border, #1f2d47); padding-top: 10px; }++.ds-submit summary, .ds-history summary { cursor: pointer; font-weight: 700; font-size: .9rem; min-height: 32px; display: flex; align-items: center; }++.ds-submit form { display: grid; gap: 8px; margin-top: 8px; }++.ds-submit label { display: grid; gap: 4px; font-size: .78rem; font-weight: 700; color: var(--text-muted, #7386a3); }++.ds-history ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }++.ds-history li { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; font-size: .84rem; }++.ds-history li.ds-fine { display: block; }++.ds-hist-dot { grid-row: 1 / span 2; width: 14px; height: 14px; border-radius: 50%; background: var(--border, #1f2d47); }++.ds-history li small { grid-column: 2; color: var(--text-muted, #7386a3); }++.ds-history li button { grid-column: 3; grid-row: 1 / span 2; }++++/* The home's motif: the theme orb (each dot a theme's accent, slowly circling). */++.ds-orb { position: relative; width: min(100%, 320px); aspect-ratio: 1; margin: 0 auto; }++.ds-orb-ring { position: absolute; inset: 8%; border-radius: 50%; border: 1.5px dashed color-mix(in srgb, var(--room-accent) 40%, transparent); animation: ds-spin 60s linear infinite; }++.ds-orb-core { position: absolute; inset: 30%; border-radius: 50%; background: conic-gradient(from 90deg, var(--room-accent), #5b7cfa, #22c55e, #f59e0b, #ef4444, var(--room-accent)); filter: saturate(1.1); box-shadow: 0 20px 60px -20px var(--room-accent); }++.ds-orb i { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px; border-radius: 50%; border: 3px solid var(--bg-primary, #0a0f1c); transform: rotate(calc(var(--i) * 60deg)) translateY(-136%) rotate(calc(var(--i) * -60deg)); }++@supports (container-type: inline-size) { .ds-orb { container-type: inline-size; } .ds-orb i { transform: rotate(calc(var(--i) * 60deg)) translateY(-42cqw) rotate(calc(var(--i) * -60deg)); } }++@keyframes ds-spin { to { transform: rotate(360deg); } }++.ds-scene-pv { transform: scale(.98); }++.ds-scene-pv .pv-shop { display: none; }++.ds-scene-pv { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }++@media (max-width: 600px) { .ds-scene-pv { grid-template-columns: minmax(0, 1fr); } .ds-scene-pv .pv-chatroom { display: none; } }++.ds-colours { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 20px 0 0; }++.ds-colours > div { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border, #1f2d47); background: var(--bg-card, #0f1729); }++.ds-colours dt { font-size: .74rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted, #7386a3); }++.ds-colours dd { margin: 6px 0 0; display: flex; align-items: center; gap: 8px; }++.ds-colours dd i { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border, #1f2d47); }++.ds-eps { display: grid; gap: 10px; margin: 0; }++.ds-eps > div { padding: 12px 14px; border-radius: 14px; background: var(--bg-card, #0f1729); border: 1px solid var(--border, #1f2d47); }++.ds-eps dt code { font: 600 .9rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--room-strong); overflow-wrap: anywhere; }++.ds-eps dd { margin: 6px 0 0; color: var(--text-secondary, #96a7c2); line-height: 1.5; }++@media (prefers-reduced-motion: reduce) { .ds-orb-ring { animation: none; } .ds-swatch, .ds-previews { transition: none; } }++html[data-ov-motion=reduced] .ds-orb-ring { animation: none; }nnew file mode 100644@@@ -0,0 +1,203 @@++/**++ * The theme studio, live (plan 2026-10-28 §5.2). The page works without this file (the gallery links to each theme's++ * page); with it:++ * - picking a theme recolours the three previews (Live, Chat, a shop) through CSS variables scoped to them++ * - editing a core colour derives the rest of the theme's tokens and recolours as you drag++ * - the checks measure WCAG contrast for text, muted text, buttons and links; Use waits until every required one passes++ * - "See it as" simulates colour-vision differences on the previews (SVG filters in the page)++ * - Use saves the theme (and your edits) to your account through /api/me/theme, which every OpenVibe site follows;++ * History lists your earlier looks and Restore brings one back; Share sends it to the gallery's review++ * Text is set with textContent; nothing from a theme is written as markup.++ */++(function () {++ 'use strict';++ const root = document.querySelector('.ds-studio');++ if (!root) return;++ const signedIn = root.getAttribute('data-signed-in') === '1';++ let themes = [];++ try { themes = JSON.parse(document.getElementById('ds-themes').textContent) || []; } catch (e) { themes = []; }++ const byId = new Map(themes.map((t) => [t.id, t]));++ const $ = (s) => document.querySelector(s);++ const $$ = (s) => Array.prototype.slice.call(document.querySelectorAll(s));++ const previews = $('#ds-previews');++ const status = $('#ds-status');++ const say = (t) => { status.textContent = t || ''; };++++ // ── Colour maths: sRGB, WCAG contrast, mixing ──++ const hex = (h) => { const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(String(h || '').trim()); if (!m) return null; let x = m[1]; if (x.length === 3) x = x.split('').map((c) => c + c).join(''); return [0, 2, 4].map((i) => parseInt(x.slice(i, i + 2), 16)); };++ const toHex = (rgb) => `#${rgb.map((v) => Math.max(0, Math.min(255, Math.round(v))).toString(16).padStart(2, '0')).join('')}`;++ const lum = (rgb) => { const c = rgb.map((v) => { v /= 255; return v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4); }); return 0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2]; };++ const contrast = (a, b) => { const x = lum(a), y = lum(b); return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05); };++ const mix = (a, b, t) => a.map((v, i) => v + (b[i] - v) * t);++ const WHITE = [255, 255, 255], INK = [11, 13, 16];++++ /** The full token set from the six core colours (the way builtin themes derive theirs). */++ function derive(core) {++ const bg = hex(core['--bg-primary']), card = hex(core['--bg-card']), text = hex(core['--text-primary']);++ const muted = hex(core['--text-muted']), accent = hex(core['--accent']), border = hex(core['--border']);++ if (!bg || !card || !text || !muted || !accent || !border) return null;++ const light = lum(bg) > 0.4;++ const onAccent = contrast(WHITE, accent) >= 4.5 ? WHITE : INK;++ return {++ '--bg-primary': toHex(bg), '--bg-card': toHex(card), '--bg-secondary': toHex(mix(bg, card, 0.6)),++ '--bg-tertiary': toHex(mix(card, text, 0.05)), '--bg-hover': toHex(mix(card, text, 0.08)), '--bg-input': toHex(mix(bg, card, 0.35)),++ '--text-primary': toHex(text), '--text-secondary': toHex(mix(text, muted, 0.45)), '--text-muted': toHex(muted),++ '--accent': toHex(accent), '--accent-light': toHex(light ? accent : mix(accent, WHITE, 0.18)), '--accent-dark': toHex(mix(accent, INK, 0.2)),++ '--accent-strong': toHex(accent), '--on-accent-strong': toHex(onAccent), '--on-accent': toHex(onAccent),++ '--accent-rgb': accent.map(Math.round).join(', '),++ '--border': toHex(border), '--border-light': toHex(mix(border, text, 0.12)),++ '--color-scheme': light ? 'light' : 'dark',++ };++ }++++ // ── State ──++ let base = null; // the theme picked++ let edited = null; // core overrides, or null++ const coreOf = (v) => ({ '--bg-primary': v['--bg-primary'], '--bg-card': v['--bg-card'] || v['--bg-secondary'], '--text-primary': v['--text-primary'], '--text-muted': v['--text-muted'] || v['--text-secondary'], '--accent': v['--accent'], '--border': v['--border'] });++ const current = () => { if (!base) return null; if (!edited) return base.variables; return Object.assign({}, base.variables, derive(Object.assign(coreOf(base.variables), edited)) || {}); };++++ function paint() {++ const v = current();++ if (!v) return;++ for (const [k, x] of Object.entries(v)) if (/^--[a-z][a-z0-9-]*$/.test(k)) previews.style.setProperty(k, String(x));++ const core = coreOf(v);++ $$('.ds-field input[type=color]').forEach((inp) => { const x = hex(core[inp.getAttribute('data-var')]); if (x) inp.value = toHex(x); });++ $$('.ds-field input[data-hex]').forEach((inp) => { if (document.activeElement !== inp) { const x = hex(core[inp.getAttribute('data-hex')]); inp.value = x ? toHex(x) : ''; } });++ $('#ds-current').textContent = base.name + (edited ? ' (edited)' : '');++ $('#ds-reset').disabled = !edited;++ check(v);++ }++++ // ── Checks (WCAG 2.1): required ones gate Use ──++ function check(v) {++ const g = (k) => hex(v[k]);++ const rows = [++ ['Text on the background', g('--text-primary'), g('--bg-primary'), 4.5, true],++ ['Text on cards', g('--text-primary'), g('--bg-card'), 4.5, true],++ ['Muted text on cards', g('--text-muted'), g('--bg-card'), 4.5, true],++ ['Button text', g('--on-accent-strong') || g('--on-accent'), g('--accent-strong') || g('--accent'), 4.5, true],++ ['Links on the background', g('--accent-light') || g('--accent'), g('--bg-primary'), 4.5, true],++ ['Lines against cards', g('--border'), g('--bg-card'), 1.3, false],++ ];++ const list = $('#ds-checks');++ list.textContent = '';++ let ok = true;++ for (const [label, fg, bg, need, required] of rows) {++ if (!fg || !bg) continue;++ const r = contrast(fg, bg), pass = r >= need;++ if (required && !pass) ok = false;++ const li = document.createElement('li');++ li.className = pass ? 'is-pass' : required ? 'is-fail' : 'is-warn';++ const b = document.createElement('b'); b.textContent = label;++ const s = document.createElement('span'); s.textContent = `${r.toFixed(1)}:1${pass ? '' : ` · needs ${need}`}`;++ li.append(b, s);++ list.appendChild(li);++ }++ const use = $('#ds-use');++ use.disabled = !base || (signedIn && !ok);++ use.title = ok ? '' : 'Every required check must pass';++ return ok;++ }++++ // ── Picking and editing ──++ function pick(id, { quiet = false } = {}) {++ const t = byId.get(id);++ if (!t) return;++ base = t; edited = null;++ $$('.ds-swatch[data-theme-id]').forEach((b) => b.setAttribute('aria-pressed', String(b.getAttribute('data-theme-id') === id)));++ paint();++ if (!quiet) { try { history.replaceState(null, '', `/studio?theme=${encodeURIComponent(id)}`); } catch (e) { /* */ } }++ say('');++ }++ root.addEventListener('click', (e) => {++ const b = e.target.closest && e.target.closest('.ds-swatch[data-theme-id]');++ if (b) pick(b.getAttribute('data-theme-id'));++ const f = e.target.closest && e.target.closest('[data-show]');++ if (f) {++ const show = f.getAttribute('data-show');++ $$('[data-show]').forEach((x) => x.setAttribute('aria-pressed', String(x === f)));++ $$('.ds-swatch[data-theme-id]').forEach((s) => { s.parentElement.hidden = show !== 'all' && s.getAttribute('data-mode') !== show; });++ }++ });++ const setCore = (k, value) => { const x = hex(value); if (!x || !base) return; edited = Object.assign({}, edited || {}, { [k]: toHex(x) }); paint(); };++ $$('.ds-field input[type=color]').forEach((inp) => inp.addEventListener('input', () => setCore(inp.getAttribute('data-var'), inp.value)));++ $$('.ds-field input[data-hex]').forEach((inp) => inp.addEventListener('change', () => setCore(inp.getAttribute('data-hex'), inp.value)));++ $('#ds-reset').addEventListener('click', () => { edited = null; paint(); say('Back to the theme as it was.'); });++ $('#ds-cvd').addEventListener('change', (e) => {++ const v = e.target.value;++ previews.style.filter = v === 'gray' ? 'grayscale(1)' : v ? `url(#ds-cvd-${v})` : '';++ });++++ // ── Talking to /api (this site's proxy of Network's theme API, as the signed-in person) ──++ async function api(path, opts) {++ const r = await fetch(path, Object.assign({ credentials: 'same-origin', headers: { 'Content-Type': 'application/json', Accept: 'application/json' } }, opts || {}));++ let body = null; try { body = await r.json(); } catch (e) { body = null; }++ if (!r.ok) { const err = new Error((body && (body.detail || body.error)) || `HTTP ${r.status}`); err.status = r.status; throw err; }++ return body || {};++ }++ $('#ds-use').addEventListener('click', async () => {++ if (!signedIn) { location.href = '/auth/login?next=' + encodeURIComponent(location.pathname + location.search); return; }++ if (!base) return;++ const v = current();++ say('Saving…');++ try {++ await api('/api/me/theme', { method: 'PUT', body: JSON.stringify({ theme_id: base.id, custom_variables: edited ? derive(Object.assign(coreOf(base.variables), edited)) : null }) });++ // This page wears it at once; every other OpenVibe site follows on its next page.++ for (const [k, x] of Object.entries(v)) if (/^--[a-z][a-z0-9-]*$/.test(k)) document.documentElement.style.setProperty(k, String(x));++ say(`${base.name}${edited ? ' (with your edits)' : ''} is your theme on every OpenVibe site.`);++ loadHistory();++ } catch (err) { say(err.status === 401 ? 'Sign in again to save it.' : `Not saved: ${err.message}`); }++ });++ const form = $('#ds-submit-form');++ if (form) form.addEventListener('submit', async (e) => {++ e.preventDefault();++ if (!signedIn || !base) return;++ const name = $('#ds-name').value.trim();++ const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 48);++ if (slug.length < 2) { say('Give it a name of two letters or more.'); return; }++ const v = current();++ try {++ await api('/api/themes/submit', { method: 'POST', body: JSON.stringify({ name, slug, description: $('#ds-desc').value.trim(), mode: v['--color-scheme'] === 'light' ? 'light' : 'dark', variables: v, tags: [] }) });++ say(`${name} is waiting for review. You can use it yourself right away.`);++ form.reset();++ } catch (err) { say(`Not sent: ${err.message}`); }++ });++++ // ── History and restore ──++ async function loadHistory() {++ const list = $('#ds-history-list');++ if (!list || !signedIn) return;++ let h = [];++ try { h = (await api('/api/me/theme/history')).history || []; } catch (e) { return; }++ list.textContent = '';++ if (!h.length) { const li = document.createElement('li'); li.className = 'ds-fine'; li.textContent = 'Your earlier looks appear here after your first change.'; list.appendChild(li); return; }++ for (const x of h.slice(0, 20)) {++ const li = document.createElement('li');++ const t = byId.get(x.theme_id);++ const dot = document.createElement('i'); dot.className = 'ds-hist-dot';++ const accent = (x.custom_variables && x.custom_variables['--accent']) || (t && t.variables['--accent']);++ if (hex(accent)) dot.style.background = toHex(hex(accent));++ const b = document.createElement('b'); b.textContent = (x.theme_name || x.theme_id) + (x.custom_variables ? ' (edited)' : '');++ const when = document.createElement('small'); when.textContent = String(x.created_at || '').slice(0, 16).replace('T', ' ');++ const go = document.createElement('button'); go.type = 'button'; go.className = 'ovk-btn ovk-btn--quiet ovk-btn--small'; go.textContent = 'Restore';++ go.addEventListener('click', async () => {++ go.disabled = true;++ try {++ await api(`/api/me/theme/history/${encodeURIComponent(x.id)}/restore`, { method: 'POST', body: '{}' });++ say(`Restored ${x.theme_name || x.theme_id}. Every OpenVibe site follows on its next page.`);++ if (byId.has(x.theme_id)) { pick(x.theme_id, { quiet: true }); if (x.custom_variables) { edited = coreOf(x.custom_variables); paint(); } }++ loadHistory();++ } catch (err) { say(`Not restored: ${err.message}`); go.disabled = false; }++ });++ li.append(dot, b, when, go);++ list.appendChild(li);++ }++ }++++ // ── Start: the theme in the address, else the person's active one, else the first ──++ const wanted = new URLSearchParams(location.search).get('theme');++ if (wanted && byId.has(wanted)) pick(wanted, { quiet: true });++ else if (signedIn) api('/api/me/theme').then((m) => { if (m && byId.has(m.theme_id)) { pick(m.theme_id, { quiet: true }); if (m.custom_variables) { edited = coreOf(m.custom_variables); paint(); } } else if (themes[0]) pick(themes[0].id, { quiet: true }); }).catch(() => { if (themes[0]) pick(themes[0].id, { quiet: true }); });++ else if (themes[0]) pick((byId.has('vibe') ? 'vibe' : themes[0].id), { quiet: true });++ loadHistory();++})();nnew file mode 100644@@@ -0,0 +1,156 @@++'use strict';++++/**++ * OpenVibe.Design — Express app factory; server/index.js listens, tests build their own instance with a mock++ * Network.++ *++ * /, /studio, /t/:slug, /developers the pages (http/pages.js)++ * /api/themes/*, /api/me/theme* the theme API proxy to OpenVibe.Network (http/api.js)++ * /auth/* Network SSO with PKCE (auth/sso.js)++ * /api/health, /api/ready, /release.json liveness, truthful readiness, release metadata++ * /robots.txt, /sitemap.xml, /llms.txt crawl artifacts (http/discovery.js)++ *++ * Stateless: no database, no Valkey, no Events. The only dependency is OpenVibe.Network, for sign-in and the theme++ * API; the pages and the public catalogue degrade honestly without it.++ */++const path = require('path');++const express = require('express');++const helmet = require('helmet');++const cookieParser = require('cookie-parser');++const rateLimit = require('express-rate-limit');++const contracts = require('openvibe-contracts');++const cache = require('openvibe-shared/cache-policy');++const releaseLib = require('openvibe-shared/release');++const metricsLib = require('openvibe-shared/metrics');++const serve = require('openvibe-shared/serve');++++const configLib = require('./config');++const { createKeyStore } = require('./auth/keys');++const { createSso } = require('./auth/sso');++const { createThemeCatalog } = require('./themes');++const { createApi } = require('./http/api');++const { createPageRoutes } = require('./http/pages');++const { createDiscoveryRoutes } = require('./http/discovery');++const { createServiceReadiness } = require('./observability');++const { PUBLIC_DIR, assetVersion } = require('./assets');++const views = require('./views');++++const VERSION = require('../package.json').version;++++/**++ * opts: config, catalog, fetchImpl, log, now, release++ * `catalog` is the public theme client; a test passes an object with the same methods, or a fetchImpl that talks to++ * an in-process Network.++ */++function createApp(opts = {}) {++ const config = opts.config || configLib.load();++ const log = opts.log || console;++ const fetchImpl = opts.fetchImpl || globalThis.fetch;++ const now = opts.now || (() => Date.now());++++ const keys = createKeyStore({ config, fetchImpl, log });++ const sso = createSso({ config, keys, fetchImpl, log, now });++ const catalog = opts.catalog || createThemeCatalog({ config, fetchImpl, log, now });++ const ctx = { config, keys, sso, catalog, log };++++ const release = opts.release || releaseLib.createRelease({ service: 'design', root: path.join(__dirname, '..') });++ views.setRelease(release.release);++ views.configure({ baseUrl: config.baseUrl });++++ const app = express();++ app.disable('x-powered-by');++ app.set('trust proxy', config.trustProxy);++ app.locals.ctx = ctx;++++ const metrics = metricsLib.instrument(app, { service: 'design', release: release.release });++ app.locals.metrics = metrics.registry;++ release.mount(app, { registry: metrics.registry });++++ // ── Machine endpoints ───────────────────────────────────++ app.get('/api/health', (_req, res) => res.json({ status: 'ok', service: 'openvibe-design', version: VERSION }));++ const readiness = createServiceReadiness({ config, catalog, keys, release: release.release });++ app.get('/api/ready', readiness.handler);++++ app.use(contracts.http.middleware());++ app.use(helmet({++ contentSecurityPolicy: {++ directives: {++ defaultSrc: ["'self'"],++ // The OpenVibe Frame (theme-loader, navbar, footer) comes from the Network; the inline init is ours.++ scriptSrc: ["'self'", "'unsafe-inline'", 'https://openvibe.network', 'https://static.cloudflareinsights.com'],++ styleSrc: ["'self'", "'unsafe-inline'", 'https://openvibe.network', 'https://fonts.googleapis.com', 'https://cdnjs.cloudflare.com'],++ fontSrc: ["'self'", 'data:', 'https://fonts.gstatic.com', 'https://cdnjs.cloudflare.com'],++ // Theme previews may carry inline data: images and any https image the catalogue references.++ imgSrc: ["'self'", 'data:', 'https:'],++ connectSrc: ["'self'", 'https://openvibe.network'],++ frameSrc: ["'self'", 'https://openvibe.network'],++ frameAncestors: ["'none'"],++ objectSrc: ["'none'"],++ baseUri: ["'self'"],++ formAction: ["'self'", 'https://openvibe.network'],++ },++ },++ frameguard: { action: 'deny' },++ crossOriginEmbedderPolicy: false,++ crossOriginResourcePolicy: { policy: 'same-site' },++ referrerPolicy: { policy: 'strict-origin-when-cross-origin' },++ }));++ app.use(cookieParser());++++ // ── Per-IP budget for the API and sign-in (120 a minute) ─++ const limiter = rateLimit({++ windowMs: 60_000,++ limit: config.rateLimitPerMinute || 120,++ standardHeaders: true,++ legacyHeaders: false,++ handler: (req, res) => contracts.http.sendProblem(res, 429, 'rate_limited', {++ detail: 'too many requests from this address; retry shortly',++ ctx: req.ov,++ }),++ });++ app.use(['/api', '/auth'], limiter);++++ // ── Who is signed in, then sign-in itself ───────────────++ app.use(sso.middleware());++ app.use('/auth', sso.routes());++++ // ── Static assets (content-hashed ?v= → immutable) ──────++ app.use('/shared', serve.handler());++ const setAssetHeaders = (res, filePath) => {++ const rel = path.relative(PUBLIC_DIR, filePath).split(path.sep).join('/');++ const v = res.req && res.req.query && res.req.query.v;++ res.setHeader('Cache-Control', cache.assetHeaders(rel, { hashed: Boolean(v) && v === assetVersion(rel) }));++ };++ app.use('/css', express.static(path.join(PUBLIC_DIR, 'css'), { index: false, redirect: false, setHeaders: setAssetHeaders }));++ app.use('/js', express.static(path.join(PUBLIC_DIR, 'js'), { index: false, redirect: false, setHeaders: setAssetHeaders }));++++ // ── API: the theme proxy ────────────────────────────────++ app.use('/api', express.json({ limit: '64kb' }));++ app.use('/api', createApi(ctx));++ app.use('/api', (req, res) => contracts.http.sendProblem(res, 404, 'route.not_found', {++ detail: 'No such API route.',++ ctx: req.ov,++ }));++++ // ── Crawl artifacts ─────────────────────────────────────++ app.use(createDiscoveryRoutes(ctx));++++ // ── Pages ───────────────────────────────────────────────++ app.use(createPageRoutes(ctx));++++ // eslint-disable-next-line no-unused-vars++ app.use((err, req, res, _next) => {++ // Never log request bodies (a theme's variables can be large, a person's request can be personal).++ log.error('[OpenVibe.Design]', err && err.message ? err.message.slice(0, 300) : err);++ if (res.headersSent) return;++ res.set('Cache-Control', 'no-store');++ if (err && err.type === 'entity.parse.failed') return contracts.http.sendProblem(res, 400, 'request.malformed_json', { ctx: req.ov });++ if (err && err.type === 'entity.too.large') return req.path.startsWith('/api/') ? contracts.http.sendProblem(res, 413, 'request.too_large', { ctx: req.ov }) : res.status(413).type('text/plain').send('That request was too large.');++ if (req.path.startsWith('/api/')) return contracts.http.sendProblem(res, 500, 'internal.error', { detail: 'Internal error', ctx: req.ov });++ return res.status(500).type('text/plain').send('Something went wrong on our side. Try again in a moment.');++ });++++ return { app, ctx };++}++++module.exports = { createApp };nnew file mode 100644@@@ -0,0 +1,30 @@++'use strict';++++/**++ * Content-addressed URLs for this site's own assets: /css/design.css?v=<first 10 hex of SHA-256>. The static++ * middleware treats a matching ?v= as immutable (openvibe-shared/cache-policy); any other URL gets the short++ * public window, because those bytes may change under the same URL.++ */++const crypto = require('crypto');++const fs = require('fs');++const path = require('path');++++const PUBLIC_DIR = path.join(__dirname, '..', 'public');++const hashes = new Map();++++function assetVersion(rel) {++ const key = String(rel || '').replace(/^\/+/, '');++ if (hashes.has(key)) return hashes.get(key);++ let version = 'dev';++ try {++ version = crypto.createHash('sha256').update(fs.readFileSync(path.join(PUBLIC_DIR, key))).digest('hex').slice(0, 10);++ } catch {++ /* a missing asset stays at a stable placeholder */++ }++ hashes.set(key, version);++ return version;++}++++const asset = (rel) => `/${String(rel || '').replace(/^\/+/, '')}?v=${assetVersion(rel)}`;++++module.exports = { PUBLIC_DIR, assetVersion, asset };nnew file mode 100644@@@ -0,0 +1,111 @@++'use strict';++++/**++ * The Network's RS256 signing key, fetched once from GET /api/.well-known/jwks on the configured internal URL and++ * kept fresh by openvibe-sdk/auth's JWKS client. Tokens are verified offline against it: the person's session token++ * (sign-in).++ *++ * The SDK keeps one client per URL: the last good keys through outages, exponential backoff, a rotation honoured at++ * once, unknown-kid floods throttled, the refresh timer unref'd. This module is a thin shim so the rest of++ * OpenVibe.Design (the readiness check, the SSO middleware) can keep talking to `keys.get()` / `keys.ensure()` /++ * `keys.loaded()`, while verification goes through the SDK's verifyUserToken / verifyAppToken with `jwks: <url>`.++ *++ * Nothing the SDK says about a failed key fetch leaves this module: its message names the internal JWKS URL and the++ * fetch error, so token.no_key answers 'signing key not loaded yet' (and an error without a code 'token does not++ * verify'). Reasons about the token itself (audience, expiry, signature) are kept. Every rejection is logged.++ */++const sdk = require('openvibe-sdk/auth');++++/** Public reasons. The SDK's own text (the JWKS URL, the fetch error) never goes over the wire. */++const KEY_UNAVAILABLE = 'signing key not loaded yet';++const DOES_NOT_VERIFY = 'token does not verify';++++/**++ * What a caller may be told. Only token.no_key carries the SDK's fetch text (the internal JWKS URL and the connect++ * error); every other code's message is about the token itself ('not for openvibe.design', 'expired'), which a++ * developer needs, so it is kept.++ */++function publicReason(err) {++ const code = err && err.code;++ if (!code || code === 'token.no_key') return code ? KEY_UNAVAILABLE : DOES_NOT_VERIFY;++ return (err.message && String(err.message).slice(0, 200)) || DOES_NOT_VERIFY;++}++++/** Resolve the JWKS URL for the configured Network (internal first, then public). */++function jwksUrl(config) {++ return (config.networkInternalUrl || config.networkUrl) + '/api/.well-known/jwks';++}++++/**++ * `keys` is what app.js hands the rest of the service: a facade over the SDK's jwksClient. A synchronous caller++ * wants a PEM, so we mirror the cached first key as PEM — refreshed every time the SDK gives us keys (ensure(),++ * verifyUser(), verifyApp()).++ */++function createKeyStore({ config, fetchImpl = globalThis.fetch, log = console }) {++ const url = jwksUrl(config);++ const client = sdk.jwksClient(url, { fetch: fetchImpl, log });++ let mirror = null; // { pem, count } — the first cached key as PEM++++ async function refreshMirror() {++ try {++ const ks = await client.keys();++ const first = ks && ks[0];++ mirror = first ? { pem: first.key.export({ type: 'spki', format: 'pem' }), count: ks.length } : null;++ } catch (err) { log.warn(`[OpenVibe.Design] JWKS mirror refresh failed: ${err && err.message || err}`); mirror = null; }++ }++ /** First fetch (or wait out the backoff window). Refreshes the mirror. */++ async function ensure() { await refreshMirror(); }++ /** Cached public key as PEM — for openvibe-contracts' verifyServiceToken (synchronous). */++ function get() { return mirror ? mirror.pem : null; }++ function loaded() { return Boolean(mirror); }++++ /** The SDK's `now` is a NUMBER of milliseconds (it does Math.floor(now / 1000)); a function disables every expiry check. */++ const asMs = (v) => (typeof v === 'function' ? v() : (typeof v === 'number' ? v : Date.now()));++++ // Verify a user (session) token via the SDK. Returns { ok, claims } | { ok: false, reason, code, expired }.++ // `reason` is one of the two fixed public strings; the SDK's text is logged, never returned.++ async function verifyUser(token, { issuer, audience, now = Date.now() } = {}) {++ try {++ const claims = await sdk.verifyUserToken(token, { jwks: url, issuer, audience, now: asMs(now), log });++ await refreshMirror();++ return { ok: true, claims };++ } catch (err) {++ await refreshMirror();++ const code = err && err.code;++ log.warn(`[OpenVibe.Design] user token rejected (${code || 'error'}):`, (err && err.message) || err);++ return { ok: false, reason: publicReason(err), code, expired: code === 'token.expired' };++ }++ }++ // Verify an app token. Same shape and same fixed reasons.++ async function verifyApp(token, { issuer, audience, acceptSandbox = true, now = Date.now() } = {}) {++ try {++ const claims = await sdk.verifyAppToken(token, { jwks: url, issuer, audience, acceptSandbox, now: asMs(now), log });++ await refreshMirror();++ return { ok: true, claims };++ } catch (err) {++ await refreshMirror();++ const code = err && err.code;++ log.warn(`[OpenVibe.Design] app token rejected (${code || 'error'}):`, (err && err.message) || err);++ return { ok: false, reason: publicReason(err), code };++ }++ }++++ /**++ * The PEM for the key a token's header names (a rotation publishes two keys: the first one is not always it), for++ * openvibe-contracts' synchronous guard. The SDK refetches for an unknown kid (at most every 30 s). Null when no++ * key is loaded; a token that names no kid gets the first key.++ */++ async function pemForToken(token) {++ let kid = null;++ try { kid = JSON.parse(Buffer.from(String(token).split('.')[0], 'base64url').toString('utf8')).kid || null; } catch { /* the guard refuses it */ }++ try {++ const ks = await client.keysForKid(kid);++ const k = (kid && ks.find((x) => x.kid === kid)) || ks[0];++ return k ? k.key.export({ type: 'spki', format: 'pem' }) : null;++ } catch { return null; }++ }++++ return { ensure, get, loaded, status: client.status, verifyUser, verifyApp, pemForToken, client };++}++++module.exports = { createKeyStore, jwksUrl };nnew file mode 100644@@@ -0,0 +1,282 @@++'use strict';++++/**++ * Sign-in with OpenVibe.Network: OAuth 2 authorization code with PKCE (S256), as OAuth client `design`.++ *++ * GET /auth/login → Network /oauth/authorize?…&code_challenge=…&code_challenge_method=S256++ * (?silent=1 adds prompt=none; ?next= a same-site path)++ * GET /auth/callback → state check, server-side code exchange (client secret + code_verifier)++ * GET /auth/logout → clear cookies, revoke the refresh token (best effort)++ * GET /auth/me → { user } for the shared navbar (it cannot read the httpOnly cookie); { user: null } for a guest++ *++ * The person's Network access token lives in an httpOnly cookie (design_at) no script can read: with it, a script++ * could act as them. The refresh token (design_rt) is httpOnly too. Neither is ever stored server-side, rendered++ * or logged.++ */++const crypto = require('crypto');++const express = require('express');++const cache = require('openvibe-shared/cache-policy');++++const ACCESS_COOKIE = 'design_at';++const REFRESH_COOKIE = 'design_rt';++const HINT_COOKIE = 'ov_sso_hint';++const FLOW_COOKIE = 'design_oauth';++++function pkcePair() {++ const verifier = crypto.randomBytes(32).toString('base64url'); // 43 characters++ const challenge = crypto.createHash('sha256').update(verifier).digest('base64url');++ return { verifier, challenge };++}++++/** This site's own origins: BASE_URL (the one origin the theme studio is served from). */++function ownOrigins(config) {++ const out = new Set();++ for (const u of [config && config.baseUrl]) {++ try { if (u) out.add(new URL(u).origin); } catch { /* not a URL */ }++ }++ return out;++}++++/**++ * Same-site relative paths only (never protocol-relative, never another origin). An absolute URL on one of this++ * site's own origins counts as its path: the shared navbar's silent sign-in sends the whole page address, and until++ * 2026-10-22 that landed on the home page (a person signed in quietly found themselves somewhere else).++ */++function sanitizeNext(next, config) {++ // Browsers drop tab and newline characters from a URL and read a backslash as "/": "/<TAB>/evil.com" would++ // leave the site. A next with any control character or backslash goes home.++ if (typeof next === 'string' && /[\u0000-\u001f\u007f\\]/.test(next)) return '/';++ if (typeof next === 'string' && /^https?:\/\//i.test(next)) {++ let u = null;++ try { u = new URL(next); } catch { return '/'; }++ if (!ownOrigins(config).has(u.origin)) return '/';++ next = `${u.pathname}${u.search}${u.hash}`;++ }++ if (typeof next !== 'string' || !/^\/(?!\/|\\)/.test(next) || next.length > 500) return '/';++ return next;++}++++function authorizeUrl(config, { state, challenge, silent = false }) {++ const q = new URLSearchParams({++ response_type: 'code',++ client_id: config.oauth.clientId,++ redirect_uri: config.oauth.redirectUri,++ scope: config.oauth.scope,++ state,++ code_challenge: challenge,++ code_challenge_method: 'S256',++ });++ if (silent) q.set('prompt', 'none');++ return `${config.networkPublicUrl || config.networkUrl}/oauth/authorize?${q.toString()}`;++}++++function createSso({ config, keys, fetchImpl = globalThis.fetch, now = () => Date.now(), log = console }) {++ const cookieBase = () => ({ sameSite: 'lax', secure: config.cookies.secure, httpOnly: true, path: '/' });++++ function setSession(res, data) {++ res.cookie(ACCESS_COOKIE, data.access_token, { ...cookieBase(), maxAge: 24 * 60 * 60 * 1000 });++ if (data.refresh_token) res.cookie(REFRESH_COOKIE, data.refresh_token, { ...cookieBase(), maxAge: 30 * 24 * 60 * 60 * 1000 });++ res.cookie(HINT_COOKIE, 'account', { sameSite: 'lax', secure: config.cookies.secure, httpOnly: false, path: '/', maxAge: 365 * 24 * 60 * 60 * 1000 });++ }++ function clearSession(res) {++ res.clearCookie(ACCESS_COOKIE, cookieBase());++ res.clearCookie(REFRESH_COOKIE, cookieBase());++ }++++ /** POST the Network token endpoint (internal URL). Throws { status, error } on refusal. */++ async function tokenGrant(fields) {++ const body = new URLSearchParams({ client_id: config.oauth.clientId, client_secret: config.oauth.clientSecret, ...fields });++ let res;++ try {++ res = await fetchImpl(`${config.networkInternalUrl || config.networkUrl}/oauth/token`, {++ method: 'POST',++ headers: { 'Content-Type': 'application/x-www-form-urlencoded', Accept: 'application/json' },++ body, signal: AbortSignal.timeout(10_000),++ });++ } catch (err) {++ throw Object.assign(new Error('OpenVibe.Network did not answer'), { status: 502, error: err && err.name === 'TimeoutError' ? 'timeout' : 'unreachable' });++ }++ const data = await res.json().catch(() => null);++ if (!res.ok || !data || !data.access_token) {++ throw Object.assign(new Error((data && (data.error_description || data.error)) || `token endpoint ${res.status}`),++ { status: res.status, error: (data && data.error) || 'invalid_grant' });++ }++ return data;++ }++++ /**++ * An OpenVibe.Design session is a Network SESSION token: audience openvibe.network and a person. The Network++ * signs FedCM assertions (audience = any owned-zone origin that asked), app/service tokens and++ * internal tokens with the same key and issuer; none of them may become a session here.++ */++ async function verifySession(token) {++ const v = await keys.verifyUser(token, { issuer: config.networkIssuer || config.networkPublicUrl || config.networkUrl, audience: config.oauth.sessionAudience, now: now() });++ const c = v.claims;++ if (c && (c.typ === 'fedcm' || c.actor_type !== undefined)) return { ok: false, reason: 'not a session token' };++ return v;++ }++++ function viewerFromClaims(claims, token) {++ const subject = typeof claims.subject_id === 'string' ? claims.subject_id : null;++ const role = typeof claims.role === 'string' ? claims.role : 'user';++ return {++ kind: 'user',++ subject,++ username: typeof claims.username === 'string' ? claims.username.slice(0, 64) : null,++ displayName: typeof claims.display_name === 'string' ? claims.display_name.slice(0, 80) : (typeof claims.username === 'string' ? claims.username.slice(0, 64) : 'you'),++ role,++ // The navbar's avatar and colour (Network's token claims; the avatar is an https image on openvibe.media).++ avatarUrl: typeof claims.avatar_url === 'string' && /^https:\/\/[^\s"'<>]{1,500}$/.test(claims.avatar_url) ? claims.avatar_url : null,++ profileColor: typeof claims.profile_color === 'string' && /^#[0-9a-fA-F]{3,8}$/.test(claims.profile_color) ? claims.profile_color : null,++ // The person's Network access token: used for server-side Network calls, never rendered.++ token,++ };++ }++++ /** One refresh per request, however many Network calls in it see a 401 (refresh tokens rotate). */++ async function refresh(req, res) {++ if (!req.sessionRefresh) req.sessionRefresh = await doRefresh(req, res);++ return req.sessionRefresh;++ }++++ async function doRefresh(req, res) {++ const rt = req.cookies && req.cookies[REFRESH_COOKIE];++ if (!rt) return null;++ try {++ const data = await tokenGrant({ grant_type: 'refresh_token', refresh_token: rt });++ setSession(res, data);++ const v = await verifySession(data.access_token);++ return v.ok ? viewerFromClaims(v.claims, data.access_token) : null;++ } catch (err) {++ if (err.status && err.status < 500) clearSession(res);++ return null;++ }++ }++++ /** req.viewer for every page: the signed-in person, refreshed when their token expired. */++ function middleware() {++ return async (req, res, next) => {++ req.viewer = { kind: 'anonymous' };++ const token = req.cookies && req.cookies[ACCESS_COOKIE];++ if (!token) return next();++ await keys.ensure();++ const v = await verifySession(token);++ if (v.ok) { req.viewer = viewerFromClaims(v.claims, token); return next(); }++ if (v.expired) {++ const fresh = await refresh(req, res);++ if (fresh) { req.viewer = fresh; return next(); }++ }++ if (keys.loaded()) clearSession(res);++ next();++ };++ }++++ /**++ * Run fn(token) as the viewer; when the Network answers 401 (expired or revoked session), refresh++ * once and run it again. Other failures are returned to the caller unchanged.++ */++ async function asViewer(req, res, fn) {++ try {++ return await fn(req.viewer.token);++ } catch (err) {++ if (!err || err.status !== 401) throw err;++ const fresh = await refresh(req, res);++ if (!fresh) throw err;++ req.viewer = fresh;++ return fn(fresh.token);++ }++ }++++ function routes() {++ const r = express.Router();++ const flowOpts = () => ({ ...cookieBase(), path: '/auth', maxAge: 10 * 60 * 1000 });++++ r.get('/login', (req, res) => {++ const silent = Boolean(req.query.silent) && req.query.silent !== '0';++ const state = crypto.randomBytes(16).toString('hex');++ const { verifier, challenge } = pkcePair();++ res.cookie(FLOW_COOKIE, JSON.stringify({ state, verifier, next: sanitizeNext(req.query.next, config), silent }), flowOpts());++ res.set('Cache-Control', cache.htmlHeaders({ private: true }));++ res.redirect(authorizeUrl(config, { state, challenge, silent }));++ });++++ r.get('/callback', async (req, res) => {++ res.set('Cache-Control', cache.htmlHeaders({ private: true }));++ let flow = null;++ try { flow = JSON.parse(req.cookies[FLOW_COOKIE] || 'null'); } catch { flow = null; }++ res.clearCookie(FLOW_COOKIE, { ...cookieBase(), path: '/auth' });++ const next = flow ? sanitizeNext(flow.next, config) : '/';++ const { code, state, error } = req.query;++ if (error) {++ if ((flow && flow.silent) || error === 'login_required' || error === 'interaction_required') return res.redirect(next);++ return res.status(400).type('text/plain').send(`Sign-in was not completed (${String(error).slice(0, 60)}).`);++ }++ if (!flow || typeof flow.state !== 'string' || typeof flow.verifier !== 'string' || typeof state !== 'string'++ || state.length !== flow.state.length || !crypto.timingSafeEqual(Buffer.from(state), Buffer.from(flow.state))) {++ return res.status(400).type('text/plain').send('Sign-in state did not match. Please try signing in again.');++ }++ if (!code) return res.status(400).type('text/plain').send('The Network sent no authorization code.');++ try {++ const data = await tokenGrant({ grant_type: 'authorization_code', code: String(code), redirect_uri: config.oauth.redirectUri, code_verifier: flow.verifier });++ setSession(res, data);++ // No Clear-Site-Data here or on sign-out: Chrome holds such an answer (and the cookies it sets) until the++ // cache is cleared, which on phones left people on the account chooser with no session (2026-10-28).++ return res.redirect(next);++ } catch (err) {++ log.warn('[OpenVibe.Design] sign-in exchange failed:', err.status || '', err.error || '');++ return res.status(err.status && err.status < 500 ? 400 : 502).type('text/plain')++ .send(err.status && err.status < 500 ? 'The Network refused the sign-in code. Please sign in again.' : 'Sign-in failed: OpenVibe.Network did not answer. Please try again.');++ }++ });++++ // Sign-out ends the session, so another site must not be able to trigger it (a cross-site++ // <img src=/auth/logout> or link). A same-origin navigation or form, or the address bar++ // (Sec-Fetch-Site none), signs out directly; anything else gets a confirm button (POST).++ const sameOriginRequest = (req) => {++ const site = String(req.get('sec-fetch-site') || '');++ if (site) return site === 'same-origin' || (site === 'none' && req.method === 'GET');++ const origin = req.get('origin');++ if (origin) return origin === `${req.protocol}://${req.get('host')}`;++ return req.method === 'GET'; // no fetch metadata and no Origin: an old browser navigating++ };++ r.get('/logout', (req, res, next) => {++ if (sameOriginRequest(req)) return next();++ res.set('Cache-Control', cache.htmlHeaders({ private: true }));++ const q = req.query.next ? `?next=${encodeURIComponent(sanitizeNext(req.query.next, config))}` : '';++ res.type('html').send(`<!doctype html><meta charset="utf-8"><title>Sign out</title><meta name="viewport" content="width=device-width,initial-scale=1">`++ + `<form method="post" action="/auth/logout${q}" style="font:16px system-ui;margin:3em auto;max-width:24em;text-align:center">`++ + `<p>Sign out of OpenVibe.Design?</p><button type="submit">Sign out</button> <a href="/">Cancel</a></form>`);++ });++ r.post('/logout', (req, res, next) => (sameOriginRequest(req) ? next() : res.status(403).type('text/plain').send('Sign-out must come from this site.')));++ r.all('/logout', async (req, res) => {++ const rt = req.cookies && req.cookies[REFRESH_COOKIE];++ if (rt) {++ fetchImpl(`${config.networkInternalUrl || config.networkUrl}/oauth/revoke`, {++ method: 'POST', headers: { 'Content-Type': 'application/json' },++ body: JSON.stringify({ client_id: config.oauth.clientId, client_secret: config.oauth.clientSecret, token: rt }),++ signal: AbortSignal.timeout(3000),++ }).catch(() => {});++ }++ clearSession(res);++ res.cookie(HINT_COOKIE, 'guest', { sameSite: 'lax', secure: config.cookies.secure, httpOnly: false, path: '/', maxAge: 365 * 24 * 60 * 60 * 1000 });++ res.redirect(303, sanitizeNext(req.query.next, config));++ });++++ r.get('/me', (req, res) => {++ res.set('Cache-Control', cache.htmlHeaders({ private: true }));++ // No session at all (a guest: no access or refresh cookie) is signed out, not an error: the shared++ // navbar asks this on every page view, and a 401 logged a console error on each (browser check,++ // OpenVibe.Host). A session cookie that is present but invalid or expired still answers 401.++ const c = req.cookies || {};++ if (!c[ACCESS_COOKIE] && !c[REFRESH_COOKIE] && !req.get('authorization')) return res.json({ user: null });++ const v = req.viewer;++ if (!v || v.kind !== 'user') return res.status(401).json({ error: 'Not signed in' });++ res.json({ user: { username: v.username, display_name: v.displayName, subject_id: v.subject, role: v.role, avatar_url: v.avatarUrl || null, profile_color: v.profileColor || null } });++ });++ return r;++ }++++ return { middleware, routes, asViewer, tokenGrant, pkcePair };++}++++module.exports = { createSso, pkcePair, sanitizeNext, ownOrigins, authorizeUrl, ACCESS_COOKIE, REFRESH_COOKIE };nnew file mode 100644@@@ -0,0 +1,60 @@++'use strict';++++/**++ * OpenVibe.Design configuration. Every value comes from the environment (production:++ * /etc/openvibe/design.env, see .env.example). Only environment variable NAMES appear in code and docs; secrets are++ * never logged.++ *++ * load(env) is pure so tests can build a config without touching process.env.++ */++require('dotenv').config();++++const trim = (s) => String(s || '').replace(/\/+$/, '');++const int = (v, def) => (Number.isFinite(parseInt(v, 10)) ? parseInt(v, 10) : def);++++function load(env = process.env) {++ const nodeEnv = env.NODE_ENV || 'development';++ const isProduction = nodeEnv === 'production';++ const port = int(env.PORT, 5090);++ const baseUrl = trim(env.BASE_URL || (isProduction ? 'https://openvibe.design' : `http://localhost:${port}`));++ // The Network's public origin is where a browser is sent to authorize. Its internal origin is where this++ // service exchanges the code, fetches the JWKS and proxies the theme API; neither a person's browser nor their++ // token ever talks to it directly.++ const networkPublicUrl = trim(env.OV_NETWORK_URL || 'https://openvibe.network');++ const networkInternalUrl = trim(env.OV_NETWORK_INTERNAL_URL || 'http://127.0.0.1:4000');++++ return {++ service: 'design',++ name: 'OpenVibe.Design',++ port,++ host: env.HOST || '127.0.0.1',++ nodeEnv,++ isProduction,++ baseUrl,++ trustProxy: env.TRUST_PROXY != null ? Number(env.TRUST_PROXY) : 2,++++ // The theme API proxy (server/http/api.js): every call goes to the Network's /api/themes. `networkUrl`++ // is the internal origin the proxy and the token exchange use; `networkPublicUrl` is the browser's.++ networkUrl: networkInternalUrl,++ networkPublicUrl,++ networkInternalUrl,++ networkIssuer: trim(env.OV_NETWORK_ISSUER || networkPublicUrl),++ themeCacheMs: Math.max(0, int(env.DESIGN_THEME_CACHE_MS, 5 * 60_000)),++ timeoutMs: Math.max(200, int(env.DESIGN_UPSTREAM_TIMEOUT_MS, 8000)),++++ // OpenVibe.Network: SSO (OAuth2 authorization server with PKCE) and its JWKS.++ oauth: {++ clientId: env.OV_OAUTH_CLIENT_ID || 'design',++ clientSecret: env.OV_OAUTH_CLIENT_SECRET || '',++ redirectUri: env.OV_OAUTH_REDIRECT_URI || `${baseUrl}/auth/callback`,++ scope: 'profile',++ sessionAudience: env.OV_SESSION_AUDIENCE || 'openvibe.network',++ },++ cookies: { secure: env.COOKIE_SECURE ? env.COOKIE_SECURE === 'true' : isProduction },++++ // One per-IP budget for /api and /auth (express-rate-limit, one 60 s window).++ rateLimitPerMinute: Math.max(1, int(env.DESIGN_RATE_LIMIT_PER_MIN, 120)),++ };++}++++module.exports = { load };nnew file mode 100644@@@ -0,0 +1,190 @@++'use strict';++++/**++ * The theme API proxy: OpenVibe.Design signs the person in and forwards their theme calls to OpenVibe.Network's++ * /api/themes, with the access token from the httpOnly design_at cookie as a Bearer. The token is never logged,++ * echoed, put in a URL or sent anywhere but the configured Network.++ *++ * GET /api/themes public catalogue, cached in memory for 5 minutes++ * GET /api/themes/:idOrSlug one public theme++ * GET /api/me/theme Network GET /api/themes/me/active → { theme_id, theme, custom_variables }++ * PUT /api/me/theme Network PUT /api/themes/me with source 'studio'++ * GET /api/me/theme/history Network GET /api/themes/me/history++ * POST /api/me/theme/history/:id/restore Network's restore (id a positive integer)++ * POST /api/themes/submit Network POST /api/themes++ *++ * Writes need the request's Origin to be this site's own origin (CSRF), otherwise 403 design.cross_site. A Network++ * 4xx answer is passed through with its status and body; a Network failure is 502. Everything under /api/me is++ * private, no-store.++ */++const { http } = require('openvibe-contracts');++const { asyncRouter } = require('./router');++const { ACCESS_COOKIE } = require('../auth/sso');++++function ownOrigin(config) {++ try { return new URL(config.baseUrl).origin; } catch { return null; }++}++++/** A Network 4xx answer, with its own status and body. A 2xx answer is passed through the same way. */++function passThrough(res, r) {++ res.status(r.status);++ if (r.contentType) res.set('Content-Type', r.contentType);++ if (r.status === 204 || (!r.text && r.data == null)) return res.end();++ return res.send(r.text || JSON.stringify(r.data));++}++++function failure(res, req, err) {++ const r = err && err.response;++ if (r && r.status >= 400 && r.status < 500) return passThrough(res, r);++ return http.sendProblem(res, 502, 'network.unavailable', {++ detail: 'OpenVibe.Network did not answer. Try again in a moment.',++ ctx: req.ov,++ });++}++++/** A Network answer: its 4xx status and body pass through; a 5xx (or no answer) is this service's 502. */++function forward(res, req, up) {++ if (up.status >= 500) return failure(res, req, { response: up });++ return passThrough(res, up);++}++++function createApi(ctx) {++ const { config, catalog, log } = ctx;++ const r = asyncRouter();++ const origin = ownOrigin(config);++++ /** Writes (PUT/POST): only this site's own origin may ask for them. */++ function requireOrigin(req, res, next) {++ const sent = String(req.get('origin') || '');++ if (!origin || sent !== origin) {++ return http.sendProblem(res, 403, 'design.cross_site', {++ detail: 'A change to a theme must come from openvibe.design itself.',++ ctx: req.ov,++ });++ }++ return next();++ }++++ /** The person's Network access token, from the httpOnly cookie only. */++ function requireToken(req, res, next) {++ const token = req.cookies && req.cookies[ACCESS_COOKIE];++ if (!token) {++ return http.sendProblem(res, 401, 'token.required', {++ detail: 'Sign in at openvibe.design to use your theme.',++ ctx: req.ov,++ });++ }++ req.themeToken = token;++ return next();++ }++++ // /api/me/* is a person's own setting: no shared cache, no browser cache.++ r.use('/me', (_req, res, next) => { res.set('Cache-Control', 'private, no-store'); next(); });++++ // ── Public catalogue ────────────────────────────────────++ r.get('/themes', async (req, res) => {++ try {++ const data = await catalog.list();++ res.set('Cache-Control', 'public, max-age=120');++ return res.json(data);++ } catch (err) {++ log.warn('[OpenVibe.Design] theme catalogue failed:', (err && err.message) || err);++ return failure(res, req, err);++ }++ });++++ // A submission is a write: same-origin, signed in, and the same body Network expects.++ r.post('/themes/submit', requireOrigin, requireToken, async (req, res) => {++ const b = req.body && typeof req.body === 'object' ? req.body : {};++ const body = { name: b.name, slug: b.slug, description: b.description, mode: b.mode, variables: b.variables, tags: b.tags };++ try {++ const up = await catalog.request('', { method: 'POST', token: req.themeToken, body });++ return forward(res, req, up);++ } catch (err) {++ log.warn('[OpenVibe.Design] theme submission failed:', (err && err.message) || err);++ return failure(res, req, err);++ }++ });++++ r.get('/themes/:idOrSlug', async (req, res) => {++ try {++ const up = await catalog.get(req.params.idOrSlug);++ if (up.ok) res.set('Cache-Control', 'public, max-age=120');++ return forward(res, req, up);++ } catch (err) {++ log.warn('[OpenVibe.Design] theme lookup failed:', (err && err.message) || err);++ return failure(res, req, err);++ }++ });++++ // ── The signed-in person's theme ────────────────────────++ r.get('/me/theme', requireToken, async (req, res) => {++ try {++ const up = await catalog.request('/me/active', { token: req.themeToken });++ if (up.status >= 400) return forward(res, req, up);++ if (!up.ok) return failure(res, req, { response: up });++ const d = up.data || {};++ const out = {++ theme_id: d.theme_id === undefined ? null : d.theme_id,++ theme: d.theme === undefined ? null : d.theme,++ custom_variables: d.custom_variables === undefined ? null : d.custom_variables,++ };++ // Network's active answer names the theme; the page wants what it is. Ask the catalogue/detail only++ // when the answer did not carry the object itself, and never fail the read because of it.++ if (!out.theme && out.theme_id) {++ try {++ const found = await catalog.get(out.theme_id, { token: req.themeToken });++ if (found.ok && found.data && found.data.theme) out.theme = found.data.theme;++ } catch { /* the id is still useful without the object */ }++ }++ return res.json(out);++ } catch (err) {++ log.warn('[OpenVibe.Design] active theme failed:', (err && err.message) || err);++ return failure(res, req, err);++ }++ });++++ r.put('/me/theme', requireOrigin, requireToken, async (req, res) => {++ const b = req.body && typeof req.body === 'object' ? req.body : {};++ const body = { theme_id: b.theme_id, custom_variables: b.custom_variables, source: 'studio' };++ try {++ const up = await catalog.request('/me', { method: 'PUT', token: req.themeToken, body });++ return forward(res, req, up);++ } catch (err) {++ log.warn('[OpenVibe.Design] saving the theme failed:', (err && err.message) || err);++ return failure(res, req, err);++ }++ });++++ r.get('/me/theme/history', requireToken, async (req, res) => {++ try {++ const up = await catalog.request('/me/history', { token: req.themeToken });++ return forward(res, req, up);++ } catch (err) {++ log.warn('[OpenVibe.Design] theme history failed:', (err && err.message) || err);++ return failure(res, req, err);++ }++ });++++ r.post('/me/theme/history/:id/restore', requireOrigin, requireToken, async (req, res) => {++ const id = String(req.params.id || '');++ const n = Number(id);++ if (!/^\d+$/.test(id) || !Number.isSafeInteger(n) || n < 1) {++ return http.sendProblem(res, 400, 'design.invalid_history_id', {++ detail: 'The history id must be a positive integer.',++ ctx: req.ov,++ });++ }++ try {++ const up = await catalog.request(`/me/history/${n}/restore`, { method: 'POST', token: req.themeToken });++ return forward(res, req, up);++ } catch (err) {++ log.warn('[OpenVibe.Design] restoring a theme failed:', (err && err.message) || err);++ return failure(res, req, err);++ }++ });++++ return r;++}++++module.exports = { createApi, ownOrigin };nnew file mode 100644@@@ -0,0 +1,95 @@++'use strict';++++/**++ * Crawl artifacts for openvibe.design, built with openvibe-shared/seo: robots.txt, sitemap.xml and llms.txt.++ * The public pages are for search engines and AI crawlers; the studio's writes, the API and sign-in are not.++ *++ * The sitemap is /, /studio and one page per public theme in the catalogue. A Network failure leaves the static++ * pages in place rather than failing the crawl artifact.++ */++const fs = require('fs');++const path = require('path');++const seo = require('openvibe-shared/seo');++const { asyncRouter } = require('./router');++++const SITE_NAME = 'OpenVibe.Design';++const DESCRIPTION = 'OpenVibe.Design is the Design room of the OpenVibe network: browse OpenVibe\'s themes, try them on previews, edit one with contrast checks, use it, submit it to the gallery, and roll back to any earlier setting.';++const DISALLOW = ['/auth/', '/api/'];++++function dayOf(ts) {++ const m = String(ts == null ? '' : ts).match(/^(\d{4}-\d{2}-\d{2})/);++ return m ? m[1] : null;++}++function siteUpdated() {++ try { return dayOf(JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'STATUS.json'), 'utf8')).updated); } catch { return null; }++}++++/** Every public page, in the order a crawler should read them. */++function publicPages(themes = []) {++ const static_ = [++ { path: '/', changefreq: 'weekly', priority: 1.0, title: 'OpenVibe.Design', text: 'Browse OpenVibe\'s themes, try them on a preview, edit one with contrast checks, use it, and roll back to any earlier setting.' },++ { path: '/studio', changefreq: 'weekly', priority: 0.9, title: 'The theme studio', text: 'Try a theme on a preview, edit its variables with contrast checks, use it across the network, submit it to the gallery, and roll back.' },++ ];++ const themePages = (Array.isArray(themes) ? themes : []).filter((t) => t && t.slug).map((t) => ({++ path: `/t/${encodeURIComponent(String(t.slug))}`,++ changefreq: 'monthly',++ priority: 0.6,++ title: String(t.name || t.slug),++ text: `${t.mode ? `${String(t.mode)} theme. ` : ''}${String(t.description || 'A theme in the OpenVibe catalogue.')}`.trim(),++ }));++ return [...static_, ...themePages];++}++++function createDiscoveryRoutes(ctx) {++ const { config, catalog } = ctx;++ const r = asyncRouter();++ const site = String(config.baseUrl).replace(/\/+$/, '');++ const abs = (p) => `${site}${p}`;++ const TEXT = 'public, max-age=3600';++++ async function themes() {++ try { const list = await catalog.list(); return list.themes; } catch { return []; }++ }++++ r.get('/robots.txt', async (_req, res) => {++ res.type('text/plain').set('Cache-Control', TEXT).send(++ '# openvibe.design: the public pages are for search and AI crawlers; sign-in and the API are not.\n'++ + seo.robotsTxt({ sitemaps: [abs('/sitemap.xml')], disallow: DISALLOW }));++ });++++ r.get('/llms.txt', async (_req, res) => {++ const list = await themes();++ res.type('text/plain').set('Cache-Control', TEXT).send(seo.llmsTxt({++ name: SITE_NAME,++ summary: DESCRIPTION,++ details: 'Theme selection stays in OpenVibe.Network (its theme API); this service signs the person in and proxies their calls. The pages here are server-rendered and readable without JavaScript, and the theme catalogue is public.',++ sections: [++ { title: 'Start here', links: [++ { title: 'OpenVibe.Design', url: abs('/'), note: 'the theme catalogue' },++ { title: 'The studio', url: abs('/studio'), note: 'try, edit, use, submit and roll back a theme' },++ { title: 'For developers', url: abs('/developers'), note: 'the theme API proxy' },++ ] },++ { title: 'Themes', links: list.filter((t) => t && t.slug).slice(0, 100).map((t) => ({ title: String(t.name || t.slug), url: abs(`/t/${encodeURIComponent(String(t.slug))}`), note: `${t.mode ? String(t.mode) : 'theme'}${t.description ? ` — ${String(t.description)}` : ''}` })) },++ { title: 'Machine-readable', links: [++ { title: 'The theme catalogue (JSON)', url: abs('/api/themes'), note: 'public, cached for 5 minutes' },++ { title: 'Sitemap', url: abs('/sitemap.xml') },++ { title: 'Release metadata (JSON)', url: abs('/release.json') },++ ] },++ { title: 'Elsewhere', links: [++ { title: 'OpenVibe.Network', url: 'https://openvibe.network', note: 'accounts and the theme API this service proxies' },++ ] },++ ],++ }));++ });++++ r.get('/sitemap.xml', async (_req, res) => {++ const pages = publicPages(await themes());++ const lastmod = siteUpdated();++ const urls = pages.map((e) => ({ loc: abs(e.path), ...(lastmod ? { lastmod } : {}), changefreq: e.changefreq, priority: e.priority }));++ res.type('application/xml').set('Cache-Control', TEXT).send(seo.sitemapXml(urls));++ });++++ return r;++}++++module.exports = { createDiscoveryRoutes, publicPages, DESCRIPTION, SITE_NAME, DISALLOW };nnew file mode 100644@@@ -0,0 +1,76 @@++'use strict';++++/**++ * The public pages:++ * / the theme catalogue's front door++ * /studio the theme studio (the shell the main session's public/js/studio.js fills)++ * /t/:slug one public theme++ * /developers the API, for people and agents++ *++ * Every page is server-rendered and complete without JavaScript. A page for a signed-in person is private and++ * never cached; a public page gets the short 120-second window. `me` comes from the session the SSO middleware++ * already resolved — a guest never causes a Network call to find out they are a guest.++ */++const views = require('../views');++const { asyncRouter } = require('./router');++const { send } = require('../render/layout');++++function meOf(viewer) {++ if (!viewer || viewer.kind !== 'user') return { signedIn: false, user: null };++ return {++ signedIn: true,++ user: {++ subject_id: viewer.subject || null,++ username: viewer.username || null,++ display_name: viewer.displayName || null,++ role: viewer.role || 'user',++ avatar_url: viewer.avatarUrl || null,++ profile_color: viewer.profileColor || null,++ },++ };++}++++function createPageRoutes(ctx) {++ const { catalog, log } = ctx;++ const r = asyncRouter();++ // The catalogue never throws in a page: a Network failure degrades to the page without its list.++ const safe = (fn) => Promise.resolve().then(fn).catch((err) => {++ log.warn('[OpenVibe.Design] page catalogue failed:', (err && err.message) || err);++ return null;++ });++ const page = (res, status, html, viewer) => send(res, status, html, { viewer });++++ r.get('/', async (req, res) => {++ const list = await safe(() => catalog.list());++ return page(res, 200, views.home({ themes: list ? list.themes : null }), req.viewer);++ });++++ r.get('/studio', async (req, res) => {++ const list = await safe(() => catalog.list());++ return page(res, 200, views.studio({ themes: list ? list.themes : null, me: meOf(req.viewer) }), req.viewer);++ });++++ r.get('/t/:slug', async (req, res) => {++ let up;++ try {++ up = await catalog.get(req.params.slug);++ } catch (err) {++ log.warn('[OpenVibe.Design] theme page failed:', (err && err.message) || err);++ res.set('Cache-Control', 'no-store');++ return res.status(502).type('text/plain').send('OpenVibe.Network did not answer. Try again in a moment.');++ }++ if (up.status === 404) return page(res, 404, views.notFound(), req.viewer);++ if (!up.ok || !up.data || !up.data.theme) {++ res.set('Cache-Control', 'no-store');++ return res.status(502).type('text/plain').send('That theme could not be read right now. Try again in a moment.');++ }++ return page(res, 200, views.theme({ theme: up.data.theme }), req.viewer);++ });++++ r.get('/developers', (req, res) => page(res, 200, views.developers(), req.viewer));++++ r.use((req, res) => page(res, 404, views.notFound(), req.viewer));++ return r;++}++++module.exports = { createPageRoutes, meOf };nnew file mode 100644@@@ -0,0 +1,23 @@++'use strict';++++/**++ * express.Router() whose get/post/put handlers may be async: a rejected promise goes to next(err) instead of++ * becoming an unhandled rejection. (The same helper OpenVibe.Help and OpenVibe.Domains carry.)++ */++const express = require('express');++++function asyncRouter() {++ const r = express.Router();++ for (const method of ['get', 'post', 'put']) {++ const orig = r[method].bind(r);++ r[method] = (path, ...handlers) => orig(path, ...handlers.map((h) => (h.length === 4 ? h : (req, res, next) => {++ try {++ const out = h(req, res, next);++ if (out && typeof out.catch === 'function') out.catch(next);++ } catch (err) { next(err); }++ })));++ }++ return r;++}++++module.exports = { asyncRouter };nnew file mode 100644@@@ -0,0 +1,44 @@++'use strict';++++/**++ * OpenVibe.Design — process entry. `node server/index.js` listens on PORT (5090) behind nginx (deploy/).++ * Stateless: the HTTP server and the JWKS refresher are what stop.++ */++const { createApp } = require('./app');++const { gracefulStop } = require('openvibe-sdk/service');++++/**++ * The process stop (openvibe-sdk/service): stop taking connections, drain the requests in flight, stop the JWKS++ * refresher, exit. Exported so a test can inject `exit` and `signals: false`.++ */++function createLifecycle({ server, ctx, exit, signals } = {}) {++ return gracefulStop({++ name: 'OpenVibe.Design',++ server,++ deadlineExitCode: 0,++ exit,++ signals,++ deadlineMs: 10_000,++ close: [() => ctx.keys.client.stop()],++ });++}++++async function start() {++ const { app, ctx } = await createApp();++ const { config } = ctx;++ const server = app.listen(config.port, config.host, () => {++ console.log(`[OpenVibe.Design] ${config.nodeEnv} on http://${config.host}:${config.port} → ${config.baseUrl} (network ${config.networkUrl})`);++ });++ server.keepAliveTimeout = 65_000;++ createLifecycle({ server, ctx });++ return { server, ctx };++}++++if (require.main === module) {++ start().catch((err) => {++ console.error('[OpenVibe.Design] failed to start:', err);++ process.exit(1);++ });++}++++module.exports = { start, createLifecycle };nnew file mode 100644@@@ -0,0 +1,38 @@++'use strict';++++/**++ * Truthful readiness for GET /api/ready (openvibe-shared/ready). There is no database: the service is stateless.++ *++ * network optional OpenVibe.Network answers its theme catalogue++ * network_jwks optional the Network signing key is loaded; without it nobody can sign in++ * oauth_client optional OV_OAUTH_CLIENT_SECRET is set (sign-in needs it)++ *++ * No check is required: if Network does not answer, the process still serves the pages and the crawl artifacts, so++ * the answer is 200 with status "degraded" — never 503 (the same rule OpenVibe.Domains uses for its two upstreams).++ */++const { createReadiness } = require('openvibe-shared/ready');++++function createServiceReadiness({ config, catalog, keys = null, release = null }) {++ return createReadiness({++ service: 'design',++ release,++ checks: [++ {++ name: 'network',++ required: false,++ check: async () => {++ const list = await catalog.list({ fresh: true });++ return list && Array.isArray(list.themes) ? true : 'OpenVibe.Network did not answer';++ },++ },++ {++ name: 'network_jwks',++ required: false,++ check: () => (keys && keys.loaded() ? true : 'Network signing key not loaded yet: sign-in is unavailable'),++ },++ { name: 'oauth_client', required: false, check: () => (config.oauth.clientSecret ? true : 'OV_OAUTH_CLIENT_SECRET unset: sign-in cannot complete') },++ ],++ });++}++++module.exports = { createServiceReadiness };nnew file mode 100644@@@ -0,0 +1,95 @@++'use strict';++++/**++ * Page shell for OpenVibe.Design. Every page is server-rendered through openvibe-shared/shell and is complete++ * without JavaScript: the OpenVibe Frame (theme, navbar, footer) comes from the shared shell and the room's accent++ * from openvibe-shared/rooms. The views themselves are plain placeholders for now (server/views/index.js).++ *++ * - <head>: the shared app icon, the room's stylesheets, this site's content-hashed design.css++ * - the navbar's session probe (/auth/me), sign-in and sign-out URLs and silent sign-in, as every site's++ * - the product's own script only where a page offers an in-browser convenience (/studio)++ */++const shell = require('openvibe-shared/shell');++const ovServe = require('openvibe-shared/serve');++const appIcon = require('openvibe-shared/app-icon');++const kit = require('openvibe-shared/kit');++const rooms = require('openvibe-shared/rooms');++const { asset, assetVersion } = require('../assets');++++const NAME = 'OpenVibe.Design';++const NETWORK = 'https://openvibe.network';++const ROOM = rooms.get('design');++const esc = kit.esc;++++const NAV = [++ { label: 'Home', href: '/', icon: 'fa-house' },++ { label: 'Studio', href: '/studio', icon: 'fa-palette' },++ { label: 'Developers', href: '/developers', icon: 'fa-code', more: true },++];++++let RELEASE = 'dev';++let BASE = 'https://openvibe.design';++function setRelease(id) { if (id) RELEASE = String(id); }++function configure({ baseUrl } = {}) { if (baseUrl) BASE = String(baseUrl).replace(/\/+$/, ''); }++const baseUrl = () => BASE;++const canonical = (p) => `${BASE}${p || '/'}`;++++/** The page around a body: the shared shell with the room's stylesheets and behaviour. */++function layout({ title, description, canonical, path, robots = 'index, follow', body, active = '/', scripts = [], jsonLd = [] } = {}) {++ const pathNow = path || active || '/';++ canonical = canonical || (path ? `${BASE}${path}` : undefined);++ const navbar = {++ service: 'design',++ apiBase: NETWORK,++ links: NAV.map((l) => ({ ...l, active: l.href === active || (l.href !== '/' && String(active).startsWith(`${l.href}/`)) })),++ appBar: [{ label: 'Home', href: '/', icon: 'fa-house' }, { label: 'Studio', href: '/studio', icon: 'fa-palette' }],++ history: { type: 'page', title: title || NAME },++ silentLogin: `${BASE}/auth/login?silent=1&next={url}`,++ sessionUrl: '/auth/me',++ loginUrl: '/auth/login?next={path}',++ logoutUrl: '/auth/logout?next={path}',++ };++ const footer = { service: 'design', variant: 'full', mount: '#ov-footer', brandName: NAME };++ return shell.page({++ name: NAME,++ lang: 'en',++ title: title || `${NAME}: ${ROOM.line}`,++ titleSuffix: title ? ` · ${NAME}` : '',++ siteName: NAME,++ description: description || `${ROOM.line}. Browse OpenVibe's themes, try them on a preview, edit one with contrast checks, and use it across the network.`,++ canonical,++ robots,++ jsonLd,++ home: '/',++ navLinks: NAV,++ navbar,++ footer,++ head: `${appIcon.headTags({ site: 'design' })}++<link rel="stylesheet" href="${esc(ovServe.url('kit.css'))}">++<link rel="stylesheet" href="${esc(ovServe.url('room.css'))}">++<link rel="stylesheet" href="${esc(ovServe.url('showcase.css'))}">++<link rel="stylesheet" href="${esc(asset('css/design.css'))}">++<script src="${esc(ovServe.url('kit-web.js'))}" defer></script>++<script src="${esc(ovServe.url('motion.js'))}" defer></script>++${(scripts || []).map((rel) => `<script src="${esc(asset(rel))}" defer></script>`).join('\n')}++<meta name="ov-boost" content="design@${esc(RELEASE)}">`,++ body: `<a class="skip" href="#main">Skip to content</a>++<div id="navbar-mount"></div>++<main id="main" class="ds ov-room" style="${rooms.style('design')}">${body || ''}</main>++<script>window.__OV_PAGE = ${JSON.stringify({ navbar, footer, path: pathNow }).replace(/</g, '\\u003c')};++document.addEventListener('DOMContentLoaded', function () { try { if (window.OpenVibeFooter) OpenVibeFooter.init(window.__OV_PAGE.footer); } catch (e) { /* the Frame is optional */ } });</script>`,++ });++}++++/**++ * Send a page; a page rendered for a signed-in person is private and never cached. A public page gets the short++ * public window the whole network uses for HTML.++ */++function send(res, status, html, { viewer } = {}) {++ const personal = viewer && viewer.kind === 'user';++ res.set('Cache-Control', personal ? 'private, no-store' : 'public, max-age=120');++ res.set('Vary', 'Cookie');++ res.status(status).type('html').send(html);++}++++module.exports = { layout, send, setRelease, configure, baseUrl, canonical, NAME, NETWORK, ROOM, NAV, esc, asset, assetVersion };nnew file mode 100644@@@ -0,0 +1,69 @@++'use strict';++++/**++ * The public theme catalogue from OpenVibe.Network, cached in this process for five minutes.++ *++ * GET /api/themes is public and is asked on every page and by the sitemap, so one answer serves all of them until++ * it is five minutes old. A failure is never cached: the next request asks again, and the page degrades honestly.++ * The API proxy and the pages share this one client (server/app.js puts it in ctx).++ */++function createThemeCatalog({ config, fetchImpl = globalThis.fetch, log = console, now = () => Date.now() }) {++ let cached = null;++++ async function request(path, { method = 'GET', token = null, body, timeoutMs = config.timeoutMs || 8000 } = {}) {++ const headers = { Accept: 'application/json' };++ if (token) headers.Authorization = `Bearer ${token}`;++ if (body !== undefined) headers['Content-Type'] = 'application/json';++ let res;++ try {++ res = await fetchImpl(`${config.networkUrl}/api/themes${path}`, {++ method,++ headers,++ body: body === undefined ? undefined : JSON.stringify(body),++ // A person's token is in the header only: it is never logged, and a redirect would not carry it to++ // another origin (fetch drops Authorization across one).++ signal: AbortSignal.timeout(timeoutMs),++ });++ } catch (err) {++ throw Object.assign(new Error('OpenVibe.Network did not answer'), {++ status: 502,++ error: err && err.name === 'TimeoutError' ? 'timeout' : 'unreachable',++ });++ }++ const text = await res.text().catch(() => '');++ let data = null;++ try { data = text ? JSON.parse(text) : null; } catch { /* not JSON: passed through as text */ }++ return {++ status: res.status,++ ok: res.ok,++ data,++ text,++ contentType: res.headers.get('content-type') || (data ? 'application/json' : 'text/plain'),++ };++ }++++ /** The public catalogue, `{ themes: [...] }`, from memory when it is under five minutes old. */++ async function list({ fresh = false } = {}) {++ const cacheMs = config.themeCacheMs == null ? 5 * 60_000 : config.themeCacheMs;++ if (!fresh && cached && now() - cached.at < cacheMs) return cached.value;++ const r = await request('');++ if (!r.ok) throw Object.assign(new Error(`theme catalogue ${r.status}`), { status: r.status, response: r });++ if (!r.data || !Array.isArray(r.data.themes)) {++ throw Object.assign(new Error('theme catalogue answered without a themes list'), { status: 502 });++ }++ const value = { themes: r.data.themes };++ cached = { at: now(), value };++ return value;++ }++++ /** One theme, as Network answers it ({ status, ok, data, text, contentType }). */++ async function get(idOrSlug, { token = null } = {}) {++ return request(`/${encodeURIComponent(String(idOrSlug || ''))}`, { token });++ }++++ function clear() { cached = null; }++++ return { request, list, get, clear, get cached() { return cached; } };++}++++module.exports = { createThemeCatalog };nnew file mode 100644@@@ -0,0 +1,166 @@++'use strict';++/**++ * The Design room's pages (plan 2026-10-28 §5.2, v1: the theme studio and rollback). Server-rendered and whole without++ * JavaScript (the gallery and each theme's page are plain links); public/js/studio.js makes the studio live: the++ * previews recolour as you pick or edit, the checks run, and Use, Submit and History talk to /api (server/http/api.js,++ * which proxies Network's theme API as the signed-in person).++ *++ * home({ themes }) the front door: the room's hero, a strip of themes, what the studio does++ * studio({ themes, me }) me: { signedIn, user }++ * theme({ theme }) one theme: its colours, a preview, and "Open in the studio"++ * developers() the API++ * notFound()++ */++const layoutLib = require('../render/layout');++const kit = require('openvibe-shared/kit');++const sc = require('openvibe-shared/showcase');++const rooms = require('openvibe-shared/rooms');++++const { layout, esc, NAME } = layoutLib;++const ROOM = rooms.get('design');++const listOf = (themes) => (Array.isArray(themes) ? themes : (themes && Array.isArray(themes.themes) ? themes.themes : []));++const HEX = /^#[0-9a-f]{3,8}$/i;++const col = (v, k, d) => (v && HEX.test(String(v[k] || '')) ? v[k] : d);++const SWATCH = ['--bg-primary', '--bg-card', '--accent', '--text-primary'];++const CORE = [++ ['--bg-primary', 'Background'], ['--bg-card', 'Surface'], ['--text-primary', 'Text'],++ ['--text-muted', 'Muted text'], ['--accent', 'Accent'], ['--border', 'Lines'],++];++++/** The variables a preview frame carries inline (only allow-listed token names with colour values). */++function varsStyle(v) {++ return Object.entries(v || {}).filter(([k, x]) => /^--[a-z][a-z0-9-]{1,40}$/.test(k) && /^(#[0-9a-f]{3,8}|rgba?\([0-9., ]+\)|[0-9., ]+)$/i.test(String(x))).map(([k, x]) => `${k}:${x}`).join(';');++}++++/** A theme as a swatch button (the studio) or link (the home and gallery without JavaScript). */++function swatch(t, { tag = 'a' } = {}) {++ const v = t.variables || {};++ const dots = SWATCH.map((k) => `<i style="background:${esc(col(v, k, '#888'))}"></i>`).join('');++ const inner = `<span class="ds-dots" aria-hidden="true">${dots}</span><span class="ds-swatch-name">${esc(t.name)}</span><span class="ds-swatch-mode">${t.mode === 'light' ? 'Light' : 'Dark'}</span>`;++ if (tag === 'button') return `<button type="button" class="ds-swatch" data-theme-id="${esc(t.id)}" data-mode="${t.mode === 'light' ? 'light' : 'dark'}" aria-pressed="false">${inner}</button>`;++ return `<a class="ds-swatch" href="/t/${encodeURIComponent(t.slug || t.id)}">${inner}</a>`;++}++++/** The three surfaces every theme is tried on: a Live channel, a Chat room and a shop's grid (open.shoes, Deals). */++function previews() {++ const msg = (who, hue, text) => `<li><span class="pv-av" style="--h:${hue}">${esc(who.slice(0, 1))}</span><span><b>${esc(who)}</b> ${esc(text)}</span></li>`;++ const shoe = (name, price, was, best) => `<li class="pv-shoe"><span class="pv-shoe-pic" aria-hidden="true">${kit.icon('shoe')}</span><b>${esc(name)}</b><span class="pv-price">${esc(price)}${was ? ` <s>${esc(was)}</s>` : ''}</span>${best ? '<em class="pv-chip">Best price</em>' : ''}</li>`;++ return `<div class="pv-frame pv-live" aria-label="Preview: a Live channel"><p class="pv-label">OpenVibe.Live</p>++<div class="pv-video"><span class="pv-badge">LIVE</span><span class="pv-viewers">1.2k watching</span></div>++<div class="pv-row"><span class="pv-av pv-av-lg" style="--h:30">G</span><span class="pv-col"><b>Seattle at night, chat picks the route</b><small>goosely · IRL</small></span><button type="button" class="pv-btn" tabindex="-1">Follow</button></div>++<ul class="pv-chat">${msg('maru', 200, 'left at the light!')}${msg('kiwi', 120, 'the view from here 😮')}${msg('teddy', 320, 'clip that')}</ul></div>++<div class="pv-frame pv-chatroom" aria-label="Preview: a Chat room"><p class="pv-label">OpenVibe.Chat</p>++<p class="pv-room"># night-owls <span class="pv-muted">· 38 here</span></p>++<ul class="pv-chat pv-chat-lg">${msg('ana', 10, 'anyone up for the surf race?')}${msg('jules', 260, 'in five, warming up on utopia')}<li class="pv-me"><span>count me in</span></li></ul>++<div class="pv-composer"><span>Message #night-owls</span><button type="button" class="pv-send" tabindex="-1" aria-hidden="true">${kit.icon('send')}</button></div></div>++<div class="pv-frame pv-shop" aria-label="Preview: a shop's grid"><p class="pv-label">open.shoes</p>++<p class="pv-chips"><span class="is-on">Running</span><span>Trail</span><span>Size 10</span></p>++<ul class="pv-grid">${shoe('Cloudrunner 2', '$119', '$150', true)}${shoe('Trail Pro', '$139')}${shoe('Daily 3', '$89', '$110')}${shoe('Racer X', '$179')}</ul></div>`;++}++++const CVD = `<svg width="0" height="0" style="position:absolute" aria-hidden="true" focusable="false"><defs>++<filter id="ds-cvd-protan"><feColorMatrix type="matrix" values="0.152 1.053 -0.205 0 0 0.115 0.786 0.099 0 0 -0.004 -0.048 1.052 0 0 0 0 0 1 0"/></filter>++<filter id="ds-cvd-deutan"><feColorMatrix type="matrix" values="0.367 0.861 -0.228 0 0 0.280 0.673 0.047 0 0 -0.012 0.043 0.969 0 0 0 0 0 1 0"/></filter>++<filter id="ds-cvd-tritan"><feColorMatrix type="matrix" values="1.256 -0.077 -0.179 0 0 -0.078 0.931 0.148 0 0 0.005 0.691 0.304 0 0 0 0 0 1 0"/></filter></defs></svg>`;++++function home({ themes } = {}) {++ const all = listOf(themes);++ const picks = ['vibe', 'violet-hour', 'forest', 'neon-tokyo', 'sunset', 'cloud', 'daylight', 'meadow'].map((id) => all.find((t) => t.id === id)).filter(Boolean);++ const shown = picks.concat(all.filter((t) => !picks.includes(t))).slice(0, 8);++ const strip = shown.map((t) => `<li>${swatch(t)}</li>`).join('');++ const orb = `<div class="ds-orb" aria-hidden="true"><span class="ds-orb-ring"></span><span class="ds-orb-core"></span>${(picks.length ? picks : all).slice(0, 6).map((t, i) => `<i style="--i:${i};background:${esc(col(t.variables, '--accent', '#888'))}"></i>`).join('')}</div>`;++ const body = sc.room({++ room: 'design',++ hero: {++ title: ROOM.line,++ lede: 'Pick a theme and watch Live, Chat and a shop wear it side by side. Change a colour, see every contrast check pass or fail, and use it on every OpenVibe site at once. Any earlier look is one tap back.',++ start: { href: '/studio', label: 'Open the studio' },++ chips: picks.slice(0, 5).map((t) => ({ label: t.name, href: `/studio?theme=${encodeURIComponent(t.id)}` })),++ motif: orb,++ },++ proof: [{ value: all.length, label: all.length === 1 ? 'theme to try' : 'themes to try' }, { value: all.filter((t) => t.mode === 'light').length, label: 'with a light side' }].filter((p) => p.value),++ html: strip ? `<section aria-labelledby="ds-strip-h"><div class="ds-head-row"><h2 id="ds-strip-h">Themes to try</h2><a class="ds-more" href="/studio">All of them in the studio${kit.icon('chevron')}</a></div><ul class="ds-strip">${strip}</ul></section>` : '',++ scenes: [++ { title: 'One theme, three sites, side by side', text: 'Every theme is tried on a Live channel, a Chat room and a shop\'s grid at once, so you see the buttons, the chat and the prices before you choose.', html: `<div class="ds-scene-pv">${previews()}</div>`, action: { href: '/studio', label: 'Try one' } },++ { title: 'Checks that must pass', text: 'Text on every surface, buttons, links and muted text are measured against WCAG as you edit, and the previews can be seen as people with colour-vision differences see them.', html: `<ul class="ds-checks is-demo"><li class="is-pass"><b>Text on background</b><span>14.2:1</span></li><li class="is-pass"><b>Button text</b><span>7.1:1</span></li><li class="is-fail"><b>Muted text on surface</b><span>3.1:1 · needs 4.5</span></li></ul>`, action: { href: '/studio', label: 'Edit a theme' } },++ ],++ explore: { title: 'More on Design', items: [++ { title: 'The studio', text: 'Pick, edit, check and use a theme', href: '/studio', icon: 'ov:theme' },++ { title: 'Your themes on Network', text: 'Display, motion and text size', href: 'https://openvibe.network/my', icon: 'ov:account' },++ { title: 'The API', text: 'The theme catalog as open JSON', href: '/developers', icon: 'ov:code' },++ ] },++ faq: { items: [++ ['Where does my theme apply?', 'Everywhere you are signed in to OpenVibe: the theme lives on your account, and every site picks it up on its next page.'],++ ['Can I undo a change?', 'Yes. Every change keeps the look it replaced; the studio\'s history brings any of the last fifty back.'],++ ['Can others use my theme?', 'Submit it to the gallery. A person reviews each submission before anyone else sees it.'],++ ] },++ });++ return layout({ title: null, path: '/', body: `<div class="ds-wrap">${body}</div>`, active: '/' });++}++++function studio({ themes, me = {} } = {}) {++ const all = listOf(themes).filter((t) => t && t.id);++ const signedIn = !!me.signedIn;++ const gallery = all.map((t) => `<li>${swatch(t, { tag: 'button' })}</li>`).join('');++ const data = JSON.stringify(all.map((t) => ({ id: t.id, name: t.name, mode: t.mode, variables: t.variables || {} }))).replace(/</g, '\\u003c');++ const body = `${CVD}<div class="ds-studio" data-signed-in="${signedIn ? '1' : '0'}">++<header class="ds-studio-h"><div><p class="ds-kicker">Theme studio</p><h1>Make it yours</h1>++<p class="ds-lede">Pick a theme, change any colour, and see it on three sites at once. Every check must pass before it can be used.</p></div>++${signedIn ? `<p class="ds-sign ds-fine">Signed in as <b>${esc((me.user && (me.user.display_name || me.user.username)) || 'you')}</b>: Use changes your look on every OpenVibe site.</p>` : `<p class="ds-sign">${kit.button({ href: '/auth/login?next=%2Fstudio', label: 'Sign in to use a theme', kind: 'quiet', small: true })}</p>`}</header>++<div class="ds-grid">++<aside class="ds-gallery" aria-labelledby="ds-gal-h"><div class="ds-gal-head"><h2 id="ds-gal-h">Themes</h2>++<div class="ds-seg" role="group" aria-label="Show"><button type="button" data-show="all" aria-pressed="true">All</button><button type="button" data-show="dark" aria-pressed="false">Dark</button><button type="button" data-show="light" aria-pressed="false">Light</button></div></div>++<ul class="ds-gal-list">${gallery || '<li class="ds-fine">The catalog is not answering. Try again in a minute.</li>'}</ul></aside>++<section class="ds-stage" aria-labelledby="ds-stage-h"><div class="ds-stage-head"><h2 id="ds-stage-h"><span id="ds-current">Your current theme</span></h2>++<label class="ds-see">See it as <select id="ds-cvd"><option value="">Typical colour vision</option><option value="protan">Protanopia (red-blind)</option><option value="deutan">Deuteranopia (green-blind)</option><option value="tritan">Tritanopia (blue-blind)</option><option value="gray">Grayscale</option></select></label></div>++<div class="ds-previews" id="ds-previews">${previews()}</div></section>++<aside class="ds-editor" aria-labelledby="ds-ed-h"><h2 id="ds-ed-h">Edit</h2>++<div class="ds-fields">${CORE.map(([k, l]) => `<label class="ds-field"><span>${esc(l)}</span><input type="color" data-var="${k}" aria-label="${esc(l)}"><input type="text" data-hex="${k}" inputmode="text" maxlength="7" spellcheck="false" aria-label="${esc(l)}, hex"></label>`).join('')}</div>++<h3>Checks</h3><ul class="ds-checks" id="ds-checks" aria-live="polite"><li class="ds-fine">Pick a theme to check it.</li></ul>++<div class="ds-actions"><button type="button" class="ovk-btn ovk-btn--primary" id="ds-use" disabled>${signedIn ? 'Use this theme' : 'Sign in to use it'}</button>++<button type="button" class="ovk-btn ovk-btn--quiet" id="ds-reset" disabled>Undo my edits</button></div>++<p class="ds-status" id="ds-status" role="status"></p>++<details class="ds-submit"><summary>Share it in the gallery</summary><form id="ds-submit-form"><label>Name <input type="text" id="ds-name" maxlength="60" minlength="2" required placeholder="Cozy autumn"></label>++<label>One line about it <input type="text" id="ds-desc" maxlength="300" placeholder="Warm browns and a pumpkin accent"></label>++<button type="submit" class="ovk-btn ovk-btn--quiet" ${signedIn ? '' : 'disabled'}>Send for review</button><p class="ds-fine">A person reviews each theme before anyone else sees it.</p></form></details>++${signedIn ? '<details class="ds-history" id="ds-history"><summary>History</summary><ol id="ds-history-list"><li class="ds-fine">Your earlier looks appear here.</li></ol></details>' : ''}++</aside></div></div>++<script type="application/json" id="ds-themes">${data}</script>`;++ return layout({ title: 'Theme studio', description: 'Pick an OpenVibe theme, edit any colour with contrast and colour-vision checks, see it on Live, Chat and a shop at once, and use it everywhere.', path: '/studio', body: `<div class="ds-wrap">${body}</div>`, active: '/studio', scripts: ['js/studio.js'] });++}++++function theme({ theme: t } = {}) {++ const v = (t && t.variables) || {};++ const rows = CORE.map(([k, l]) => (HEX.test(String(v[k] || '')) ? `<div><dt>${esc(l)}</dt><dd><i style="background:${esc(v[k])}"></i><code>${esc(v[k])}</code></dd></div>` : '')).join('');++ const body = `<header class="ds-page-h"><p class="ds-kicker">${t.mode === 'light' ? 'Light theme' : 'Dark theme'}</p><h1>${esc(t.name)}</h1>${t.description ? `<p class="ds-lede">${esc(t.description)}</p>` : ''}++<p class="ds-act">${kit.button({ href: `/studio?theme=${encodeURIComponent(t.id)}`, label: 'Open in the studio' })} ${kit.button({ href: `/api/themes/${encodeURIComponent(t.slug || t.id)}`, label: 'As JSON', kind: 'quiet' })}</p></header>++${rows ? `<dl class="ds-colours">${rows}</dl>` : ''}++<section aria-labelledby="ds-pv-h"><h2 id="ds-pv-h">How it looks</h2><div class="ds-previews ds-previews--static" style="${esc(varsStyle(v))}">${previews()}</div></section>`;++ return layout({ title: `${t.name}: an OpenVibe theme`, description: t.description || `${t.name}, a ${t.mode === 'light' ? 'light' : 'dark'} OpenVibe theme: its colours and how Live, Chat and a shop look in it.`, path: `/t/${encodeURIComponent(t.slug || t.id)}`, body: `<div class="ds-wrap">${body}</div>`, active: '/studio' });++}++++function developers() {++ const rows = [++ ['GET /api/themes', 'Every public OpenVibe theme with its colours (Network\'s catalog).'],++ ['GET /api/themes/:id', 'One theme.'],++ ['GET /api/me/theme', 'Your active theme (signed in).'],++ ['PUT /api/me/theme', 'Use a theme, with optional custom colours (signed in; from this site only).'],++ ['GET /api/me/theme/history', 'Your earlier looks, newest first; POST /api/me/theme/history/:id/restore brings one back.'],++ ];++ const body = `<header class="ds-page-h"><p class="ds-kicker">For developers</p><h1>The Design API</h1><p class="ds-lede">The theme catalog is open JSON. A theme is a set of CSS custom properties every OpenVibe site reads; Network keeps which one each person uses.</p></header>++<section aria-labelledby="ds-ep-h"><h2 id="ds-ep-h">Endpoints</h2><dl class="ds-eps">${rows.map(([ep, what]) => `<div><dt><code>${esc(ep)}</code></dt><dd>${esc(what)}</dd></div>`).join('')}</dl></section>++<p class="ds-fine">Themes also export and import as <code>openvibe-theme@1</code> files through <a href="https://openvibe.network/api/themes">Network's theme API</a>.</p>`;++ return layout({ title: 'The Design API', path: '/developers', body: `<div class="ds-wrap">${body}</div>`, active: '/developers' });++}++++function notFound() {++ const body = `<header class="ds-page-h"><h1>Nothing here</h1><p class="ds-lede">That page does not exist. <a href="/studio">Open the studio</a> or <a href="/">browse the themes</a>.</p></header>`;++ return layout({ title: 'Not found', robots: 'noindex, follow', body: `<div class="ds-wrap">${body}</div>`, active: '/' });++}++++module.exports = {++ home, studio, theme, developers, notFound,++ layout,++ setRelease: layoutLib.setRelease,++ configure: layoutLib.configure,++};nnew file mode 100644@@@ -0,0 +1,85 @@++'use strict';++/**++ * Boots OpenVibe.Design on a random port against an in-process Network (test/helpers/network.js), and returns a++ * small HTTP client. Every test file gets its own process, Network and app.++ *++ * const t = await boot();++ * t.get(path, { as: user, cookie, json, headers, method })++ * t.signIn(user) → cookie header value (design_at = a Network user token, as after /auth/callback)++ * t.logs(), t.close()++ */++const http = require('http');++const { startNetwork } = require('./network');++++async function boot(opts = {}) {++ const network = await startNetwork(opts.network || {});++ const env = {++ NODE_ENV: 'test', PORT: '0', BASE_URL: 'https://openvibe.design', TRUST_PROXY: '1',++ OV_NETWORK_URL: network.url, OV_NETWORK_INTERNAL_URL: network.url, OV_NETWORK_ISSUER: network.url,++ OV_OAUTH_CLIENT_ID: 'design', OV_OAUTH_CLIENT_SECRET: 'design-secret', COOKIE_SECURE: 'false',++ DESIGN_RATE_LIMIT_PER_MIN: '100000',++ ...(opts.env || {}),++ };++ for (const [k, v] of Object.entries(opts.env || {})) if (v === null) delete env[k];++++ const logLines = [];++ const log = {++ log: (...a) => logLines.push(a.map(String).join(' ')),++ info: (...a) => logLines.push(a.map(String).join(' ')),++ warn: (...a) => logLines.push(a.map(String).join(' ')),++ error: (...a) => logLines.push(a.map(String).join(' ')),++ };++++ const configLib = require('../../server/config');++ const { createApp } = require('../../server/app');++ const config = configLib.load(env);++ const built = createApp({ config, log, now: opts.now });++ await built.ctx.keys.ensure();++ const server = await new Promise((resolve) => { const s = http.createServer(built.app); s.listen(0, '127.0.0.1', () => resolve(s)); });++ const base = `http://127.0.0.1:${server.address().port}`;++++ const signIn = (user) => `design_at=${network.userToken(user)}`;++++ async function get(p, o = {}) {++ const headers = { ...(o.headers || {}) };++ if (o.as) headers.cookie = [signIn(o.as), headers.cookie].filter(Boolean).join('; ');++ if (o.cookie) headers.cookie = o.cookie;++ let body = o.body;++ if (o.json !== undefined) { body = JSON.stringify(o.json); headers['content-type'] = 'application/json'; }++ const res = await fetch(base + p, { method: o.method || (body ? 'POST' : 'GET'), headers, body, redirect: 'manual' });++ const text = Buffer.from(await res.arrayBuffer()).toString('utf8');++ return {++ status: res.status,++ headers: res.headers,++ text,++ json() { return JSON.parse(text); },++ };++ }++++ return {++ base, network, config, ctx: built.ctx, get, signIn,++ logs: () => logLines.join('\n'),++ async close() {++ await new Promise((r) => server.close(r));++ built.ctx.keys.client.stop();++ await network.close();++ },++ };++}++++let failures = 0;++async function check(name, fn) {++ try {++ await fn();++ process.stdout.write(` ✓ ${name}\n`);++ } catch (e) {++ failures++;++ process.stdout.write(` ✗ ${name}\n ${(e.stack || String(e)).split('\n').slice(0, 10).join('\n ')}\n`);++ }++}++function done() {++ process.stdout.write(failures ? `\n${failures} failed\n` : '\nall passed\n');++ process.exit(failures ? 1 : 0);++}++++module.exports = { boot, check, done };nnew file mode 100644@@@ -0,0 +1,160 @@++'use strict';++/**++ * An in-process stand-in for OpenVibe.Network: a real RS256 key pair and JWKS, /oauth/token with PKCE S256,++ * /oauth/revoke, the public theme catalogue and the person's theme routes. Every request is recorded so a test can++ * assert what was (and was not) called. setDown(true) makes every answer a 503, which is how the proxy sees a++ * Network failure without closing the socket under a test.++ */++const http = require('http');++const crypto = require('crypto');++++const b64 = (o) => Buffer.from(JSON.stringify(o)).toString('base64url');++function signJwt(claims, privateKey) {++ const input = `${b64({ alg: 'RS256', typ: 'JWT' })}.${b64(claims)}`;++ return `${input}.${crypto.sign('RSA-SHA256', Buffer.from(input), privateKey).toString('base64url')}`;++}++++function listen(handler) {++ return new Promise((resolve) => {++ const sockets = new Set();++ const server = http.createServer((req, res) => {++ const chunks = [];++ req.on('data', (c) => chunks.push(c));++ req.on('end', () => {++ const raw = Buffer.concat(chunks);++ const json = (status, obj, headers = {}) => {++ res.writeHead(status, { 'Content-Type': 'application/json', ...headers });++ res.end(JSON.stringify(obj));++ };++ Promise.resolve(handler(req, raw, json, res)).catch((err) => json(500, { error: String(err && err.message) }));++ });++ });++ server.on('connection', (s) => { sockets.add(s); s.on('close', () => sockets.delete(s)); });++ server.listen(0, '127.0.0.1', () => resolve({++ server,++ url: `http://127.0.0.1:${server.address().port}`,++ close: () => new Promise((r) => { for (const s of sockets) s.destroy(); server.close(r); }),++ }));++ });++}++++const DEFAULT_THEMES = [++ { id: 'vibe', name: 'Vibe', slug: 'vibe', description: 'The default OpenVibe theme.', mode: 'dark', variables: { '--bg-primary': '#0b0f1a', '--text-primary': '#e6edf7' }, tags: ['default'], is_builtin: 1 },++ { id: 'aurora', name: 'Aurora', slug: 'aurora', description: 'A cold light over the network.', mode: 'dark', variables: { '--bg-primary': '#07131f', '--text-primary': '#dff3ff' }, tags: ['cool'] },++ { id: 'paper', name: 'Paper', slug: 'paper', description: 'A quiet light theme.', mode: 'light', variables: { '--bg-primary': '#fbfaf7', '--text-primary': '#22201d' }, tags: ['light'] },++];++++async function startNetwork({ themes = DEFAULT_THEMES } = {}) {++ const { publicKey, privateKey } = crypto.generateKeyPairSync('rsa', { modulusLength: 2048 });++ const publicPem = publicKey.export({ type: 'spki', format: 'pem' });++ const privatePem = privateKey.export({ type: 'pkcs8', format: 'pem' });++ const st = {++ themes: themes.map((t) => ({ ...t })),++ users: new Map(), codes: new Map(), refresh: new Map(),++ down: false, catalogRequests: 0, requests: [], tokenRequests: [],++ catalogStatus: 200, submitStatus: 201, delayMs: 0,++ };++ let issuer = null;++ let nextUserId = 1;++++ function addUser(username, { role = 'user' } = {}) {++ const u = { id: nextUserId++, subject: `usr_${crypto.randomBytes(12).toString('hex')}`, username, display_name: username, role };++ st.users.set(u.id, u);++ return u;++ }++ function userToken(u, { ttl = 3600 } = {}) {++ const now = Math.floor(Date.now() / 1000);++ return signJwt({ iss: issuer, sub: u.id, subject_id: u.subject, username: u.username, display_name: u.display_name, role: u.role, aud: ['openvibe.network'], iat: now, exp: now + ttl }, privatePem);++ }++ const bearer = (req) => {++ const h = String(req.headers.authorization || '');++ return h.startsWith('Bearer ') ? h.slice(7) : null;++ };++++ const srv = await listen(async (req, raw, json) => {++ const url = new URL(req.url, 'http://x');++ const text = raw.toString('utf8');++ let body = {};++ try { body = text ? JSON.parse(text) : {}; } catch { body = {}; }++ st.requests.push({ method: req.method, path: url.pathname, authorization: req.headers.authorization || null, body: text });++ if (st.delayMs) await new Promise((r) => setTimeout(r, st.delayMs));++ if (st.down) return json(503, { error: 'Network is restarting' });++++ if (url.pathname === '/api/.well-known/jwks') return json(200, { public_key: publicPem, algorithm: 'RS256' });++ if (url.pathname === '/oauth/revoke') return json(200, {});++ if (url.pathname === '/oauth/token' && req.method === 'POST') {++ const form = Object.fromEntries(new URLSearchParams(text));++ st.tokenRequests.push(form);++ if (form.client_id !== 'design' || form.client_secret !== 'design-secret') return json(401, { error: 'invalid_client', error_description: 'bad client secret' });++ if (form.grant_type === 'authorization_code') {++ const c = st.codes.get(form.code);++ if (!c) return json(400, { error: 'invalid_grant', error_description: 'unknown code' });++ st.codes.delete(form.code);++ const challenge = crypto.createHash('sha256').update(String(form.code_verifier || '')).digest('base64url');++ if (challenge !== c.challenge) return json(400, { error: 'invalid_grant', error_description: 'PKCE verification failed' });++ const rt = `rt_${crypto.randomBytes(12).toString('hex')}`;++ st.refresh.set(rt, c.user);++ return json(200, { access_token: userToken(c.user), refresh_token: rt, token_type: 'Bearer' });++ }++ if (form.grant_type === 'refresh_token') {++ const u = st.refresh.get(form.refresh_token);++ if (!u) return json(400, { error: 'invalid_grant', error_description: 'refresh token rejected' });++ st.refresh.delete(form.refresh_token);++ const rt = `rt_${crypto.randomBytes(12).toString('hex')}`;++ st.refresh.set(rt, u);++ return json(200, { access_token: userToken(u), refresh_token: rt, token_type: 'Bearer' });++ }++ return json(400, { error: 'unsupported_grant_type' });++ }++++ if (url.pathname === '/api/themes' && req.method === 'GET') {++ st.catalogRequests++;++ if (st.catalogStatus !== 200) return json(st.catalogStatus, { error: 'catalogue unavailable' });++ return json(200, { themes: st.themes });++ }++ if (url.pathname === '/api/themes/me/active' && req.method === 'GET') {++ if (!bearer(req)) return json(401, { error: 'Authentication required' });++ return json(200, { theme_id: 'vibe', custom_variables: { '--bg-primary': '#0b0f1a' }, display: null });++ }++ if (url.pathname === '/api/themes/me' && req.method === 'PUT') {++ if (!bearer(req)) return json(401, { error: 'Authentication required' });++ return json(200, { success: true, theme_id: body.theme_id, custom_variables: body.custom_variables || null, source: body.source });++ }++ if (url.pathname === '/api/themes/me/history' && req.method === 'GET') {++ if (!bearer(req)) return json(401, { error: 'Authentication required' });++ return json(200, { history: [{ id: 2, theme_id: 'aurora', created_at: '2026-10-28T00:00:00.000Z' }, { id: 1, theme_id: 'vibe', created_at: '2026-10-27T00:00:00.000Z' }] });++ }++ const restore = /^\/api\/themes\/me\/history\/(\d+)\/restore$/.exec(url.pathname);++ if (restore && req.method === 'POST') {++ if (!bearer(req)) return json(401, { error: 'Authentication required' });++ return json(200, { success: true, id: Number(restore[1]), theme_id: 'vibe' });++ }++ if (url.pathname === '/api/themes' && req.method === 'POST') {++ if (!bearer(req)) return json(401, { error: 'Authentication required' });++ const status = body.slug === 'taken' ? 422 : st.submitStatus;++ if (status !== 201) return json(status, { error: 'Theme rejected', code: 'theme.invalid_variables', errors: ['--bg-primary must be a colour'] });++ return json(201, { theme: { id: `community-${body.slug}`, ...body }, review: 'pending' });++ }++ const one = /^\/api\/themes\/([^/]+)$/.exec(url.pathname);++ if (one && req.method === 'GET') {++ const t = st.themes.find((x) => x.id === decodeURIComponent(one[1]) || x.slug === decodeURIComponent(one[1]));++ if (!t) return json(404, { error: 'Theme not found' });++ return json(200, { theme: t });++ }++ return json(404, { error: 'not found' });++ });++ issuer = srv.url;++++ return {++ url: srv.url, publicPem, privatePem, state: st,++ themes: st.themes, requests: st.requests, tokenRequests: st.tokenRequests,++ addUser, userToken,++ issueCode(user, challenge) { const code = `code_${crypto.randomBytes(8).toString('hex')}`; st.codes.set(code, { user, challenge }); return code; },++ setDown(v) { st.down = Boolean(v); },++ setCatalogStatus(v) { st.catalogStatus = v; },++ setDelay(ms) { st.delayMs = ms; },++ close: srv.close,++ };++}++++module.exports = { startNetwork, signJwt, DEFAULT_THEMES };nnew file mode 100644@@@ -0,0 +1,108 @@++'use strict';++/**++ * The pages and the plumbing: /, /studio, /t/:slug, /developers, the 404; public vs signed-in cache policy; the++ * crawl artifacts (robots.txt, sitemap.xml with the public themes, llms.txt); health and truthful readiness; the++ * release manifest and content-hashed static assets.++ */++const assert = require('assert');++const { boot, check, done } = require('./helpers/boot');++const { assetVersion } = require('../server/assets');++++(async () => {++ const t = await boot();++ const user = t.network.addUser('kim');++++ await check('the home page lists the catalogue, escaped, and is publicly cacheable', async () => {++ const r = await t.get('/');++ assert.strictEqual(r.status, 200);++ assert.match(r.text, /Make it yours/);++ assert.match(r.text, /<a class="ds-swatch" href="\/t\/aurora">[\s\S]*?<span class="ds-swatch-name">Aurora<\/span>/);++ assert.match(r.text, /<main id="main"/);++ assert.strictEqual(r.headers.get('cache-control'), 'public, max-age=120');++ assert.match(r.headers.get('vary'), /Cookie/i);++ });++++ await check('/studio includes the studio script and stylesheet, and says who is signed in', async () => {++ const r = await t.get('/studio');++ assert.strictEqual(r.status, 200);++ assert.match(r.text, /\/js\/studio\.js\?v=[0-9a-f]{10}/);++ assert.match(r.text, /\/css\/design\.css\?v=[0-9a-f]{10}/);++ assert.match(r.text, /Sign in to use a theme/);++ assert.strictEqual(r.headers.get('cache-control'), 'public, max-age=120');++ const me = await t.get('/studio', { as: user });++ assert.strictEqual(me.status, 200);++ assert.match(me.text, /kim/);++ assert.strictEqual(me.headers.get('cache-control'), 'private, no-store', 'a signed-in page is never cached');++ });++++ await check('one theme, a missing theme, developers and an unknown page', async () => {++ const one = await t.get('/t/aurora');++ assert.strictEqual(one.status, 200);++ assert.match(one.text, /Aurora/);++ assert.match(one.text, /--bg-primary/);++ const missing = await t.get('/t/nope');++ assert.strictEqual(missing.status, 404);++ assert.match(missing.text, /Nothing here/);++ const dev = await t.get('/developers');++ assert.strictEqual(dev.status, 200);++ assert.match(dev.text, /GET \/api\/themes/);++ const gone = await t.get('/not-a-page');++ assert.strictEqual(gone.status, 404);++ });++++ await check('robots.txt, sitemap.xml and llms.txt describe the public pages', async () => {++ const robots = await t.get('/robots.txt');++ assert.strictEqual(robots.status, 200);++ assert.match(robots.text, /Sitemap: https:\/\/openvibe\.design\/sitemap\.xml/);++ assert.match(robots.text, /Disallow: \/api\//);++ const sitemap = await t.get('/sitemap.xml');++ assert.strictEqual(sitemap.status, 200);++ assert.match(sitemap.headers.get('content-type'), /application\/xml/);++ assert.match(sitemap.text, /<loc>https:\/\/openvibe\.design\/<\/loc>/);++ assert.match(sitemap.text, /<loc>https:\/\/openvibe\.design\/studio<\/loc>/);++ assert.match(sitemap.text, /<loc>https:\/\/openvibe\.design\/t\/aurora<\/loc>/);++ const llms = await t.get('/llms.txt');++ assert.strictEqual(llms.status, 200);++ assert.match(llms.text, /OpenVibe\.Design/);++ assert.match(llms.text, /https:\/\/openvibe\.design\/api\/themes/);++ });++++ await check('health and readiness are honest; a Network outage is degraded, not down', async () => {++ const health = await t.get('/api/health');++ assert.strictEqual(health.status, 200);++ assert.strictEqual(health.json().status, 'ok');++ assert.strictEqual(health.json().service, 'openvibe-design');++ assert.strictEqual(health.json().version, '0.1.0');++ const ready = await t.get('/api/ready');++ assert.strictEqual(ready.status, 200);++ assert.strictEqual(ready.json().ready, true);++ assert.strictEqual(ready.json().checks.network.status, 'ok');++ t.network.setDown(true);++ const degraded = await t.get('/api/ready');++ t.network.setDown(false);++ assert.strictEqual(degraded.status, 200, 'the process still serves');++ assert.strictEqual(degraded.json().ready, true);++ assert.strictEqual(degraded.json().status, 'degraded');++ assert.ok(degraded.json().degraded.includes('network'));++ });++++ await check('the release manifest and content-hashed static assets', async () => {++ const rel = await t.get('/release.json');++ assert.strictEqual(rel.status, 200);++ assert.strictEqual(rel.json().service, 'design');++ assert.match(rel.headers.get('content-type'), /application\/json/);++ const css = await t.get('/css/design.css');++ assert.strictEqual(css.status, 200);++ const hashed = await t.get(`/css/design.css?v=${assetVersion('css/design.css')}`);++ assert.strictEqual(hashed.status, 200);++ assert.strictEqual(hashed.headers.get('cache-control'), 'public, max-age=31536000, immutable');++ const js = await t.get(`/js/studio.js?v=${assetVersion('js/studio.js')}`);++ assert.strictEqual(js.status, 200);++ assert.match(js.headers.get('content-type'), /javascript/);++ const shared = await t.get('/shared/room.css');++ assert.strictEqual(shared.status, 200);++ });++++ await t.close();++ done();++})().catch((err) => { console.error(err); process.exit(1); });nnew file mode 100644@@@ -0,0 +1,126 @@++'use strict';++/**++ * The theme API proxy: the catalogue is cached, /api/me/theme is 401 signed out, a PUT forwards the person's token++ * and source 'studio', a cross-site Origin is 403 design.cross_site, a Network 422 passes through, and a Network++ * failure is 502. Also the history restore's positive-integer check.++ */++const assert = require('assert');++const { boot, check, done } = require('./helpers/boot');++++const ORIGIN = 'https://openvibe.design';++++(async () => {++ const t = await boot();++ const user = t.network.addUser('kim');++ const token = t.network.userToken(user);++ const signedIn = { cookie: `design_at=${token}` };++ const writes = (path) => t.network.requests.filter((r) => r.method !== 'GET' && r.path === path);++++ await check('GET /api/themes serves the catalogue from memory for five minutes', async () => {++ const before = t.network.state.catalogRequests;++ const one = await t.get('/api/themes');++ assert.strictEqual(one.status, 200);++ assert.strictEqual(one.json().themes.length, 3);++ assert.strictEqual(t.network.state.catalogRequests, before + 1);++ const two = await t.get('/api/themes');++ assert.strictEqual(two.status, 200);++ assert.strictEqual(two.json().themes[1].slug, 'aurora');++ assert.strictEqual(t.network.state.catalogRequests, before + 1, 'the second read is the cached one');++ });++++ await check('GET /api/me/theme is a 401 problem when signed out, and private, no-store', async () => {++ const r = await t.get('/api/me/theme');++ assert.strictEqual(r.status, 401);++ assert.match(r.headers.get('content-type'), /application\/problem\+json/);++ assert.strictEqual(r.json().code, 'token.required');++ assert.strictEqual(r.headers.get('cache-control'), 'private, no-store');++ });++++ await check('GET /api/me/theme returns theme_id, theme and custom_variables with the person\'s token', async () => {++ const r = await t.get('/api/me/theme', signedIn);++ assert.strictEqual(r.status, 200, r.text);++ const b = r.json();++ assert.strictEqual(b.theme_id, 'vibe');++ assert.strictEqual(b.theme.slug, 'vibe');++ assert.deepStrictEqual(b.custom_variables, { '--bg-primary': '#0b0f1a' });++ assert.strictEqual(r.headers.get('cache-control'), 'private, no-store');++ const active = t.network.requests.filter((x) => x.path === '/api/themes/me/active').pop();++ assert.strictEqual(active.authorization, `Bearer ${token}`);++ });++++ await check('PUT /api/me/theme forwards the token and source "studio"', async () => {++ const r = await t.get('/api/me/theme', {++ ...signedIn,++ method: 'PUT',++ json: { theme_id: 'aurora', custom_variables: { '--bg-primary': '#07131f' } },++ headers: { origin: ORIGIN },++ });++ assert.strictEqual(r.status, 200, r.text);++ assert.strictEqual(r.json().source, 'studio');++ const sent = writes('/api/themes/me').pop();++ assert.ok(sent, 'Network received PUT /api/themes/me');++ assert.strictEqual(sent.authorization, `Bearer ${token}`);++ const body = JSON.parse(sent.body);++ assert.deepStrictEqual(body, { theme_id: 'aurora', custom_variables: { '--bg-primary': '#07131f' }, source: 'studio' });++ assert.ok(!t.logs().includes(token), 'the token is never logged');++ });++++ await check('a write with another site\'s Origin is 403 design.cross_site (and never reaches Network)', async () => {++ const before = writes('/api/themes/me').length;++ const r = await t.get('/api/me/theme', {++ ...signedIn,++ method: 'PUT',++ json: { theme_id: 'paper' },++ headers: { origin: 'https://evil.example' },++ });++ assert.strictEqual(r.status, 403);++ assert.match(r.headers.get('content-type'), /application\/problem\+json/);++ assert.strictEqual(r.json().code, 'design.cross_site');++ assert.strictEqual(writes('/api/themes/me').length, before, 'no Network write');++ const missing = await t.get('/api/me/theme', { ...signedIn, method: 'PUT', json: { theme_id: 'paper' } });++ assert.strictEqual(missing.status, 403, 'no Origin is not this site');++ });++++ await check('a Network 422 answer passes through with its status and body', async () => {++ const r = await t.get('/api/themes/submit', {++ ...signedIn,++ method: 'POST',++ json: { name: 'Taken', slug: 'taken', description: '', mode: 'dark', variables: { '--bg-primary': 'nope' }, tags: [] },++ headers: { origin: ORIGIN },++ });++ assert.strictEqual(r.status, 422, r.text);++ const b = r.json();++ assert.strictEqual(b.code, 'theme.invalid_variables');++ assert.ok(Array.isArray(b.errors));++ });++++ await check('history reads and restores through the proxy; a bad id is 400', async () => {++ const history = await t.get('/api/me/theme/history', signedIn);++ assert.strictEqual(history.status, 200);++ assert.strictEqual(history.json().history.length, 2);++ for (const id of ['0', '-1', '1.5', 'abc', '1e3']) {++ const bad = await t.get(`/api/me/theme/history/${encodeURIComponent(id)}/restore`, {++ ...signedIn, method: 'POST', headers: { origin: ORIGIN },++ });++ assert.strictEqual(bad.status, 400, id);++ }++ const ok = await t.get('/api/me/theme/history/2/restore', { ...signedIn, method: 'POST', headers: { origin: ORIGIN } });++ assert.strictEqual(ok.status, 200, ok.text);++ assert.strictEqual(ok.json().id, 2);++ const sent = writes('/api/themes/me/history/2/restore').pop();++ assert.strictEqual(sent.authorization, `Bearer ${token}`);++ });++++ await check('a Network failure is a 502 problem', async () => {++ t.network.setDown(true);++ const r = await t.get('/api/themes/aurora');++ assert.strictEqual(r.status, 502, r.text);++ assert.strictEqual(r.json().code, 'network.unavailable');++ const me = await t.get('/api/me/theme', signedIn);++ assert.strictEqual(me.status, 502);++ t.network.setDown(false);++ });++++ await t.close();++ done();++})().catch((err) => { console.error(err); process.exit(1); });nnew file mode 100644@@@ -0,0 +1,23 @@++#!/usr/bin/env node++/**++ * Runs every test/*.test.js in its own process and fails if any fails. Each file boots OpenVibe.Design against an++ * in-process OpenVibe.Network stand-in (test/helpers/network.js); none needs the network or a running site.++ *++ * npm test # everything++ * npm test -- login # only files whose name contains one of the words++ * npm test -- --strict # a skipped test fails the run too++ *++ * A test that cannot run something here prints `<label>: skipped (<why>)`: that file is listed with ○ and not++ * counted as passed (openvibe-shared/test-runner).++ */++'use strict';++const { run } = require('openvibe-shared/test-runner');++++// VERBOSE=1 also prints every file's output, then the summary again.++run({ dir: __dirname, timeoutMs: 60_000, pad: 34, parallel: 1 }).then((r) => {++ if (process.env.VERBOSE) {++ for (const t of r.results) console.log(`\n── ${t.file} ──\n${t.output.trimEnd()}`);++ console.log(`\n${r.summary}`);++ }++ process.exit(r.exitCode);++}, (err) => { console.error(err); process.exit(1); });nnew file mode 100644@@@ -0,0 +1,130 @@++'use strict';++/**++ * Sign-in: sanitizeNext (open-redirect regressions), the login redirect (PKCE S256, state, client id, redirect++ * URI), the callback (state mismatch refused, a stub Network token endpoint, httpOnly cookies), /auth/me signed++ * out and in, and sign-out.++ */++const assert = require('assert');++const crypto = require('crypto');++const { boot, check, done } = require('./helpers/boot');++const { sanitizeNext } = require('../server/auth/sso');++++const config = { baseUrl: 'https://openvibe.design' };++const cookies = (r) => (typeof r.headers.getSetCookie === 'function' ? r.headers.getSetCookie() : [r.headers.get('set-cookie') || '']);++const cookieNamed = (r, name) => {++ for (const c of cookies(r)) {++ const m = new RegExp(`(?:^|[,\\s])${name}=([^;]+)`).exec(c);++ if (m) return `${name}=${m[1]}`;++ }++ return null;++};++++(async () => {++ // ── sanitizeNext: same-site paths only ──++ for (const v of ['//evil.com', '/\\evil.com', '\\\\evil.com', 'https://evil.com', 'http:evil.com', '/\t/evil.com',++ '/\n/evil.com', '\t//evil.com', ' //evil.com', '/\\/evil.com', 'https:/\\evil.com', '///evil.com',++ 'javascript:alert(1)', null, '', 12]) {++ assert.strictEqual(sanitizeNext(v, config), '/', `${JSON.stringify(v)} goes home`);++ }++ assert.strictEqual(sanitizeNext('/studio?tab=contrast', config), '/studio?tab=contrast');++ assert.strictEqual(sanitizeNext('https://openvibe.design/a/b?x=1#c', config), '/a/b?x=1#c');++ for (const v of ['https://evil.com/a', 'https://openvibe.design.evil.com/a', 'https://[email protected]/', 'http://openvibe.design/a']) {++ assert.strictEqual(sanitizeNext(v, config), '/', v);++ }++++ const t = await boot();++ const user = t.network.addUser('kim');++++ await check('login redirects to Network with state, client id design and an S256 challenge', async () => {++ const r = await t.get('/auth/login?next=/studio');++ assert.strictEqual(r.status, 302);++ const loc = new URL(r.headers.get('location'));++ assert.strictEqual(loc.origin + loc.pathname, `${t.network.url}/oauth/authorize`);++ assert.strictEqual(loc.searchParams.get('client_id'), 'design');++ assert.strictEqual(loc.searchParams.get('response_type'), 'code');++ assert.strictEqual(loc.searchParams.get('redirect_uri'), 'https://openvibe.design/auth/callback');++ assert.strictEqual(loc.searchParams.get('scope'), 'profile');++ assert.strictEqual(loc.searchParams.get('code_challenge_method'), 'S256');++ assert.match(loc.searchParams.get('code_challenge'), /^[A-Za-z0-9_-]{43}$/);++ assert.match(loc.searchParams.get('state'), /^[0-9a-f]{32}$/);++ const flow = cookieNamed(r, 'design_oauth');++ assert.ok(flow, 'the flow cookie is set');++ assert.match(cookies(r).find((c) => c.includes('design_oauth=')), /Path=\/auth.*HttpOnly/i);++ const payload = JSON.parse(decodeURIComponent(flow.split('=')[1]));++ assert.strictEqual(payload.next, '/studio');++ assert.strictEqual(payload.silent, false);++ });++++ await check('silent sign-in adds prompt=none and next= only keeps this site', async () => {++ const r = await t.get('/auth/login?silent=1&next=' + encodeURIComponent('https://evil.example/x'));++ const loc = new URL(r.headers.get('location'));++ assert.strictEqual(loc.searchParams.get('prompt'), 'none');++ const flow = JSON.parse(decodeURIComponent(cookieNamed(r, 'design_oauth').split('=')[1]));++ assert.strictEqual(flow.next, '/', 'another origin goes home');++ const own = await t.get('/auth/login?next=' + encodeURIComponent('https://openvibe.design/t/aurora?x=1'));++ const ownFlow = JSON.parse(decodeURIComponent(cookieNamed(own, 'design_oauth').split('=')[1]));++ assert.strictEqual(ownFlow.next, '/t/aurora?x=1');++ });++++ await check('the callback exchanges the code and sets httpOnly design_at/design_rt cookies', async () => {++ const login = await t.get('/auth/login?next=/studio');++ const loc = new URL(login.headers.get('location'));++ const flowCookie = cookieNamed(login, 'design_oauth');++ const code = t.network.issueCode(user, loc.searchParams.get('code_challenge'));++ const r = await t.get(`/auth/callback?code=${code}&state=${loc.searchParams.get('state')}`, { cookie: flowCookie });++ assert.strictEqual(r.status, 302, r.text);++ assert.strictEqual(r.headers.get('location'), '/studio');++ const all = cookies(r).join('\n');++ assert.match(all, /design_at=[^;]+;.*HttpOnly/i);++ assert.match(all, /design_rt=[^;]+;.*HttpOnly/i);++ assert.ok(!/SameSite=None/i.test(all), 'SameSite=Lax, not None');++ const at = cookieNamed(r, 'design_at');++ assert.ok(at, 'the access cookie is set');++ const me = await t.get('/auth/me', { cookie: at });++ assert.strictEqual(me.status, 200);++ assert.strictEqual(me.json().user.username, 'kim');++ assert.ok(!me.text.includes(at.split('=')[1]), '/auth/me never returns the token');++ const tokenRequest = t.network.tokenRequests[t.network.tokenRequests.length - 1];++ assert.strictEqual(tokenRequest.client_id, 'design');++ assert.strictEqual(tokenRequest.grant_type, 'authorization_code');++ assert.strictEqual(tokenRequest.redirect_uri, 'https://openvibe.design/auth/callback');++ assert.ok(tokenRequest.code_verifier, 'the verifier is sent server-side');++ });++++ await check('a wrong state or no flow cookie is refused', async () => {++ const login = await t.get('/auth/login');++ const loc = new URL(login.headers.get('location'));++ const flowCookie = cookieNamed(login, 'design_oauth');++ const code = t.network.issueCode(user, loc.searchParams.get('code_challenge'));++ const bad = await t.get(`/auth/callback?code=${code}&state=${'0'.repeat(32)}`, { cookie: flowCookie });++ assert.strictEqual(bad.status, 400);++ const noCookie = await t.get(`/auth/callback?code=${code}&state=${loc.searchParams.get('state')}`);++ assert.strictEqual(noCookie.status, 400);++ const none = await t.get('/auth/callback?state=x');++ assert.strictEqual(none.status, 400);++ });++++ await check('/auth/me is null for a guest and 401 for a cookie that does not verify', async () => {++ const guest = await t.get('/auth/me');++ assert.strictEqual(guest.status, 200);++ assert.deepStrictEqual(guest.json(), { user: null });++ const bad = await t.get('/auth/me', { cookie: 'design_at=not-a-token' });++ assert.strictEqual(bad.status, 401);++ assert.strictEqual(bad.json().error, 'Not signed in');++ });++++ await check('sign-out clears the cookies and returns to next', async () => {++ const r = await t.get('/auth/logout?next=%2Fstudio', { headers: { 'sec-fetch-site': 'same-origin' } });++ assert.strictEqual(r.status, 303);++ assert.strictEqual(r.headers.get('location'), '/studio');++ assert.match(cookies(r).join('\n'), /design_at=;/);++ });++++ await check('the token is never logged', async () => {++ const token = t.network.userToken(user);++ assert.ok(!t.logs().includes(token), 'no access token in the logs');++ });++++ await t.close();++ done();++})().catch((err) => { console.error(err); process.exit(1); });
new file mode 100644
new file mode 100644
@@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
+# OpenVibe.Design — environment (production: /etc/openvibe/design.env). Names only; never commit values.
+
+NODE_ENV=production
+PORT=5090
+HOST=127.0.0.1
+BASE_URL=https://openvibe.design
+TRUST_PROXY=2
+
+# OpenVibe.Network: the theme API this service proxies, sign-in (OAuth client `design`, PKCE S256) and its JWKS.
+OV_NETWORK_INTERNAL_URL=http://127.0.0.1:4000
+OV_OAUTH_CLIENT_ID=design
+OV_OAUTH_CLIENT_SECRET=
+# The browser is sent to the public origin; the token exchange and the JWKS use the internal one above.
+# OV_NETWORK_URL=https://openvibe.network
+# OV_NETWORK_ISSUER=https://openvibe.network
+# OV_OAUTH_REDIRECT_URI=https://openvibe.design/auth/callback
+# OV_SESSION_AUDIENCE=openvibe.network
+
+# Optional: the public catalogue's in-process cache (default 5 minutes), the Network timeout, the per-IP limit.
+# DESIGN_THEME_CACHE_MS=300000
+# DESIGN_UPSTREAM_TIMEOUT_MS=8000
+# DESIGN_RATE_LIMIT_PER_MIN=120
+
+# optional: defaults to true in production
+# COOKIE_SECURE=true
new file mode 100644
new file mode 100644
@@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
+name: ci
+on:
+ push:
+ branches: [main]
+ pull_request:
+jobs:
+ # install, node --check and npm test: the shared test job (Track Q).
+ test:
+ uses: OpenVibers/OpenVibe.Shared/.github/workflows/test.yml@423fe519b5fe9594cc81b670e5ba5cb9f21f6176
+ with:
+ syntax-dirs: server test
+ # No database, no Valkey, no Events: every test runs against an in-process Network stand-in.
+ test: OV_ALLOW_SUITE=1 npm test
+ # Secret scan (gitleaks) and dependency audit, shared by every OpenVibers repo (Track Q).
+ security:
+ uses: OpenVibers/OpenVibe.Shared/.github/workflows/security.yml@423fe519b5fe9594cc81b670e5ba5cb9f21f6176
new file mode 100644
new file mode 100644
@@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
+node_modules/
+data/
+dist/
+.env
+.env.*
+!.env.example
+*.log
+*.pem
+*.key
+.npm-cache/
+.ref/
+.npm-cache
new file mode 100644
new file mode 100644
@@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
+# Changelog
+
+What changed in OpenVibe.Design, newest first. Each site also publishes its patch notes at /updates.
+
+## 0.1.0 — 2026-10-28
+
+The service skeleton: sign-in and the theme API proxy.
+
+- **Sign-in with OpenVibe.Network** (`server/auth/sso.js`, OAuth client `design`): authorization code with PKCE
+ S256, a state check, a server-side code exchange, httpOnly `design_at` and `design_rt` cookies
+ (SameSite=Lax, Secure in production), the `design_oauth` flow cookie, and `sanitizeNext` (this site's own origin
+ only, no control characters or backslashes). `/auth/login`, `/auth/callback`, `/auth/logout`, `/auth/me`.
+- **The theme API proxy** (`server/http/api.js`): all calls go to OpenVibe.Network's `/api/themes` with the
+ person's access token from the cookie as a Bearer. `GET /api/themes` is the public catalogue, cached in memory
+ for 5 minutes; `GET /api/themes/:idOrSlug` is one public theme; `GET`/`PUT /api/me/theme` read and save the
+ person's theme (`source: 'studio'`); `GET /api/me/theme/history` and `POST /api/me/theme/history/:id/restore`
+ read and roll back the history; `POST /api/themes/submit` submits a theme to the gallery. Writes need the
+ request's Origin to be this site's own origin, otherwise 403 `design.cross_site`. Network 4xx answers pass
+ through; a Network failure is 502; `/api/me/*` is `private, no-store`.
+- **Pages** (`server/http/pages.js`, `server/views/index.js`): `/`, `/studio`, `/t/:slug` and `/developers`, all
+ server-rendered through the OpenVibe Frame and complete without JavaScript, plus a 404. The views are plain
+ placeholders here: the main session designs the pages and writes `public/js/studio.js`.
+- **Plumbing** (`server/app.js`): helmet with the network's CSP, content-hashed `/css` and `/js`, `/api/health`,
+ `/api/ready` (degraded when Network does not answer), `/release.json`, `/release-metrics`, `/shared/*`,
+ `/robots.txt`, `/sitemap.xml` (the public themes), `/llms.txt`, a 120/min per-IP limit on `/api` and `/auth`,
+ and a graceful stop.
+- **Deploy:** `deploy/systemd/openvibe-design.service` (port 5090, `/etc/openvibe/design.env`) and
+ `deploy/nginx/openvibe.design.conf` (TLS for openvibe.design, www → apex, GET/POST/PUT on `/api`, GET on
+ `/auth`).
+- **Tests:** `test/sso.test.js`, `test/proxy.test.js` and `test/pages.test.js`, each against an in-process
+ OpenVibe.Network stand-in with a real RS256 key pair.
new file mode 100644
new file mode 100644
@@ -0,0 +1,661 @@
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+<https://www.gnu.org/licenses/>.
new file mode 100644
new file mode 100644
@@ -0,0 +1,142 @@
@@ -0,0 +1,142 @@
+# OpenVibe.Design
+
+> Make it yours, find the best AI designer.
+
+**Status:** v1, the theme studio (v0.1.0, see [STATUS.json](STATUS.json)).
+**Domain:** `openvibe.design` · **Port:** 5090 · **Service id:** `design` · **Env prefix:** `DESIGN`
+**License:** AGPL-3.0-only (the same as every OpenVibe service).
+
+OpenVibe.Design is the Design room: the theme studio where a person browses OpenVibe's themes, tries them on
+previews, edits one with contrast checks, uses it, submits it to the gallery, and rolls back to any earlier
+setting. Theme selection stays in OpenVibe.Network; this service signs the person in and proxies their calls to
+the Network's theme API.
+
+## What it is
+
+- **Identity:** service id `design`, name OpenVibe.Design, port 5090, host 127.0.0.1. It stores no accounts, no
+ database and no tokens: the person's Network session lives in httpOnly cookies and their theme lives in
+ OpenVibe.Network.
+- **Sign-in:** an OAuth 2 client of OpenVibe.Network (`design`), authorization code with PKCE S256, a state check
+ and a server-side code exchange.
+- **The theme API proxy:** every theme read and write goes to OpenVibe.Network's `/api/themes`, with the person's
+ access token from the `design_at` cookie as a Bearer. The proxy never logs, renders or echoes the token.
+
+## The studio
+
+- **Gallery:** every theme in the catalogue, filtered by dark or light; picking one paints the previews.
+- **Previews:** the theme is tried on three sites at once: a Live channel, a Chat room and a shop's grid. They read
+ only theme tokens, so they look exactly as the sites will. *See it as* repaints them as people with protanopia,
+ deuteranopia or tritanopia see them (SVG colour matrices).
+- **Editor:** six colours (background, surface, text, muted text, accent, lines); [public/js/studio.js](public/js/studio.js)
+ derives the full token set from them, the same tokens Network's validator accepts.
+- **Checks:** WCAG contrast for text on the background and on cards, muted text, button text and links. Every
+ required check must pass before *Use this theme* is enabled; *Lines against cards* is advisory.
+- **Use, share, roll back:** *Use* is `PUT /api/me/theme` (source `studio`), *Share it in the gallery* submits the
+ theme for review, and *History* lists the person's earlier looks with a one-tap *Restore*.
+
+## Pages
+
+| Route | What it is |
+|---|---|
+| `/` | the theme catalogue's front door |
+| `/studio` | the theme studio; includes `/js/studio.js` and `/css/design.css` |
+| `/t/:slug` | one public theme (Network 404 → the 404 page) |
+| `/developers` | the API, for people and agents |
+| anything else | the 404 page |
+
+All of them are server-rendered through the OpenVibe Frame (`openvibe-shared/shell`) and readable without
+JavaScript. A page rendered for a signed-in person is `private, no-store`; a public page is
+`public, max-age=120` with `Vary: Cookie`.
+
+## API
+
+Everything is proxied to `config.networkUrl` (`OV_NETWORK_INTERNAL_URL`, default `http://127.0.0.1:4000`) under
+`/api/themes`. Errors are RFC 9457 `application/problem+json`. Reads are public; writes need the session and this
+site's own `Origin` header.
+
+| Route | Auth | What it does |
+|---|---|---|
+| `GET /api/themes` | none | the public catalogue; cached in memory 5 minutes |
+| `GET /api/themes/:idOrSlug` | none | one public theme |
+| `GET /api/me/theme` | cookie | Network `GET /api/themes/me/active` → `{ theme_id, theme, custom_variables }`; 401 when signed out |
+| `PUT /api/me/theme` | cookie + Origin | Network `PUT /api/themes/me` with `{ theme_id, custom_variables, source: "studio" }` |
+| `GET /api/me/theme/history` | cookie | Network `GET /api/themes/me/history` |
+| `POST /api/me/theme/history/:id/restore` | cookie + Origin | Network's restore; `id` must be a positive integer, else 400 |
+| `POST /api/themes/submit` | cookie + Origin | Network `POST /api/themes` with `{ name, slug, description, mode, variables, tags }` |
+
+- A Network **4xx** answer passes through with its status and body; a Network failure (no answer, timeout, 5xx)
+ is a `502 network.unavailable` problem.
+- Every write (`PUT`, `POST`) whose `Origin` is not this site's own origin is refused with `403 design.cross_site`.
+- Everything under `/api/me/*` carries `Cache-Control: private, no-store`.
+
+Plumbing: `GET /api/health`, `GET /api/ready` (200 `ready` or `degraded`; Network, JWKS and the OAuth client are
+optional checks), `GET /release.json`, `POST /release-metrics`, `/shared/*` (the pinned Frame), `/css/*` and
+`/js/*` (content-hashed `?v=` → immutable), `GET /robots.txt`, `GET /sitemap.xml` (the public themes),
+`GET /llms.txt` and `GET /metrics` (loopback only).
+
+## Sign-in
+
+`server/auth/sso.js` is OpenVibe.Help's module with this site's names:
+
+- `GET /auth/login?next=/studio[&silent=1]` mints a state and a PKCE S256 verifier/challenge, stores them (and the
+ sanitized `next`) in the httpOnly `design_oauth` flow cookie scoped to `/auth`, and redirects to
+ `${OV_NETWORK_URL}/oauth/authorize` with `client_id=design` and `redirect_uri=${BASE_URL}/auth/callback`.
+- `GET /auth/callback` checks the state in constant time, exchanges the code at the Network's internal
+ `/oauth/token` with the client secret and the code verifier, and sets `design_at` (24 h) and `design_rt` (30 d):
+ httpOnly, SameSite=Lax, Secure in production, Path=/.
+- `GET /auth/logout` clears them and revokes the refresh token (best effort); `GET /auth/me` answers `{ user }` or
+ `{ user: null }` for the shared navbar. A FedCM assertion or an app/service token never becomes a session.
+- `sanitizeNext` accepts same-site relative paths only. An absolute URL on this site's own origin counts as its
+ path; another origin, `//evil`, a control character or a backslash goes to `/`.
+
+The Network signs the access token (RS256); `server/auth/keys.js` fetches and refreshes its JWKS from
+`${OV_NETWORK_INTERNAL_URL}/api/.well-known/jwks` through `openvibe-sdk/auth`.
+
+## Configuration
+
+See [.env.example](.env.example). Required in production: `BASE_URL` and `OV_OAUTH_CLIENT_SECRET` (the `design`
+OAuth client on the Network). Optional: `OV_NETWORK_URL` (default `https://openvibe.network`),
+`OV_NETWORK_INTERNAL_URL` (default `http://127.0.0.1:4000`), `OV_NETWORK_ISSUER`, `OV_OAUTH_REDIRECT_URI`,
+`DESIGN_THEME_CACHE_MS`, `DESIGN_UPSTREAM_TIMEOUT_MS`, `DESIGN_RATE_LIMIT_PER_MIN` and `COOKIE_SECURE`.
+
+## How to run
+
+```bash
+npm install
+npm run dev # http://localhost:5090
+OV_ALLOW_SUITE=1 npm test
+```
+
+`npm test` runs every `test/*.test.js` in its own process with an in-process OpenVibe.Network stand-in
+(`test/helpers/network.js`): a real RS256 key pair, the JWKS, the OAuth token endpoint, the theme catalogue and
+the person's theme routes. Nothing calls the real internet. `OV_ALLOW_SUITE=1` is the suite opt-in the shared
+test runner expects.
+
+## Deploy (for the lead)
+
+- **Deploy:** `sudo ovhost deploy design` on the host (checkout at `/opt/openvibe.design`, unit
+ `openvibe-design.service` on 127.0.0.1:5090, env `/etc/openvibe/design.env`).
+- **nginx:** [deploy/nginx/openvibe.design.conf](deploy/nginx/openvibe.design.conf), installed with
+ `ov-vhost-install`. It allows GET/POST/PUT on `/api` and GET on `/auth`.
+- **Readiness:** `/api/ready` reports `degraded` (HTTP 200) when OpenVibe.Network does not answer; the process
+ still serves the pages and the crawl artifacts.
+
+## Security (threat notes)
+
+Reporting a vulnerability: [SECURITY.md](SECURITY.md).
+
+- Session tokens are httpOnly cookies; no script can read them and nothing renders or logs them. The only place
+ they go is the `Authorization` header of a request to the configured Network origin.
+- A theme write must come from this site's own origin (the `Origin` header), so another site cannot make a
+ signed-in visitor change their theme.
+- `next` after sign-in is this site's own path only; control characters and backslashes are refused because
+ browsers drop or rewrite them.
+- Every dynamic value in the placeholder views goes through the shared `esc`; the views are plain and show model
+ text escaped.
+- Secrets live only in the environment file; only variable names appear in code and docs, and no secret or token
+ is logged.
+
+---
+
+Part of the [OpenVibe network](https://openvibe.network). Built in the open by
+[OpenVibers](https://github.com/OpenVibers).
new file mode 100644
new file mode 100644
@@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
+# Security policy
+
+OpenVibe is run in the open, and we want to hear about security problems before anyone else does.
+
+## Reporting a vulnerability
+
+Email **[email protected]** with "security" in the subject. Please include what you found, where (URL,
+repository, file), how to reproduce it, and what an attacker could do with it. Do not open a public GitHub issue for
+a vulnerability, and do not test against other people's accounts, data or streams.
+
+We reply within 7 days, keep you updated while we fix it, and credit you when the fix ships if you would like.
+
+## Scope
+
+Every OpenVibe service and site (openvibe.design, openvibe.live, openvibe.network, openvibe.tools, openvibe.media,
+openvibe.community, openvibe.games and the other openvibe.* domains) and every repository under
+github.com/OpenVibers. Machine-readable contact details are at `/.well-known/security.txt` on each site.
+
+## Supported versions
+
+Only the current `main` branch, which is what runs in production, receives fixes.
new file mode 100644
new file mode 100644
@@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
+{
+ "repository": "OpenVibers/OpenVibe.Design",
+ "version": "0.1.0",
+ "stage": "v1",
+ "code": true,
+ "wave": "W20",
+ "plan": "OpenVibe.Design: the Design room's theme studio. Browse OpenVibe's themes, try them on previews, edit one with contrast checks, use it, submit it to the gallery, and roll back to any earlier setting. Theme selection stays in OpenVibe.Network; this service signs the person in and proxies their calls.",
+ "runtime": "node 22, express 4, openvibe-shared/shell; stateless (no database, no Valkey, no Events)",
+ "port": "5090",
+ "domain": "openvibe.design",
+ "contracts": "openvibe-contracts v0.227.0",
+ "sdk": "openvibe-sdk v0.70.0",
+ "shared": "openvibe-shared v4.29.2",
+ "packages": [
+ "openvibe-contracts v0.227.0",
+ "openvibe-sdk v0.70.0",
+ "openvibe-shared v4.29.2"
+ ],
+ "summary": "The service skeleton for openvibe.design: Network sign-in as OAuth client `design` (PKCE S256, httpOnly design_at/design_rt cookies) and a theme API proxy to OpenVibe.Network's /api/themes. The proxy serves the public catalogue (cached 5 minutes), one theme, the person's active theme and custom variables, saving a theme with source 'studio', its history and a restore by id, and a submission to the gallery. Writes need this site's own Origin; Network 4xx answers pass through and a Network failure is 502. The studio is designed: a gallery, previews on a Live channel, a Chat room and a shop's grid (with colour-vision views), a six-colour editor that derives the full token set, WCAG checks that gate Use, sharing to the gallery, and History with Restore.",
+ "works": [
+ "Sign-in with OpenVibe.Network: OAuth 2 authorization code, PKCE S256, state check, server-side exchange, httpOnly design_at/design_rt cookies, sanitizeNext (own origins only, no control characters or backslashes)",
+ "The theme API proxy: GET /api/themes (5-minute in-memory cache), GET /api/themes/:idOrSlug, GET/PUT /api/me/theme, GET /api/me/theme/history, POST /api/me/theme/history/:id/restore, POST /api/themes/submit",
+ "Same-origin CSRF on every proxied write (403 design.cross_site), 401 problem when signed out, Network 4xx pass-through, 502 on a Network failure, private, no-store on /api/me/*",
+ "Server-rendered pages: /, /studio (the shell for public/js/studio.js), /t/:slug, /developers and a 404",
+ "Crawl artifacts (robots.txt, sitemap.xml with the public themes, llms.txt), /api/health, /api/ready (degraded when Network does not answer), /release.json, /release-metrics, /shared/*",
+ "Helmet with the network's CSP, per-IP 120/min on /api and /auth, content-hashed /css and /js, graceful stop",
+ "Deploy files: openvibe-design.service, nginx vhost for openvibe.design on 127.0.0.1:5090",
+ "Tests: sanitizeNext, the login redirect and callback, /auth/me, the proxy (cache, 401, CSRF, pass-through, down), the pages and the crawl artifacts, health and readiness"
+ ],
+ "notYet": [
+ "The pages' design and public/js/studio.js: the main session writes them; today the views are plain placeholders and design.css and studio.js are one-comment files",
+ "A Design service manifest and capabilities in OpenVibe.Contracts: this service has no capability of its own and no other service calls it",
+ "Deployment: the deploy files are written, but the service is not deployed yet"
+ ],
+ "capabilitiesRegistered": false,
+ "serviceManifestRegistered": false,
+ "deployed": false,
+ "placeholderInSites": false,
+ "features": [
+ "Network sign-in (PKCE)",
+ "theme API proxy",
+ "theme history and restore",
+ "theme submission",
+ "server-rendered pages",
+ "crawl artifacts",
+ "limits and readiness",
+ "deploy files"
+ ],
+ "updated": "2026-10-28"
+}
new file mode 100644
new file mode 100644
@@ -0,0 +1,101 @@
@@ -0,0 +1,101 @@
+## ═══════════════════════════════════════════════════════════════
+## openvibe.design — Nginx configuration (REFERENCE)
+##
+## Deployed to /etc/nginx/sites-available/openvibe.design.conf (ov-vhost-install) — keep them in sync and reload
+## nginx after changing it. The Node app (port 5090, systemd unit openvibe-design) renders every page and serves
+## the theme API proxy; nginx terminates TLS, redirects www → apex, rate-limits the API and sign-in, and compresses
+## text.
+##
+## No proxy_cache: the app decides cacheability per response (public for a page rendered for an anonymous visitor;
+## private, no-store for a person's theme and everything under /api/me). Never log request bodies here.
+## ═══════════════════════════════════════════════════════════════
+
+limit_req_zone $binary_remote_addr zone=design_auth:10m rate=10r/m;
+limit_req_zone $binary_remote_addr zone=design_api:10m rate=5r/s;
+
+server {
+ listen 80;
+ listen [::]:80;
+ server_name openvibe.design www.openvibe.design;
+
+ location /.well-known/acme-challenge/ { root /var/www/certbot; }
+ location / { return 301 https://openvibe.design$request_uri; }
+}
+
+server {
+ listen 443 ssl;
+ listen [::]:443 ssl;
+ http2 on;
+ server_name www.openvibe.design;
+
+ ssl_certificate /etc/letsencrypt/live/openvibe.design/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/openvibe.design/privkey.pem;
+ ssl_protocols TLSv1.2 TLSv1.3;
+
+ return 301 https://openvibe.design$request_uri;
+}
+
+server {
+ listen 443 ssl;
+ listen [::]:443 ssl;
+ http2 on;
+ server_name openvibe.design;
+
+ ssl_certificate /etc/letsencrypt/live/openvibe.design/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/openvibe.design/privkey.pem;
+ ssl_protocols TLSv1.2 TLSv1.3;
+
+ access_log /var/log/nginx/openvibe.design.access.log;
+ error_log /var/log/nginx/openvibe.design.error.log;
+
+ # Theme variables and a submission are JSON; 128 KB leaves room for the headers.
+ client_max_body_size 128k;
+
+ add_header X-Content-Type-Options nosniff always;
+ add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
+
+ gzip on;
+ gzip_proxied any;
+ gzip_vary on;
+ gzip_comp_level 5;
+ gzip_min_length 1024;
+ gzip_types text/css application/javascript text/javascript application/json application/problem+json image/svg+xml text/plain application/xml;
+
+ proxy_http_version 1.1;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $remote_addr;
+ proxy_set_header CF-Connecting-IP $remote_addr;
+ proxy_set_header X-Forwarded-Proto $scheme;
+
+ # ── The theme API: reads, and the two writes it proxies (GET/POST/PUT) ──
+ # DELETE, PATCH and everything else never reaches the app.
+ location /api/ {
+ limit_except GET POST PUT { deny all; }
+ limit_req zone=design_api burst=20 nodelay;
+ limit_req_status 429;
+ proxy_pass http://127.0.0.1:5090;
+ }
+
+ # ── Sign-in: GET only ───────────────────────────────────
+ # /auth/login, /auth/callback, /auth/me and /auth/logout are all GETs here. The app's POST /auth/logout confirm
+ # is defence in depth and is not exposed by nginx; a same-origin navigation signs out directly.
+ location /auth/ {
+ limit_except GET { deny all; }
+ limit_req zone=design_auth burst=10 nodelay;
+ limit_req_status 429;
+ proxy_pass http://127.0.0.1:5090;
+ }
+
+ # ── Prometheus metrics: host-local scrapers only (http://127.0.0.1:5090/metrics) ──
+ location ~* ^/metrics(/|$) { return 404; }
+
+ # ── Pages, discovery, static assets, release.json ──────
+ location / {
+ proxy_pass http://127.0.0.1:5090;
+ }
+
+ location ~ /\.(?!well-known) {
+ deny all;
+ }
+}
new file mode 100644
new file mode 100644
@@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
+[Unit]
+Description=OpenVibe.Design — Make it yours, find the best AI designer.
+# Network (sign-in, JWKS, the theme API) should be up first, but OpenVibe.Design degrades honestly without it: the
+# pages and the public catalogue serve, and sign-in waits for the signing key (see /api/ready).
+After=network.target
+Wants=openvibe-network.service
+
+[Service]
+Type=simple
+User=ubuntu
+Group=ubuntu
+WorkingDirectory=/opt/openvibe.design
+EnvironmentFile=/etc/openvibe/design.env
+Environment=NODE_ENV=production
+Environment=PORT=5090
+Environment=PATH=/usr/local/bin:/usr/bin:/bin
+ExecStart=/usr/bin/env node /opt/openvibe.design/server/index.js
+Restart=always
+RestartSec=5
+KillSignal=SIGTERM
+# In-flight requests get the 10 s drain.
+TimeoutStopSec=15
+NoNewPrivileges=true
+PrivateTmp=true
+ProtectSystem=strict
+ProtectHome=true
+# Stateless: the code tree is read-only and nothing here writes to disk.
+
+[Install]
+WantedBy=multi-user.target
new file mode 100644
new file mode 100644
@@ -0,0 +1,1143 @@
@@ -0,0 +1,1143 @@
+{
+ "name": "openvibe-design",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "openvibe-design",
+ "version": "0.1.0",
+ "license": "AGPL-3.0-only",
+ "dependencies": {
+ "cookie-parser": "^1.4.7",
+ "dotenv": "^16.4.7",
+ "express": "^4.21.2",
+ "express-rate-limit": "^7.5.0",
+ "helmet": "^8.1.0",
+ "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.227.0",
+ "openvibe-sdk": "https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.70.0",
+ "openvibe-shared": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.29.2"
+ },
+ "engines": {
+ "node": ">=22.0.0"
+ }
+ },
+ "node_modules/accepts": {
+ "version": "1.3.8",
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
+ "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-types": "~2.1.34",
+ "negotiator": "0.6.3"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/ajv": {
+ "version": "8.20.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.20.0.tgz",
+ "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==",
+ "license": "MIT",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.3",
+ "fast-uri": "^3.0.1",
+ "json-schema-traverse": "^1.0.0",
+ "require-from-string": "^2.0.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
+ "node_modules/ajv-formats": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz",
+ "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==",
+ "license": "MIT",
+ "dependencies": {
+ "ajv": "^8.0.0"
+ },
+ "peerDependencies": {
+ "ajv": "^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "ajv": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/array-flatten": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
+ "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
+ "license": "MIT"
+ },
+ "node_modules/body-parser": {
+ "version": "1.20.9",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.9.tgz",
+ "integrity": "sha512-FISIQxV5u91Y9gvuFq3q/tA/qTqLJn3AhRcEvyozyhJTh5OBFFtv827AdHU7Rbyct4r+Ba1/99oFa1Y3yuFsdw==",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "~3.1.2",
+ "content-type": "~1.0.5",
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "destroy": "~1.2.0",
+ "http-errors": "~2.0.1",
+ "iconv-lite": "~0.4.24",
+ "on-finished": "~2.4.1",
+ "qs": "~6.16.0",
+ "raw-body": "~2.5.3",
+ "type-is": "~1.6.18",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8",
+ "npm": "1.2.8000 || >= 1.4.16"
+ }
+ },
+ "node_modules/buffer-equal-constant-time": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
+ "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==",
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/bytes": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/call-bind-apply-helpers": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/call-bound": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
+ "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "get-intrinsic": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/content-disposition": {
+ "version": "0.5.4",
+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
+ "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
+ "license": "MIT",
+ "dependencies": {
+ "safe-buffer": "5.2.1"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/content-type": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
+ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie": {
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie-parser": {
+ "version": "1.4.7",
+ "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.7.tgz",
+ "integrity": "sha512-nGUvgXnotP3BsjiLX2ypbQnWoGUPIIfHQNZkkC668ntrzGWEZVW70HDEB1qnNGMicPje6EttlIgzo51YSwNQGw==",
+ "license": "MIT",
+ "dependencies": {
+ "cookie": "0.7.2",
+ "cookie-signature": "1.0.6"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/cookie-signature": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
+ "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==",
+ "license": "MIT"
+ },
+ "node_modules/debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/depd": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/destroy": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
+ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8",
+ "npm": "1.2.8000 || >= 1.4.16"
+ }
+ },
+ "node_modules/dotenv": {
+ "version": "16.6.1",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
+ "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://dotenvx.com"
+ }
+ },
+ "node_modules/dunder-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/ecdsa-sig-formatter": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
+ "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "node_modules/ee-first": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
+ "license": "MIT"
+ },
+ "node_modules/encodeurl": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/es-define-property": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-errors": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-object-atoms": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
+ "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/escape-html": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
+ "license": "MIT"
+ },
+ "node_modules/etag": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/express": {
+ "version": "4.22.3",
+ "resolved": "https://registry.npmjs.org/express/-/express-4.22.3.tgz",
+ "integrity": "sha512-Bdcs4+3qlpVlx2NRn6fgX2Ue2/gGRaPeawebgclM0ERSCqDpA+owF1fdPwjJUTAJWMTuAaxjDf+hzb0/4eKvvw==",
+ "license": "MIT",
+ "dependencies": {
+ "accepts": "~1.3.8",
+ "array-flatten": "1.1.1",
+ "body-parser": "~1.20.5",
+ "content-disposition": "~0.5.4",
+ "content-type": "~1.0.4",
+ "cookie": "~0.7.1",
+ "cookie-signature": "~1.0.6",
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "finalhandler": "~1.3.1",
+ "fresh": "~0.5.2",
+ "http-errors": "~2.0.0",
+ "merge-descriptors": "1.0.3",
+ "methods": "~1.1.2",
+ "on-finished": "~2.4.1",
+ "parseurl": "~1.3.3",
+ "path-to-regexp": "~0.1.13",
+ "proxy-addr": "~2.0.7",
+ "qs": "~6.16.0",
+ "range-parser": "~1.2.1",
+ "safe-buffer": "5.2.1",
+ "send": "~0.19.0",
+ "serve-static": "~1.16.2",
+ "setprototypeof": "1.2.0",
+ "statuses": "~2.0.1",
+ "type-is": "~1.6.18",
+ "utils-merge": "1.0.1",
+ "vary": "~1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.10.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/express-rate-limit": {
+ "version": "7.5.1",
+ "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.5.1.tgz",
+ "integrity": "sha512-7iN8iPMDzOMHPUYllBEsQdWVB6fPDMPqwjBaFrgr4Jgr/+okjvzAy+UHlYYL/Vs0OsOrMkwS6PJDkFlJwoxUnw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/express-rate-limit"
+ },
+ "peerDependencies": {
+ "express": ">= 4.11"
+ }
+ },
+ "node_modules/fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+ "license": "MIT"
+ },
+ "node_modules/fast-uri": {
+ "version": "3.1.9",
+ "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.9.tgz",
+ "integrity": "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fastify"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/fastify"
+ }
+ ],
+ "license": "BSD-3-Clause"
+ },
+ "node_modules/finalhandler": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
+ "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "2.6.9",
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "on-finished": "~2.4.1",
+ "parseurl": "~1.3.3",
+ "statuses": "~2.0.2",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/forwarded": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
+ "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/fresh": {
+ "version": "0.5.2",
+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
+ "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/function-bind": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-intrinsic": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "es-define-property": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.1.1",
+ "function-bind": "^1.1.2",
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "has-symbols": "^1.1.0",
+ "hasown": "^2.0.2",
+ "math-intrinsics": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
+ "license": "MIT",
+ "dependencies": {
+ "dunder-proto": "^1.0.1",
+ "es-object-atoms": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/gopd": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-symbols": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/hasown": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
+ "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
+ "license": "MIT",
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/helmet": {
+ "version": "8.3.0",
+ "resolved": "https://registry.npmjs.org/helmet/-/helmet-8.3.0.tgz",
+ "integrity": "sha512-Qgpiaws3Sm30Av8Eah6sjMCZZwjlBu+E68rhpCWBshY1lb09HtLwj5GviX0OyQIn+ulUS0iX0AxN5n3tLZzz1w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/EvanHahn"
+ }
+ },
+ "node_modules/http-errors": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
+ "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
+ "license": "MIT",
+ "dependencies": {
+ "depd": "~2.0.0",
+ "inherits": "~2.0.4",
+ "setprototypeof": "~1.2.0",
+ "statuses": "~2.0.2",
+ "toidentifier": "~1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/iconv-lite": {
+ "version": "0.4.24",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "license": "ISC"
+ },
+ "node_modules/ipaddr.js": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
+ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/json-schema-traverse": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
+ "license": "MIT"
+ },
+ "node_modules/jsonwebtoken": {
+ "version": "9.0.3",
+ "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz",
+ "integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==",
+ "license": "MIT",
+ "dependencies": {
+ "jws": "^4.0.1",
+ "lodash.includes": "^4.3.0",
+ "lodash.isboolean": "^3.0.3",
+ "lodash.isinteger": "^4.0.4",
+ "lodash.isnumber": "^3.0.3",
+ "lodash.isplainobject": "^4.0.6",
+ "lodash.isstring": "^4.0.1",
+ "lodash.once": "^4.0.0",
+ "ms": "^2.1.1",
+ "semver": "^7.5.4"
+ },
+ "engines": {
+ "node": ">=12",
+ "npm": ">=6"
+ }
+ },
+ "node_modules/jsonwebtoken/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/jwa": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz",
+ "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==",
+ "license": "MIT",
+ "dependencies": {
+ "buffer-equal-constant-time": "^1.0.1",
+ "ecdsa-sig-formatter": "1.0.11",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "node_modules/jws": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz",
+ "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==",
+ "license": "MIT",
+ "dependencies": {
+ "jwa": "^2.0.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "node_modules/lodash.includes": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
+ "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isboolean": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz",
+ "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isinteger": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz",
+ "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isnumber": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz",
+ "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isplainobject": {
+ "version": "4.0.6",
+ "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
+ "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.isstring": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz",
+ "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==",
+ "license": "MIT"
+ },
+ "node_modules/lodash.once": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
+ "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==",
+ "license": "MIT"
+ },
+ "node_modules/math-intrinsics": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/media-typer": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
+ "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/merge-descriptors": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
+ "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/methods": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
+ "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
+ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
+ "license": "MIT",
+ "bin": {
+ "mime": "cli.js"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "license": "MIT"
+ },
+ "node_modules/negotiator": {
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
+ "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/object-inspect": {
+ "version": "1.13.4",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
+ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/on-finished": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.2.tgz",
+ "integrity": "sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ==",
+ "license": "MIT",
+ "dependencies": {
+ "ee-first": "1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/openvibe-contracts": {
+ "version": "0.227.0",
+ "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.227.0",
+ "integrity": "sha512-5B3PUpcN2+WGq/8tEai+fpTznza8PcPTTYKkmhkx8Vpn/nRuQV1DupZwAciSzGbZufgdaNI/28b4AVLtylwrAA==",
+ "license": "AGPL-3.0-only",
+ "dependencies": {
+ "ajv": "^8.17.1",
+ "ajv-formats": "^3.0.1"
+ },
+ "bin": {
+ "openvibe-contracts-check": "bin/check-service.js"
+ },
+ "engines": {
+ "node": ">=20"
+ }
+ },
+ "node_modules/openvibe-sdk": {
+ "version": "0.70.0",
+ "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.70.0",
+ "integrity": "sha512-iMNxlnRm0fmyj60nHiC/lKAaG3JAqiJgu42lShnkby4yF4dQJRG3G0trrqOoULZKBalrYHb/gjauRwNQYN/tog==",
+ "license": "MIT",
+ "bin": {
+ "openvibe-download": "bin/openvibe-download.js"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "peerDependencies": {
+ "@electric-sql/pglite": "^0.5.8",
+ "iovalkey": "^0.4.0",
+ "pg": "^8.23.0"
+ },
+ "peerDependenciesMeta": {
+ "@electric-sql/pglite": {
+ "optional": true
+ },
+ "iovalkey": {
+ "optional": true
+ },
+ "pg": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/openvibe-shared": {
+ "version": "4.29.2",
+ "resolved": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.29.2",
+ "integrity": "sha512-d1D1WTysljk0hRP0ORc8c/RJqsdAcGSUyTQ3RwgZ0rtkvjJMsQh6ukslN88hbaG0xMK9WbqCyWYBBI+dDGDYYg==",
+ "license": "MIT",
+ "dependencies": {
+ "jsonwebtoken": "^9.0.0"
+ },
+ "bin": {
+ "openvibe-build-assets": "scripts/build-assets.js"
+ }
+ },
+ "node_modules/parseurl": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/path-to-regexp": {
+ "version": "0.1.13",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
+ "integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==",
+ "license": "MIT"
+ },
+ "node_modules/proxy-addr": {
+ "version": "2.0.8",
+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz",
+ "integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==",
+ "license": "MIT",
+ "dependencies": {
+ "forwarded": "0.2.0",
+ "ipaddr.js": "1.9.1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/qs": {
+ "version": "6.16.2",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.16.2.tgz",
+ "integrity": "sha512-VYdnB5S7/0IeXzBacUtwNAaM6d7Y/PgYnNC7bJCI6meqA/OgnsQbZMtVW8Dt2D1PHgbHGtYmhSoEIgvt7xZ2ZA==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "es-define-property": "^1.0.1",
+ "side-channel": "^1.1.1"
+ },
+ "engines": {
+ "node": ">=0.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/range-parser": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/raw-body": {
+ "version": "2.5.3",
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",
+ "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "~3.1.2",
+ "http-errors": "~2.0.1",
+ "iconv-lite": "~0.4.24",
+ "unpipe": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/require-from-string": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
+ "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "license": "MIT"
+ },
+ "node_modules/semver": {
+ "version": "7.8.5",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
+ "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/send": {
+ "version": "0.19.2",
+ "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",
+ "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "2.6.9",
+ "depd": "2.0.0",
+ "destroy": "1.2.0",
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "etag": "~1.8.1",
+ "fresh": "~0.5.2",
+ "http-errors": "~2.0.1",
+ "mime": "1.6.0",
+ "ms": "2.1.3",
+ "on-finished": "~2.4.1",
+ "range-parser": "~1.2.1",
+ "statuses": "~2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/send/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/serve-static": {
+ "version": "1.16.3",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",
+ "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",
+ "license": "MIT",
+ "dependencies": {
+ "encodeurl": "~2.0.0",
+ "escape-html": "~1.0.3",
+ "parseurl": "~1.3.3",
+ "send": "~0.19.1"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/setprototypeof": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
+ "license": "ISC"
+ },
+ "node_modules/side-channel": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
+ "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.4",
+ "side-channel-list": "^1.0.1",
+ "side-channel-map": "^1.0.1",
+ "side-channel-weakmap": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-list": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
+ "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.4"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-map": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
+ "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-weakmap": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
+ "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3",
+ "side-channel-map": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/statuses": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
+ "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/toidentifier": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/type-is": {
+ "version": "1.6.18",
+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
+ "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
+ "license": "MIT",
+ "dependencies": {
+ "media-typer": "0.3.0",
+ "mime-types": "~2.1.24"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/unpipe": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/utils-merge": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
+ "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4.0"
+ }
+ },
+ "node_modules/vary": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
+ "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ }
+ }
+}
new file mode 100644
new file mode 100644
@@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
+{
+ "name": "openvibe-design",
+ "version": "0.1.0",
+ "private": true,
+ "description": "OpenVibe.Design \u2014 Make it yours, find the best AI designer.",
+ "main": "server/index.js",
+ "scripts": {
+ "start": "node server/index.js",
+ "dev": "NODE_ENV=development node server/index.js",
+ "test": "node test/run.js"
+ },
+ "keywords": [
+ "openvibe"
+ ],
+ "author": "OpenVibers",
+ "license": "AGPL-3.0-only",
+ "dependencies": {
+ "cookie-parser": "^1.4.7",
+ "dotenv": "^16.4.7",
+ "express": "^4.21.2",
+ "express-rate-limit": "^7.5.0",
+ "helmet": "^8.1.0",
+ "openvibe-contracts": "https://codeload.github.com/OpenVibers/OpenVibe.Contracts/tar.gz/refs/tags/v0.227.0",
+ "openvibe-sdk": "https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.70.0",
+ "openvibe-shared": "https://codeload.github.com/OpenVibers/OpenVibe.Shared/tar.gz/refs/tags/v4.29.2"
+ },
+ "engines": {
+ "node": ">=22.0.0"
+ }
+}
new file mode 100644
new file mode 100644
@@ -0,0 +1,145 @@
@@ -0,0 +1,145 @@
+/* OpenVibe.Design — the studio and the room's own pieces. The page wears the person's theme (theme-loader); the
+ previews wear the theme being tried: studio.js sets its tokens on .ds-previews, and everything inside reads only
+ var(--…), so a preview is exactly what an OpenVibe site would look like. Phone first: the studio stacks (gallery as a
+ swipeable row, then the previews, then the editor); from 1100 px it is three columns. */
+*, *::before, *::after { box-sizing: border-box; }
+html, body { margin: 0; background: var(--bg-primary, #0a0f1c); color: var(--text-primary, #e6edf7); font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
+.skip { position: absolute; left: -9999px; }
+.skip:focus { left: 12px; top: 12px; z-index: 99; padding: 8px 12px; border-radius: 10px; background: var(--bg-card, #0f1729); color: inherit; }
+.ds-wrap { max-width: 1320px; margin: 0 auto; padding: 0 16px 64px; }
+.ds a:not([class]) { color: var(--room-strong); }
+.ds h2 { margin: 0 0 10px; font-size: 1.05rem; font-weight: 800; letter-spacing: -.01em; }
+.ds h3 { margin: 18px 0 8px; font-size: .78rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted, #7386a3); }
+:where(.ds) .ovk-i { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
+.ds-kicker { margin: 0 0 4px; font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--room-strong); }
+.ds-lede { margin: 8px 0 0; max-width: 720px; color: var(--text-secondary, #96a7c2); line-height: 1.55; }
+.ds-fine { color: var(--text-muted, #7386a3); font-size: .84rem; line-height: 1.5; }
+.ds-head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
+.ds-more { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; font-size: .9rem; text-decoration: none; color: var(--room-strong); }
+.ds-more .ovk-i { width: 1em; height: 1em; }
+.ds-page-h { padding-top: clamp(20px, 4vw, 40px); }
+.ds-page-h h1, .ds-studio-h h1 { margin: 0; font-size: clamp(1.8rem, 4.4vw, 2.6rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.08; }
+.ds-act { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
+.ds section { margin-top: clamp(26px, 4vw, 40px); }
+
+/* Swatches: a theme as four dots and its name. */
+.ds-swatch { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border, #1f2d47); background: var(--bg-card, #0f1729); color: var(--text-primary, #e6edf7); font: inherit; font-size: .9rem; text-align: left; text-decoration: none; cursor: pointer; transition: border-color .15s, transform .15s; }
+.ds-swatch:hover, .ds-swatch:focus-visible { border-color: var(--room-accent); outline: none; }
+.ds-swatch[aria-pressed="true"] { border-color: var(--room-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--room-accent) 35%, transparent); }
+.ds-dots { display: inline-flex; }
+.ds-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--bg-card, #0f1729); margin-left: -5px; }
+.ds-dots i:first-child { margin-left: 0; }
+.ds-swatch-name { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.ds-swatch-mode { font-size: .72rem; color: var(--text-muted, #7386a3); }
+.ds-strip { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 10px; }
+
+/* The studio. */
+.ds-studio-h { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; padding: clamp(18px, 3vw, 32px) 0 14px; }
+.ds-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
+.ds-gallery, .ds-stage, .ds-editor { min-width: 0; border-radius: 18px; border: 1px solid var(--border, #1f2d47); background: var(--bg-secondary, #101828); padding: 14px; }
+.ds-gal-head, .ds-stage-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
+.ds-gal-head h2, .ds-stage-head h2 { margin: 0; }
+.ds-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--bg-card, #0f1729); border: 1px solid var(--border, #1f2d47); }
+.ds-seg button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--text-secondary, #96a7c2); font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; }
+.ds-seg button[aria-pressed="true"] { background: var(--room-fill); color: var(--room-on); }
+.ds-gal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
+.ds-gal-list li[hidden] { display: none; }
+.ds-see { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--text-muted, #7386a3); }
+.ds-see select, .ds-submit input, .ds-field input[type=text] { min-height: 36px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--border, #1f2d47); background: var(--bg-input, #0d1322); color: var(--text-primary, #e6edf7); font: inherit; font-size: .86rem; }
+@media (max-width: 1099px) {
+ .ds-gal-list { grid-auto-flow: column; grid-auto-columns: minmax(180px, 64%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: thin; }
+ .ds-gal-list li { scroll-snap-align: start; }
+}
+@media (min-width: 1100px) {
+ .ds-grid { grid-template-columns: 250px minmax(0, 1fr) 300px; align-items: start; }
+ .ds-gallery { position: sticky; top: calc(var(--ovnav-real-h, 56px) + 12px); max-height: calc(100vh - var(--ovnav-real-h, 56px) - 24px); overflow-y: auto; }
+ .ds-editor { position: sticky; top: calc(var(--ovnav-real-h, 56px) + 12px); }
+}
+
+/* The previews: only var(--…) inside, so they wear the theme being tried. */
+.ds-previews { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); transition: filter .2s; }
+@media (min-width: 760px) { .ds-previews { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } .pv-shop { grid-column: 1 / -1; } }
+.pv-frame { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 16px; background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border); min-width: 0; font-size: .86rem; }
+.pv-label { margin: 0; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
+.pv-video { position: relative; aspect-ratio: 16 / 8; border-radius: 12px; background: radial-gradient(120% 120% at 70% 30%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 60%), linear-gradient(160deg, var(--bg-tertiary, var(--bg-card)), var(--bg-card)); }
+.pv-badge { position: absolute; left: 8px; top: 8px; padding: 1px 7px; border-radius: 5px; background: var(--live-red, #e11d48); color: #fff; font-size: .68rem; font-weight: 800; }
+.pv-viewers { position: absolute; right: 8px; bottom: 8px; padding: 1px 7px; border-radius: 5px; background: rgba(0, 0, 0, .6); color: #fff; font-size: .7rem; font-weight: 700; }
+.pv-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
+.pv-col { display: flex; flex-direction: column; min-width: 0; flex: 1; }
+.pv-col b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.pv-col small, .pv-muted { color: var(--text-muted); }
+.pv-av { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: hsl(var(--h, 200) 55% 45%); color: #fff; font-size: .72rem; font-weight: 800; }
+.pv-av-lg { width: 36px; height: 36px; }
+.pv-btn { flex: none; min-height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--accent-strong, var(--accent)); color: var(--on-accent-strong, var(--on-accent, #fff)); font: inherit; font-weight: 800; font-size: .8rem; }
+.pv-chat { list-style: none; margin: 0; padding: 10px; display: grid; gap: 8px; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border); }
+.pv-chat li { display: flex; align-items: flex-start; gap: 8px; color: var(--text-secondary); line-height: 1.35; }
+.pv-chat b { color: var(--text-primary); }
+.pv-chat .pv-me { justify-content: flex-end; }
+.pv-me span { padding: 5px 10px; border-radius: 12px 12px 4px 12px; background: var(--accent-strong, var(--accent)); color: var(--on-accent-strong, #fff); font-weight: 600; }
+.pv-room { margin: 0; font-weight: 800; }
+.pv-composer { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 4px 4px 4px 12px; border-radius: 999px; background: var(--bg-input, var(--bg-card)); border: 1px solid var(--border); color: var(--text-muted); }
+.pv-send { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--accent-strong, var(--accent)); color: var(--on-accent-strong, #fff); }
+.pv-send .ovk-i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; }
+.pv-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
+.pv-chips span { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-secondary); font-size: .76rem; font-weight: 600; }
+.pv-chips .is-on { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: var(--accent); color: var(--accent-light, var(--accent)); }
+.pv-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
+.pv-shoe { display: flex; flex-direction: column; gap: 3px; padding: 8px; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border); }
+.pv-shoe-pic { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 8px; background: var(--bg-secondary); color: var(--accent); }
+.pv-shoe-pic .ovk-i { width: 40%; height: auto; aspect-ratio: 1; stroke-width: 1.6; }
+.pv-price { font-weight: 800; color: var(--text-primary); }
+.pv-price s { font-weight: 500; color: var(--text-muted); }
+.pv-chip { width: fit-content; padding: 1px 7px; border-radius: 999px; font-style: normal; font-size: .66rem; font-weight: 800; color: var(--success-text, #16a34a); background: color-mix(in srgb, var(--success-text, #16a34a) 15%, transparent); }
+
+/* The editor. */
+.ds-fields { display: grid; gap: 8px; }
+.ds-field { display: grid; grid-template-columns: 1fr 42px 92px; align-items: center; gap: 8px; font-size: .86rem; font-weight: 600; }
+.ds-field input[type=color] { width: 42px; height: 36px; padding: 2px; border-radius: 10px; border: 1px solid var(--border, #1f2d47); background: var(--bg-input, #0d1322); cursor: pointer; }
+.ds-field input[type=text] { width: 92px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; }
+.ds-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
+.ds-checks li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 10px; background: var(--bg-card, #0f1729); border: 1px solid var(--border, #1f2d47); font-size: .82rem; }
+.ds-checks li b { font-weight: 600; }
+.ds-checks li span { font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
+.ds-checks li::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; margin-right: 2px; }
+.ds-checks li b { flex: 1; }
+.ds-checks .is-pass::before { background: var(--success, #22c55e); }
+.ds-checks .is-fail { border-color: color-mix(in srgb, var(--danger, #ef4444) 55%, var(--border, #1f2d47)); }
+.ds-checks .is-fail::before { background: var(--danger, #ef4444); }
+.ds-checks .is-fail span { color: var(--danger-text, #f87171); }
+.ds-checks .is-warn::before { background: var(--warning, #f59e0b); }
+.ds-checks.is-demo { max-width: 420px; }
+.ds-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
+.ds-status { min-height: 1.4em; margin: 10px 0 0; font-size: .86rem; color: var(--text-secondary, #96a7c2); }
+.ds-submit, .ds-history { margin-top: 14px; border-top: 1px solid var(--border, #1f2d47); padding-top: 10px; }
+.ds-submit summary, .ds-history summary { cursor: pointer; font-weight: 700; font-size: .9rem; min-height: 32px; display: flex; align-items: center; }
+.ds-submit form { display: grid; gap: 8px; margin-top: 8px; }
+.ds-submit label { display: grid; gap: 4px; font-size: .78rem; font-weight: 700; color: var(--text-muted, #7386a3); }
+.ds-history ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
+.ds-history li { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; font-size: .84rem; }
+.ds-history li.ds-fine { display: block; }
+.ds-hist-dot { grid-row: 1 / span 2; width: 14px; height: 14px; border-radius: 50%; background: var(--border, #1f2d47); }
+.ds-history li small { grid-column: 2; color: var(--text-muted, #7386a3); }
+.ds-history li button { grid-column: 3; grid-row: 1 / span 2; }
+
+/* The home's motif: the theme orb (each dot a theme's accent, slowly circling). */
+.ds-orb { position: relative; width: min(100%, 320px); aspect-ratio: 1; margin: 0 auto; }
+.ds-orb-ring { position: absolute; inset: 8%; border-radius: 50%; border: 1.5px dashed color-mix(in srgb, var(--room-accent) 40%, transparent); animation: ds-spin 60s linear infinite; }
+.ds-orb-core { position: absolute; inset: 30%; border-radius: 50%; background: conic-gradient(from 90deg, var(--room-accent), #5b7cfa, #22c55e, #f59e0b, #ef4444, var(--room-accent)); filter: saturate(1.1); box-shadow: 0 20px 60px -20px var(--room-accent); }
+.ds-orb i { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px; border-radius: 50%; border: 3px solid var(--bg-primary, #0a0f1c); transform: rotate(calc(var(--i) * 60deg)) translateY(-136%) rotate(calc(var(--i) * -60deg)); }
+@supports (container-type: inline-size) { .ds-orb { container-type: inline-size; } .ds-orb i { transform: rotate(calc(var(--i) * 60deg)) translateY(-42cqw) rotate(calc(var(--i) * -60deg)); } }
+@keyframes ds-spin { to { transform: rotate(360deg); } }
+.ds-scene-pv { transform: scale(.98); }
+.ds-scene-pv .pv-shop { display: none; }
+.ds-scene-pv { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
+@media (max-width: 600px) { .ds-scene-pv { grid-template-columns: minmax(0, 1fr); } .ds-scene-pv .pv-chatroom { display: none; } }
+.ds-colours { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 20px 0 0; }
+.ds-colours > div { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border, #1f2d47); background: var(--bg-card, #0f1729); }
+.ds-colours dt { font-size: .74rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted, #7386a3); }
+.ds-colours dd { margin: 6px 0 0; display: flex; align-items: center; gap: 8px; }
+.ds-colours dd i { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border, #1f2d47); }
+.ds-eps { display: grid; gap: 10px; margin: 0; }
+.ds-eps > div { padding: 12px 14px; border-radius: 14px; background: var(--bg-card, #0f1729); border: 1px solid var(--border, #1f2d47); }
+.ds-eps dt code { font: 600 .9rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--room-strong); overflow-wrap: anywhere; }
+.ds-eps dd { margin: 6px 0 0; color: var(--text-secondary, #96a7c2); line-height: 1.5; }
+@media (prefers-reduced-motion: reduce) { .ds-orb-ring { animation: none; } .ds-swatch, .ds-previews { transition: none; } }
+html[data-ov-motion=reduced] .ds-orb-ring { animation: none; }
new file mode 100644
new file mode 100644
@@ -0,0 +1,203 @@
@@ -0,0 +1,203 @@
+/**
+ * The theme studio, live (plan 2026-10-28 §5.2). The page works without this file (the gallery links to each theme's
+ * page); with it:
+ * - picking a theme recolours the three previews (Live, Chat, a shop) through CSS variables scoped to them
+ * - editing a core colour derives the rest of the theme's tokens and recolours as you drag
+ * - the checks measure WCAG contrast for text, muted text, buttons and links; Use waits until every required one passes
+ * - "See it as" simulates colour-vision differences on the previews (SVG filters in the page)
+ * - Use saves the theme (and your edits) to your account through /api/me/theme, which every OpenVibe site follows;
+ * History lists your earlier looks and Restore brings one back; Share sends it to the gallery's review
+ * Text is set with textContent; nothing from a theme is written as markup.
+ */
+(function () {
+ 'use strict';
+ const root = document.querySelector('.ds-studio');
+ if (!root) return;
+ const signedIn = root.getAttribute('data-signed-in') === '1';
+ let themes = [];
+ try { themes = JSON.parse(document.getElementById('ds-themes').textContent) || []; } catch (e) { themes = []; }
+ const byId = new Map(themes.map((t) => [t.id, t]));
+ const $ = (s) => document.querySelector(s);
+ const $$ = (s) => Array.prototype.slice.call(document.querySelectorAll(s));
+ const previews = $('#ds-previews');
+ const status = $('#ds-status');
+ const say = (t) => { status.textContent = t || ''; };
+
+ // ── Colour maths: sRGB, WCAG contrast, mixing ──
+ const hex = (h) => { const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(String(h || '').trim()); if (!m) return null; let x = m[1]; if (x.length === 3) x = x.split('').map((c) => c + c).join(''); return [0, 2, 4].map((i) => parseInt(x.slice(i, i + 2), 16)); };
+ const toHex = (rgb) => `#${rgb.map((v) => Math.max(0, Math.min(255, Math.round(v))).toString(16).padStart(2, '0')).join('')}`;
+ const lum = (rgb) => { const c = rgb.map((v) => { v /= 255; return v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4); }); return 0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2]; };
+ const contrast = (a, b) => { const x = lum(a), y = lum(b); return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05); };
+ const mix = (a, b, t) => a.map((v, i) => v + (b[i] - v) * t);
+ const WHITE = [255, 255, 255], INK = [11, 13, 16];
+
+ /** The full token set from the six core colours (the way builtin themes derive theirs). */
+ function derive(core) {
+ const bg = hex(core['--bg-primary']), card = hex(core['--bg-card']), text = hex(core['--text-primary']);
+ const muted = hex(core['--text-muted']), accent = hex(core['--accent']), border = hex(core['--border']);
+ if (!bg || !card || !text || !muted || !accent || !border) return null;
+ const light = lum(bg) > 0.4;
+ const onAccent = contrast(WHITE, accent) >= 4.5 ? WHITE : INK;
+ return {
+ '--bg-primary': toHex(bg), '--bg-card': toHex(card), '--bg-secondary': toHex(mix(bg, card, 0.6)),
+ '--bg-tertiary': toHex(mix(card, text, 0.05)), '--bg-hover': toHex(mix(card, text, 0.08)), '--bg-input': toHex(mix(bg, card, 0.35)),
+ '--text-primary': toHex(text), '--text-secondary': toHex(mix(text, muted, 0.45)), '--text-muted': toHex(muted),
+ '--accent': toHex(accent), '--accent-light': toHex(light ? accent : mix(accent, WHITE, 0.18)), '--accent-dark': toHex(mix(accent, INK, 0.2)),
+ '--accent-strong': toHex(accent), '--on-accent-strong': toHex(onAccent), '--on-accent': toHex(onAccent),
+ '--accent-rgb': accent.map(Math.round).join(', '),
+ '--border': toHex(border), '--border-light': toHex(mix(border, text, 0.12)),
+ '--color-scheme': light ? 'light' : 'dark',
+ };
+ }
+
+ // ── State ──
+ let base = null; // the theme picked
+ let edited = null; // core overrides, or null
+ const coreOf = (v) => ({ '--bg-primary': v['--bg-primary'], '--bg-card': v['--bg-card'] || v['--bg-secondary'], '--text-primary': v['--text-primary'], '--text-muted': v['--text-muted'] || v['--text-secondary'], '--accent': v['--accent'], '--border': v['--border'] });
+ const current = () => { if (!base) return null; if (!edited) return base.variables; return Object.assign({}, base.variables, derive(Object.assign(coreOf(base.variables), edited)) || {}); };
+
+ function paint() {
+ const v = current();
+ if (!v) return;
+ for (const [k, x] of Object.entries(v)) if (/^--[a-z][a-z0-9-]*$/.test(k)) previews.style.setProperty(k, String(x));
+ const core = coreOf(v);
+ $$('.ds-field input[type=color]').forEach((inp) => { const x = hex(core[inp.getAttribute('data-var')]); if (x) inp.value = toHex(x); });
+ $$('.ds-field input[data-hex]').forEach((inp) => { if (document.activeElement !== inp) { const x = hex(core[inp.getAttribute('data-hex')]); inp.value = x ? toHex(x) : ''; } });
+ $('#ds-current').textContent = base.name + (edited ? ' (edited)' : '');
+ $('#ds-reset').disabled = !edited;
+ check(v);
+ }
+
+ // ── Checks (WCAG 2.1): required ones gate Use ──
+ function check(v) {
+ const g = (k) => hex(v[k]);
+ const rows = [
+ ['Text on the background', g('--text-primary'), g('--bg-primary'), 4.5, true],
+ ['Text on cards', g('--text-primary'), g('--bg-card'), 4.5, true],
+ ['Muted text on cards', g('--text-muted'), g('--bg-card'), 4.5, true],
+ ['Button text', g('--on-accent-strong') || g('--on-accent'), g('--accent-strong') || g('--accent'), 4.5, true],
+ ['Links on the background', g('--accent-light') || g('--accent'), g('--bg-primary'), 4.5, true],
+ ['Lines against cards', g('--border'), g('--bg-card'), 1.3, false],
+ ];
+ const list = $('#ds-checks');
+ list.textContent = '';
+ let ok = true;
+ for (const [label, fg, bg, need, required] of rows) {
+ if (!fg || !bg) continue;
+ const r = contrast(fg, bg), pass = r >= need;
+ if (required && !pass) ok = false;
+ const li = document.createElement('li');
+ li.className = pass ? 'is-pass' : required ? 'is-fail' : 'is-warn';
+ const b = document.createElement('b'); b.textContent = label;
+ const s = document.createElement('span'); s.textContent = `${r.toFixed(1)}:1${pass ? '' : ` · needs ${need}`}`;
+ li.append(b, s);
+ list.appendChild(li);
+ }
+ const use = $('#ds-use');
+ use.disabled = !base || (signedIn && !ok);
+ use.title = ok ? '' : 'Every required check must pass';
+ return ok;
+ }
+
+ // ── Picking and editing ──
+ function pick(id, { quiet = false } = {}) {
+ const t = byId.get(id);
+ if (!t) return;
+ base = t; edited = null;
+ $$('.ds-swatch[data-theme-id]').forEach((b) => b.setAttribute('aria-pressed', String(b.getAttribute('data-theme-id') === id)));
+ paint();
+ if (!quiet) { try { history.replaceState(null, '', `/studio?theme=${encodeURIComponent(id)}`); } catch (e) { /* */ } }
+ say('');
+ }
+ root.addEventListener('click', (e) => {
+ const b = e.target.closest && e.target.closest('.ds-swatch[data-theme-id]');
+ if (b) pick(b.getAttribute('data-theme-id'));
+ const f = e.target.closest && e.target.closest('[data-show]');
+ if (f) {
+ const show = f.getAttribute('data-show');
+ $$('[data-show]').forEach((x) => x.setAttribute('aria-pressed', String(x === f)));
+ $$('.ds-swatch[data-theme-id]').forEach((s) => { s.parentElement.hidden = show !== 'all' && s.getAttribute('data-mode') !== show; });
+ }
+ });
+ const setCore = (k, value) => { const x = hex(value); if (!x || !base) return; edited = Object.assign({}, edited || {}, { [k]: toHex(x) }); paint(); };
+ $$('.ds-field input[type=color]').forEach((inp) => inp.addEventListener('input', () => setCore(inp.getAttribute('data-var'), inp.value)));
+ $$('.ds-field input[data-hex]').forEach((inp) => inp.addEventListener('change', () => setCore(inp.getAttribute('data-hex'), inp.value)));
+ $('#ds-reset').addEventListener('click', () => { edited = null; paint(); say('Back to the theme as it was.'); });
+ $('#ds-cvd').addEventListener('change', (e) => {
+ const v = e.target.value;
+ previews.style.filter = v === 'gray' ? 'grayscale(1)' : v ? `url(#ds-cvd-${v})` : '';
+ });
+
+ // ── Talking to /api (this site's proxy of Network's theme API, as the signed-in person) ──
+ async function api(path, opts) {
+ const r = await fetch(path, Object.assign({ credentials: 'same-origin', headers: { 'Content-Type': 'application/json', Accept: 'application/json' } }, opts || {}));
+ let body = null; try { body = await r.json(); } catch (e) { body = null; }
+ if (!r.ok) { const err = new Error((body && (body.detail || body.error)) || `HTTP ${r.status}`); err.status = r.status; throw err; }
+ return body || {};
+ }
+ $('#ds-use').addEventListener('click', async () => {
+ if (!signedIn) { location.href = '/auth/login?next=' + encodeURIComponent(location.pathname + location.search); return; }
+ if (!base) return;
+ const v = current();
+ say('Saving…');
+ try {
+ await api('/api/me/theme', { method: 'PUT', body: JSON.stringify({ theme_id: base.id, custom_variables: edited ? derive(Object.assign(coreOf(base.variables), edited)) : null }) });
+ // This page wears it at once; every other OpenVibe site follows on its next page.
+ for (const [k, x] of Object.entries(v)) if (/^--[a-z][a-z0-9-]*$/.test(k)) document.documentElement.style.setProperty(k, String(x));
+ say(`${base.name}${edited ? ' (with your edits)' : ''} is your theme on every OpenVibe site.`);
+ loadHistory();
+ } catch (err) { say(err.status === 401 ? 'Sign in again to save it.' : `Not saved: ${err.message}`); }
+ });
+ const form = $('#ds-submit-form');
+ if (form) form.addEventListener('submit', async (e) => {
+ e.preventDefault();
+ if (!signedIn || !base) return;
+ const name = $('#ds-name').value.trim();
+ const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 48);
+ if (slug.length < 2) { say('Give it a name of two letters or more.'); return; }
+ const v = current();
+ try {
+ await api('/api/themes/submit', { method: 'POST', body: JSON.stringify({ name, slug, description: $('#ds-desc').value.trim(), mode: v['--color-scheme'] === 'light' ? 'light' : 'dark', variables: v, tags: [] }) });
+ say(`${name} is waiting for review. You can use it yourself right away.`);
+ form.reset();
+ } catch (err) { say(`Not sent: ${err.message}`); }
+ });
+
+ // ── History and restore ──
+ async function loadHistory() {
+ const list = $('#ds-history-list');
+ if (!list || !signedIn) return;
+ let h = [];
+ try { h = (await api('/api/me/theme/history')).history || []; } catch (e) { return; }
+ list.textContent = '';
+ if (!h.length) { const li = document.createElement('li'); li.className = 'ds-fine'; li.textContent = 'Your earlier looks appear here after your first change.'; list.appendChild(li); return; }
+ for (const x of h.slice(0, 20)) {
+ const li = document.createElement('li');
+ const t = byId.get(x.theme_id);
+ const dot = document.createElement('i'); dot.className = 'ds-hist-dot';
+ const accent = (x.custom_variables && x.custom_variables['--accent']) || (t && t.variables['--accent']);
+ if (hex(accent)) dot.style.background = toHex(hex(accent));
+ const b = document.createElement('b'); b.textContent = (x.theme_name || x.theme_id) + (x.custom_variables ? ' (edited)' : '');
+ const when = document.createElement('small'); when.textContent = String(x.created_at || '').slice(0, 16).replace('T', ' ');
+ const go = document.createElement('button'); go.type = 'button'; go.className = 'ovk-btn ovk-btn--quiet ovk-btn--small'; go.textContent = 'Restore';
+ go.addEventListener('click', async () => {
+ go.disabled = true;
+ try {
+ await api(`/api/me/theme/history/${encodeURIComponent(x.id)}/restore`, { method: 'POST', body: '{}' });
+ say(`Restored ${x.theme_name || x.theme_id}. Every OpenVibe site follows on its next page.`);
+ if (byId.has(x.theme_id)) { pick(x.theme_id, { quiet: true }); if (x.custom_variables) { edited = coreOf(x.custom_variables); paint(); } }
+ loadHistory();
+ } catch (err) { say(`Not restored: ${err.message}`); go.disabled = false; }
+ });
+ li.append(dot, b, when, go);
+ list.appendChild(li);
+ }
+ }
+
+ // ── Start: the theme in the address, else the person's active one, else the first ──
+ const wanted = new URLSearchParams(location.search).get('theme');
+ if (wanted && byId.has(wanted)) pick(wanted, { quiet: true });
+ else if (signedIn) api('/api/me/theme').then((m) => { if (m && byId.has(m.theme_id)) { pick(m.theme_id, { quiet: true }); if (m.custom_variables) { edited = coreOf(m.custom_variables); paint(); } } else if (themes[0]) pick(themes[0].id, { quiet: true }); }).catch(() => { if (themes[0]) pick(themes[0].id, { quiet: true }); });
+ else if (themes[0]) pick((byId.has('vibe') ? 'vibe' : themes[0].id), { quiet: true });
+ loadHistory();
+})();
new file mode 100644
new file mode 100644
@@ -0,0 +1,156 @@
@@ -0,0 +1,156 @@
+'use strict';
+
+/**
+ * OpenVibe.Design — Express app factory; server/index.js listens, tests build their own instance with a mock
+ * Network.
+ *
+ * /, /studio, /t/:slug, /developers the pages (http/pages.js)
+ * /api/themes/*, /api/me/theme* the theme API proxy to OpenVibe.Network (http/api.js)
+ * /auth/* Network SSO with PKCE (auth/sso.js)
+ * /api/health, /api/ready, /release.json liveness, truthful readiness, release metadata
+ * /robots.txt, /sitemap.xml, /llms.txt crawl artifacts (http/discovery.js)
+ *
+ * Stateless: no database, no Valkey, no Events. The only dependency is OpenVibe.Network, for sign-in and the theme
+ * API; the pages and the public catalogue degrade honestly without it.
+ */
+const path = require('path');
+const express = require('express');
+const helmet = require('helmet');
+const cookieParser = require('cookie-parser');
+const rateLimit = require('express-rate-limit');
+const contracts = require('openvibe-contracts');
+const cache = require('openvibe-shared/cache-policy');
+const releaseLib = require('openvibe-shared/release');
+const metricsLib = require('openvibe-shared/metrics');
+const serve = require('openvibe-shared/serve');
+
+const configLib = require('./config');
+const { createKeyStore } = require('./auth/keys');
+const { createSso } = require('./auth/sso');
+const { createThemeCatalog } = require('./themes');
+const { createApi } = require('./http/api');
+const { createPageRoutes } = require('./http/pages');
+const { createDiscoveryRoutes } = require('./http/discovery');
+const { createServiceReadiness } = require('./observability');
+const { PUBLIC_DIR, assetVersion } = require('./assets');
+const views = require('./views');
+
+const VERSION = require('../package.json').version;
+
+/**
+ * opts: config, catalog, fetchImpl, log, now, release
+ * `catalog` is the public theme client; a test passes an object with the same methods, or a fetchImpl that talks to
+ * an in-process Network.
+ */
+function createApp(opts = {}) {
+ const config = opts.config || configLib.load();
+ const log = opts.log || console;
+ const fetchImpl = opts.fetchImpl || globalThis.fetch;
+ const now = opts.now || (() => Date.now());
+
+ const keys = createKeyStore({ config, fetchImpl, log });
+ const sso = createSso({ config, keys, fetchImpl, log, now });
+ const catalog = opts.catalog || createThemeCatalog({ config, fetchImpl, log, now });
+ const ctx = { config, keys, sso, catalog, log };
+
+ const release = opts.release || releaseLib.createRelease({ service: 'design', root: path.join(__dirname, '..') });
+ views.setRelease(release.release);
+ views.configure({ baseUrl: config.baseUrl });
+
+ const app = express();
+ app.disable('x-powered-by');
+ app.set('trust proxy', config.trustProxy);
+ app.locals.ctx = ctx;
+
+ const metrics = metricsLib.instrument(app, { service: 'design', release: release.release });
+ app.locals.metrics = metrics.registry;
+ release.mount(app, { registry: metrics.registry });
+
+ // ── Machine endpoints ───────────────────────────────────
+ app.get('/api/health', (_req, res) => res.json({ status: 'ok', service: 'openvibe-design', version: VERSION }));
+ const readiness = createServiceReadiness({ config, catalog, keys, release: release.release });
+ app.get('/api/ready', readiness.handler);
+
+ app.use(contracts.http.middleware());
+ app.use(helmet({
+ contentSecurityPolicy: {
+ directives: {
+ defaultSrc: ["'self'"],
+ // The OpenVibe Frame (theme-loader, navbar, footer) comes from the Network; the inline init is ours.
+ scriptSrc: ["'self'", "'unsafe-inline'", 'https://openvibe.network', 'https://static.cloudflareinsights.com'],
+ styleSrc: ["'self'", "'unsafe-inline'", 'https://openvibe.network', 'https://fonts.googleapis.com', 'https://cdnjs.cloudflare.com'],
+ fontSrc: ["'self'", 'data:', 'https://fonts.gstatic.com', 'https://cdnjs.cloudflare.com'],
+ // Theme previews may carry inline data: images and any https image the catalogue references.
+ imgSrc: ["'self'", 'data:', 'https:'],
+ connectSrc: ["'self'", 'https://openvibe.network'],
+ frameSrc: ["'self'", 'https://openvibe.network'],
+ frameAncestors: ["'none'"],
+ objectSrc: ["'none'"],
+ baseUri: ["'self'"],
+ formAction: ["'self'", 'https://openvibe.network'],
+ },
+ },
+ frameguard: { action: 'deny' },
+ crossOriginEmbedderPolicy: false,
+ crossOriginResourcePolicy: { policy: 'same-site' },
+ referrerPolicy: { policy: 'strict-origin-when-cross-origin' },
+ }));
+ app.use(cookieParser());
+
+ // ── Per-IP budget for the API and sign-in (120 a minute) ─
+ const limiter = rateLimit({
+ windowMs: 60_000,
+ limit: config.rateLimitPerMinute || 120,
+ standardHeaders: true,
+ legacyHeaders: false,
+ handler: (req, res) => contracts.http.sendProblem(res, 429, 'rate_limited', {
+ detail: 'too many requests from this address; retry shortly',
+ ctx: req.ov,
+ }),
+ });
+ app.use(['/api', '/auth'], limiter);
+
+ // ── Who is signed in, then sign-in itself ───────────────
+ app.use(sso.middleware());
+ app.use('/auth', sso.routes());
+
+ // ── Static assets (content-hashed ?v= → immutable) ──────
+ app.use('/shared', serve.handler());
+ const setAssetHeaders = (res, filePath) => {
+ const rel = path.relative(PUBLIC_DIR, filePath).split(path.sep).join('/');
+ const v = res.req && res.req.query && res.req.query.v;
+ res.setHeader('Cache-Control', cache.assetHeaders(rel, { hashed: Boolean(v) && v === assetVersion(rel) }));
+ };
+ app.use('/css', express.static(path.join(PUBLIC_DIR, 'css'), { index: false, redirect: false, setHeaders: setAssetHeaders }));
+ app.use('/js', express.static(path.join(PUBLIC_DIR, 'js'), { index: false, redirect: false, setHeaders: setAssetHeaders }));
+
+ // ── API: the theme proxy ────────────────────────────────
+ app.use('/api', express.json({ limit: '64kb' }));
+ app.use('/api', createApi(ctx));
+ app.use('/api', (req, res) => contracts.http.sendProblem(res, 404, 'route.not_found', {
+ detail: 'No such API route.',
+ ctx: req.ov,
+ }));
+
+ // ── Crawl artifacts ─────────────────────────────────────
+ app.use(createDiscoveryRoutes(ctx));
+
+ // ── Pages ───────────────────────────────────────────────
+ app.use(createPageRoutes(ctx));
+
+ // eslint-disable-next-line no-unused-vars
+ app.use((err, req, res, _next) => {
+ // Never log request bodies (a theme's variables can be large, a person's request can be personal).
+ log.error('[OpenVibe.Design]', err && err.message ? err.message.slice(0, 300) : err);
+ if (res.headersSent) return;
+ res.set('Cache-Control', 'no-store');
+ if (err && err.type === 'entity.parse.failed') return contracts.http.sendProblem(res, 400, 'request.malformed_json', { ctx: req.ov });
+ if (err && err.type === 'entity.too.large') return req.path.startsWith('/api/') ? contracts.http.sendProblem(res, 413, 'request.too_large', { ctx: req.ov }) : res.status(413).type('text/plain').send('That request was too large.');
+ if (req.path.startsWith('/api/')) return contracts.http.sendProblem(res, 500, 'internal.error', { detail: 'Internal error', ctx: req.ov });
+ return res.status(500).type('text/plain').send('Something went wrong on our side. Try again in a moment.');
+ });
+
+ return { app, ctx };
+}
+
+module.exports = { createApp };
new file mode 100644
new file mode 100644
@@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
+'use strict';
+
+/**
+ * Content-addressed URLs for this site's own assets: /css/design.css?v=<first 10 hex of SHA-256>. The static
+ * middleware treats a matching ?v= as immutable (openvibe-shared/cache-policy); any other URL gets the short
+ * public window, because those bytes may change under the same URL.
+ */
+const crypto = require('crypto');
+const fs = require('fs');
+const path = require('path');
+
+const PUBLIC_DIR = path.join(__dirname, '..', 'public');
+const hashes = new Map();
+
+function assetVersion(rel) {
+ const key = String(rel || '').replace(/^\/+/, '');
+ if (hashes.has(key)) return hashes.get(key);
+ let version = 'dev';
+ try {
+ version = crypto.createHash('sha256').update(fs.readFileSync(path.join(PUBLIC_DIR, key))).digest('hex').slice(0, 10);
+ } catch {
+ /* a missing asset stays at a stable placeholder */
+ }
+ hashes.set(key, version);
+ return version;
+}
+
+const asset = (rel) => `/${String(rel || '').replace(/^\/+/, '')}?v=${assetVersion(rel)}`;
+
+module.exports = { PUBLIC_DIR, assetVersion, asset };
new file mode 100644
new file mode 100644
@@ -0,0 +1,111 @@
@@ -0,0 +1,111 @@
+'use strict';
+
+/**
+ * The Network's RS256 signing key, fetched once from GET /api/.well-known/jwks on the configured internal URL and
+ * kept fresh by openvibe-sdk/auth's JWKS client. Tokens are verified offline against it: the person's session token
+ * (sign-in).
+ *
+ * The SDK keeps one client per URL: the last good keys through outages, exponential backoff, a rotation honoured at
+ * once, unknown-kid floods throttled, the refresh timer unref'd. This module is a thin shim so the rest of
+ * OpenVibe.Design (the readiness check, the SSO middleware) can keep talking to `keys.get()` / `keys.ensure()` /
+ * `keys.loaded()`, while verification goes through the SDK's verifyUserToken / verifyAppToken with `jwks: <url>`.
+ *
+ * Nothing the SDK says about a failed key fetch leaves this module: its message names the internal JWKS URL and the
+ * fetch error, so token.no_key answers 'signing key not loaded yet' (and an error without a code 'token does not
+ * verify'). Reasons about the token itself (audience, expiry, signature) are kept. Every rejection is logged.
+ */
+const sdk = require('openvibe-sdk/auth');
+
+/** Public reasons. The SDK's own text (the JWKS URL, the fetch error) never goes over the wire. */
+const KEY_UNAVAILABLE = 'signing key not loaded yet';
+const DOES_NOT_VERIFY = 'token does not verify';
+
+/**
+ * What a caller may be told. Only token.no_key carries the SDK's fetch text (the internal JWKS URL and the connect
+ * error); every other code's message is about the token itself ('not for openvibe.design', 'expired'), which a
+ * developer needs, so it is kept.
+ */
+function publicReason(err) {
+ const code = err && err.code;
+ if (!code || code === 'token.no_key') return code ? KEY_UNAVAILABLE : DOES_NOT_VERIFY;
+ return (err.message && String(err.message).slice(0, 200)) || DOES_NOT_VERIFY;
+}
+
+/** Resolve the JWKS URL for the configured Network (internal first, then public). */
+function jwksUrl(config) {
+ return (config.networkInternalUrl || config.networkUrl) + '/api/.well-known/jwks';
+}
+
+/**
+ * `keys` is what app.js hands the rest of the service: a facade over the SDK's jwksClient. A synchronous caller
+ * wants a PEM, so we mirror the cached first key as PEM — refreshed every time the SDK gives us keys (ensure(),
+ * verifyUser(), verifyApp()).
+ */
+function createKeyStore({ config, fetchImpl = globalThis.fetch, log = console }) {
+ const url = jwksUrl(config);
+ const client = sdk.jwksClient(url, { fetch: fetchImpl, log });
+ let mirror = null; // { pem, count } — the first cached key as PEM
+
+ async function refreshMirror() {
+ try {
+ const ks = await client.keys();
+ const first = ks && ks[0];
+ mirror = first ? { pem: first.key.export({ type: 'spki', format: 'pem' }), count: ks.length } : null;
+ } catch (err) { log.warn(`[OpenVibe.Design] JWKS mirror refresh failed: ${err && err.message || err}`); mirror = null; }
+ }
+ /** First fetch (or wait out the backoff window). Refreshes the mirror. */
+ async function ensure() { await refreshMirror(); }
+ /** Cached public key as PEM — for openvibe-contracts' verifyServiceToken (synchronous). */
+ function get() { return mirror ? mirror.pem : null; }
+ function loaded() { return Boolean(mirror); }
+
+ /** The SDK's `now` is a NUMBER of milliseconds (it does Math.floor(now / 1000)); a function disables every expiry check. */
+ const asMs = (v) => (typeof v === 'function' ? v() : (typeof v === 'number' ? v : Date.now()));
+
+ // Verify a user (session) token via the SDK. Returns { ok, claims } | { ok: false, reason, code, expired }.
+ // `reason` is one of the two fixed public strings; the SDK's text is logged, never returned.
+ async function verifyUser(token, { issuer, audience, now = Date.now() } = {}) {
+ try {
+ const claims = await sdk.verifyUserToken(token, { jwks: url, issuer, audience, now: asMs(now), log });
+ await refreshMirror();
+ return { ok: true, claims };
+ } catch (err) {
+ await refreshMirror();
+ const code = err && err.code;
+ log.warn(`[OpenVibe.Design] user token rejected (${code || 'error'}):`, (err && err.message) || err);
+ return { ok: false, reason: publicReason(err), code, expired: code === 'token.expired' };
+ }
+ }
+ // Verify an app token. Same shape and same fixed reasons.
+ async function verifyApp(token, { issuer, audience, acceptSandbox = true, now = Date.now() } = {}) {
+ try {
+ const claims = await sdk.verifyAppToken(token, { jwks: url, issuer, audience, acceptSandbox, now: asMs(now), log });
+ await refreshMirror();
+ return { ok: true, claims };
+ } catch (err) {
+ await refreshMirror();
+ const code = err && err.code;
+ log.warn(`[OpenVibe.Design] app token rejected (${code || 'error'}):`, (err && err.message) || err);
+ return { ok: false, reason: publicReason(err), code };
+ }
+ }
+
+ /**
+ * The PEM for the key a token's header names (a rotation publishes two keys: the first one is not always it), for
+ * openvibe-contracts' synchronous guard. The SDK refetches for an unknown kid (at most every 30 s). Null when no
+ * key is loaded; a token that names no kid gets the first key.
+ */
+ async function pemForToken(token) {
+ let kid = null;
+ try { kid = JSON.parse(Buffer.from(String(token).split('.')[0], 'base64url').toString('utf8')).kid || null; } catch { /* the guard refuses it */ }
+ try {
+ const ks = await client.keysForKid(kid);
+ const k = (kid && ks.find((x) => x.kid === kid)) || ks[0];
+ return k ? k.key.export({ type: 'spki', format: 'pem' }) : null;
+ } catch { return null; }
+ }
+
+ return { ensure, get, loaded, status: client.status, verifyUser, verifyApp, pemForToken, client };
+}
+
+module.exports = { createKeyStore, jwksUrl };
new file mode 100644
new file mode 100644
@@ -0,0 +1,282 @@
@@ -0,0 +1,282 @@
+'use strict';
+
+/**
+ * Sign-in with OpenVibe.Network: OAuth 2 authorization code with PKCE (S256), as OAuth client `design`.
+ *
+ * GET /auth/login → Network /oauth/authorize?…&code_challenge=…&code_challenge_method=S256
+ * (?silent=1 adds prompt=none; ?next= a same-site path)
+ * GET /auth/callback → state check, server-side code exchange (client secret + code_verifier)
+ * GET /auth/logout → clear cookies, revoke the refresh token (best effort)
+ * GET /auth/me → { user } for the shared navbar (it cannot read the httpOnly cookie); { user: null } for a guest
+ *
+ * The person's Network access token lives in an httpOnly cookie (design_at) no script can read: with it, a script
+ * could act as them. The refresh token (design_rt) is httpOnly too. Neither is ever stored server-side, rendered
+ * or logged.
+ */
+const crypto = require('crypto');
+const express = require('express');
+const cache = require('openvibe-shared/cache-policy');
+
+const ACCESS_COOKIE = 'design_at';
+const REFRESH_COOKIE = 'design_rt';
+const HINT_COOKIE = 'ov_sso_hint';
+const FLOW_COOKIE = 'design_oauth';
+
+function pkcePair() {
+ const verifier = crypto.randomBytes(32).toString('base64url'); // 43 characters
+ const challenge = crypto.createHash('sha256').update(verifier).digest('base64url');
+ return { verifier, challenge };
+}
+
+/** This site's own origins: BASE_URL (the one origin the theme studio is served from). */
+function ownOrigins(config) {
+ const out = new Set();
+ for (const u of [config && config.baseUrl]) {
+ try { if (u) out.add(new URL(u).origin); } catch { /* not a URL */ }
+ }
+ return out;
+}
+
+/**
+ * Same-site relative paths only (never protocol-relative, never another origin). An absolute URL on one of this
+ * site's own origins counts as its path: the shared navbar's silent sign-in sends the whole page address, and until
+ * 2026-10-22 that landed on the home page (a person signed in quietly found themselves somewhere else).
+ */
+function sanitizeNext(next, config) {
+ // Browsers drop tab and newline characters from a URL and read a backslash as "/": "/<TAB>/evil.com" would
+ // leave the site. A next with any control character or backslash goes home.
+ if (typeof next === 'string' && /[\u0000-\u001f\u007f\\]/.test(next)) return '/';
+ if (typeof next === 'string' && /^https?:\/\//i.test(next)) {
+ let u = null;
+ try { u = new URL(next); } catch { return '/'; }
+ if (!ownOrigins(config).has(u.origin)) return '/';
+ next = `${u.pathname}${u.search}${u.hash}`;
+ }
+ if (typeof next !== 'string' || !/^\/(?!\/|\\)/.test(next) || next.length > 500) return '/';
+ return next;
+}
+
+function authorizeUrl(config, { state, challenge, silent = false }) {
+ const q = new URLSearchParams({
+ response_type: 'code',
+ client_id: config.oauth.clientId,
+ redirect_uri: config.oauth.redirectUri,
+ scope: config.oauth.scope,
+ state,
+ code_challenge: challenge,
+ code_challenge_method: 'S256',
+ });
+ if (silent) q.set('prompt', 'none');
+ return `${config.networkPublicUrl || config.networkUrl}/oauth/authorize?${q.toString()}`;
+}
+
+function createSso({ config, keys, fetchImpl = globalThis.fetch, now = () => Date.now(), log = console }) {
+ const cookieBase = () => ({ sameSite: 'lax', secure: config.cookies.secure, httpOnly: true, path: '/' });
+
+ function setSession(res, data) {
+ res.cookie(ACCESS_COOKIE, data.access_token, { ...cookieBase(), maxAge: 24 * 60 * 60 * 1000 });
+ if (data.refresh_token) res.cookie(REFRESH_COOKIE, data.refresh_token, { ...cookieBase(), maxAge: 30 * 24 * 60 * 60 * 1000 });
+ res.cookie(HINT_COOKIE, 'account', { sameSite: 'lax', secure: config.cookies.secure, httpOnly: false, path: '/', maxAge: 365 * 24 * 60 * 60 * 1000 });
+ }
+ function clearSession(res) {
+ res.clearCookie(ACCESS_COOKIE, cookieBase());
+ res.clearCookie(REFRESH_COOKIE, cookieBase());
+ }
+
+ /** POST the Network token endpoint (internal URL). Throws { status, error } on refusal. */
+ async function tokenGrant(fields) {
+ const body = new URLSearchParams({ client_id: config.oauth.clientId, client_secret: config.oauth.clientSecret, ...fields });
+ let res;
+ try {
+ res = await fetchImpl(`${config.networkInternalUrl || config.networkUrl}/oauth/token`, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded', Accept: 'application/json' },
+ body, signal: AbortSignal.timeout(10_000),
+ });
+ } catch (err) {
+ throw Object.assign(new Error('OpenVibe.Network did not answer'), { status: 502, error: err && err.name === 'TimeoutError' ? 'timeout' : 'unreachable' });
+ }
+ const data = await res.json().catch(() => null);
+ if (!res.ok || !data || !data.access_token) {
+ throw Object.assign(new Error((data && (data.error_description || data.error)) || `token endpoint ${res.status}`),
+ { status: res.status, error: (data && data.error) || 'invalid_grant' });
+ }
+ return data;
+ }
+
+ /**
+ * An OpenVibe.Design session is a Network SESSION token: audience openvibe.network and a person. The Network
+ * signs FedCM assertions (audience = any owned-zone origin that asked), app/service tokens and
+ * internal tokens with the same key and issuer; none of them may become a session here.
+ */
+ async function verifySession(token) {
+ const v = await keys.verifyUser(token, { issuer: config.networkIssuer || config.networkPublicUrl || config.networkUrl, audience: config.oauth.sessionAudience, now: now() });
+ const c = v.claims;
+ if (c && (c.typ === 'fedcm' || c.actor_type !== undefined)) return { ok: false, reason: 'not a session token' };
+ return v;
+ }
+
+ function viewerFromClaims(claims, token) {
+ const subject = typeof claims.subject_id === 'string' ? claims.subject_id : null;
+ const role = typeof claims.role === 'string' ? claims.role : 'user';
+ return {
+ kind: 'user',
+ subject,
+ username: typeof claims.username === 'string' ? claims.username.slice(0, 64) : null,
+ displayName: typeof claims.display_name === 'string' ? claims.display_name.slice(0, 80) : (typeof claims.username === 'string' ? claims.username.slice(0, 64) : 'you'),
+ role,
+ // The navbar's avatar and colour (Network's token claims; the avatar is an https image on openvibe.media).
+ avatarUrl: typeof claims.avatar_url === 'string' && /^https:\/\/[^\s"'<>]{1,500}$/.test(claims.avatar_url) ? claims.avatar_url : null,
+ profileColor: typeof claims.profile_color === 'string' && /^#[0-9a-fA-F]{3,8}$/.test(claims.profile_color) ? claims.profile_color : null,
+ // The person's Network access token: used for server-side Network calls, never rendered.
+ token,
+ };
+ }
+
+ /** One refresh per request, however many Network calls in it see a 401 (refresh tokens rotate). */
+ async function refresh(req, res) {
+ if (!req.sessionRefresh) req.sessionRefresh = await doRefresh(req, res);
+ return req.sessionRefresh;
+ }
+
+ async function doRefresh(req, res) {
+ const rt = req.cookies && req.cookies[REFRESH_COOKIE];
+ if (!rt) return null;
+ try {
+ const data = await tokenGrant({ grant_type: 'refresh_token', refresh_token: rt });
+ setSession(res, data);
+ const v = await verifySession(data.access_token);
+ return v.ok ? viewerFromClaims(v.claims, data.access_token) : null;
+ } catch (err) {
+ if (err.status && err.status < 500) clearSession(res);
+ return null;
+ }
+ }
+
+ /** req.viewer for every page: the signed-in person, refreshed when their token expired. */
+ function middleware() {
+ return async (req, res, next) => {
+ req.viewer = { kind: 'anonymous' };
+ const token = req.cookies && req.cookies[ACCESS_COOKIE];
+ if (!token) return next();
+ await keys.ensure();
+ const v = await verifySession(token);
+ if (v.ok) { req.viewer = viewerFromClaims(v.claims, token); return next(); }
+ if (v.expired) {
+ const fresh = await refresh(req, res);
+ if (fresh) { req.viewer = fresh; return next(); }
+ }
+ if (keys.loaded()) clearSession(res);
+ next();
+ };
+ }
+
+ /**
+ * Run fn(token) as the viewer; when the Network answers 401 (expired or revoked session), refresh
+ * once and run it again. Other failures are returned to the caller unchanged.
+ */
+ async function asViewer(req, res, fn) {
+ try {
+ return await fn(req.viewer.token);
+ } catch (err) {
+ if (!err || err.status !== 401) throw err;
+ const fresh = await refresh(req, res);
+ if (!fresh) throw err;
+ req.viewer = fresh;
+ return fn(fresh.token);
+ }
+ }
+
+ function routes() {
+ const r = express.Router();
+ const flowOpts = () => ({ ...cookieBase(), path: '/auth', maxAge: 10 * 60 * 1000 });
+
+ r.get('/login', (req, res) => {
+ const silent = Boolean(req.query.silent) && req.query.silent !== '0';
+ const state = crypto.randomBytes(16).toString('hex');
+ const { verifier, challenge } = pkcePair();
+ res.cookie(FLOW_COOKIE, JSON.stringify({ state, verifier, next: sanitizeNext(req.query.next, config), silent }), flowOpts());
+ res.set('Cache-Control', cache.htmlHeaders({ private: true }));
+ res.redirect(authorizeUrl(config, { state, challenge, silent }));
+ });
+
+ r.get('/callback', async (req, res) => {
+ res.set('Cache-Control', cache.htmlHeaders({ private: true }));
+ let flow = null;
+ try { flow = JSON.parse(req.cookies[FLOW_COOKIE] || 'null'); } catch { flow = null; }
+ res.clearCookie(FLOW_COOKIE, { ...cookieBase(), path: '/auth' });
+ const next = flow ? sanitizeNext(flow.next, config) : '/';
+ const { code, state, error } = req.query;
+ if (error) {
+ if ((flow && flow.silent) || error === 'login_required' || error === 'interaction_required') return res.redirect(next);
+ return res.status(400).type('text/plain').send(`Sign-in was not completed (${String(error).slice(0, 60)}).`);
+ }
+ if (!flow || typeof flow.state !== 'string' || typeof flow.verifier !== 'string' || typeof state !== 'string'
+ || state.length !== flow.state.length || !crypto.timingSafeEqual(Buffer.from(state), Buffer.from(flow.state))) {
+ return res.status(400).type('text/plain').send('Sign-in state did not match. Please try signing in again.');
+ }
+ if (!code) return res.status(400).type('text/plain').send('The Network sent no authorization code.');
+ try {
+ const data = await tokenGrant({ grant_type: 'authorization_code', code: String(code), redirect_uri: config.oauth.redirectUri, code_verifier: flow.verifier });
+ setSession(res, data);
+ // No Clear-Site-Data here or on sign-out: Chrome holds such an answer (and the cookies it sets) until the
+ // cache is cleared, which on phones left people on the account chooser with no session (2026-10-28).
+ return res.redirect(next);
+ } catch (err) {
+ log.warn('[OpenVibe.Design] sign-in exchange failed:', err.status || '', err.error || '');
+ return res.status(err.status && err.status < 500 ? 400 : 502).type('text/plain')
+ .send(err.status && err.status < 500 ? 'The Network refused the sign-in code. Please sign in again.' : 'Sign-in failed: OpenVibe.Network did not answer. Please try again.');
+ }
+ });
+
+ // Sign-out ends the session, so another site must not be able to trigger it (a cross-site
+ // <img src=/auth/logout> or link). A same-origin navigation or form, or the address bar
+ // (Sec-Fetch-Site none), signs out directly; anything else gets a confirm button (POST).
+ const sameOriginRequest = (req) => {
+ const site = String(req.get('sec-fetch-site') || '');
+ if (site) return site === 'same-origin' || (site === 'none' && req.method === 'GET');
+ const origin = req.get('origin');
+ if (origin) return origin === `${req.protocol}://${req.get('host')}`;
+ return req.method === 'GET'; // no fetch metadata and no Origin: an old browser navigating
+ };
+ r.get('/logout', (req, res, next) => {
+ if (sameOriginRequest(req)) return next();
+ res.set('Cache-Control', cache.htmlHeaders({ private: true }));
+ const q = req.query.next ? `?next=${encodeURIComponent(sanitizeNext(req.query.next, config))}` : '';
+ res.type('html').send(`<!doctype html><meta charset="utf-8"><title>Sign out</title><meta name="viewport" content="width=device-width,initial-scale=1">`
+ + `<form method="post" action="/auth/logout${q}" style="font:16px system-ui;margin:3em auto;max-width:24em;text-align:center">`
+ + `<p>Sign out of OpenVibe.Design?</p><button type="submit">Sign out</button> <a href="/">Cancel</a></form>`);
+ });
+ r.post('/logout', (req, res, next) => (sameOriginRequest(req) ? next() : res.status(403).type('text/plain').send('Sign-out must come from this site.')));
+ r.all('/logout', async (req, res) => {
+ const rt = req.cookies && req.cookies[REFRESH_COOKIE];
+ if (rt) {
+ fetchImpl(`${config.networkInternalUrl || config.networkUrl}/oauth/revoke`, {
+ method: 'POST', headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ client_id: config.oauth.clientId, client_secret: config.oauth.clientSecret, token: rt }),
+ signal: AbortSignal.timeout(3000),
+ }).catch(() => {});
+ }
+ clearSession(res);
+ res.cookie(HINT_COOKIE, 'guest', { sameSite: 'lax', secure: config.cookies.secure, httpOnly: false, path: '/', maxAge: 365 * 24 * 60 * 60 * 1000 });
+ res.redirect(303, sanitizeNext(req.query.next, config));
+ });
+
+ r.get('/me', (req, res) => {
+ res.set('Cache-Control', cache.htmlHeaders({ private: true }));
+ // No session at all (a guest: no access or refresh cookie) is signed out, not an error: the shared
+ // navbar asks this on every page view, and a 401 logged a console error on each (browser check,
+ // OpenVibe.Host). A session cookie that is present but invalid or expired still answers 401.
+ const c = req.cookies || {};
+ if (!c[ACCESS_COOKIE] && !c[REFRESH_COOKIE] && !req.get('authorization')) return res.json({ user: null });
+ const v = req.viewer;
+ if (!v || v.kind !== 'user') return res.status(401).json({ error: 'Not signed in' });
+ res.json({ user: { username: v.username, display_name: v.displayName, subject_id: v.subject, role: v.role, avatar_url: v.avatarUrl || null, profile_color: v.profileColor || null } });
+ });
+ return r;
+ }
+
+ return { middleware, routes, asViewer, tokenGrant, pkcePair };
+}
+
+module.exports = { createSso, pkcePair, sanitizeNext, ownOrigins, authorizeUrl, ACCESS_COOKIE, REFRESH_COOKIE };
new file mode 100644
new file mode 100644
@@ -0,0 +1,60 @@
@@ -0,0 +1,60 @@
+'use strict';
+
+/**
+ * OpenVibe.Design configuration. Every value comes from the environment (production:
+ * /etc/openvibe/design.env, see .env.example). Only environment variable NAMES appear in code and docs; secrets are
+ * never logged.
+ *
+ * load(env) is pure so tests can build a config without touching process.env.
+ */
+require('dotenv').config();
+
+const trim = (s) => String(s || '').replace(/\/+$/, '');
+const int = (v, def) => (Number.isFinite(parseInt(v, 10)) ? parseInt(v, 10) : def);
+
+function load(env = process.env) {
+ const nodeEnv = env.NODE_ENV || 'development';
+ const isProduction = nodeEnv === 'production';
+ const port = int(env.PORT, 5090);
+ const baseUrl = trim(env.BASE_URL || (isProduction ? 'https://openvibe.design' : `http://localhost:${port}`));
+ // The Network's public origin is where a browser is sent to authorize. Its internal origin is where this
+ // service exchanges the code, fetches the JWKS and proxies the theme API; neither a person's browser nor their
+ // token ever talks to it directly.
+ const networkPublicUrl = trim(env.OV_NETWORK_URL || 'https://openvibe.network');
+ const networkInternalUrl = trim(env.OV_NETWORK_INTERNAL_URL || 'http://127.0.0.1:4000');
+
+ return {
+ service: 'design',
+ name: 'OpenVibe.Design',
+ port,
+ host: env.HOST || '127.0.0.1',
+ nodeEnv,
+ isProduction,
+ baseUrl,
+ trustProxy: env.TRUST_PROXY != null ? Number(env.TRUST_PROXY) : 2,
+
+ // The theme API proxy (server/http/api.js): every call goes to the Network's /api/themes. `networkUrl`
+ // is the internal origin the proxy and the token exchange use; `networkPublicUrl` is the browser's.
+ networkUrl: networkInternalUrl,
+ networkPublicUrl,
+ networkInternalUrl,
+ networkIssuer: trim(env.OV_NETWORK_ISSUER || networkPublicUrl),
+ themeCacheMs: Math.max(0, int(env.DESIGN_THEME_CACHE_MS, 5 * 60_000)),
+ timeoutMs: Math.max(200, int(env.DESIGN_UPSTREAM_TIMEOUT_MS, 8000)),
+
+ // OpenVibe.Network: SSO (OAuth2 authorization server with PKCE) and its JWKS.
+ oauth: {
+ clientId: env.OV_OAUTH_CLIENT_ID || 'design',
+ clientSecret: env.OV_OAUTH_CLIENT_SECRET || '',
+ redirectUri: env.OV_OAUTH_REDIRECT_URI || `${baseUrl}/auth/callback`,
+ scope: 'profile',
+ sessionAudience: env.OV_SESSION_AUDIENCE || 'openvibe.network',
+ },
+ cookies: { secure: env.COOKIE_SECURE ? env.COOKIE_SECURE === 'true' : isProduction },
+
+ // One per-IP budget for /api and /auth (express-rate-limit, one 60 s window).
+ rateLimitPerMinute: Math.max(1, int(env.DESIGN_RATE_LIMIT_PER_MIN, 120)),
+ };
+}
+
+module.exports = { load };
new file mode 100644
new file mode 100644
@@ -0,0 +1,190 @@
@@ -0,0 +1,190 @@
+'use strict';
+
+/**
+ * The theme API proxy: OpenVibe.Design signs the person in and forwards their theme calls to OpenVibe.Network's
+ * /api/themes, with the access token from the httpOnly design_at cookie as a Bearer. The token is never logged,
+ * echoed, put in a URL or sent anywhere but the configured Network.
+ *
+ * GET /api/themes public catalogue, cached in memory for 5 minutes
+ * GET /api/themes/:idOrSlug one public theme
+ * GET /api/me/theme Network GET /api/themes/me/active → { theme_id, theme, custom_variables }
+ * PUT /api/me/theme Network PUT /api/themes/me with source 'studio'
+ * GET /api/me/theme/history Network GET /api/themes/me/history
+ * POST /api/me/theme/history/:id/restore Network's restore (id a positive integer)
+ * POST /api/themes/submit Network POST /api/themes
+ *
+ * Writes need the request's Origin to be this site's own origin (CSRF), otherwise 403 design.cross_site. A Network
+ * 4xx answer is passed through with its status and body; a Network failure is 502. Everything under /api/me is
+ * private, no-store.
+ */
+const { http } = require('openvibe-contracts');
+const { asyncRouter } = require('./router');
+const { ACCESS_COOKIE } = require('../auth/sso');
+
+function ownOrigin(config) {
+ try { return new URL(config.baseUrl).origin; } catch { return null; }
+}
+
+/** A Network 4xx answer, with its own status and body. A 2xx answer is passed through the same way. */
+function passThrough(res, r) {
+ res.status(r.status);
+ if (r.contentType) res.set('Content-Type', r.contentType);
+ if (r.status === 204 || (!r.text && r.data == null)) return res.end();
+ return res.send(r.text || JSON.stringify(r.data));
+}
+
+function failure(res, req, err) {
+ const r = err && err.response;
+ if (r && r.status >= 400 && r.status < 500) return passThrough(res, r);
+ return http.sendProblem(res, 502, 'network.unavailable', {
+ detail: 'OpenVibe.Network did not answer. Try again in a moment.',
+ ctx: req.ov,
+ });
+}
+
+/** A Network answer: its 4xx status and body pass through; a 5xx (or no answer) is this service's 502. */
+function forward(res, req, up) {
+ if (up.status >= 500) return failure(res, req, { response: up });
+ return passThrough(res, up);
+}
+
+function createApi(ctx) {
+ const { config, catalog, log } = ctx;
+ const r = asyncRouter();
+ const origin = ownOrigin(config);
+
+ /** Writes (PUT/POST): only this site's own origin may ask for them. */
+ function requireOrigin(req, res, next) {
+ const sent = String(req.get('origin') || '');
+ if (!origin || sent !== origin) {
+ return http.sendProblem(res, 403, 'design.cross_site', {
+ detail: 'A change to a theme must come from openvibe.design itself.',
+ ctx: req.ov,
+ });
+ }
+ return next();
+ }
+
+ /** The person's Network access token, from the httpOnly cookie only. */
+ function requireToken(req, res, next) {
+ const token = req.cookies && req.cookies[ACCESS_COOKIE];
+ if (!token) {
+ return http.sendProblem(res, 401, 'token.required', {
+ detail: 'Sign in at openvibe.design to use your theme.',
+ ctx: req.ov,
+ });
+ }
+ req.themeToken = token;
+ return next();
+ }
+
+ // /api/me/* is a person's own setting: no shared cache, no browser cache.
+ r.use('/me', (_req, res, next) => { res.set('Cache-Control', 'private, no-store'); next(); });
+
+ // ── Public catalogue ────────────────────────────────────
+ r.get('/themes', async (req, res) => {
+ try {
+ const data = await catalog.list();
+ res.set('Cache-Control', 'public, max-age=120');
+ return res.json(data);
+ } catch (err) {
+ log.warn('[OpenVibe.Design] theme catalogue failed:', (err && err.message) || err);
+ return failure(res, req, err);
+ }
+ });
+
+ // A submission is a write: same-origin, signed in, and the same body Network expects.
+ r.post('/themes/submit', requireOrigin, requireToken, async (req, res) => {
+ const b = req.body && typeof req.body === 'object' ? req.body : {};
+ const body = { name: b.name, slug: b.slug, description: b.description, mode: b.mode, variables: b.variables, tags: b.tags };
+ try {
+ const up = await catalog.request('', { method: 'POST', token: req.themeToken, body });
+ return forward(res, req, up);
+ } catch (err) {
+ log.warn('[OpenVibe.Design] theme submission failed:', (err && err.message) || err);
+ return failure(res, req, err);
+ }
+ });
+
+ r.get('/themes/:idOrSlug', async (req, res) => {
+ try {
+ const up = await catalog.get(req.params.idOrSlug);
+ if (up.ok) res.set('Cache-Control', 'public, max-age=120');
+ return forward(res, req, up);
+ } catch (err) {
+ log.warn('[OpenVibe.Design] theme lookup failed:', (err && err.message) || err);
+ return failure(res, req, err);
+ }
+ });
+
+ // ── The signed-in person's theme ────────────────────────
+ r.get('/me/theme', requireToken, async (req, res) => {
+ try {
+ const up = await catalog.request('/me/active', { token: req.themeToken });
+ if (up.status >= 400) return forward(res, req, up);
+ if (!up.ok) return failure(res, req, { response: up });
+ const d = up.data || {};
+ const out = {
+ theme_id: d.theme_id === undefined ? null : d.theme_id,
+ theme: d.theme === undefined ? null : d.theme,
+ custom_variables: d.custom_variables === undefined ? null : d.custom_variables,
+ };
+ // Network's active answer names the theme; the page wants what it is. Ask the catalogue/detail only
+ // when the answer did not carry the object itself, and never fail the read because of it.
+ if (!out.theme && out.theme_id) {
+ try {
+ const found = await catalog.get(out.theme_id, { token: req.themeToken });
+ if (found.ok && found.data && found.data.theme) out.theme = found.data.theme;
+ } catch { /* the id is still useful without the object */ }
+ }
+ return res.json(out);
+ } catch (err) {
+ log.warn('[OpenVibe.Design] active theme failed:', (err && err.message) || err);
+ return failure(res, req, err);
+ }
+ });
+
+ r.put('/me/theme', requireOrigin, requireToken, async (req, res) => {
+ const b = req.body && typeof req.body === 'object' ? req.body : {};
+ const body = { theme_id: b.theme_id, custom_variables: b.custom_variables, source: 'studio' };
+ try {
+ const up = await catalog.request('/me', { method: 'PUT', token: req.themeToken, body });
+ return forward(res, req, up);
+ } catch (err) {
+ log.warn('[OpenVibe.Design] saving the theme failed:', (err && err.message) || err);
+ return failure(res, req, err);
+ }
+ });
+
+ r.get('/me/theme/history', requireToken, async (req, res) => {
+ try {
+ const up = await catalog.request('/me/history', { token: req.themeToken });
+ return forward(res, req, up);
+ } catch (err) {
+ log.warn('[OpenVibe.Design] theme history failed:', (err && err.message) || err);
+ return failure(res, req, err);
+ }
+ });
+
+ r.post('/me/theme/history/:id/restore', requireOrigin, requireToken, async (req, res) => {
+ const id = String(req.params.id || '');
+ const n = Number(id);
+ if (!/^\d+$/.test(id) || !Number.isSafeInteger(n) || n < 1) {
+ return http.sendProblem(res, 400, 'design.invalid_history_id', {
+ detail: 'The history id must be a positive integer.',
+ ctx: req.ov,
+ });
+ }
+ try {
+ const up = await catalog.request(`/me/history/${n}/restore`, { method: 'POST', token: req.themeToken });
+ return forward(res, req, up);
+ } catch (err) {
+ log.warn('[OpenVibe.Design] restoring a theme failed:', (err && err.message) || err);
+ return failure(res, req, err);
+ }
+ });
+
+ return r;
+}
+
+module.exports = { createApi, ownOrigin };
new file mode 100644
new file mode 100644
@@ -0,0 +1,95 @@
@@ -0,0 +1,95 @@
+'use strict';
+
+/**
+ * Crawl artifacts for openvibe.design, built with openvibe-shared/seo: robots.txt, sitemap.xml and llms.txt.
+ * The public pages are for search engines and AI crawlers; the studio's writes, the API and sign-in are not.
+ *
+ * The sitemap is /, /studio and one page per public theme in the catalogue. A Network failure leaves the static
+ * pages in place rather than failing the crawl artifact.
+ */
+const fs = require('fs');
+const path = require('path');
+const seo = require('openvibe-shared/seo');
+const { asyncRouter } = require('./router');
+
+const SITE_NAME = 'OpenVibe.Design';
+const DESCRIPTION = 'OpenVibe.Design is the Design room of the OpenVibe network: browse OpenVibe\'s themes, try them on previews, edit one with contrast checks, use it, submit it to the gallery, and roll back to any earlier setting.';
+const DISALLOW = ['/auth/', '/api/'];
+
+function dayOf(ts) {
+ const m = String(ts == null ? '' : ts).match(/^(\d{4}-\d{2}-\d{2})/);
+ return m ? m[1] : null;
+}
+function siteUpdated() {
+ try { return dayOf(JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'STATUS.json'), 'utf8')).updated); } catch { return null; }
+}
+
+/** Every public page, in the order a crawler should read them. */
+function publicPages(themes = []) {
+ const static_ = [
+ { path: '/', changefreq: 'weekly', priority: 1.0, title: 'OpenVibe.Design', text: 'Browse OpenVibe\'s themes, try them on a preview, edit one with contrast checks, use it, and roll back to any earlier setting.' },
+ { path: '/studio', changefreq: 'weekly', priority: 0.9, title: 'The theme studio', text: 'Try a theme on a preview, edit its variables with contrast checks, use it across the network, submit it to the gallery, and roll back.' },
+ ];
+ const themePages = (Array.isArray(themes) ? themes : []).filter((t) => t && t.slug).map((t) => ({
+ path: `/t/${encodeURIComponent(String(t.slug))}`,
+ changefreq: 'monthly',
+ priority: 0.6,
+ title: String(t.name || t.slug),
+ text: `${t.mode ? `${String(t.mode)} theme. ` : ''}${String(t.description || 'A theme in the OpenVibe catalogue.')}`.trim(),
+ }));
+ return [...static_, ...themePages];
+}
+
+function createDiscoveryRoutes(ctx) {
+ const { config, catalog } = ctx;
+ const r = asyncRouter();
+ const site = String(config.baseUrl).replace(/\/+$/, '');
+ const abs = (p) => `${site}${p}`;
+ const TEXT = 'public, max-age=3600';
+
+ async function themes() {
+ try { const list = await catalog.list(); return list.themes; } catch { return []; }
+ }
+
+ r.get('/robots.txt', async (_req, res) => {
+ res.type('text/plain').set('Cache-Control', TEXT).send(
+ '# openvibe.design: the public pages are for search and AI crawlers; sign-in and the API are not.\n'
+ + seo.robotsTxt({ sitemaps: [abs('/sitemap.xml')], disallow: DISALLOW }));
+ });
+
+ r.get('/llms.txt', async (_req, res) => {
+ const list = await themes();
+ res.type('text/plain').set('Cache-Control', TEXT).send(seo.llmsTxt({
+ name: SITE_NAME,
+ summary: DESCRIPTION,
+ details: 'Theme selection stays in OpenVibe.Network (its theme API); this service signs the person in and proxies their calls. The pages here are server-rendered and readable without JavaScript, and the theme catalogue is public.',
+ sections: [
+ { title: 'Start here', links: [
+ { title: 'OpenVibe.Design', url: abs('/'), note: 'the theme catalogue' },
+ { title: 'The studio', url: abs('/studio'), note: 'try, edit, use, submit and roll back a theme' },
+ { title: 'For developers', url: abs('/developers'), note: 'the theme API proxy' },
+ ] },
+ { title: 'Themes', links: list.filter((t) => t && t.slug).slice(0, 100).map((t) => ({ title: String(t.name || t.slug), url: abs(`/t/${encodeURIComponent(String(t.slug))}`), note: `${t.mode ? String(t.mode) : 'theme'}${t.description ? ` — ${String(t.description)}` : ''}` })) },
+ { title: 'Machine-readable', links: [
+ { title: 'The theme catalogue (JSON)', url: abs('/api/themes'), note: 'public, cached for 5 minutes' },
+ { title: 'Sitemap', url: abs('/sitemap.xml') },
+ { title: 'Release metadata (JSON)', url: abs('/release.json') },
+ ] },
+ { title: 'Elsewhere', links: [
+ { title: 'OpenVibe.Network', url: 'https://openvibe.network', note: 'accounts and the theme API this service proxies' },
+ ] },
+ ],
+ }));
+ });
+
+ r.get('/sitemap.xml', async (_req, res) => {
+ const pages = publicPages(await themes());
+ const lastmod = siteUpdated();
+ const urls = pages.map((e) => ({ loc: abs(e.path), ...(lastmod ? { lastmod } : {}), changefreq: e.changefreq, priority: e.priority }));
+ res.type('application/xml').set('Cache-Control', TEXT).send(seo.sitemapXml(urls));
+ });
+
+ return r;
+}
+
+module.exports = { createDiscoveryRoutes, publicPages, DESCRIPTION, SITE_NAME, DISALLOW };
new file mode 100644
new file mode 100644
@@ -0,0 +1,76 @@
@@ -0,0 +1,76 @@
+'use strict';
+
+/**
+ * The public pages:
+ * / the theme catalogue's front door
+ * /studio the theme studio (the shell the main session's public/js/studio.js fills)
+ * /t/:slug one public theme
+ * /developers the API, for people and agents
+ *
+ * Every page is server-rendered and complete without JavaScript. A page for a signed-in person is private and
+ * never cached; a public page gets the short 120-second window. `me` comes from the session the SSO middleware
+ * already resolved — a guest never causes a Network call to find out they are a guest.
+ */
+const views = require('../views');
+const { asyncRouter } = require('./router');
+const { send } = require('../render/layout');
+
+function meOf(viewer) {
+ if (!viewer || viewer.kind !== 'user') return { signedIn: false, user: null };
+ return {
+ signedIn: true,
+ user: {
+ subject_id: viewer.subject || null,
+ username: viewer.username || null,
+ display_name: viewer.displayName || null,
+ role: viewer.role || 'user',
+ avatar_url: viewer.avatarUrl || null,
+ profile_color: viewer.profileColor || null,
+ },
+ };
+}
+
+function createPageRoutes(ctx) {
+ const { catalog, log } = ctx;
+ const r = asyncRouter();
+ // The catalogue never throws in a page: a Network failure degrades to the page without its list.
+ const safe = (fn) => Promise.resolve().then(fn).catch((err) => {
+ log.warn('[OpenVibe.Design] page catalogue failed:', (err && err.message) || err);
+ return null;
+ });
+ const page = (res, status, html, viewer) => send(res, status, html, { viewer });
+
+ r.get('/', async (req, res) => {
+ const list = await safe(() => catalog.list());
+ return page(res, 200, views.home({ themes: list ? list.themes : null }), req.viewer);
+ });
+
+ r.get('/studio', async (req, res) => {
+ const list = await safe(() => catalog.list());
+ return page(res, 200, views.studio({ themes: list ? list.themes : null, me: meOf(req.viewer) }), req.viewer);
+ });
+
+ r.get('/t/:slug', async (req, res) => {
+ let up;
+ try {
+ up = await catalog.get(req.params.slug);
+ } catch (err) {
+ log.warn('[OpenVibe.Design] theme page failed:', (err && err.message) || err);
+ res.set('Cache-Control', 'no-store');
+ return res.status(502).type('text/plain').send('OpenVibe.Network did not answer. Try again in a moment.');
+ }
+ if (up.status === 404) return page(res, 404, views.notFound(), req.viewer);
+ if (!up.ok || !up.data || !up.data.theme) {
+ res.set('Cache-Control', 'no-store');
+ return res.status(502).type('text/plain').send('That theme could not be read right now. Try again in a moment.');
+ }
+ return page(res, 200, views.theme({ theme: up.data.theme }), req.viewer);
+ });
+
+ r.get('/developers', (req, res) => page(res, 200, views.developers(), req.viewer));
+
+ r.use((req, res) => page(res, 404, views.notFound(), req.viewer));
+ return r;
+}
+
+module.exports = { createPageRoutes, meOf };
new file mode 100644
new file mode 100644
@@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
+'use strict';
+
+/**
+ * express.Router() whose get/post/put handlers may be async: a rejected promise goes to next(err) instead of
+ * becoming an unhandled rejection. (The same helper OpenVibe.Help and OpenVibe.Domains carry.)
+ */
+const express = require('express');
+
+function asyncRouter() {
+ const r = express.Router();
+ for (const method of ['get', 'post', 'put']) {
+ const orig = r[method].bind(r);
+ r[method] = (path, ...handlers) => orig(path, ...handlers.map((h) => (h.length === 4 ? h : (req, res, next) => {
+ try {
+ const out = h(req, res, next);
+ if (out && typeof out.catch === 'function') out.catch(next);
+ } catch (err) { next(err); }
+ })));
+ }
+ return r;
+}
+
+module.exports = { asyncRouter };
new file mode 100644
new file mode 100644
@@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
+'use strict';
+
+/**
+ * OpenVibe.Design — process entry. `node server/index.js` listens on PORT (5090) behind nginx (deploy/).
+ * Stateless: the HTTP server and the JWKS refresher are what stop.
+ */
+const { createApp } = require('./app');
+const { gracefulStop } = require('openvibe-sdk/service');
+
+/**
+ * The process stop (openvibe-sdk/service): stop taking connections, drain the requests in flight, stop the JWKS
+ * refresher, exit. Exported so a test can inject `exit` and `signals: false`.
+ */
+function createLifecycle({ server, ctx, exit, signals } = {}) {
+ return gracefulStop({
+ name: 'OpenVibe.Design',
+ server,
+ deadlineExitCode: 0,
+ exit,
+ signals,
+ deadlineMs: 10_000,
+ close: [() => ctx.keys.client.stop()],
+ });
+}
+
+async function start() {
+ const { app, ctx } = await createApp();
+ const { config } = ctx;
+ const server = app.listen(config.port, config.host, () => {
+ console.log(`[OpenVibe.Design] ${config.nodeEnv} on http://${config.host}:${config.port} → ${config.baseUrl} (network ${config.networkUrl})`);
+ });
+ server.keepAliveTimeout = 65_000;
+ createLifecycle({ server, ctx });
+ return { server, ctx };
+}
+
+if (require.main === module) {
+ start().catch((err) => {
+ console.error('[OpenVibe.Design] failed to start:', err);
+ process.exit(1);
+ });
+}
+
+module.exports = { start, createLifecycle };
new file mode 100644
new file mode 100644
@@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
+'use strict';
+
+/**
+ * Truthful readiness for GET /api/ready (openvibe-shared/ready). There is no database: the service is stateless.
+ *
+ * network optional OpenVibe.Network answers its theme catalogue
+ * network_jwks optional the Network signing key is loaded; without it nobody can sign in
+ * oauth_client optional OV_OAUTH_CLIENT_SECRET is set (sign-in needs it)
+ *
+ * No check is required: if Network does not answer, the process still serves the pages and the crawl artifacts, so
+ * the answer is 200 with status "degraded" — never 503 (the same rule OpenVibe.Domains uses for its two upstreams).
+ */
+const { createReadiness } = require('openvibe-shared/ready');
+
+function createServiceReadiness({ config, catalog, keys = null, release = null }) {
+ return createReadiness({
+ service: 'design',
+ release,
+ checks: [
+ {
+ name: 'network',
+ required: false,
+ check: async () => {
+ const list = await catalog.list({ fresh: true });
+ return list && Array.isArray(list.themes) ? true : 'OpenVibe.Network did not answer';
+ },
+ },
+ {
+ name: 'network_jwks',
+ required: false,
+ check: () => (keys && keys.loaded() ? true : 'Network signing key not loaded yet: sign-in is unavailable'),
+ },
+ { name: 'oauth_client', required: false, check: () => (config.oauth.clientSecret ? true : 'OV_OAUTH_CLIENT_SECRET unset: sign-in cannot complete') },
+ ],
+ });
+}
+
+module.exports = { createServiceReadiness };
new file mode 100644
new file mode 100644
@@ -0,0 +1,95 @@
@@ -0,0 +1,95 @@
+'use strict';
+
+/**
+ * Page shell for OpenVibe.Design. Every page is server-rendered through openvibe-shared/shell and is complete
+ * without JavaScript: the OpenVibe Frame (theme, navbar, footer) comes from the shared shell and the room's accent
+ * from openvibe-shared/rooms. The views themselves are plain placeholders for now (server/views/index.js).
+ *
+ * - <head>: the shared app icon, the room's stylesheets, this site's content-hashed design.css
+ * - the navbar's session probe (/auth/me), sign-in and sign-out URLs and silent sign-in, as every site's
+ * - the product's own script only where a page offers an in-browser convenience (/studio)
+ */
+const shell = require('openvibe-shared/shell');
+const ovServe = require('openvibe-shared/serve');
+const appIcon = require('openvibe-shared/app-icon');
+const kit = require('openvibe-shared/kit');
+const rooms = require('openvibe-shared/rooms');
+const { asset, assetVersion } = require('../assets');
+
+const NAME = 'OpenVibe.Design';
+const NETWORK = 'https://openvibe.network';
+const ROOM = rooms.get('design');
+const esc = kit.esc;
+
+const NAV = [
+ { label: 'Home', href: '/', icon: 'fa-house' },
+ { label: 'Studio', href: '/studio', icon: 'fa-palette' },
+ { label: 'Developers', href: '/developers', icon: 'fa-code', more: true },
+];
+
+let RELEASE = 'dev';
+let BASE = 'https://openvibe.design';
+function setRelease(id) { if (id) RELEASE = String(id); }
+function configure({ baseUrl } = {}) { if (baseUrl) BASE = String(baseUrl).replace(/\/+$/, ''); }
+const baseUrl = () => BASE;
+const canonical = (p) => `${BASE}${p || '/'}`;
+
+/** The page around a body: the shared shell with the room's stylesheets and behaviour. */
+function layout({ title, description, canonical, path, robots = 'index, follow', body, active = '/', scripts = [], jsonLd = [] } = {}) {
+ const pathNow = path || active || '/';
+ canonical = canonical || (path ? `${BASE}${path}` : undefined);
+ const navbar = {
+ service: 'design',
+ apiBase: NETWORK,
+ links: NAV.map((l) => ({ ...l, active: l.href === active || (l.href !== '/' && String(active).startsWith(`${l.href}/`)) })),
+ appBar: [{ label: 'Home', href: '/', icon: 'fa-house' }, { label: 'Studio', href: '/studio', icon: 'fa-palette' }],
+ history: { type: 'page', title: title || NAME },
+ silentLogin: `${BASE}/auth/login?silent=1&next={url}`,
+ sessionUrl: '/auth/me',
+ loginUrl: '/auth/login?next={path}',
+ logoutUrl: '/auth/logout?next={path}',
+ };
+ const footer = { service: 'design', variant: 'full', mount: '#ov-footer', brandName: NAME };
+ return shell.page({
+ name: NAME,
+ lang: 'en',
+ title: title || `${NAME}: ${ROOM.line}`,
+ titleSuffix: title ? ` · ${NAME}` : '',
+ siteName: NAME,
+ description: description || `${ROOM.line}. Browse OpenVibe's themes, try them on a preview, edit one with contrast checks, and use it across the network.`,
+ canonical,
+ robots,
+ jsonLd,
+ home: '/',
+ navLinks: NAV,
+ navbar,
+ footer,
+ head: `${appIcon.headTags({ site: 'design' })}
+<link rel="stylesheet" href="${esc(ovServe.url('kit.css'))}">
+<link rel="stylesheet" href="${esc(ovServe.url('room.css'))}">
+<link rel="stylesheet" href="${esc(ovServe.url('showcase.css'))}">
+<link rel="stylesheet" href="${esc(asset('css/design.css'))}">
+<script src="${esc(ovServe.url('kit-web.js'))}" defer></script>
+<script src="${esc(ovServe.url('motion.js'))}" defer></script>
+${(scripts || []).map((rel) => `<script src="${esc(asset(rel))}" defer></script>`).join('\n')}
+<meta name="ov-boost" content="design@${esc(RELEASE)}">`,
+ body: `<a class="skip" href="#main">Skip to content</a>
+<div id="navbar-mount"></div>
+<main id="main" class="ds ov-room" style="${rooms.style('design')}">${body || ''}</main>
+<script>window.__OV_PAGE = ${JSON.stringify({ navbar, footer, path: pathNow }).replace(/</g, '\\u003c')};
+document.addEventListener('DOMContentLoaded', function () { try { if (window.OpenVibeFooter) OpenVibeFooter.init(window.__OV_PAGE.footer); } catch (e) { /* the Frame is optional */ } });</script>`,
+ });
+}
+
+/**
+ * Send a page; a page rendered for a signed-in person is private and never cached. A public page gets the short
+ * public window the whole network uses for HTML.
+ */
+function send(res, status, html, { viewer } = {}) {
+ const personal = viewer && viewer.kind === 'user';
+ res.set('Cache-Control', personal ? 'private, no-store' : 'public, max-age=120');
+ res.set('Vary', 'Cookie');
+ res.status(status).type('html').send(html);
+}
+
+module.exports = { layout, send, setRelease, configure, baseUrl, canonical, NAME, NETWORK, ROOM, NAV, esc, asset, assetVersion };
new file mode 100644
new file mode 100644
@@ -0,0 +1,69 @@
@@ -0,0 +1,69 @@
+'use strict';
+
+/**
+ * The public theme catalogue from OpenVibe.Network, cached in this process for five minutes.
+ *
+ * GET /api/themes is public and is asked on every page and by the sitemap, so one answer serves all of them until
+ * it is five minutes old. A failure is never cached: the next request asks again, and the page degrades honestly.
+ * The API proxy and the pages share this one client (server/app.js puts it in ctx).
+ */
+function createThemeCatalog({ config, fetchImpl = globalThis.fetch, log = console, now = () => Date.now() }) {
+ let cached = null;
+
+ async function request(path, { method = 'GET', token = null, body, timeoutMs = config.timeoutMs || 8000 } = {}) {
+ const headers = { Accept: 'application/json' };
+ if (token) headers.Authorization = `Bearer ${token}`;
+ if (body !== undefined) headers['Content-Type'] = 'application/json';
+ let res;
+ try {
+ res = await fetchImpl(`${config.networkUrl}/api/themes${path}`, {
+ method,
+ headers,
+ body: body === undefined ? undefined : JSON.stringify(body),
+ // A person's token is in the header only: it is never logged, and a redirect would not carry it to
+ // another origin (fetch drops Authorization across one).
+ signal: AbortSignal.timeout(timeoutMs),
+ });
+ } catch (err) {
+ throw Object.assign(new Error('OpenVibe.Network did not answer'), {
+ status: 502,
+ error: err && err.name === 'TimeoutError' ? 'timeout' : 'unreachable',
+ });
+ }
+ const text = await res.text().catch(() => '');
+ let data = null;
+ try { data = text ? JSON.parse(text) : null; } catch { /* not JSON: passed through as text */ }
+ return {
+ status: res.status,
+ ok: res.ok,
+ data,
+ text,
+ contentType: res.headers.get('content-type') || (data ? 'application/json' : 'text/plain'),
+ };
+ }
+
+ /** The public catalogue, `{ themes: [...] }`, from memory when it is under five minutes old. */
+ async function list({ fresh = false } = {}) {
+ const cacheMs = config.themeCacheMs == null ? 5 * 60_000 : config.themeCacheMs;
+ if (!fresh && cached && now() - cached.at < cacheMs) return cached.value;
+ const r = await request('');
+ if (!r.ok) throw Object.assign(new Error(`theme catalogue ${r.status}`), { status: r.status, response: r });
+ if (!r.data || !Array.isArray(r.data.themes)) {
+ throw Object.assign(new Error('theme catalogue answered without a themes list'), { status: 502 });
+ }
+ const value = { themes: r.data.themes };
+ cached = { at: now(), value };
+ return value;
+ }
+
+ /** One theme, as Network answers it ({ status, ok, data, text, contentType }). */
+ async function get(idOrSlug, { token = null } = {}) {
+ return request(`/${encodeURIComponent(String(idOrSlug || ''))}`, { token });
+ }
+
+ function clear() { cached = null; }
+
+ return { request, list, get, clear, get cached() { return cached; } };
+}
+
+module.exports = { createThemeCatalog };
new file mode 100644
new file mode 100644
@@ -0,0 +1,166 @@
@@ -0,0 +1,166 @@
+'use strict';
+/**
+ * The Design room's pages (plan 2026-10-28 §5.2, v1: the theme studio and rollback). Server-rendered and whole without
+ * JavaScript (the gallery and each theme's page are plain links); public/js/studio.js makes the studio live: the
+ * previews recolour as you pick or edit, the checks run, and Use, Submit and History talk to /api (server/http/api.js,
+ * which proxies Network's theme API as the signed-in person).
+ *
+ * home({ themes }) the front door: the room's hero, a strip of themes, what the studio does
+ * studio({ themes, me }) me: { signedIn, user }
+ * theme({ theme }) one theme: its colours, a preview, and "Open in the studio"
+ * developers() the API
+ * notFound()
+ */
+const layoutLib = require('../render/layout');
+const kit = require('openvibe-shared/kit');
+const sc = require('openvibe-shared/showcase');
+const rooms = require('openvibe-shared/rooms');
+
+const { layout, esc, NAME } = layoutLib;
+const ROOM = rooms.get('design');
+const listOf = (themes) => (Array.isArray(themes) ? themes : (themes && Array.isArray(themes.themes) ? themes.themes : []));
+const HEX = /^#[0-9a-f]{3,8}$/i;
+const col = (v, k, d) => (v && HEX.test(String(v[k] || '')) ? v[k] : d);
+const SWATCH = ['--bg-primary', '--bg-card', '--accent', '--text-primary'];
+const CORE = [
+ ['--bg-primary', 'Background'], ['--bg-card', 'Surface'], ['--text-primary', 'Text'],
+ ['--text-muted', 'Muted text'], ['--accent', 'Accent'], ['--border', 'Lines'],
+];
+
+/** The variables a preview frame carries inline (only allow-listed token names with colour values). */
+function varsStyle(v) {
+ return Object.entries(v || {}).filter(([k, x]) => /^--[a-z][a-z0-9-]{1,40}$/.test(k) && /^(#[0-9a-f]{3,8}|rgba?\([0-9., ]+\)|[0-9., ]+)$/i.test(String(x))).map(([k, x]) => `${k}:${x}`).join(';');
+}
+
+/** A theme as a swatch button (the studio) or link (the home and gallery without JavaScript). */
+function swatch(t, { tag = 'a' } = {}) {
+ const v = t.variables || {};
+ const dots = SWATCH.map((k) => `<i style="background:${esc(col(v, k, '#888'))}"></i>`).join('');
+ const inner = `<span class="ds-dots" aria-hidden="true">${dots}</span><span class="ds-swatch-name">${esc(t.name)}</span><span class="ds-swatch-mode">${t.mode === 'light' ? 'Light' : 'Dark'}</span>`;
+ if (tag === 'button') return `<button type="button" class="ds-swatch" data-theme-id="${esc(t.id)}" data-mode="${t.mode === 'light' ? 'light' : 'dark'}" aria-pressed="false">${inner}</button>`;
+ return `<a class="ds-swatch" href="/t/${encodeURIComponent(t.slug || t.id)}">${inner}</a>`;
+}
+
+/** The three surfaces every theme is tried on: a Live channel, a Chat room and a shop's grid (open.shoes, Deals). */
+function previews() {
+ const msg = (who, hue, text) => `<li><span class="pv-av" style="--h:${hue}">${esc(who.slice(0, 1))}</span><span><b>${esc(who)}</b> ${esc(text)}</span></li>`;
+ const shoe = (name, price, was, best) => `<li class="pv-shoe"><span class="pv-shoe-pic" aria-hidden="true">${kit.icon('shoe')}</span><b>${esc(name)}</b><span class="pv-price">${esc(price)}${was ? ` <s>${esc(was)}</s>` : ''}</span>${best ? '<em class="pv-chip">Best price</em>' : ''}</li>`;
+ return `<div class="pv-frame pv-live" aria-label="Preview: a Live channel"><p class="pv-label">OpenVibe.Live</p>
+<div class="pv-video"><span class="pv-badge">LIVE</span><span class="pv-viewers">1.2k watching</span></div>
+<div class="pv-row"><span class="pv-av pv-av-lg" style="--h:30">G</span><span class="pv-col"><b>Seattle at night, chat picks the route</b><small>goosely · IRL</small></span><button type="button" class="pv-btn" tabindex="-1">Follow</button></div>
+<ul class="pv-chat">${msg('maru', 200, 'left at the light!')}${msg('kiwi', 120, 'the view from here 😮')}${msg('teddy', 320, 'clip that')}</ul></div>
+<div class="pv-frame pv-chatroom" aria-label="Preview: a Chat room"><p class="pv-label">OpenVibe.Chat</p>
+<p class="pv-room"># night-owls <span class="pv-muted">· 38 here</span></p>
+<ul class="pv-chat pv-chat-lg">${msg('ana', 10, 'anyone up for the surf race?')}${msg('jules', 260, 'in five, warming up on utopia')}<li class="pv-me"><span>count me in</span></li></ul>
+<div class="pv-composer"><span>Message #night-owls</span><button type="button" class="pv-send" tabindex="-1" aria-hidden="true">${kit.icon('send')}</button></div></div>
+<div class="pv-frame pv-shop" aria-label="Preview: a shop's grid"><p class="pv-label">open.shoes</p>
+<p class="pv-chips"><span class="is-on">Running</span><span>Trail</span><span>Size 10</span></p>
+<ul class="pv-grid">${shoe('Cloudrunner 2', '$119', '$150', true)}${shoe('Trail Pro', '$139')}${shoe('Daily 3', '$89', '$110')}${shoe('Racer X', '$179')}</ul></div>`;
+}
+
+const CVD = `<svg width="0" height="0" style="position:absolute" aria-hidden="true" focusable="false"><defs>
+<filter id="ds-cvd-protan"><feColorMatrix type="matrix" values="0.152 1.053 -0.205 0 0 0.115 0.786 0.099 0 0 -0.004 -0.048 1.052 0 0 0 0 0 1 0"/></filter>
+<filter id="ds-cvd-deutan"><feColorMatrix type="matrix" values="0.367 0.861 -0.228 0 0 0.280 0.673 0.047 0 0 -0.012 0.043 0.969 0 0 0 0 0 1 0"/></filter>
+<filter id="ds-cvd-tritan"><feColorMatrix type="matrix" values="1.256 -0.077 -0.179 0 0 -0.078 0.931 0.148 0 0 0.005 0.691 0.304 0 0 0 0 0 1 0"/></filter></defs></svg>`;
+
+function home({ themes } = {}) {
+ const all = listOf(themes);
+ const picks = ['vibe', 'violet-hour', 'forest', 'neon-tokyo', 'sunset', 'cloud', 'daylight', 'meadow'].map((id) => all.find((t) => t.id === id)).filter(Boolean);
+ const shown = picks.concat(all.filter((t) => !picks.includes(t))).slice(0, 8);
+ const strip = shown.map((t) => `<li>${swatch(t)}</li>`).join('');
+ const orb = `<div class="ds-orb" aria-hidden="true"><span class="ds-orb-ring"></span><span class="ds-orb-core"></span>${(picks.length ? picks : all).slice(0, 6).map((t, i) => `<i style="--i:${i};background:${esc(col(t.variables, '--accent', '#888'))}"></i>`).join('')}</div>`;
+ const body = sc.room({
+ room: 'design',
+ hero: {
+ title: ROOM.line,
+ lede: 'Pick a theme and watch Live, Chat and a shop wear it side by side. Change a colour, see every contrast check pass or fail, and use it on every OpenVibe site at once. Any earlier look is one tap back.',
+ start: { href: '/studio', label: 'Open the studio' },
+ chips: picks.slice(0, 5).map((t) => ({ label: t.name, href: `/studio?theme=${encodeURIComponent(t.id)}` })),
+ motif: orb,
+ },
+ proof: [{ value: all.length, label: all.length === 1 ? 'theme to try' : 'themes to try' }, { value: all.filter((t) => t.mode === 'light').length, label: 'with a light side' }].filter((p) => p.value),
+ html: strip ? `<section aria-labelledby="ds-strip-h"><div class="ds-head-row"><h2 id="ds-strip-h">Themes to try</h2><a class="ds-more" href="/studio">All of them in the studio${kit.icon('chevron')}</a></div><ul class="ds-strip">${strip}</ul></section>` : '',
+ scenes: [
+ { title: 'One theme, three sites, side by side', text: 'Every theme is tried on a Live channel, a Chat room and a shop\'s grid at once, so you see the buttons, the chat and the prices before you choose.', html: `<div class="ds-scene-pv">${previews()}</div>`, action: { href: '/studio', label: 'Try one' } },
+ { title: 'Checks that must pass', text: 'Text on every surface, buttons, links and muted text are measured against WCAG as you edit, and the previews can be seen as people with colour-vision differences see them.', html: `<ul class="ds-checks is-demo"><li class="is-pass"><b>Text on background</b><span>14.2:1</span></li><li class="is-pass"><b>Button text</b><span>7.1:1</span></li><li class="is-fail"><b>Muted text on surface</b><span>3.1:1 · needs 4.5</span></li></ul>`, action: { href: '/studio', label: 'Edit a theme' } },
+ ],
+ explore: { title: 'More on Design', items: [
+ { title: 'The studio', text: 'Pick, edit, check and use a theme', href: '/studio', icon: 'ov:theme' },
+ { title: 'Your themes on Network', text: 'Display, motion and text size', href: 'https://openvibe.network/my', icon: 'ov:account' },
+ { title: 'The API', text: 'The theme catalog as open JSON', href: '/developers', icon: 'ov:code' },
+ ] },
+ faq: { items: [
+ ['Where does my theme apply?', 'Everywhere you are signed in to OpenVibe: the theme lives on your account, and every site picks it up on its next page.'],
+ ['Can I undo a change?', 'Yes. Every change keeps the look it replaced; the studio\'s history brings any of the last fifty back.'],
+ ['Can others use my theme?', 'Submit it to the gallery. A person reviews each submission before anyone else sees it.'],
+ ] },
+ });
+ return layout({ title: null, path: '/', body: `<div class="ds-wrap">${body}</div>`, active: '/' });
+}
+
+function studio({ themes, me = {} } = {}) {
+ const all = listOf(themes).filter((t) => t && t.id);
+ const signedIn = !!me.signedIn;
+ const gallery = all.map((t) => `<li>${swatch(t, { tag: 'button' })}</li>`).join('');
+ const data = JSON.stringify(all.map((t) => ({ id: t.id, name: t.name, mode: t.mode, variables: t.variables || {} }))).replace(/</g, '\\u003c');
+ const body = `${CVD}<div class="ds-studio" data-signed-in="${signedIn ? '1' : '0'}">
+<header class="ds-studio-h"><div><p class="ds-kicker">Theme studio</p><h1>Make it yours</h1>
+<p class="ds-lede">Pick a theme, change any colour, and see it on three sites at once. Every check must pass before it can be used.</p></div>
+${signedIn ? `<p class="ds-sign ds-fine">Signed in as <b>${esc((me.user && (me.user.display_name || me.user.username)) || 'you')}</b>: Use changes your look on every OpenVibe site.</p>` : `<p class="ds-sign">${kit.button({ href: '/auth/login?next=%2Fstudio', label: 'Sign in to use a theme', kind: 'quiet', small: true })}</p>`}</header>
+<div class="ds-grid">
+<aside class="ds-gallery" aria-labelledby="ds-gal-h"><div class="ds-gal-head"><h2 id="ds-gal-h">Themes</h2>
+<div class="ds-seg" role="group" aria-label="Show"><button type="button" data-show="all" aria-pressed="true">All</button><button type="button" data-show="dark" aria-pressed="false">Dark</button><button type="button" data-show="light" aria-pressed="false">Light</button></div></div>
+<ul class="ds-gal-list">${gallery || '<li class="ds-fine">The catalog is not answering. Try again in a minute.</li>'}</ul></aside>
+<section class="ds-stage" aria-labelledby="ds-stage-h"><div class="ds-stage-head"><h2 id="ds-stage-h"><span id="ds-current">Your current theme</span></h2>
+<label class="ds-see">See it as <select id="ds-cvd"><option value="">Typical colour vision</option><option value="protan">Protanopia (red-blind)</option><option value="deutan">Deuteranopia (green-blind)</option><option value="tritan">Tritanopia (blue-blind)</option><option value="gray">Grayscale</option></select></label></div>
+<div class="ds-previews" id="ds-previews">${previews()}</div></section>
+<aside class="ds-editor" aria-labelledby="ds-ed-h"><h2 id="ds-ed-h">Edit</h2>
+<div class="ds-fields">${CORE.map(([k, l]) => `<label class="ds-field"><span>${esc(l)}</span><input type="color" data-var="${k}" aria-label="${esc(l)}"><input type="text" data-hex="${k}" inputmode="text" maxlength="7" spellcheck="false" aria-label="${esc(l)}, hex"></label>`).join('')}</div>
+<h3>Checks</h3><ul class="ds-checks" id="ds-checks" aria-live="polite"><li class="ds-fine">Pick a theme to check it.</li></ul>
+<div class="ds-actions"><button type="button" class="ovk-btn ovk-btn--primary" id="ds-use" disabled>${signedIn ? 'Use this theme' : 'Sign in to use it'}</button>
+<button type="button" class="ovk-btn ovk-btn--quiet" id="ds-reset" disabled>Undo my edits</button></div>
+<p class="ds-status" id="ds-status" role="status"></p>
+<details class="ds-submit"><summary>Share it in the gallery</summary><form id="ds-submit-form"><label>Name <input type="text" id="ds-name" maxlength="60" minlength="2" required placeholder="Cozy autumn"></label>
+<label>One line about it <input type="text" id="ds-desc" maxlength="300" placeholder="Warm browns and a pumpkin accent"></label>
+<button type="submit" class="ovk-btn ovk-btn--quiet" ${signedIn ? '' : 'disabled'}>Send for review</button><p class="ds-fine">A person reviews each theme before anyone else sees it.</p></form></details>
+${signedIn ? '<details class="ds-history" id="ds-history"><summary>History</summary><ol id="ds-history-list"><li class="ds-fine">Your earlier looks appear here.</li></ol></details>' : ''}
+</aside></div></div>
+<script type="application/json" id="ds-themes">${data}</script>`;
+ return layout({ title: 'Theme studio', description: 'Pick an OpenVibe theme, edit any colour with contrast and colour-vision checks, see it on Live, Chat and a shop at once, and use it everywhere.', path: '/studio', body: `<div class="ds-wrap">${body}</div>`, active: '/studio', scripts: ['js/studio.js'] });
+}
+
+function theme({ theme: t } = {}) {
+ const v = (t && t.variables) || {};
+ const rows = CORE.map(([k, l]) => (HEX.test(String(v[k] || '')) ? `<div><dt>${esc(l)}</dt><dd><i style="background:${esc(v[k])}"></i><code>${esc(v[k])}</code></dd></div>` : '')).join('');
+ const body = `<header class="ds-page-h"><p class="ds-kicker">${t.mode === 'light' ? 'Light theme' : 'Dark theme'}</p><h1>${esc(t.name)}</h1>${t.description ? `<p class="ds-lede">${esc(t.description)}</p>` : ''}
+<p class="ds-act">${kit.button({ href: `/studio?theme=${encodeURIComponent(t.id)}`, label: 'Open in the studio' })} ${kit.button({ href: `/api/themes/${encodeURIComponent(t.slug || t.id)}`, label: 'As JSON', kind: 'quiet' })}</p></header>
+${rows ? `<dl class="ds-colours">${rows}</dl>` : ''}
+<section aria-labelledby="ds-pv-h"><h2 id="ds-pv-h">How it looks</h2><div class="ds-previews ds-previews--static" style="${esc(varsStyle(v))}">${previews()}</div></section>`;
+ return layout({ title: `${t.name}: an OpenVibe theme`, description: t.description || `${t.name}, a ${t.mode === 'light' ? 'light' : 'dark'} OpenVibe theme: its colours and how Live, Chat and a shop look in it.`, path: `/t/${encodeURIComponent(t.slug || t.id)}`, body: `<div class="ds-wrap">${body}</div>`, active: '/studio' });
+}
+
+function developers() {
+ const rows = [
+ ['GET /api/themes', 'Every public OpenVibe theme with its colours (Network\'s catalog).'],
+ ['GET /api/themes/:id', 'One theme.'],
+ ['GET /api/me/theme', 'Your active theme (signed in).'],
+ ['PUT /api/me/theme', 'Use a theme, with optional custom colours (signed in; from this site only).'],
+ ['GET /api/me/theme/history', 'Your earlier looks, newest first; POST /api/me/theme/history/:id/restore brings one back.'],
+ ];
+ const body = `<header class="ds-page-h"><p class="ds-kicker">For developers</p><h1>The Design API</h1><p class="ds-lede">The theme catalog is open JSON. A theme is a set of CSS custom properties every OpenVibe site reads; Network keeps which one each person uses.</p></header>
+<section aria-labelledby="ds-ep-h"><h2 id="ds-ep-h">Endpoints</h2><dl class="ds-eps">${rows.map(([ep, what]) => `<div><dt><code>${esc(ep)}</code></dt><dd>${esc(what)}</dd></div>`).join('')}</dl></section>
+<p class="ds-fine">Themes also export and import as <code>openvibe-theme@1</code> files through <a href="https://openvibe.network/api/themes">Network's theme API</a>.</p>`;
+ return layout({ title: 'The Design API', path: '/developers', body: `<div class="ds-wrap">${body}</div>`, active: '/developers' });
+}
+
+function notFound() {
+ const body = `<header class="ds-page-h"><h1>Nothing here</h1><p class="ds-lede">That page does not exist. <a href="/studio">Open the studio</a> or <a href="/">browse the themes</a>.</p></header>`;
+ return layout({ title: 'Not found', robots: 'noindex, follow', body: `<div class="ds-wrap">${body}</div>`, active: '/' });
+}
+
+module.exports = {
+ home, studio, theme, developers, notFound,
+ layout,
+ setRelease: layoutLib.setRelease,
+ configure: layoutLib.configure,
+};
new file mode 100644
new file mode 100644
@@ -0,0 +1,85 @@
@@ -0,0 +1,85 @@
+'use strict';
+/**
+ * Boots OpenVibe.Design on a random port against an in-process Network (test/helpers/network.js), and returns a
+ * small HTTP client. Every test file gets its own process, Network and app.
+ *
+ * const t = await boot();
+ * t.get(path, { as: user, cookie, json, headers, method })
+ * t.signIn(user) → cookie header value (design_at = a Network user token, as after /auth/callback)
+ * t.logs(), t.close()
+ */
+const http = require('http');
+const { startNetwork } = require('./network');
+
+async function boot(opts = {}) {
+ const network = await startNetwork(opts.network || {});
+ const env = {
+ NODE_ENV: 'test', PORT: '0', BASE_URL: 'https://openvibe.design', TRUST_PROXY: '1',
+ OV_NETWORK_URL: network.url, OV_NETWORK_INTERNAL_URL: network.url, OV_NETWORK_ISSUER: network.url,
+ OV_OAUTH_CLIENT_ID: 'design', OV_OAUTH_CLIENT_SECRET: 'design-secret', COOKIE_SECURE: 'false',
+ DESIGN_RATE_LIMIT_PER_MIN: '100000',
+ ...(opts.env || {}),
+ };
+ for (const [k, v] of Object.entries(opts.env || {})) if (v === null) delete env[k];
+
+ const logLines = [];
+ const log = {
+ log: (...a) => logLines.push(a.map(String).join(' ')),
+ info: (...a) => logLines.push(a.map(String).join(' ')),
+ warn: (...a) => logLines.push(a.map(String).join(' ')),
+ error: (...a) => logLines.push(a.map(String).join(' ')),
+ };
+
+ const configLib = require('../../server/config');
+ const { createApp } = require('../../server/app');
+ const config = configLib.load(env);
+ const built = createApp({ config, log, now: opts.now });
+ await built.ctx.keys.ensure();
+ const server = await new Promise((resolve) => { const s = http.createServer(built.app); s.listen(0, '127.0.0.1', () => resolve(s)); });
+ const base = `http://127.0.0.1:${server.address().port}`;
+
+ const signIn = (user) => `design_at=${network.userToken(user)}`;
+
+ async function get(p, o = {}) {
+ const headers = { ...(o.headers || {}) };
+ if (o.as) headers.cookie = [signIn(o.as), headers.cookie].filter(Boolean).join('; ');
+ if (o.cookie) headers.cookie = o.cookie;
+ let body = o.body;
+ if (o.json !== undefined) { body = JSON.stringify(o.json); headers['content-type'] = 'application/json'; }
+ const res = await fetch(base + p, { method: o.method || (body ? 'POST' : 'GET'), headers, body, redirect: 'manual' });
+ const text = Buffer.from(await res.arrayBuffer()).toString('utf8');
+ return {
+ status: res.status,
+ headers: res.headers,
+ text,
+ json() { return JSON.parse(text); },
+ };
+ }
+
+ return {
+ base, network, config, ctx: built.ctx, get, signIn,
+ logs: () => logLines.join('\n'),
+ async close() {
+ await new Promise((r) => server.close(r));
+ built.ctx.keys.client.stop();
+ await network.close();
+ },
+ };
+}
+
+let failures = 0;
+async function check(name, fn) {
+ try {
+ await fn();
+ process.stdout.write(` ✓ ${name}\n`);
+ } catch (e) {
+ failures++;
+ process.stdout.write(` ✗ ${name}\n ${(e.stack || String(e)).split('\n').slice(0, 10).join('\n ')}\n`);
+ }
+}
+function done() {
+ process.stdout.write(failures ? `\n${failures} failed\n` : '\nall passed\n');
+ process.exit(failures ? 1 : 0);
+}
+
+module.exports = { boot, check, done };
new file mode 100644
new file mode 100644
@@ -0,0 +1,160 @@
@@ -0,0 +1,160 @@
+'use strict';
+/**
+ * An in-process stand-in for OpenVibe.Network: a real RS256 key pair and JWKS, /oauth/token with PKCE S256,
+ * /oauth/revoke, the public theme catalogue and the person's theme routes. Every request is recorded so a test can
+ * assert what was (and was not) called. setDown(true) makes every answer a 503, which is how the proxy sees a
+ * Network failure without closing the socket under a test.
+ */
+const http = require('http');
+const crypto = require('crypto');
+
+const b64 = (o) => Buffer.from(JSON.stringify(o)).toString('base64url');
+function signJwt(claims, privateKey) {
+ const input = `${b64({ alg: 'RS256', typ: 'JWT' })}.${b64(claims)}`;
+ return `${input}.${crypto.sign('RSA-SHA256', Buffer.from(input), privateKey).toString('base64url')}`;
+}
+
+function listen(handler) {
+ return new Promise((resolve) => {
+ const sockets = new Set();
+ const server = http.createServer((req, res) => {
+ const chunks = [];
+ req.on('data', (c) => chunks.push(c));
+ req.on('end', () => {
+ const raw = Buffer.concat(chunks);
+ const json = (status, obj, headers = {}) => {
+ res.writeHead(status, { 'Content-Type': 'application/json', ...headers });
+ res.end(JSON.stringify(obj));
+ };
+ Promise.resolve(handler(req, raw, json, res)).catch((err) => json(500, { error: String(err && err.message) }));
+ });
+ });
+ server.on('connection', (s) => { sockets.add(s); s.on('close', () => sockets.delete(s)); });
+ server.listen(0, '127.0.0.1', () => resolve({
+ server,
+ url: `http://127.0.0.1:${server.address().port}`,
+ close: () => new Promise((r) => { for (const s of sockets) s.destroy(); server.close(r); }),
+ }));
+ });
+}
+
+const DEFAULT_THEMES = [
+ { id: 'vibe', name: 'Vibe', slug: 'vibe', description: 'The default OpenVibe theme.', mode: 'dark', variables: { '--bg-primary': '#0b0f1a', '--text-primary': '#e6edf7' }, tags: ['default'], is_builtin: 1 },
+ { id: 'aurora', name: 'Aurora', slug: 'aurora', description: 'A cold light over the network.', mode: 'dark', variables: { '--bg-primary': '#07131f', '--text-primary': '#dff3ff' }, tags: ['cool'] },
+ { id: 'paper', name: 'Paper', slug: 'paper', description: 'A quiet light theme.', mode: 'light', variables: { '--bg-primary': '#fbfaf7', '--text-primary': '#22201d' }, tags: ['light'] },
+];
+
+async function startNetwork({ themes = DEFAULT_THEMES } = {}) {
+ const { publicKey, privateKey } = crypto.generateKeyPairSync('rsa', { modulusLength: 2048 });
+ const publicPem = publicKey.export({ type: 'spki', format: 'pem' });
+ const privatePem = privateKey.export({ type: 'pkcs8', format: 'pem' });
+ const st = {
+ themes: themes.map((t) => ({ ...t })),
+ users: new Map(), codes: new Map(), refresh: new Map(),
+ down: false, catalogRequests: 0, requests: [], tokenRequests: [],
+ catalogStatus: 200, submitStatus: 201, delayMs: 0,
+ };
+ let issuer = null;
+ let nextUserId = 1;
+
+ function addUser(username, { role = 'user' } = {}) {
+ const u = { id: nextUserId++, subject: `usr_${crypto.randomBytes(12).toString('hex')}`, username, display_name: username, role };
+ st.users.set(u.id, u);
+ return u;
+ }
+ function userToken(u, { ttl = 3600 } = {}) {
+ const now = Math.floor(Date.now() / 1000);
+ return signJwt({ iss: issuer, sub: u.id, subject_id: u.subject, username: u.username, display_name: u.display_name, role: u.role, aud: ['openvibe.network'], iat: now, exp: now + ttl }, privatePem);
+ }
+ const bearer = (req) => {
+ const h = String(req.headers.authorization || '');
+ return h.startsWith('Bearer ') ? h.slice(7) : null;
+ };
+
+ const srv = await listen(async (req, raw, json) => {
+ const url = new URL(req.url, 'http://x');
+ const text = raw.toString('utf8');
+ let body = {};
+ try { body = text ? JSON.parse(text) : {}; } catch { body = {}; }
+ st.requests.push({ method: req.method, path: url.pathname, authorization: req.headers.authorization || null, body: text });
+ if (st.delayMs) await new Promise((r) => setTimeout(r, st.delayMs));
+ if (st.down) return json(503, { error: 'Network is restarting' });
+
+ if (url.pathname === '/api/.well-known/jwks') return json(200, { public_key: publicPem, algorithm: 'RS256' });
+ if (url.pathname === '/oauth/revoke') return json(200, {});
+ if (url.pathname === '/oauth/token' && req.method === 'POST') {
+ const form = Object.fromEntries(new URLSearchParams(text));
+ st.tokenRequests.push(form);
+ if (form.client_id !== 'design' || form.client_secret !== 'design-secret') return json(401, { error: 'invalid_client', error_description: 'bad client secret' });
+ if (form.grant_type === 'authorization_code') {
+ const c = st.codes.get(form.code);
+ if (!c) return json(400, { error: 'invalid_grant', error_description: 'unknown code' });
+ st.codes.delete(form.code);
+ const challenge = crypto.createHash('sha256').update(String(form.code_verifier || '')).digest('base64url');
+ if (challenge !== c.challenge) return json(400, { error: 'invalid_grant', error_description: 'PKCE verification failed' });
+ const rt = `rt_${crypto.randomBytes(12).toString('hex')}`;
+ st.refresh.set(rt, c.user);
+ return json(200, { access_token: userToken(c.user), refresh_token: rt, token_type: 'Bearer' });
+ }
+ if (form.grant_type === 'refresh_token') {
+ const u = st.refresh.get(form.refresh_token);
+ if (!u) return json(400, { error: 'invalid_grant', error_description: 'refresh token rejected' });
+ st.refresh.delete(form.refresh_token);
+ const rt = `rt_${crypto.randomBytes(12).toString('hex')}`;
+ st.refresh.set(rt, u);
+ return json(200, { access_token: userToken(u), refresh_token: rt, token_type: 'Bearer' });
+ }
+ return json(400, { error: 'unsupported_grant_type' });
+ }
+
+ if (url.pathname === '/api/themes' && req.method === 'GET') {
+ st.catalogRequests++;
+ if (st.catalogStatus !== 200) return json(st.catalogStatus, { error: 'catalogue unavailable' });
+ return json(200, { themes: st.themes });
+ }
+ if (url.pathname === '/api/themes/me/active' && req.method === 'GET') {
+ if (!bearer(req)) return json(401, { error: 'Authentication required' });
+ return json(200, { theme_id: 'vibe', custom_variables: { '--bg-primary': '#0b0f1a' }, display: null });
+ }
+ if (url.pathname === '/api/themes/me' && req.method === 'PUT') {
+ if (!bearer(req)) return json(401, { error: 'Authentication required' });
+ return json(200, { success: true, theme_id: body.theme_id, custom_variables: body.custom_variables || null, source: body.source });
+ }
+ if (url.pathname === '/api/themes/me/history' && req.method === 'GET') {
+ if (!bearer(req)) return json(401, { error: 'Authentication required' });
+ return json(200, { history: [{ id: 2, theme_id: 'aurora', created_at: '2026-10-28T00:00:00.000Z' }, { id: 1, theme_id: 'vibe', created_at: '2026-10-27T00:00:00.000Z' }] });
+ }
+ const restore = /^\/api\/themes\/me\/history\/(\d+)\/restore$/.exec(url.pathname);
+ if (restore && req.method === 'POST') {
+ if (!bearer(req)) return json(401, { error: 'Authentication required' });
+ return json(200, { success: true, id: Number(restore[1]), theme_id: 'vibe' });
+ }
+ if (url.pathname === '/api/themes' && req.method === 'POST') {
+ if (!bearer(req)) return json(401, { error: 'Authentication required' });
+ const status = body.slug === 'taken' ? 422 : st.submitStatus;
+ if (status !== 201) return json(status, { error: 'Theme rejected', code: 'theme.invalid_variables', errors: ['--bg-primary must be a colour'] });
+ return json(201, { theme: { id: `community-${body.slug}`, ...body }, review: 'pending' });
+ }
+ const one = /^\/api\/themes\/([^/]+)$/.exec(url.pathname);
+ if (one && req.method === 'GET') {
+ const t = st.themes.find((x) => x.id === decodeURIComponent(one[1]) || x.slug === decodeURIComponent(one[1]));
+ if (!t) return json(404, { error: 'Theme not found' });
+ return json(200, { theme: t });
+ }
+ return json(404, { error: 'not found' });
+ });
+ issuer = srv.url;
+
+ return {
+ url: srv.url, publicPem, privatePem, state: st,
+ themes: st.themes, requests: st.requests, tokenRequests: st.tokenRequests,
+ addUser, userToken,
+ issueCode(user, challenge) { const code = `code_${crypto.randomBytes(8).toString('hex')}`; st.codes.set(code, { user, challenge }); return code; },
+ setDown(v) { st.down = Boolean(v); },
+ setCatalogStatus(v) { st.catalogStatus = v; },
+ setDelay(ms) { st.delayMs = ms; },
+ close: srv.close,
+ };
+}
+
+module.exports = { startNetwork, signJwt, DEFAULT_THEMES };
new file mode 100644
new file mode 100644
@@ -0,0 +1,108 @@
@@ -0,0 +1,108 @@
+'use strict';
+/**
+ * The pages and the plumbing: /, /studio, /t/:slug, /developers, the 404; public vs signed-in cache policy; the
+ * crawl artifacts (robots.txt, sitemap.xml with the public themes, llms.txt); health and truthful readiness; the
+ * release manifest and content-hashed static assets.
+ */
+const assert = require('assert');
+const { boot, check, done } = require('./helpers/boot');
+const { assetVersion } = require('../server/assets');
+
+(async () => {
+ const t = await boot();
+ const user = t.network.addUser('kim');
+
+ await check('the home page lists the catalogue, escaped, and is publicly cacheable', async () => {
+ const r = await t.get('/');
+ assert.strictEqual(r.status, 200);
+ assert.match(r.text, /Make it yours/);
+ assert.match(r.text, /<a class="ds-swatch" href="\/t\/aurora">[\s\S]*?<span class="ds-swatch-name">Aurora<\/span>/);
+ assert.match(r.text, /<main id="main"/);
+ assert.strictEqual(r.headers.get('cache-control'), 'public, max-age=120');
+ assert.match(r.headers.get('vary'), /Cookie/i);
+ });
+
+ await check('/studio includes the studio script and stylesheet, and says who is signed in', async () => {
+ const r = await t.get('/studio');
+ assert.strictEqual(r.status, 200);
+ assert.match(r.text, /\/js\/studio\.js\?v=[0-9a-f]{10}/);
+ assert.match(r.text, /\/css\/design\.css\?v=[0-9a-f]{10}/);
+ assert.match(r.text, /Sign in to use a theme/);
+ assert.strictEqual(r.headers.get('cache-control'), 'public, max-age=120');
+ const me = await t.get('/studio', { as: user });
+ assert.strictEqual(me.status, 200);
+ assert.match(me.text, /kim/);
+ assert.strictEqual(me.headers.get('cache-control'), 'private, no-store', 'a signed-in page is never cached');
+ });
+
+ await check('one theme, a missing theme, developers and an unknown page', async () => {
+ const one = await t.get('/t/aurora');
+ assert.strictEqual(one.status, 200);
+ assert.match(one.text, /Aurora/);
+ assert.match(one.text, /--bg-primary/);
+ const missing = await t.get('/t/nope');
+ assert.strictEqual(missing.status, 404);
+ assert.match(missing.text, /Nothing here/);
+ const dev = await t.get('/developers');
+ assert.strictEqual(dev.status, 200);
+ assert.match(dev.text, /GET \/api\/themes/);
+ const gone = await t.get('/not-a-page');
+ assert.strictEqual(gone.status, 404);
+ });
+
+ await check('robots.txt, sitemap.xml and llms.txt describe the public pages', async () => {
+ const robots = await t.get('/robots.txt');
+ assert.strictEqual(robots.status, 200);
+ assert.match(robots.text, /Sitemap: https:\/\/openvibe\.design\/sitemap\.xml/);
+ assert.match(robots.text, /Disallow: \/api\//);
+ const sitemap = await t.get('/sitemap.xml');
+ assert.strictEqual(sitemap.status, 200);
+ assert.match(sitemap.headers.get('content-type'), /application\/xml/);
+ assert.match(sitemap.text, /<loc>https:\/\/openvibe\.design\/<\/loc>/);
+ assert.match(sitemap.text, /<loc>https:\/\/openvibe\.design\/studio<\/loc>/);
+ assert.match(sitemap.text, /<loc>https:\/\/openvibe\.design\/t\/aurora<\/loc>/);
+ const llms = await t.get('/llms.txt');
+ assert.strictEqual(llms.status, 200);
+ assert.match(llms.text, /OpenVibe\.Design/);
+ assert.match(llms.text, /https:\/\/openvibe\.design\/api\/themes/);
+ });
+
+ await check('health and readiness are honest; a Network outage is degraded, not down', async () => {
+ const health = await t.get('/api/health');
+ assert.strictEqual(health.status, 200);
+ assert.strictEqual(health.json().status, 'ok');
+ assert.strictEqual(health.json().service, 'openvibe-design');
+ assert.strictEqual(health.json().version, '0.1.0');
+ const ready = await t.get('/api/ready');
+ assert.strictEqual(ready.status, 200);
+ assert.strictEqual(ready.json().ready, true);
+ assert.strictEqual(ready.json().checks.network.status, 'ok');
+ t.network.setDown(true);
+ const degraded = await t.get('/api/ready');
+ t.network.setDown(false);
+ assert.strictEqual(degraded.status, 200, 'the process still serves');
+ assert.strictEqual(degraded.json().ready, true);
+ assert.strictEqual(degraded.json().status, 'degraded');
+ assert.ok(degraded.json().degraded.includes('network'));
+ });
+
+ await check('the release manifest and content-hashed static assets', async () => {
+ const rel = await t.get('/release.json');
+ assert.strictEqual(rel.status, 200);
+ assert.strictEqual(rel.json().service, 'design');
+ assert.match(rel.headers.get('content-type'), /application\/json/);
+ const css = await t.get('/css/design.css');
+ assert.strictEqual(css.status, 200);
+ const hashed = await t.get(`/css/design.css?v=${assetVersion('css/design.css')}`);
+ assert.strictEqual(hashed.status, 200);
+ assert.strictEqual(hashed.headers.get('cache-control'), 'public, max-age=31536000, immutable');
+ const js = await t.get(`/js/studio.js?v=${assetVersion('js/studio.js')}`);
+ assert.strictEqual(js.status, 200);
+ assert.match(js.headers.get('content-type'), /javascript/);
+ const shared = await t.get('/shared/room.css');
+ assert.strictEqual(shared.status, 200);
+ });
+
+ await t.close();
+ done();
+})().catch((err) => { console.error(err); process.exit(1); });
new file mode 100644
new file mode 100644
@@ -0,0 +1,126 @@
@@ -0,0 +1,126 @@
+'use strict';
+/**
+ * The theme API proxy: the catalogue is cached, /api/me/theme is 401 signed out, a PUT forwards the person's token
+ * and source 'studio', a cross-site Origin is 403 design.cross_site, a Network 422 passes through, and a Network
+ * failure is 502. Also the history restore's positive-integer check.
+ */
+const assert = require('assert');
+const { boot, check, done } = require('./helpers/boot');
+
+const ORIGIN = 'https://openvibe.design';
+
+(async () => {
+ const t = await boot();
+ const user = t.network.addUser('kim');
+ const token = t.network.userToken(user);
+ const signedIn = { cookie: `design_at=${token}` };
+ const writes = (path) => t.network.requests.filter((r) => r.method !== 'GET' && r.path === path);
+
+ await check('GET /api/themes serves the catalogue from memory for five minutes', async () => {
+ const before = t.network.state.catalogRequests;
+ const one = await t.get('/api/themes');
+ assert.strictEqual(one.status, 200);
+ assert.strictEqual(one.json().themes.length, 3);
+ assert.strictEqual(t.network.state.catalogRequests, before + 1);
+ const two = await t.get('/api/themes');
+ assert.strictEqual(two.status, 200);
+ assert.strictEqual(two.json().themes[1].slug, 'aurora');
+ assert.strictEqual(t.network.state.catalogRequests, before + 1, 'the second read is the cached one');
+ });
+
+ await check('GET /api/me/theme is a 401 problem when signed out, and private, no-store', async () => {
+ const r = await t.get('/api/me/theme');
+ assert.strictEqual(r.status, 401);
+ assert.match(r.headers.get('content-type'), /application\/problem\+json/);
+ assert.strictEqual(r.json().code, 'token.required');
+ assert.strictEqual(r.headers.get('cache-control'), 'private, no-store');
+ });
+
+ await check('GET /api/me/theme returns theme_id, theme and custom_variables with the person\'s token', async () => {
+ const r = await t.get('/api/me/theme', signedIn);
+ assert.strictEqual(r.status, 200, r.text);
+ const b = r.json();
+ assert.strictEqual(b.theme_id, 'vibe');
+ assert.strictEqual(b.theme.slug, 'vibe');
+ assert.deepStrictEqual(b.custom_variables, { '--bg-primary': '#0b0f1a' });
+ assert.strictEqual(r.headers.get('cache-control'), 'private, no-store');
+ const active = t.network.requests.filter((x) => x.path === '/api/themes/me/active').pop();
+ assert.strictEqual(active.authorization, `Bearer ${token}`);
+ });
+
+ await check('PUT /api/me/theme forwards the token and source "studio"', async () => {
+ const r = await t.get('/api/me/theme', {
+ ...signedIn,
+ method: 'PUT',
+ json: { theme_id: 'aurora', custom_variables: { '--bg-primary': '#07131f' } },
+ headers: { origin: ORIGIN },
+ });
+ assert.strictEqual(r.status, 200, r.text);
+ assert.strictEqual(r.json().source, 'studio');
+ const sent = writes('/api/themes/me').pop();
+ assert.ok(sent, 'Network received PUT /api/themes/me');
+ assert.strictEqual(sent.authorization, `Bearer ${token}`);
+ const body = JSON.parse(sent.body);
+ assert.deepStrictEqual(body, { theme_id: 'aurora', custom_variables: { '--bg-primary': '#07131f' }, source: 'studio' });
+ assert.ok(!t.logs().includes(token), 'the token is never logged');
+ });
+
+ await check('a write with another site\'s Origin is 403 design.cross_site (and never reaches Network)', async () => {
+ const before = writes('/api/themes/me').length;
+ const r = await t.get('/api/me/theme', {
+ ...signedIn,
+ method: 'PUT',
+ json: { theme_id: 'paper' },
+ headers: { origin: 'https://evil.example' },
+ });
+ assert.strictEqual(r.status, 403);
+ assert.match(r.headers.get('content-type'), /application\/problem\+json/);
+ assert.strictEqual(r.json().code, 'design.cross_site');
+ assert.strictEqual(writes('/api/themes/me').length, before, 'no Network write');
+ const missing = await t.get('/api/me/theme', { ...signedIn, method: 'PUT', json: { theme_id: 'paper' } });
+ assert.strictEqual(missing.status, 403, 'no Origin is not this site');
+ });
+
+ await check('a Network 422 answer passes through with its status and body', async () => {
+ const r = await t.get('/api/themes/submit', {
+ ...signedIn,
+ method: 'POST',
+ json: { name: 'Taken', slug: 'taken', description: '', mode: 'dark', variables: { '--bg-primary': 'nope' }, tags: [] },
+ headers: { origin: ORIGIN },
+ });
+ assert.strictEqual(r.status, 422, r.text);
+ const b = r.json();
+ assert.strictEqual(b.code, 'theme.invalid_variables');
+ assert.ok(Array.isArray(b.errors));
+ });
+
+ await check('history reads and restores through the proxy; a bad id is 400', async () => {
+ const history = await t.get('/api/me/theme/history', signedIn);
+ assert.strictEqual(history.status, 200);
+ assert.strictEqual(history.json().history.length, 2);
+ for (const id of ['0', '-1', '1.5', 'abc', '1e3']) {
+ const bad = await t.get(`/api/me/theme/history/${encodeURIComponent(id)}/restore`, {
+ ...signedIn, method: 'POST', headers: { origin: ORIGIN },
+ });
+ assert.strictEqual(bad.status, 400, id);
+ }
+ const ok = await t.get('/api/me/theme/history/2/restore', { ...signedIn, method: 'POST', headers: { origin: ORIGIN } });
+ assert.strictEqual(ok.status, 200, ok.text);
+ assert.strictEqual(ok.json().id, 2);
+ const sent = writes('/api/themes/me/history/2/restore').pop();
+ assert.strictEqual(sent.authorization, `Bearer ${token}`);
+ });
+
+ await check('a Network failure is a 502 problem', async () => {
+ t.network.setDown(true);
+ const r = await t.get('/api/themes/aurora');
+ assert.strictEqual(r.status, 502, r.text);
+ assert.strictEqual(r.json().code, 'network.unavailable');
+ const me = await t.get('/api/me/theme', signedIn);
+ assert.strictEqual(me.status, 502);
+ t.network.setDown(false);
+ });
+
+ await t.close();
+ done();
+})().catch((err) => { console.error(err); process.exit(1); });
new file mode 100644
new file mode 100644
@@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
+#!/usr/bin/env node
+/**
+ * Runs every test/*.test.js in its own process and fails if any fails. Each file boots OpenVibe.Design against an
+ * in-process OpenVibe.Network stand-in (test/helpers/network.js); none needs the network or a running site.
+ *
+ * npm test # everything
+ * npm test -- login # only files whose name contains one of the words
+ * npm test -- --strict # a skipped test fails the run too
+ *
+ * A test that cannot run something here prints `<label>: skipped (<why>)`: that file is listed with ○ and not
+ * counted as passed (openvibe-shared/test-runner).
+ */
+'use strict';
+const { run } = require('openvibe-shared/test-runner');
+
+// VERBOSE=1 also prints every file's output, then the summary again.
+run({ dir: __dirname, timeoutMs: 60_000, pad: 34, parallel: 1 }).then((r) => {
+ if (process.env.VERBOSE) {
+ for (const t of r.results) console.log(`\n── ${t.file} ──\n${t.output.trimEnd()}`);
+ console.log(`\n${r.summary}`);
+ }
+ process.exit(r.exitCode);
+}, (err) => { console.error(err); process.exit(1); });
new file mode 100644
new file mode 100644
@@ -0,0 +1,130 @@
@@ -0,0 +1,130 @@
+'use strict';
+/**
+ * Sign-in: sanitizeNext (open-redirect regressions), the login redirect (PKCE S256, state, client id, redirect
+ * URI), the callback (state mismatch refused, a stub Network token endpoint, httpOnly cookies), /auth/me signed
+ * out and in, and sign-out.
+ */
+const assert = require('assert');
+const crypto = require('crypto');
+const { boot, check, done } = require('./helpers/boot');
+const { sanitizeNext } = require('../server/auth/sso');
+
+const config = { baseUrl: 'https://openvibe.design' };
+const cookies = (r) => (typeof r.headers.getSetCookie === 'function' ? r.headers.getSetCookie() : [r.headers.get('set-cookie') || '']);
+const cookieNamed = (r, name) => {
+ for (const c of cookies(r)) {
+ const m = new RegExp(`(?:^|[,\\s])${name}=([^;]+)`).exec(c);
+ if (m) return `${name}=${m[1]}`;
+ }
+ return null;
+};
+
+(async () => {
+ // ── sanitizeNext: same-site paths only ──
+ for (const v of ['//evil.com', '/\\evil.com', '\\\\evil.com', 'https://evil.com', 'http:evil.com', '/\t/evil.com',
+ '/\n/evil.com', '\t//evil.com', ' //evil.com', '/\\/evil.com', 'https:/\\evil.com', '///evil.com',
+ 'javascript:alert(1)', null, '', 12]) {
+ assert.strictEqual(sanitizeNext(v, config), '/', `${JSON.stringify(v)} goes home`);
+ }
+ assert.strictEqual(sanitizeNext('/studio?tab=contrast', config), '/studio?tab=contrast');
+ assert.strictEqual(sanitizeNext('https://openvibe.design/a/b?x=1#c', config), '/a/b?x=1#c');
+ for (const v of ['https://evil.com/a', 'https://openvibe.design.evil.com/a', 'https://[email protected]/', 'http://openvibe.design/a']) {
+ assert.strictEqual(sanitizeNext(v, config), '/', v);
+ }
+
+ const t = await boot();
+ const user = t.network.addUser('kim');
+
+ await check('login redirects to Network with state, client id design and an S256 challenge', async () => {
+ const r = await t.get('/auth/login?next=/studio');
+ assert.strictEqual(r.status, 302);
+ const loc = new URL(r.headers.get('location'));
+ assert.strictEqual(loc.origin + loc.pathname, `${t.network.url}/oauth/authorize`);
+ assert.strictEqual(loc.searchParams.get('client_id'), 'design');
+ assert.strictEqual(loc.searchParams.get('response_type'), 'code');
+ assert.strictEqual(loc.searchParams.get('redirect_uri'), 'https://openvibe.design/auth/callback');
+ assert.strictEqual(loc.searchParams.get('scope'), 'profile');
+ assert.strictEqual(loc.searchParams.get('code_challenge_method'), 'S256');
+ assert.match(loc.searchParams.get('code_challenge'), /^[A-Za-z0-9_-]{43}$/);
+ assert.match(loc.searchParams.get('state'), /^[0-9a-f]{32}$/);
+ const flow = cookieNamed(r, 'design_oauth');
+ assert.ok(flow, 'the flow cookie is set');
+ assert.match(cookies(r).find((c) => c.includes('design_oauth=')), /Path=\/auth.*HttpOnly/i);
+ const payload = JSON.parse(decodeURIComponent(flow.split('=')[1]));
+ assert.strictEqual(payload.next, '/studio');
+ assert.strictEqual(payload.silent, false);
+ });
+
+ await check('silent sign-in adds prompt=none and next= only keeps this site', async () => {
+ const r = await t.get('/auth/login?silent=1&next=' + encodeURIComponent('https://evil.example/x'));
+ const loc = new URL(r.headers.get('location'));
+ assert.strictEqual(loc.searchParams.get('prompt'), 'none');
+ const flow = JSON.parse(decodeURIComponent(cookieNamed(r, 'design_oauth').split('=')[1]));
+ assert.strictEqual(flow.next, '/', 'another origin goes home');
+ const own = await t.get('/auth/login?next=' + encodeURIComponent('https://openvibe.design/t/aurora?x=1'));
+ const ownFlow = JSON.parse(decodeURIComponent(cookieNamed(own, 'design_oauth').split('=')[1]));
+ assert.strictEqual(ownFlow.next, '/t/aurora?x=1');
+ });
+
+ await check('the callback exchanges the code and sets httpOnly design_at/design_rt cookies', async () => {
+ const login = await t.get('/auth/login?next=/studio');
+ const loc = new URL(login.headers.get('location'));
+ const flowCookie = cookieNamed(login, 'design_oauth');
+ const code = t.network.issueCode(user, loc.searchParams.get('code_challenge'));
+ const r = await t.get(`/auth/callback?code=${code}&state=${loc.searchParams.get('state')}`, { cookie: flowCookie });
+ assert.strictEqual(r.status, 302, r.text);
+ assert.strictEqual(r.headers.get('location'), '/studio');
+ const all = cookies(r).join('\n');
+ assert.match(all, /design_at=[^;]+;.*HttpOnly/i);
+ assert.match(all, /design_rt=[^;]+;.*HttpOnly/i);
+ assert.ok(!/SameSite=None/i.test(all), 'SameSite=Lax, not None');
+ const at = cookieNamed(r, 'design_at');
+ assert.ok(at, 'the access cookie is set');
+ const me = await t.get('/auth/me', { cookie: at });
+ assert.strictEqual(me.status, 200);
+ assert.strictEqual(me.json().user.username, 'kim');
+ assert.ok(!me.text.includes(at.split('=')[1]), '/auth/me never returns the token');
+ const tokenRequest = t.network.tokenRequests[t.network.tokenRequests.length - 1];
+ assert.strictEqual(tokenRequest.client_id, 'design');
+ assert.strictEqual(tokenRequest.grant_type, 'authorization_code');
+ assert.strictEqual(tokenRequest.redirect_uri, 'https://openvibe.design/auth/callback');
+ assert.ok(tokenRequest.code_verifier, 'the verifier is sent server-side');
+ });
+
+ await check('a wrong state or no flow cookie is refused', async () => {
+ const login = await t.get('/auth/login');
+ const loc = new URL(login.headers.get('location'));
+ const flowCookie = cookieNamed(login, 'design_oauth');
+ const code = t.network.issueCode(user, loc.searchParams.get('code_challenge'));
+ const bad = await t.get(`/auth/callback?code=${code}&state=${'0'.repeat(32)}`, { cookie: flowCookie });
+ assert.strictEqual(bad.status, 400);
+ const noCookie = await t.get(`/auth/callback?code=${code}&state=${loc.searchParams.get('state')}`);
+ assert.strictEqual(noCookie.status, 400);
+ const none = await t.get('/auth/callback?state=x');
+ assert.strictEqual(none.status, 400);
+ });
+
+ await check('/auth/me is null for a guest and 401 for a cookie that does not verify', async () => {
+ const guest = await t.get('/auth/me');
+ assert.strictEqual(guest.status, 200);
+ assert.deepStrictEqual(guest.json(), { user: null });
+ const bad = await t.get('/auth/me', { cookie: 'design_at=not-a-token' });
+ assert.strictEqual(bad.status, 401);
+ assert.strictEqual(bad.json().error, 'Not signed in');
+ });
+
+ await check('sign-out clears the cookies and returns to next', async () => {
+ const r = await t.get('/auth/logout?next=%2Fstudio', { headers: { 'sec-fetch-site': 'same-origin' } });
+ assert.strictEqual(r.status, 303);
+ assert.strictEqual(r.headers.get('location'), '/studio');
+ assert.match(cookies(r).join('\n'), /design_at=;/);
+ });
+
+ await check('the token is never logged', async () => {
+ const token = t.network.userToken(user);
+ assert.ok(!t.logs().includes(token), 'no access token in the logs');
+ });
+
+ await t.close();
+ done();
+})().catch((err) => { console.error(err); process.exit(1); });