gatsby-attainlabs-cms 1.0.43 → 1.0.46
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/gatsby-node.js +15 -9
- package/package.json +1 -1
- package/test-trust.js +29 -0
package/gatsby-node.js
CHANGED
|
@@ -28,7 +28,7 @@ const generatePage = async (blocks, layout, isNested) => {
|
|
|
28
28
|
const pageContent = `
|
|
29
29
|
/* This is a generated file by the gatsby-attainlabs-cms plugin. Any changes will be overwritten on the next build. */
|
|
30
30
|
import { Slice } from "gatsby";
|
|
31
|
-
import SEO from "../${isNested && "../"}components/SEO";
|
|
31
|
+
import SEO from "../${isNested && "../"}../cms/components/SEO";
|
|
32
32
|
|
|
33
33
|
export const Head = ({ pageContext }: any) => {
|
|
34
34
|
const blocks = pageContext.blocks;
|
|
@@ -37,7 +37,7 @@ const generatePage = async (blocks, layout, isNested) => {
|
|
|
37
37
|
<SEO
|
|
38
38
|
title={meta ? meta.title : ""}
|
|
39
39
|
description={meta ? meta.description : ""}
|
|
40
|
-
noIndex={
|
|
40
|
+
noIndex={meta ? meta.robots : ""}
|
|
41
41
|
data={blocks}
|
|
42
42
|
/>
|
|
43
43
|
);
|
|
@@ -281,7 +281,8 @@ exports.onPreInit = async (_, pluginOptions) => {
|
|
|
281
281
|
return;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
const
|
|
284
|
+
const uniqueId = Math.random().toString(36).substring(7);
|
|
285
|
+
const tmpFile = destFile + "." + uniqueId + ".part";
|
|
285
286
|
const fileStream = fs.createWriteStream(tmpFile);
|
|
286
287
|
|
|
287
288
|
res.pipe(fileStream);
|
|
@@ -444,11 +445,11 @@ exports.sourceNodes = async (
|
|
|
444
445
|
},
|
|
445
446
|
};
|
|
446
447
|
createNode(node);
|
|
447
|
-
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// Disclaimers Source Node
|
|
448
451
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
const allDisclaimers = Object.values(firebaseData.disclaimers)
|
|
452
|
+
const allDisclaimers = Object.values(firebaseData.disclaimers);
|
|
452
453
|
|
|
453
454
|
for (const disclaimer of allDisclaimers) {
|
|
454
455
|
const id = createNodeId(`attain-cms-disclaimer-${disclaimer.id}`);
|
|
@@ -465,8 +466,6 @@ exports.sourceNodes = async (
|
|
|
465
466
|
};
|
|
466
467
|
createNode(node);
|
|
467
468
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
469
|
};
|
|
471
470
|
|
|
472
471
|
exports.createPages = async ({ actions, store }, pluginOptions) => {
|
|
@@ -556,6 +555,7 @@ exports.createPages = async ({ actions, store }, pluginOptions) => {
|
|
|
556
555
|
},
|
|
557
556
|
});
|
|
558
557
|
|
|
558
|
+
console.log(sliceId);
|
|
559
559
|
b["sliceId"] = sliceId;
|
|
560
560
|
return b;
|
|
561
561
|
})
|
|
@@ -565,8 +565,14 @@ exports.createPages = async ({ actions, store }, pluginOptions) => {
|
|
|
565
565
|
const pageSource = await generatePage(content, layout, parentPath);
|
|
566
566
|
const folderPath = parentPath ? path.join(parentPath, pageUrl) : pageUrl;
|
|
567
567
|
const outPath = path.join(siteRoot, "src/cms/pages", `${folderPath}.tsx`);
|
|
568
|
+
const gatsbyPagePath = path.join(
|
|
569
|
+
siteRoot,
|
|
570
|
+
"src/pages",
|
|
571
|
+
`${folderPath}.tsx`
|
|
572
|
+
);
|
|
568
573
|
|
|
569
574
|
await fse.outputFile(outPath, pageSource);
|
|
575
|
+
await fse.remove(gatsbyPagePath);
|
|
570
576
|
|
|
571
577
|
await createPage({
|
|
572
578
|
path: folderPath.endsWith("index")
|
package/package.json
CHANGED
package/test-trust.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const https = require('https');
|
|
2
|
+
|
|
3
|
+
const options = {
|
|
4
|
+
hostname: 'your_secure_server_hostname.com', // MUST match the Common Name (CN) in your server's certificate
|
|
5
|
+
port: 443,
|
|
6
|
+
path: '/',
|
|
7
|
+
method: 'GET',
|
|
8
|
+
rejectUnauthorized: true // Ensure verification is mandatory
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
console.log(`Testing HTTPS connection to ${options.hostname}...`);
|
|
12
|
+
console.log(`Expecting NODE_EXTRA_CA_CERTS value: process.env.NODE_EXTRA_CA_CERTS`);
|
|
13
|
+
|
|
14
|
+
const req = https.request(options, (res) => {
|
|
15
|
+
console.log(`\n✅ Connection Successful! Status Code: ${res.statusCode}`);
|
|
16
|
+
console.log('The certificate was successfully trusted using the provided CA file.');
|
|
17
|
+
res.resume();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
req.on('error', (e) => {
|
|
21
|
+
console.error('\n❌ Connection Failed!');
|
|
22
|
+
console.error('Error details:', e.message);
|
|
23
|
+
if (e.code === 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' || e.code === 'CERT_HAS_EXPIRED') {
|
|
24
|
+
console.error('\nRecommendation: Ensure NODE_EXTRA_CA_CERTS is set correctly and the file path is accurate.');
|
|
25
|
+
console.error('Do not use NODE_TLS_REJECT_UNAUTHORIZED="0".');
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
req.end();
|