- Linktree-style homepage with photo, social links, and self-hosted services (container registry, Git server) - Registry pages rendered on demand from Harbor via a live content collection, cached in memory (60s fresh, 10min stale-while-revalidate) - Pinned registry images (PINNED_IMAGES) shown first with a star - Node standalone server with security headers; self-contained server build so the Docker image ships no node_modules - Gitea workflow building multi-arch images for Flux Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
---
|
||||
interface Props {
|
||||
text: string;
|
||||
label?: string;
|
||||
}
|
||||
|
||||
const { text, label = 'Copy' } = Astro.props;
|
||||
---
|
||||
|
||||
<copy-button data-text={text}>
|
||||
<button type="button" aria-label={`${label}: ${text}`} hidden>{label}</button>
|
||||
</copy-button>
|
||||
|
||||
<script>
|
||||
// Progressive enhancement: the button only appears when the Clipboard API is available.
|
||||
class CopyButton extends HTMLElement {
|
||||
connectedCallback() {
|
||||
const button = this.querySelector('button');
|
||||
const text = this.dataset.text;
|
||||
if (!button || !text || !navigator.clipboard) return;
|
||||
|
||||
button.hidden = false;
|
||||
const original = button.textContent;
|
||||
button.addEventListener('click', async () => {
|
||||
await navigator.clipboard.writeText(text);
|
||||
button.textContent = 'Copied';
|
||||
setTimeout(() => (button.textContent = original), 1500);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define('copy-button', CopyButton);
|
||||
</script>
|
||||
|
||||
<style>
|
||||
button {
|
||||
font: inherit;
|
||||
font-size: 0.8rem;
|
||||
padding: 0.2rem 0.6rem;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
import CopyButton from './CopyButton.astro';
|
||||
|
||||
interface Props {
|
||||
image: string;
|
||||
}
|
||||
|
||||
const command = `docker pull ${Astro.props.image}`;
|
||||
---
|
||||
|
||||
<div class="pull">
|
||||
<code>{command}</code>
|
||||
<CopyButton text={command} />
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.pull {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--gap);
|
||||
padding: 0.5rem 0.75rem;
|
||||
background: var(--code-bg);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
code {
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
import type { Artifact } from '../loaders/harbor';
|
||||
|
||||
interface Props {
|
||||
scan: Artifact['vulnerabilities'];
|
||||
}
|
||||
|
||||
const { scan } = Astro.props;
|
||||
const level = scan ? (scan.total === 0 ? 'none' : scan.severity.toLowerCase()) : undefined;
|
||||
const breakdown = scan
|
||||
? Object.entries(scan.bySeverity)
|
||||
.filter(([, n]) => n > 0)
|
||||
.map(([sev, n]) => `${n} ${sev}`)
|
||||
.join(', ')
|
||||
: '';
|
||||
---
|
||||
|
||||
{
|
||||
scan ? (
|
||||
<span class="badge" data-level={level} title={breakdown || 'No known vulnerabilities'}>
|
||||
{scan.total === 0 ? 'No CVEs' : `${scan.total} CVEs (${scan.fixable} fixable)`}
|
||||
</span>
|
||||
) : (
|
||||
<span class="badge">Not scanned</span>
|
||||
)
|
||||
}
|
||||
|
||||
<style>
|
||||
.badge {
|
||||
--c: var(--muted);
|
||||
display: inline-block;
|
||||
font-size: 0.75rem;
|
||||
padding: 0.1rem 0.5rem;
|
||||
border-radius: 999px;
|
||||
border: 1px solid var(--c);
|
||||
color: var(--c);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
[data-level='critical'] { --c: var(--sev-critical); }
|
||||
[data-level='high'] { --c: var(--sev-high); }
|
||||
[data-level='medium'] { --c: var(--sev-medium); }
|
||||
[data-level='low'] { --c: var(--sev-low); }
|
||||
[data-level='none'] { --c: var(--sev-none); }
|
||||
</style>
|
||||
Reference in New Issue
Block a user