Initial commit of AthonetTools

This commit is contained in:
2025-08-21 12:59:43 +00:00
commit cd932b8fcb
2483 changed files with 433999 additions and 0 deletions

39
static/js/wizard/api.js Normal file
View File

@@ -0,0 +1,39 @@
// static/js/graph/wizard/api.js
export async function setTarget(ip) {
const r = await fetch('/api/host/target', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({ ip })
});
const j = await r.json();
if (!r.ok || !j.ok) throw new Error(j.error || 'Failed to set target IP');
return j;
}
export async function getTarget() {
const r = await fetch('/api/host/target');
// returns { ip: "x.x.x.x" } or { ip: null }
return r.ok ? r.json() : { ip: null };
}
export async function bootstrapAccess() {
const r = await fetch('/api/host/bootstrap_access', { method: 'POST' });
const j = await r.json();
if (!r.ok || !j.ok) throw new Error(j.error || 'Failed to bootstrap access');
return j;
}
// static/js/wizard/api.js
export async function renderAnsible(payload) {
const r = await fetch('/api/ansible/render', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(payload)
});
const j = await r.json().catch(() => ({}));
if (!r.ok || !j.ok) {
const msg = j.error || `Render failed (HTTP ${r.status})`;
throw new Error(msg);
}
return j; // { ok: true, staging: "ansible_workspace/staging" }
}