Feat v0.5.4 package updates (#34)
All checks were successful
CI/CD / detect-changes (push) Successful in 3s
CI/CD / test-frontend (push) Successful in 5s
CI/CD / test-sqlite (push) Successful in 2m41s
CI/CD / test-go-pg (push) Successful in 2m42s
CI/CD / build-and-deploy (push) Successful in 29s

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #34.
This commit is contained in:
2026-03-30 19:31:45 +00:00
committed by xcaliber
parent 8092f00fbe
commit 4da25350ac
15 changed files with 1294 additions and 32 deletions

View File

@@ -116,6 +116,27 @@ export default function PackagesSection() {
window.open(`${BASE}/api/v1/admin/packages/${id}/export`, '_blank');
}
function updatePkg(pkg) {
const input = document.createElement('input');
input.type = 'file';
input.accept = '.pkg,.surface,.zip';
input.onchange = async () => {
const file = input.files[0];
if (!file) return;
const ok = await sw.confirm(`Update "${pkg.title}" from v${pkg.version}?\n\nExport a backup first if needed.`, { destructive: true });
if (!ok) return;
setInstalling(true);
try {
const res = await sw.api.admin.packages.update(pkg.id, file);
const data = res?.data || res || {};
sw.toast(`Updated to v${data.version || '?'}`, 'success');
load();
} catch (e) { sw.toast(e.message, 'error'); }
finally { setInstalling(false); }
};
input.click();
}
// ── Settings drawer ─────────────────────────
async function toggleSettings(pkgId) {
if (expandedId === pkgId) {
@@ -271,6 +292,9 @@ export default function PackagesSection() {
${permsId === pkg.id ? 'Close' : 'Permissions'}
</button>
`}
${pkg.source !== 'core' && html`
<button class="btn-small" onClick=${() => updatePkg(pkg)}>Update</button>
`}
<button class="btn-small" onClick=${() => exportPkg(pkg.id)}>Export</button>
${pkg.source !== 'core' && !pkg.is_system && html`
<button class="btn-small btn-danger" onClick=${() => deletePkg(pkg)}>Delete</button>