Complete private Monero miner control stack.

Implement Windows agent with RandomX mining and WebSocket fleet reporting, wire dashboard settings into the builder with saved exe paths, and add project README.
This commit is contained in:
drjones
2026-05-26 22:51:47 -07:00
commit 6c42f2b600
48 changed files with 10001 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
import type { Agent, Share, HashrateSample, BuildRecord, FleetStats, ServerConfig, BuildRequest, BuildResponse } from '../types';
const API_BASE = '/api/v1';
async function fetchJSON<T>(url: string, options?: RequestInit): Promise<T> {
const res = await fetch(`${API_BASE}${url}`, {
headers: { 'Content-Type': 'application/json' },
...options,
});
if (!res.ok) {
const err = await res.text();
throw new Error(`API error ${res.status}: ${err}`);
}
return res.json();
}
export const api = {
// Dashboard
getStats: () => fetchJSON<FleetStats>('/dashboard/stats'),
// Agents
listAgents: () => fetchJSON<Agent[]>('/agents'),
getAgent: (id: string) => fetchJSON<Agent>(`/agents/${id}`),
getAgentStats: (id: string, limit?: number) =>
fetchJSON<HashrateSample[]>(`/agents/${id}/stats${limit ? `?limit=${limit}` : ''}`),
// Shares
getRecentShares: (limit?: number) =>
fetchJSON<Share[]>(`/shares${limit ? `?limit=${limit}` : ''}`),
// Builds
listBuilds: () => fetchJSON<BuildRecord[]>('/builds'),
// Config
getConfig: () => fetchJSON<ServerConfig>('/config'),
updateConfig: (config: Partial<ServerConfig>) =>
fetchJSON<ServerConfig>('/config', {
method: 'PUT',
body: JSON.stringify(config),
}),
// Builder
buildAgent: (req: BuildRequest) =>
fetchJSON<BuildResponse>('/builder/build', {
method: 'POST',
body: JSON.stringify(req),
}),
downloadBuild: (buildId: string) => `${API_BASE}/builds/${buildId}/download`,
// Health
healthCheck: () => fetchJSON<{ status: string }>('/health'),
};