cmd/pkgserver: add /status endpoint

This commit is contained in:
mae
2026-03-10 04:24:49 -05:00
parent 52a4e5b87d
commit 469bd1ee99
5 changed files with 37 additions and 23 deletions

View File

@@ -9,7 +9,7 @@ function toHTML(entry) {
let v = entry.version != null ? `<span>${escapeHtml(entry.version)}</span>` : "";
let d = entry.description != null ? `<p>${escapeHtml(entry.description)}</p>` : "";
let w = entry.website != null ? `<a href="${encodeURI(entry.website)}">Website</a>` : "";
let r = entry.report != null ? `<a href="${encodeURI(entry.report)}">Log</a>` : "";
let r = entry.report ? `Log (<a href=\"${encodeURI('/api/v1/status/' + entry.name)}\">View</a> | <a href=\"${encodeURI('/status/' + entry.name)}\">Download</a>)` : "";
let row = (document.createElement('tr'));
row.innerHTML = `<td>
<h2>${escapeHtml(entry.name)} ${v}</h2>
@@ -50,7 +50,7 @@ class State {
entriesPerPage = 10;
currentPage = 1;
entryIndex = 0;
maxEntries = 100;
maxEntries = 0;
getEntriesPerPage() {
return this.entriesPerPage;
}

View File

@@ -3,13 +3,13 @@ class PackageIndexEntry {
description: string | null
website: string | null
version: string | null
report: string | null
report: boolean
}
function toHTML(entry: PackageIndexEntry): HTMLTableRowElement {
let v = entry.version != null ? `<span>${escapeHtml(entry.version)}</span>` : ""
let d = entry.description != null ? `<p>${escapeHtml(entry.description)}</p>` : ""
let w = entry.website != null ? `<a href="${encodeURI(entry.website)}">Website</a>` : ""
let r = entry.report != null ? `<a href="${encodeURI(entry.report)}">Log</a>` : ""
let r = entry.report ? `Log (<a href=\"${encodeURI('/api/v1/status/' + entry.name)}\">View</a> | <a href=\"${encodeURI('/status/' + entry.name)}\">Download</a>)` : ""
let row = <HTMLTableRowElement>(document.createElement('tr'))
row.innerHTML = `<td>
<h2>${escapeHtml(entry.name)} ${v}</h2>