Add mock options in frontend and removed from environment variables
This commit is contained in:
@@ -188,6 +188,16 @@
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
</form>
|
||||
</div>
|
||||
<h3 style="margin:1.5rem 0 1rem">Mock Mode</h3>
|
||||
<div class="card" style="max-width:440px">
|
||||
<p style="color:var(--text-muted);font-size:.9rem;margin-bottom:1rem">
|
||||
When enabled, gate open requests always succeed without contacting AVConnect.
|
||||
</p>
|
||||
<label style="display:flex;align-items:center;gap:.75rem;cursor:pointer;margin:0">
|
||||
<input type="checkbox" id="mock-toggle" style="width:1.1rem;height:1.1rem;flex-shrink:0;cursor:pointer" />
|
||||
<span style="font-weight:600">Enable mock AVConnect</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── Statistics pane ───────────────────────────────────────────── -->
|
||||
|
||||
@@ -447,8 +447,22 @@ async function loadCredentials() {
|
||||
document.getElementById("cred-username").value = list[0].username;
|
||||
}
|
||||
} catch { /* no creds yet */ }
|
||||
try {
|
||||
const { enabled } = await api("GET", "/api/admin/credentials/mock");
|
||||
document.getElementById("mock-toggle").checked = enabled;
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
|
||||
document.getElementById("mock-toggle").addEventListener("change", async e => {
|
||||
try {
|
||||
await api("PUT", "/api/admin/credentials/mock", { enabled: e.target.checked });
|
||||
showToast(e.target.checked ? "Mock mode enabled" : "Mock mode disabled");
|
||||
} catch (err) {
|
||||
showToast(err.message, true);
|
||||
e.target.checked = !e.target.checked; // revert
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById("credentials-form").addEventListener("submit", async e => {
|
||||
e.preventDefault();
|
||||
const username = document.getElementById("cred-username").value.trim();
|
||||
|
||||
Reference in New Issue
Block a user