@ofidj/generator-fidj 3.8.1 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,7 @@
15
15
  "privacy:rehearse": "npm run build && node --test test/server.test.mjs"
16
16
  },
17
17
  "dependencies": {
18
- "@ofidj/node": "^3.8.0"
18
+ "@ofidj/node": "^3.9.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/node": "^22.0.0",
package/lib/scaffold.cjs CHANGED
@@ -21,6 +21,21 @@ const escapeHtml = (value) =>
21
21
  const moduleRedirectRoot = (file) =>
22
22
  (path.posix.relative(path.posix.dirname("module/" + file), ".") || ".") + "/";
23
23
 
24
+ // Which Fidj an app points at follows the API it talks to. It used to be the
25
+ // constant https://fidj.ovh, so every app built against the sandbox API sent
26
+ // people to a different deployment with a different database, where their apps
27
+ // are not — and the sandbox console never recognised itself as Fidj, because
28
+ // recognising itself is comparing its own origin against this value.
29
+ //
30
+ // An API host named after its console (api.X serves X) says where that console
31
+ // is. One that is not says nothing, and then the default stands rather than a
32
+ // guess being invented.
33
+ function dashboardFor(api) {
34
+ return api.hostname.startsWith("api.")
35
+ ? `https://${api.hostname.slice(4)}`
36
+ : "https://fidj.ovh";
37
+ }
38
+
24
39
  function scaffold(destination, options) {
25
40
  const anonymous = options.anonymous ?? true;
26
41
  if (![true, false, "true", "false"].includes(anonymous))
@@ -182,7 +197,7 @@ function scaffold(destination, options) {
182
197
  ? new URL("/oidc", localApi).href
183
198
  : null,
184
199
  apiEndpoint: localApi,
185
- dashboardUrl: options.local ? "http://localhost:4200" : "https://fidj.ovh",
200
+ dashboardUrl: options.local ? "http://localhost:4200" : dashboardFor(api),
186
201
  title,
187
202
  releaseVersion,
188
203
  localDemo: Boolean(options.local),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ofidj/generator-fidj",
3
- "version": "3.8.1",
3
+ "version": "3.9.0",
4
4
  "description": "Generate a TypeScript app with Fidj sign-in, live server-side roles and per-app privacy.",
5
5
  "homepage": "https://fidj.ovh",
6
6
  "bugs": {