@cmssy/core 19.3.0 → 19.3.2
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.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/locale.cjs +1 -1
- package/dist/internal/locale.js +1 -1
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +1 -1
- package/dist/preflight.cjs +30 -12
- package/dist/preflight.js +30 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
package/dist/internal/locale.cjs
CHANGED
package/dist/internal/locale.js
CHANGED
package/dist/internal.cjs
CHANGED
package/dist/internal.js
CHANGED
package/dist/preflight.cjs
CHANGED
|
@@ -151,6 +151,10 @@ function documentText(document) {
|
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
// src/version.ts
|
|
155
|
+
var CMSSY_CORE_VERSION = "19.3.2" ;
|
|
156
|
+
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
157
|
+
|
|
154
158
|
// src/content/content-client.ts
|
|
155
159
|
var DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
156
160
|
function resolveApiUrl(apiUrl) {
|
|
@@ -348,7 +352,10 @@ async function postPreflightQuery(config, query, variables) {
|
|
|
348
352
|
try {
|
|
349
353
|
response = await doFetch(url, {
|
|
350
354
|
method: "POST",
|
|
351
|
-
headers: {
|
|
355
|
+
headers: {
|
|
356
|
+
"content-type": "application/json",
|
|
357
|
+
"user-agent": CMSSY_USER_AGENT
|
|
358
|
+
},
|
|
352
359
|
body: JSON.stringify({ query: documentText(query), variables })
|
|
353
360
|
});
|
|
354
361
|
} catch (error) {
|
|
@@ -454,11 +461,10 @@ async function checkDraftSecret(config) {
|
|
|
454
461
|
fix: `copy the draft secret from ${SETTINGS_PATH}`
|
|
455
462
|
};
|
|
456
463
|
}
|
|
457
|
-
const outcome = await postPreflightQuery(
|
|
458
|
-
config,
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
);
|
|
464
|
+
const outcome = await postPreflightQuery(config, DRAFT_SECRET_VALID_QUERY, {
|
|
465
|
+
workspaceSlug: config.workspaceSlug,
|
|
466
|
+
secret
|
|
467
|
+
});
|
|
462
468
|
if (outcome.kind === "network") {
|
|
463
469
|
return {
|
|
464
470
|
status: "unknown",
|
|
@@ -500,15 +506,20 @@ function parseOrigin(value) {
|
|
|
500
506
|
return null;
|
|
501
507
|
}
|
|
502
508
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
509
|
+
function isLocalHostname(hostname) {
|
|
510
|
+
const host = hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
511
|
+
return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "::1";
|
|
512
|
+
}
|
|
513
|
+
function isLocalOrigin(origin) {
|
|
514
|
+
if (!origin) return false;
|
|
506
515
|
try {
|
|
507
|
-
|
|
516
|
+
return isLocalHostname(new URL(origin).hostname);
|
|
508
517
|
} catch {
|
|
509
|
-
|
|
518
|
+
return false;
|
|
510
519
|
}
|
|
511
|
-
|
|
520
|
+
}
|
|
521
|
+
function previewUrlFix(devOrigin) {
|
|
522
|
+
if (isLocalOrigin(parseOrigin(devOrigin))) {
|
|
512
523
|
return `toggle dev mode in the editor and enter ${devOrigin} there - ${SETTINGS_PATH} holds the shared preview URL of the DEPLOYED site, not your machine`;
|
|
513
524
|
}
|
|
514
525
|
return `paste ${devOrigin} into the preview URL field in ${SETTINGS_PATH}`;
|
|
@@ -537,6 +548,13 @@ function checkPreviewUrl(previewUrl, devOrigin) {
|
|
|
537
548
|
message: `the workspace preview URL matches ${devOrigin}`
|
|
538
549
|
};
|
|
539
550
|
}
|
|
551
|
+
if (isLocalOrigin(localOrigin)) {
|
|
552
|
+
return {
|
|
553
|
+
status: "unknown",
|
|
554
|
+
message: `the workspace preview URL is ${previewOrigin}; whether the editor reaches ${devOrigin} depends on the dev-mode switch, which overrides the shared preview URL and cannot be read from here`,
|
|
555
|
+
fix: previewUrlFix(devOrigin)
|
|
556
|
+
};
|
|
557
|
+
}
|
|
540
558
|
return {
|
|
541
559
|
status: "fail",
|
|
542
560
|
message: `the workspace preview URL is ${previewOrigin} but your dev server runs at ${devOrigin}`,
|
package/dist/preflight.js
CHANGED
|
@@ -149,6 +149,10 @@ function documentText(document) {
|
|
|
149
149
|
);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
// src/version.ts
|
|
153
|
+
var CMSSY_CORE_VERSION = "19.3.2" ;
|
|
154
|
+
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
155
|
+
|
|
152
156
|
// src/content/content-client.ts
|
|
153
157
|
var DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
154
158
|
function resolveApiUrl(apiUrl) {
|
|
@@ -346,7 +350,10 @@ async function postPreflightQuery(config, query, variables) {
|
|
|
346
350
|
try {
|
|
347
351
|
response = await doFetch(url, {
|
|
348
352
|
method: "POST",
|
|
349
|
-
headers: {
|
|
353
|
+
headers: {
|
|
354
|
+
"content-type": "application/json",
|
|
355
|
+
"user-agent": CMSSY_USER_AGENT
|
|
356
|
+
},
|
|
350
357
|
body: JSON.stringify({ query: documentText(query), variables })
|
|
351
358
|
});
|
|
352
359
|
} catch (error) {
|
|
@@ -452,11 +459,10 @@ async function checkDraftSecret(config) {
|
|
|
452
459
|
fix: `copy the draft secret from ${SETTINGS_PATH}`
|
|
453
460
|
};
|
|
454
461
|
}
|
|
455
|
-
const outcome = await postPreflightQuery(
|
|
456
|
-
config,
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
);
|
|
462
|
+
const outcome = await postPreflightQuery(config, DRAFT_SECRET_VALID_QUERY, {
|
|
463
|
+
workspaceSlug: config.workspaceSlug,
|
|
464
|
+
secret
|
|
465
|
+
});
|
|
460
466
|
if (outcome.kind === "network") {
|
|
461
467
|
return {
|
|
462
468
|
status: "unknown",
|
|
@@ -498,15 +504,20 @@ function parseOrigin(value) {
|
|
|
498
504
|
return null;
|
|
499
505
|
}
|
|
500
506
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
507
|
+
function isLocalHostname(hostname) {
|
|
508
|
+
const host = hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
509
|
+
return host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "::1";
|
|
510
|
+
}
|
|
511
|
+
function isLocalOrigin(origin) {
|
|
512
|
+
if (!origin) return false;
|
|
504
513
|
try {
|
|
505
|
-
|
|
514
|
+
return isLocalHostname(new URL(origin).hostname);
|
|
506
515
|
} catch {
|
|
507
|
-
|
|
516
|
+
return false;
|
|
508
517
|
}
|
|
509
|
-
|
|
518
|
+
}
|
|
519
|
+
function previewUrlFix(devOrigin) {
|
|
520
|
+
if (isLocalOrigin(parseOrigin(devOrigin))) {
|
|
510
521
|
return `toggle dev mode in the editor and enter ${devOrigin} there - ${SETTINGS_PATH} holds the shared preview URL of the DEPLOYED site, not your machine`;
|
|
511
522
|
}
|
|
512
523
|
return `paste ${devOrigin} into the preview URL field in ${SETTINGS_PATH}`;
|
|
@@ -535,6 +546,13 @@ function checkPreviewUrl(previewUrl, devOrigin) {
|
|
|
535
546
|
message: `the workspace preview URL matches ${devOrigin}`
|
|
536
547
|
};
|
|
537
548
|
}
|
|
549
|
+
if (isLocalOrigin(localOrigin)) {
|
|
550
|
+
return {
|
|
551
|
+
status: "unknown",
|
|
552
|
+
message: `the workspace preview URL is ${previewOrigin}; whether the editor reaches ${devOrigin} depends on the dev-mode switch, which overrides the shared preview URL and cannot be read from here`,
|
|
553
|
+
fix: previewUrlFix(devOrigin)
|
|
554
|
+
};
|
|
555
|
+
}
|
|
538
556
|
return {
|
|
539
557
|
status: "fail",
|
|
540
558
|
message: `the workspace preview URL is ${previewOrigin} but your dev server runs at ${devOrigin}`,
|