Add magic bytes deployment system for agent modes
- Agent config: Added EmbeddedConfig struct and RunMode enum for filename-based mode detection (Viewer, TempSupport, PermanentAgent) - Agent main: Updated to detect run mode from filename or embedded config - Server: Added /api/download/* endpoints for generating configured binaries - /api/download/viewer - Downloads GuruConnect-Viewer.exe - /api/download/support?code=123456 - Downloads GuruConnect-123456.exe - /api/download/agent?company=X&site=Y - Downloads with embedded config - Dashboard: Updated Build tab with Quick Downloads and Permanent Agent Builder - Included base agent binary in static/downloads 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -477,20 +477,50 @@
|
||||
|
||||
<!-- Build Tab -->
|
||||
<div class="tab-panel" id="build-panel">
|
||||
<!-- Quick Downloads -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<h2 class="card-title">Installer Builder</h2>
|
||||
<h2 class="card-title">Quick Downloads</h2>
|
||||
<p class="card-description">Download viewer or create temp support sessions</p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px;">
|
||||
<div style="padding: 20px; background: hsl(var(--muted)); border-radius: 8px;">
|
||||
<h3 style="font-size: 16px; margin-bottom: 8px;">Viewer Only</h3>
|
||||
<p style="font-size: 13px; color: hsl(var(--muted-foreground)); margin-bottom: 16px;">
|
||||
Installs the protocol handler for connecting to remote sessions. No agent functionality.
|
||||
</p>
|
||||
<a href="/api/download/viewer" class="btn btn-primary" style="text-decoration: none;">Download Viewer</a>
|
||||
</div>
|
||||
<div style="padding: 20px; background: hsl(var(--muted)); border-radius: 8px;">
|
||||
<h3 style="font-size: 16px; margin-bottom: 8px;">Temp Support Session</h3>
|
||||
<p style="font-size: 13px; color: hsl(var(--muted-foreground)); margin-bottom: 12px;">
|
||||
Generate a support code first, then create a download link with that code embedded.
|
||||
</p>
|
||||
<div style="display: flex; gap: 8px; align-items: center;">
|
||||
<input type="text" id="supportCodeInput" placeholder="6-digit code" maxlength="6"
|
||||
style="width: 120px; padding: 8px 12px; font-size: 14px; background: hsl(var(--input)); border: 1px solid hsl(var(--border)); border-radius: 6px; color: hsl(var(--foreground));">
|
||||
<button class="btn btn-outline" onclick="downloadSupportAgent()">Generate Link</button>
|
||||
</div>
|
||||
<div id="supportDownloadLink" style="margin-top: 12px; display: none;">
|
||||
<a href="#" id="supportDownloadAnchor" class="btn btn-primary" style="text-decoration: none;">Download Support Agent</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Permanent Agent Builder -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<h2 class="card-title">Permanent Agent Builder</h2>
|
||||
<p class="card-description">Create customized agent installers for unattended access</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-grid">
|
||||
<div class="form-group">
|
||||
<label for="buildName">Name</label>
|
||||
<input type="text" id="buildName" placeholder="Machine name (auto if blank)">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="buildCompany">Company</label>
|
||||
<label for="buildCompany">Company *</label>
|
||||
<input type="text" id="buildCompany" placeholder="Client organization">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -498,29 +528,19 @@
|
||||
<input type="text" id="buildSite" placeholder="Physical location">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="buildDepartment">Department</label>
|
||||
<input type="text" id="buildDepartment" placeholder="Business unit">
|
||||
<label for="buildTags">Tags</label>
|
||||
<input type="text" id="buildTags" placeholder="Comma-separated (e.g., workstation, finance)">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="buildDeviceType">Device Type</label>
|
||||
<select id="buildDeviceType">
|
||||
<option value="workstation">Workstation</option>
|
||||
<option value="laptop">Laptop</option>
|
||||
<option value="server">Server</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="buildTag">Tag</label>
|
||||
<input type="text" id="buildTag" placeholder="Custom label">
|
||||
<label for="buildApiKey">API Key</label>
|
||||
<input type="text" id="buildApiKey" placeholder="Optional (uses default if blank)">
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 24px; display: flex; gap: 12px;">
|
||||
<button class="btn btn-primary" disabled>Build EXE (64-bit)</button>
|
||||
<button class="btn btn-outline" disabled>Build EXE (32-bit)</button>
|
||||
<button class="btn btn-outline" disabled>Build MSI</button>
|
||||
<div style="margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap;">
|
||||
<button class="btn btn-primary" onclick="buildPermanentAgent()">Download Configured Agent</button>
|
||||
</div>
|
||||
<p style="margin-top: 16px; font-size: 13px; color: hsl(var(--muted-foreground));">
|
||||
Agent builds will be available once the agent is compiled.
|
||||
The downloaded agent will have company/site/tags embedded. It will auto-register when run.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1371,6 +1391,46 @@
|
||||
div.textContent = text;
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
// ========== Download Functions ==========
|
||||
|
||||
function downloadSupportAgent() {
|
||||
const code = document.getElementById("supportCodeInput").value.trim();
|
||||
if (!code || code.length !== 6 || !/^\d{6}$/.test(code)) {
|
||||
alert("Please enter a valid 6-digit support code.");
|
||||
return;
|
||||
}
|
||||
|
||||
const downloadUrl = "/api/download/support?code=" + code;
|
||||
const anchor = document.getElementById("supportDownloadAnchor");
|
||||
anchor.href = downloadUrl;
|
||||
anchor.textContent = "Download GuruConnect-" + code + ".exe";
|
||||
document.getElementById("supportDownloadLink").style.display = "block";
|
||||
|
||||
// Automatically start download
|
||||
window.location.href = downloadUrl;
|
||||
}
|
||||
|
||||
function buildPermanentAgent() {
|
||||
const company = document.getElementById("buildCompany").value.trim();
|
||||
const site = document.getElementById("buildSite").value.trim();
|
||||
const tags = document.getElementById("buildTags").value.trim();
|
||||
const apiKey = document.getElementById("buildApiKey").value.trim();
|
||||
|
||||
if (!company) {
|
||||
alert("Company name is required for permanent agent builds.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Build URL with query parameters
|
||||
let url = "/api/download/agent?company=" + encodeURIComponent(company);
|
||||
if (site) url += "&site=" + encodeURIComponent(site);
|
||||
if (tags) url += "&tags=" + encodeURIComponent(tags);
|
||||
if (apiKey) url += "&api_key=" + encodeURIComponent(apiKey);
|
||||
|
||||
// Start download
|
||||
window.location.href = url;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user