Deployr is now installable and drivable the way winutil is: one PowerShell or
shell line, no prior setup on the machine.
irm .../scripts/install.ps1 | iex
curl -fsSL .../scripts/install.sh | sh
The bootstrap self-elevates, picks the right binary for the machine's
architecture, verifies it against the release SHA256SUMS, puts it on PATH and
opens the UI. Arguments pass through for unattended use.
`deployr ui` serves a point-and-click page on loopback and opens a browser at
it: apps grouped by category, profile bundles, a filter box, and per-app
progress streamed live over SSE as the engine runs. A browser page rather than a
native window because it is the only GUI that behaves the same on all three
platforms without a toolkit or cgo, so the binary stays one static file.
It is not a hole in the endpoint: loopback-only on an OS-assigned port, a
session token minted per run and required on every request, plus Origin and
Host checks so no other page can drive a tool that installs software as SYSTEM.
A run keeps going if the tab closes -- aborting mid-installer is worse than
finishing without a spectator.
`deployr menu` is the same thing as a numbered terminal picker, for a machine
reached over SSH or a recovery console where no browser exists.
Engine gains optional OnAppStart/OnResult hooks, which is what makes progress
streamable instead of a report that only shows up at the end.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
346 lines
13 KiB
HTML
346 lines
13 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="referrer" content="no-referrer">
|
|
<title>Deployr</title>
|
|
<style>
|
|
:root {
|
|
color-scheme: light dark;
|
|
--bg: #0f1115;
|
|
--panel: #161a21;
|
|
--panel-2: #1c212a;
|
|
--line: #272d38;
|
|
--text: #e6e9ef;
|
|
--muted: #98a1b3;
|
|
--accent: #4f9cf9;
|
|
--ok: #3fb950;
|
|
--warn: #d29922;
|
|
--fail: #f85149;
|
|
--radius: 10px;
|
|
}
|
|
@media (prefers-color-scheme: light) {
|
|
:root {
|
|
--bg: #f4f6fa; --panel: #ffffff; --panel-2: #f0f3f8; --line: #dde3ec;
|
|
--text: #12151b; --muted: #5b6577; --accent: #1c6ed4;
|
|
}
|
|
}
|
|
* { box-sizing: border-box; }
|
|
.hidden { display: none !important; }
|
|
body {
|
|
margin: 0; background: var(--bg); color: var(--text);
|
|
font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
}
|
|
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, "SF Mono", monospace; }
|
|
|
|
header {
|
|
position: sticky; top: 0; z-index: 10;
|
|
background: var(--panel); border-bottom: 1px solid var(--line);
|
|
padding: 14px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
|
|
}
|
|
.brand { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
|
|
.brand span { color: var(--accent); }
|
|
.meta { color: var(--muted); font-size: 12.5px; }
|
|
.spacer { flex: 1 1 auto; }
|
|
|
|
.banner { padding: 10px 20px; font-size: 13px; border-bottom: 1px solid var(--line); }
|
|
.banner.warn { background: color-mix(in srgb, var(--warn) 16%, var(--panel)); }
|
|
.banner.info { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
|
|
.banner.hidden { display: none; }
|
|
|
|
main { display: grid; grid-template-columns: minmax(0,1fr) 380px; gap: 20px; padding: 20px; align-items: start; }
|
|
@media (max-width: 1000px) { main { grid-template-columns: minmax(0,1fr); } }
|
|
|
|
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
|
|
.card h2 { margin: 0; padding: 14px 16px; font-size: 13px; text-transform: uppercase;
|
|
letter-spacing: 0.07em; color: var(--muted); border-bottom: 1px solid var(--line); }
|
|
|
|
.controls { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 16px; align-items: center; }
|
|
input[type=search] {
|
|
flex: 1 1 220px; min-width: 180px; padding: 9px 12px; border-radius: 8px;
|
|
border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit;
|
|
}
|
|
input[type=search]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
|
|
|
|
button {
|
|
font: inherit; padding: 8px 14px; border-radius: 8px; cursor: pointer;
|
|
border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
|
|
}
|
|
button:hover:not(:disabled) { border-color: var(--accent); }
|
|
button:disabled { opacity: 0.45; cursor: not-allowed; }
|
|
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
|
|
button.danger:hover:not(:disabled) { border-color: var(--fail); color: var(--fail); }
|
|
button.chip { padding: 5px 11px; border-radius: 999px; font-size: 12.5px; }
|
|
button.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
|
|
|
|
.profiles { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 14px; }
|
|
|
|
.cat { padding: 6px 16px 2px; font-size: 11.5px; letter-spacing: 0.08em;
|
|
text-transform: uppercase; color: var(--muted); }
|
|
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
|
gap: 8px; padding: 6px 16px 16px; }
|
|
|
|
label.app {
|
|
display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
|
|
border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); cursor: pointer;
|
|
}
|
|
label.app:hover { border-color: var(--accent); }
|
|
label.app.checked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel-2)); }
|
|
label.app input { margin-top: 3px; accent-color: var(--accent); }
|
|
.app-name { font-weight: 550; }
|
|
.app-sub { color: var(--muted); font-size: 12px; }
|
|
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line);
|
|
color: var(--muted); white-space: nowrap; }
|
|
.tag.installed { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
|
|
|
|
.actions { display: flex; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-top: 1px solid var(--line); }
|
|
.count { color: var(--muted); align-self: center; }
|
|
|
|
#log { margin: 0; padding: 12px 16px; max-height: 60vh; overflow: auto;
|
|
font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
|
|
.row { display: flex; gap: 8px; padding: 3px 0; align-items: baseline; }
|
|
.row .st { flex: 0 0 52px; }
|
|
.st.ok { color: var(--ok); } .st.skip { color: var(--muted); }
|
|
.st.fail { color: var(--fail); } .st.run { color: var(--accent); }
|
|
.row .who { flex: 0 0 130px; overflow: hidden; text-overflow: ellipsis; }
|
|
.row .why { color: var(--muted); flex: 1 1 auto; word-break: break-word; }
|
|
.summary { margin: 10px 16px 16px; padding: 10px 12px; border-radius: 8px;
|
|
background: var(--panel-2); border: 1px solid var(--line); }
|
|
.empty { padding: 16px; color: var(--muted); }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<header>
|
|
<div class="brand">deploy<span>r</span></div>
|
|
<div class="meta" id="meta">loading…</div>
|
|
<div class="spacer"></div>
|
|
<button id="quit" title="Stop the local server and close">quit</button>
|
|
</header>
|
|
|
|
<div class="banner warn hidden" id="elevate">
|
|
Not running as administrator — installs will fail. Close this and re-run deployr from an elevated shell.
|
|
</div>
|
|
<div class="banner info hidden" id="dryrun">
|
|
Dry run: nothing on this machine will be changed.
|
|
</div>
|
|
|
|
<main>
|
|
<section class="card">
|
|
<h2>Applications</h2>
|
|
<div class="controls">
|
|
<input type="search" id="search" placeholder="Filter by name, id or category…" autocomplete="off">
|
|
<button id="sel-none">clear</button>
|
|
<button id="sel-installed">select installed</button>
|
|
<button id="sel-missing">select missing</button>
|
|
</div>
|
|
<div class="profiles" id="profiles"></div>
|
|
<div id="apps"></div>
|
|
<div class="actions">
|
|
<button class="primary" id="do-install">Install selected</button>
|
|
<button id="do-update">Update selected</button>
|
|
<button class="danger" id="do-uninstall">Uninstall selected</button>
|
|
<span class="count" id="count">0 selected</span>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="card">
|
|
<h2>Progress</h2>
|
|
<div id="log"><div class="empty">Nothing has run yet.</div></div>
|
|
<div class="summary hidden" id="summary"></div>
|
|
</section>
|
|
</main>
|
|
|
|
<script>
|
|
const token = new URLSearchParams(location.search).get('t') || '';
|
|
const api = (path, opts = {}) => fetch(path, {
|
|
...opts,
|
|
headers: { 'X-Deployr-Token': token, 'Content-Type': 'application/json', ...(opts.headers || {}) },
|
|
});
|
|
|
|
let state = { apps: [], profiles: {} };
|
|
const selected = new Set();
|
|
|
|
const $ = id => document.getElementById(id);
|
|
const esc = s => String(s ?? '').replace(/[&<>"']/g, c =>
|
|
({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
|
|
async function load() {
|
|
const res = await api('/api/state');
|
|
if (!res.ok) { $('meta').textContent = 'error: ' + await res.text(); return; }
|
|
state = await res.json();
|
|
|
|
$('meta').innerHTML = `${esc(state.version)} · <span class="mono">${esc(state.host)}</span> · ` +
|
|
`${esc(state.os)}/${esc(state.arch)} · ${state.installed} of ${state.apps.length} installed`;
|
|
$('elevate').classList.toggle('hidden', state.elevated);
|
|
$('dryrun').classList.toggle('hidden', !state.dry_run);
|
|
|
|
renderProfiles();
|
|
renderApps();
|
|
}
|
|
|
|
function renderProfiles() {
|
|
const names = Object.keys(state.profiles).sort();
|
|
$('profiles').innerHTML = names.length
|
|
? names.map(n => `<button class="chip" data-profile="${esc(n)}">@${esc(n)}</button>`).join('')
|
|
: '';
|
|
document.querySelectorAll('[data-profile]').forEach(btn => {
|
|
btn.onclick = () => {
|
|
const members = state.profiles[btn.dataset.profile] || [];
|
|
const allOn = members.every(id => selected.has(id));
|
|
members.forEach(id => allOn ? selected.delete(id) : selected.add(id));
|
|
renderApps();
|
|
};
|
|
});
|
|
}
|
|
|
|
function visibleApps() {
|
|
const q = $('search').value.trim().toLowerCase();
|
|
if (!q) return state.apps;
|
|
return state.apps.filter(a =>
|
|
a.id.includes(q) || a.name.toLowerCase().includes(q) ||
|
|
(a.category || '').includes(q) || (a.description || '').toLowerCase().includes(q));
|
|
}
|
|
|
|
function renderApps() {
|
|
const apps = visibleApps();
|
|
const byCat = {};
|
|
for (const a of apps) (byCat[a.category] ||= []).push(a);
|
|
|
|
const html = Object.keys(byCat).sort().map(cat => `
|
|
<div class="cat">${esc(cat)}</div>
|
|
<div class="grid">${byCat[cat].map(appCard).join('')}</div>`).join('');
|
|
|
|
$('apps').innerHTML = html || '<div class="empty">No apps match that filter.</div>';
|
|
|
|
document.querySelectorAll('label.app input').forEach(box => {
|
|
box.onchange = () => {
|
|
box.checked ? selected.add(box.value) : selected.delete(box.value);
|
|
box.closest('label').classList.toggle('checked', box.checked);
|
|
updateCount();
|
|
};
|
|
});
|
|
|
|
// Profile chips light up when every member is selected.
|
|
document.querySelectorAll('[data-profile]').forEach(btn => {
|
|
const members = state.profiles[btn.dataset.profile] || [];
|
|
btn.classList.toggle('on', members.length > 0 && members.every(id => selected.has(id)));
|
|
});
|
|
updateCount();
|
|
}
|
|
|
|
function appCard(a) {
|
|
const on = selected.has(a.id);
|
|
const tag = a.installed
|
|
? `<span class="tag installed">${esc(a.version || 'installed')}</span>`
|
|
: `<span class="tag">${esc(a.provider)}</span>`;
|
|
return `
|
|
<label class="app${on ? ' checked' : ''}">
|
|
<input type="checkbox" value="${esc(a.id)}"${on ? ' checked' : ''}>
|
|
<span>
|
|
<span class="app-name">${esc(a.name)}</span> ${tag}<br>
|
|
<span class="app-sub mono">${esc(a.id)}</span>
|
|
</span>
|
|
</label>`;
|
|
}
|
|
|
|
function updateCount() {
|
|
const n = selected.size;
|
|
$('count').textContent = `${n} selected`;
|
|
for (const id of ['do-install', 'do-update', 'do-uninstall']) $(id).disabled = n === 0 || running;
|
|
}
|
|
|
|
let running = false;
|
|
|
|
async function run(action) {
|
|
if (!selected.size || running) return;
|
|
running = true;
|
|
updateCount();
|
|
$('summary').classList.add('hidden');
|
|
$('log').innerHTML = '';
|
|
logRow('run', action, `${selected.size} app(s)`);
|
|
|
|
const res = await api('/api/run', {
|
|
method: 'POST',
|
|
body: JSON.stringify({ action, apps: [...selected] }),
|
|
});
|
|
if (!res.ok) {
|
|
logRow('fail', action, await res.text());
|
|
running = false;
|
|
updateCount();
|
|
}
|
|
}
|
|
|
|
function logRow(status, who, why) {
|
|
const first = $('log').querySelector('.empty');
|
|
if (first) first.remove();
|
|
const div = document.createElement('div');
|
|
div.className = 'row';
|
|
div.innerHTML = `<span class="st ${esc(status)}">[${esc(status)}]</span>` +
|
|
`<span class="who mono">${esc(who)}</span><span class="why">${esc(why)}</span>`;
|
|
$('log').appendChild(div);
|
|
$('log').scrollTop = $('log').scrollHeight;
|
|
return div;
|
|
}
|
|
|
|
const pending = new Map();
|
|
|
|
function connect() {
|
|
const es = new EventSource(`/api/events?t=${encodeURIComponent(token)}`);
|
|
es.onmessage = ev => {
|
|
const msg = JSON.parse(ev.data);
|
|
if (msg.kind === 'start') {
|
|
pending.set(msg.app, logRow('run', msg.app, 'working…'));
|
|
} else if (msg.kind === 'result') {
|
|
const r = msg.result;
|
|
// The message usually already carries the version ("already installed
|
|
// (1.2.3)"), so only fall back to the bare version when there is none.
|
|
const bits = [];
|
|
if (r.provider) bits.push('via ' + r.provider);
|
|
if (r.message) bits.push(r.message);
|
|
else if (r.version) bits.push(r.version);
|
|
const detail = r.error || bits.join(' ');
|
|
const row = pending.get(msg.app);
|
|
if (row) { row.remove(); pending.delete(msg.app); }
|
|
logRow(r.status === 'n/a' ? 'skip' : r.status, msg.app, detail);
|
|
} else if (msg.kind === 'done') {
|
|
const s = msg.summary;
|
|
running = false;
|
|
updateCount();
|
|
const el = $('summary');
|
|
el.classList.remove('hidden');
|
|
el.innerHTML = `<b>${s.changed} changed</b>, ${s.skipped} skipped, ` +
|
|
`<b>${s.failed} failed</b>, ${s.unsupported} n/a in ${(s.duration_ms / 1000).toFixed(1)}s` +
|
|
(s.reboot_required ? '<br>A reboot is required to finish.' : '');
|
|
load();
|
|
}
|
|
};
|
|
es.onerror = () => { /* EventSource retries on its own */ };
|
|
}
|
|
|
|
$('search').oninput = renderApps;
|
|
$('sel-none').onclick = () => { selected.clear(); renderApps(); };
|
|
$('sel-installed').onclick = () => {
|
|
state.apps.filter(a => a.installed).forEach(a => selected.add(a.id)); renderApps();
|
|
};
|
|
$('sel-missing').onclick = () => {
|
|
state.apps.filter(a => !a.installed).forEach(a => selected.add(a.id)); renderApps();
|
|
};
|
|
$('do-install').onclick = () => run('install');
|
|
$('do-update').onclick = () => run('update');
|
|
$('do-uninstall').onclick = () => {
|
|
if (confirm(`Uninstall ${selected.size} application(s)?`)) run('uninstall');
|
|
};
|
|
$('quit').onclick = async () => {
|
|
await api('/api/quit', { method: 'POST' });
|
|
document.body.innerHTML = '<main><section class="card"><div class="empty">' +
|
|
'Deployr has stopped. You can close this tab.</div></section></main>';
|
|
};
|
|
|
|
load();
|
|
connect();
|
|
</script>
|
|
</body>
|
|
</html>
|