Skip to content

Commit 0cc4f58

Browse files
authored
Merge branch 'main' into 4909-text-contrast
2 parents 2d2c8e3 + 8127cf0 commit 0cc4f58

12 files changed

Lines changed: 154 additions & 9 deletions

.github/workflows/test.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ jobs:
1010
id: generate_token
1111
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
1212
with:
13-
app-id: ${{ secrets.GH_BOT_APP_ID }}
14-
private-key: ${{ secrets.GH_BOT_APP_KEY }}
13+
app-id: ${{ secrets.GH_CI_READONLY_APP_ID }}
14+
private-key: ${{ secrets.GH_CI_READONLY_APP_KEY }}
1515
owner: ${{ github.repository_owner }}
16+
repositories: |
17+
website
18+
flowfuse
19+
blueprint-library
1620
- name: Check out website repository
1721
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1822
with:
@@ -50,4 +54,3 @@ jobs:
5054
- uses: untitaker/hyperlink@fb5bb9c5011a3d143a54b4b30aedc30ec5bc0f89 # 0.2.0
5155
with:
5256
args: website/_site/ --check-anchors --sources website/src
53-

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"@11ty/eleventy-fetch": "^4.0.0",
6969
"@flowfuse/flow-renderer": "^0.5.0",
7070
"@netlify/blobs": "^10.3.0",
71-
"@xmldom/xmldom": "^0.8.12",
71+
"@xmldom/xmldom": "^0.8.13",
7272
"algoliasearch": "^4.25.3",
7373
"codeowners": "^5.1.1",
7474
"eleventy-plugin-toc": "^1.1.5",

src/_data/integrations.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ module.exports = async () => {
6666
node.categories.push("catalogue");
6767
}
6868

69+
const stripRelativeTags = (html) => html
70+
.replace(/<link\b[^>]*?\bhref=(?:["']|&quot;)(?!https?:\/\/)[^"'>&]*(?:["']|&quot;)[^>]*\/?>/gi, '')
71+
.replace(/<script\b[^>]*?\bsrc=(?:["']|&quot;)(?!https?:\/\/)[^"'>&]*(?:["']|&quot;)[^>]*>(?:[\s\S]*?<\/script>)?/gi, '');
72+
6973
// Fetch full npm node details (readme, etc.)
7074
try {
7175
const nodeDetails = await EleventyFetch(
@@ -133,12 +137,30 @@ module.exports = async () => {
133137
}
134138
});
135139

140+
let sanitizedFlow = flowContent;
141+
try {
142+
const flowJson = JSON.parse(flowContent);
143+
const sanitizeNode = (n) => {
144+
if (n && typeof n === 'object') {
145+
if (typeof n.template === 'string') n.template = stripRelativeTags(n.template);
146+
if (typeof n.html === 'string') n.html = stripRelativeTags(n.html);
147+
}
148+
return n;
149+
};
150+
if (Array.isArray(flowJson)) {
151+
flowJson.forEach(sanitizeNode);
152+
} else {
153+
sanitizeNode(flowJson);
154+
}
155+
sanitizedFlow = JSON.stringify(flowJson);
156+
} catch (_) { /* keep original if not valid JSON */ }
157+
136158
return {
137159
name: file.name.replace('.json', ''), // Remove .json extension for display
138160
path: file.path,
139161
url: file.html_url,
140162
downloadUrl: file.download_url,
141-
flow: flowContent // Store the actual flow JSON as string
163+
flow: sanitizedFlow
142164
};
143165
} catch (err) {
144166
console.error(`Failed to fetch flow content for ${file.name}:`, err.message);
@@ -195,6 +217,7 @@ module.exports = async () => {
195217
return match;
196218
}
197219
);
220+
node.readme = stripRelativeTags(node.readme);
198221
} else {
199222
node.readme = "";
200223
}
58.3 KB
Loading
95.2 KB
Loading
112 KB
Loading
18.2 KB
Loading
21.1 KB
Loading
2.15 MB
Loading

0 commit comments

Comments
 (0)