Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ docs/.jekyll-metadata
docs/vendor
docs/jacoco
docs/apidocs
docs/sboms
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<div>
<a href="https://giulong.github.io/spectrum/">Full Docs</a>
·
<a href="https://giulong.github.io/spectrum/#sbom">SBOM</a>
·
<a href="https://github.com/giulong/spectrum/issues/new?template=bug_report.md">Report Bug</a>
·
<a href="https://github.com/giulong/spectrum/issues/new?template=feature-request.md">Request Feature</a>
Expand Down
8 changes: 8 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3801,6 +3801,14 @@ root

---

# SBOM

Spectrum's Software Bill of Materials is available here:

{% include sboms.html %}

---

# Bugs Report and Feature Requests

Found a bug? Want to request a new feature? Just follow these links and provide the requested details:
Expand Down
1 change: 1 addition & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ theme: jekyll-theme-modernist
repository_url: https://github.com/giulong/spectrum/blob/main
docs_url: https://giulong.github.io/spectrum
json_schemas_endpoint: json-schemas/
sboms_endpoint: sboms/
36 changes: 36 additions & 0 deletions docs/_includes/sboms.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<table>
<thead>
<tr>
<td>Version</td>
<td>Full Path</td>
<td style="text-align: center; width: 90px;">Copy URL</td>
</tr>
</thead>
<tbody>
<tr>
<td id="latest-sbom-xml-version"></td>
<td id="latest-sbom-xml-path"></td>
<td id="latest-sbom-xml-copy-header"></td>
</tr>
<tr>
<td id="latest-sbom-json-version"></td>
<td id="latest-sbom-json-path"></td>
<td id="latest-sbom-json-copy-header"></td>
</tr>
</tbody>
</table>

<details>
<summary>Older Versions</summary>
<table>
<thead>
<tr>
<td>Version</td>
<td>Full Path</td>
<td style="text-align: center; width: 90px;">Copy URL</td>
</tr>
</thead>
<tbody id="sboms-body">
</tbody>
</table>
</details>
1 change: 1 addition & 0 deletions docs/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@
<script src="assets/scripts/openImage.js"></script>
<script src="assets/scripts/topButton.js"></script>
<script src="assets/scripts/jsonSchemas.js"></script>
<script src="assets/scripts/sboms.js"></script>
</body>
</html>
79 changes: 79 additions & 0 deletions docs/assets/scripts/sboms.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
---
const copySbomCodeHtml = `
<span class="sbom-copy-header">
<button class="sbom-copy-button">
<span class="sbom-copy-text" style="display: none;">Copied!</span>
<img class="copy-icon" src="assets/images/copy.png" alt="copy"/>
</button>
</span>`;

(async () => {
fetch('https://api.github.com/repos/giulong/spectrum/contents/docs/sboms')
.then(response => response.json())
.then(json => json.sort(compareSemanticVersions))
.then(json => {
const latestJson = json.pop();
const rows = json
.map(sbom => {
const xmlUrl = "{{ site.docs_url }}/{{ site.sboms_endpoint }}" + sbom.name + "/sbom.xml";
const xmlVersionColumn = '<td><a href="' + xmlUrl + '" target="_blank">' + sbom.name + '</a></td>';
const xmlFullPathColumn = '<td>' + xmlUrl + '</td>';

const jsonUrl = "{{ site.docs_url }}/{{ site.sboms_endpoint }}" + sbom.name + "/sbom.json";
const jsonVersionColumn = '<td><a href="' + jsonUrl + '" target="_blank">' + sbom.name + '</a></td>';
const jsonFullPathColumn = '<td>' + jsonUrl + '</td>';

const copyCodeColumn = '<td>' + copySbomCodeHtml + '</td>';

return xmlVersionColumn + xmlFullPathColumn + copyCodeColumn + '</tr><tr>' + jsonVersionColumn + jsonFullPathColumn + copyCodeColumn;
})
.reverse()
.join('</tr><tr>');

const latestXmlUrl = "{{ site.docs_url }}/{{ site.sboms_endpoint }}" + latestJson.name + "/sbom.xml";
document.getElementById('latest-sbom-xml-version').innerHTML = '<a href="' + latestXmlUrl + '" target="_blank">' + latestJson.name + '</a>';
document.getElementById('latest-sbom-xml-path').innerText = latestXmlUrl;
document.getElementById('latest-sbom-xml-copy-header').innerHTML = copySbomCodeHtml;

const latestJsonUrl = "{{ site.docs_url }}/{{ site.sboms_endpoint }}" + latestJson.name + "/sbom.json";
document.getElementById('latest-sbom-json-version').innerHTML = '<a href="' + latestJsonUrl + '" target="_blank">' + latestJson.name + '</a>';
document.getElementById('latest-sbom-json-path').innerText = latestJsonUrl;
document.getElementById('latest-sbom-json-copy-header').innerHTML = copySbomCodeHtml;

document.getElementById('sboms-body').innerHTML = '<tr>' + rows + '</tr>';
})
.catch(error => {
document.getElementById('latest-sbom-xml-version').innerText = 'N/A';
document.getElementById('latest-sbom-xml-path').innerText = '{{ site.docs_url }}/{{ site.sboms_endpoint }}<VERSION>/sbom.xml';
document.getElementById('latest-sbom-xml-copy-header').innerHTML = copySbomCodeHtml;

document.getElementById('latest-sbom-json-version').innerText = 'N/A';
document.getElementById('latest-sbom-json-path').innerText = '{{ site.docs_url }}/{{ site.sboms_endpoint }}<VERSION>/sbom.json';
document.getElementById('latest-sbom-json-copy-header').innerHTML = copySbomCodeHtml;
})
.finally(() => {
const sbomHeaders = document.querySelectorAll('.sbom-copy-header');
const sbomButtons = document.querySelectorAll('.sbom-copy-button');
sbomButtons.forEach((copyButton, index) => {
try {
const url = sbomHeaders[index].parentElement.previousElementSibling.textContent;
copyButton.addEventListener('click', () => {
window.navigator.clipboard.writeText(url);
const copyText = copyButton.querySelector('.sbom-copy-text');
const copyIcon = copyButton.querySelector('.copy-icon');

copyText.style.display = 'inline';
copyIcon.src = 'assets/images/check.png';

setTimeout(() => {
copyText.style.display = 'none';
copyIcon.src = 'assets/images/copy.png';
}, 2000);
});
} catch (error) {
console.error(error);
}
});
});
})()
Loading
Loading