Add builder service: scaffold, ASC API, devices UI, fastlane profile manager
Phase 1-3 of the builder subsystem on the Mac mini: - Express + SQLite + sessions scaffolding, LAN-only service on port 3090 - App Store Connect JWT client (ES256 signing, devices/profiles/bundleIds) - Device management UI with Apple-side registration - Fastlane sigh wrapper with profile cache + auto-install to ~/Library/ - launchd plist + deploy script for Mac mini supervision
This commit is contained in:
511
builder/public/css/style.css
Normal file
511
builder/public/css/style.css
Normal file
@@ -0,0 +1,511 @@
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
:root {
|
||||
--bg: #0a0a0a;
|
||||
--surface: #1a1a1a;
|
||||
--surface-hover: #222;
|
||||
--border: #333;
|
||||
--text: #f5f5f5;
|
||||
--text-muted: #888;
|
||||
--accent: #007AFF;
|
||||
--accent-hover: #0066d6;
|
||||
--danger: #ff3b30;
|
||||
--success: #30d158;
|
||||
--radius: 12px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro', system-ui, sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
min-height: 100vh;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16px 24px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: var(--surface);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
header h1 { font-size: 20px; font-weight: 700; }
|
||||
|
||||
nav { display: flex; gap: 8px; }
|
||||
|
||||
nav a {
|
||||
color: var(--text-muted);
|
||||
text-decoration: none;
|
||||
padding: 8px 16px;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
nav a:hover, nav a.active {
|
||||
color: var(--text);
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
nav a.logout { color: var(--danger); }
|
||||
nav a.logout:hover { background: rgba(255,59,48,0.1); }
|
||||
|
||||
/* Main */
|
||||
main { max-width: 900px; margin: 0 auto; padding: 24px; }
|
||||
|
||||
/* App Grid */
|
||||
.app-grid { display: flex; flex-direction: column; gap: 12px; }
|
||||
|
||||
.app-card {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
}
|
||||
|
||||
.app-card:hover { background: var(--surface-hover); border-color: #444; }
|
||||
|
||||
.app-icon {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 14px;
|
||||
background: #2a2a2a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 28px;
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
|
||||
|
||||
.app-info { flex: 1; min-width: 0; }
|
||||
.app-name { font-weight: 600; font-size: 16px; }
|
||||
.app-bundle { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
|
||||
.app-version { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
|
||||
|
||||
.app-action { flex-shrink: 0; }
|
||||
|
||||
.btn, button[type="submit"] {
|
||||
background: var(--accent);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 24px;
|
||||
border-radius: 20px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.btn:hover, button[type="submit"]:hover { background: var(--accent-hover); }
|
||||
.btn-sm { padding: 6px 16px; font-size: 13px; }
|
||||
.btn-danger { background: var(--danger); }
|
||||
.btn-danger:hover { background: #e0342a; }
|
||||
|
||||
.install-btn {
|
||||
background: var(--accent);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 8px 20px;
|
||||
border-radius: 20px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Empty state */
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
padding: 80px 20px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.empty-state p { font-size: 18px; margin-bottom: 16px; }
|
||||
|
||||
/* Login */
|
||||
.login-page {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.login-card {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 16px;
|
||||
padding: 40px;
|
||||
width: 320px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.login-icon { font-size: 48px; margin-bottom: 12px; }
|
||||
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
|
||||
.login-card .subtitle { color: var(--text-muted); margin-bottom: 24px; font-size: 14px; }
|
||||
|
||||
.login-card input {
|
||||
width: 100%;
|
||||
padding: 12px 16px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-size: 16px;
|
||||
margin-bottom: 12px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.login-card input:focus { border-color: var(--accent); }
|
||||
|
||||
.login-card button {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.login-card .error { color: var(--danger); font-size: 14px; margin-bottom: 8px; }
|
||||
|
||||
/* Upload */
|
||||
.upload-card {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.upload-card h2 { margin-bottom: 16px; font-size: 20px; }
|
||||
|
||||
.drop-zone {
|
||||
border: 2px dashed var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 48px 24px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.drop-zone:hover, .drop-zone.drag-over {
|
||||
border-color: var(--accent);
|
||||
background: rgba(0,122,255,0.05);
|
||||
}
|
||||
|
||||
.drop-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
|
||||
.drop-icon { font-size: 32px; color: var(--text-muted); margin-bottom: 8px; }
|
||||
.drop-zone p { color: var(--text-muted); font-size: 14px; }
|
||||
|
||||
.file-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 12px 0;
|
||||
font-size: 14px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
resize: vertical;
|
||||
margin-bottom: 12px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
textarea:focus { border-color: var(--accent); }
|
||||
|
||||
.upload-card button[type="submit"] { width: 100%; }
|
||||
|
||||
.progress {
|
||||
height: 4px;
|
||||
background: var(--border);
|
||||
border-radius: 2px;
|
||||
margin-top: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
height: 100%;
|
||||
background: var(--accent);
|
||||
width: 0;
|
||||
transition: width 0.2s;
|
||||
}
|
||||
|
||||
.result { margin-top: 16px; padding: 12px; border-radius: 10px; font-size: 14px; }
|
||||
.result.success { background: rgba(48,209,88,0.1); color: var(--success); }
|
||||
.result.error { background: rgba(255,59,48,0.1); color: var(--danger); }
|
||||
.result a { color: var(--accent); }
|
||||
|
||||
.api-info {
|
||||
margin-top: 24px;
|
||||
padding-top: 24px;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.api-info h3 { font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }
|
||||
|
||||
.api-info pre {
|
||||
background: var(--bg);
|
||||
padding: 12px;
|
||||
border-radius: 8px;
|
||||
overflow-x: auto;
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* Modal */
|
||||
.modal {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0,0,0,0.7);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 100;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 16px;
|
||||
max-width: 500px;
|
||||
width: 100%;
|
||||
max-height: 80vh;
|
||||
overflow-y: auto;
|
||||
padding: 24px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.modal-close {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 16px;
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-muted);
|
||||
font-size: 24px;
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.modal-close:hover { color: var(--text); }
|
||||
|
||||
.modal-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.modal-header .app-icon { width: 64px; height: 64px; }
|
||||
|
||||
.build-list { display: flex; flex-direction: column; gap: 8px; }
|
||||
|
||||
.build-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12px;
|
||||
background: var(--bg);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.build-meta { flex: 1; }
|
||||
.build-version { font-weight: 600; font-size: 14px; }
|
||||
.build-date { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
|
||||
.build-notes { color: var(--text-muted); font-size: 12px; margin-top: 4px; font-style: italic; }
|
||||
.build-size { color: var(--text-muted); font-size: 12px; }
|
||||
|
||||
.build-actions { display: flex; gap: 8px; align-items: center; }
|
||||
|
||||
.delete-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
padding: 4px 8px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.delete-btn:hover { color: var(--danger); background: rgba(255,59,48,0.1); }
|
||||
|
||||
.modal-footer {
|
||||
margin-top: 16px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid var(--border);
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 600px) {
|
||||
header { padding: 12px 16px; }
|
||||
header h1 { font-size: 17px; }
|
||||
nav a { padding: 6px 10px; font-size: 13px; }
|
||||
main { padding: 16px; }
|
||||
.app-card { padding: 12px; gap: 12px; }
|
||||
.app-icon { width: 48px; height: 48px; border-radius: 11px; font-size: 22px; }
|
||||
.app-name { font-size: 15px; }
|
||||
.upload-card { padding: 16px; }
|
||||
.drop-zone { padding: 32px 16px; }
|
||||
}
|
||||
|
||||
/* --- Builder-specific additions --- */
|
||||
|
||||
.page-title {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.section { margin-bottom: 24px; }
|
||||
.section h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
|
||||
|
||||
/* Card (generic) */
|
||||
.card {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius);
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.card + .card { margin-top: 12px; }
|
||||
|
||||
/* Form controls */
|
||||
label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
|
||||
|
||||
input[type="text"], input[type="password"], input[type="url"], input[type="email"], select {
|
||||
width: 100%;
|
||||
padding: 10px 14px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
margin-bottom: 12px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
input:focus, select:focus { border-color: var(--accent); }
|
||||
|
||||
.field-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
|
||||
@media (max-width: 600px) { .field-group { grid-template-columns: 1fr; } }
|
||||
|
||||
/* Buttons */
|
||||
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 14px; }
|
||||
.btn-secondary {
|
||||
background: transparent;
|
||||
color: var(--text);
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
.btn-secondary:hover { background: var(--surface-hover); }
|
||||
|
||||
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
|
||||
|
||||
/* Status badges */
|
||||
.badge {
|
||||
display: inline-block;
|
||||
padding: 3px 10px;
|
||||
border-radius: 10px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
|
||||
.badge.pending { background: rgba(255,149,0,0.15); color: #ff9500; }
|
||||
.badge.running { background: rgba(0,122,255,0.15); color: var(--accent); }
|
||||
.badge.succeeded { background: rgba(48,209,88,0.15); color: var(--success); }
|
||||
.badge.failed { background: rgba(255,59,48,0.15); color: var(--danger); }
|
||||
.badge.synced { background: rgba(48,209,88,0.15); color: var(--success); }
|
||||
.badge.unsynced { background: rgba(255,149,0,0.15); color: #ff9500; }
|
||||
|
||||
/* Tables */
|
||||
.table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
background: var(--surface);
|
||||
border-radius: var(--radius);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table th, .table td {
|
||||
text-align: left;
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.table th {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: var(--text-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
.table tr:last-child td { border-bottom: none; }
|
||||
|
||||
.table tbody tr:hover { background: var(--surface-hover); }
|
||||
|
||||
.table .mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; color: var(--text-muted); }
|
||||
|
||||
/* Toast */
|
||||
.toast {
|
||||
position: fixed;
|
||||
bottom: 24px;
|
||||
right: 24px;
|
||||
padding: 12px 20px;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
font-size: 14px;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
|
||||
z-index: 1000;
|
||||
opacity: 0;
|
||||
transform: translateY(8px);
|
||||
transition: opacity 0.2s, transform 0.2s;
|
||||
}
|
||||
.toast.show { opacity: 1; transform: translateY(0); }
|
||||
.toast.success { border-color: var(--success); }
|
||||
.toast.error { border-color: var(--danger); }
|
||||
|
||||
/* Log viewer */
|
||||
.log-viewer {
|
||||
background: #000;
|
||||
color: #d0d0d0;
|
||||
font-family: ui-monospace, 'SF Mono', Menlo, monospace;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
padding: 16px;
|
||||
border-radius: 10px;
|
||||
max-height: 500px;
|
||||
overflow-y: auto;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
83
builder/public/js/devices.js
Normal file
83
builder/public/js/devices.js
Normal file
@@ -0,0 +1,83 @@
|
||||
const $ = (s) => document.querySelector(s);
|
||||
const esc = (s) => { const d = document.createElement('div'); d.textContent = s ?? ''; return d.innerHTML; };
|
||||
|
||||
function toast(msg, kind = '') {
|
||||
const t = $('#toast');
|
||||
t.textContent = msg;
|
||||
t.className = 'toast show ' + kind;
|
||||
setTimeout(() => t.classList.remove('show'), 3500);
|
||||
}
|
||||
|
||||
async function load() {
|
||||
const res = await fetch('/api/devices');
|
||||
if (res.status === 401) { location.href = '/login'; return; }
|
||||
const devices = await res.json();
|
||||
const container = $('#devices-container');
|
||||
|
||||
if (!devices.length) {
|
||||
container.innerHTML = '<div class="card"><p style="color:var(--text-muted)">No devices registered yet.</p></div>';
|
||||
return;
|
||||
}
|
||||
|
||||
container.innerHTML = `
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr><th>Name</th><th>UDID</th><th>Status</th><th>Added</th><th></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
${devices.map(d => `
|
||||
<tr>
|
||||
<td>${esc(d.name) || '<span class="mono" style="color:var(--text-muted)">unnamed</span>'}</td>
|
||||
<td class="mono">${esc(d.udid)}</td>
|
||||
<td>${d.synced_at
|
||||
? '<span class="badge synced">Synced</span>'
|
||||
: '<span class="badge unsynced">Local only</span>'}</td>
|
||||
<td class="mono">${esc(d.added_at)}</td>
|
||||
<td><button class="delete-btn" data-udid="${esc(d.udid)}" title="Delete">×</button></td>
|
||||
</tr>
|
||||
`).join('')}
|
||||
</tbody>
|
||||
</table>
|
||||
`;
|
||||
|
||||
container.querySelectorAll('.delete-btn').forEach(btn => {
|
||||
btn.addEventListener('click', async () => {
|
||||
if (!confirm('Remove this device locally? (It will remain in the Apple portal.)')) return;
|
||||
const udid = btn.getAttribute('data-udid');
|
||||
const r = await fetch(`/api/devices/${udid}`, { method: 'DELETE' });
|
||||
if (r.ok) { toast('Removed', 'success'); load(); }
|
||||
else toast('Delete failed', 'error');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$('#add-form').addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
const form = e.target;
|
||||
const body = {
|
||||
udid: form.udid.value.trim(),
|
||||
name: form.name.value.trim(),
|
||||
};
|
||||
const btn = form.querySelector('button[type=submit]');
|
||||
btn.disabled = true;
|
||||
btn.textContent = 'Registering…';
|
||||
|
||||
const r = await fetch('/api/devices', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
const data = await r.json().catch(() => ({}));
|
||||
btn.disabled = false;
|
||||
btn.textContent = 'Add Device';
|
||||
|
||||
if (r.ok) {
|
||||
toast(data.synced ? 'Registered with Apple' : 'Saved locally (ASC not configured)', 'success');
|
||||
form.reset();
|
||||
load();
|
||||
} else {
|
||||
toast(data.error || 'Register failed', 'error');
|
||||
}
|
||||
});
|
||||
|
||||
load();
|
||||
74
builder/public/js/settings.js
Normal file
74
builder/public/js/settings.js
Normal file
@@ -0,0 +1,74 @@
|
||||
const $ = (sel) => document.querySelector(sel);
|
||||
const toast = (msg, kind = '') => {
|
||||
const t = $('#toast');
|
||||
t.textContent = msg;
|
||||
t.className = 'toast show ' + kind;
|
||||
setTimeout(() => t.classList.remove('show'), 3000);
|
||||
};
|
||||
|
||||
async function load() {
|
||||
const res = await fetch('/api/settings');
|
||||
if (res.status === 401) { location.href = '/login'; return; }
|
||||
const s = await res.json();
|
||||
|
||||
$('[name=asc_key_id]').value = s.asc_key_id || '';
|
||||
$('[name=asc_issuer_id]').value = s.asc_issuer_id || '';
|
||||
$('[name=unraid_url]').value = s.unraid_url || '';
|
||||
$('[name=unraid_token]').value = s.unraid_token || '';
|
||||
|
||||
$('#p8-status').textContent = s.asc_key_uploaded
|
||||
? `✓ .p8 uploaded for key ${s.asc_key_id}`
|
||||
: 'No .p8 uploaded yet';
|
||||
}
|
||||
|
||||
async function saveForm(formEl, keys) {
|
||||
const data = Object.fromEntries(keys.map(k => [k, formEl.querySelector(`[name=${k}]`)?.value || '']));
|
||||
const res = await fetch('/api/settings', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
if (res.ok) toast('Saved', 'success');
|
||||
else toast('Save failed', 'error');
|
||||
}
|
||||
|
||||
$('#asc-form').addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
await saveForm(e.target, ['asc_key_id', 'asc_issuer_id']);
|
||||
|
||||
// Upload .p8 if one was selected
|
||||
const file = $('#p8-input').files[0];
|
||||
if (file) {
|
||||
const fd = new FormData();
|
||||
fd.append('p8', file);
|
||||
const res = await fetch('/api/settings/p8', { method: 'POST', body: fd });
|
||||
if (res.ok) {
|
||||
toast('.p8 uploaded', 'success');
|
||||
load();
|
||||
} else {
|
||||
const err = await res.json().catch(() => ({}));
|
||||
toast(err.error || 'Upload failed', 'error');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#unraid-form').addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
await saveForm(e.target, ['unraid_url', 'unraid_token']);
|
||||
});
|
||||
|
||||
$('#test-asc').addEventListener('click', async () => {
|
||||
const res = await fetch('/api/settings/test-asc', { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (res.ok) toast(`Connected — ${data.device_count} devices in portal`, 'success');
|
||||
else toast(data.error || 'Connection failed', 'error');
|
||||
});
|
||||
|
||||
$('#test-unraid').addEventListener('click', async () => {
|
||||
const res = await fetch('/api/settings/test-unraid', { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (res.ok) toast(`Connected to unraid — ${data.app_count} apps`, 'success');
|
||||
else toast(data.error || 'Connection failed', 'error');
|
||||
});
|
||||
|
||||
load();
|
||||
Reference in New Issue
Block a user