mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-19 11:25:56 +00:00
Rebuild installed modules for the new core during an update
The core changes almost daily and a plugin loads only into the core it was built for. update::apply now brings every enabled plugin to the new core before the trial start: a build already in the store is reused, otherwise it is rebuilt from the sources recorded at its last build (build recipe). A plugin that cannot be rebuilt is switched off with the reason (and plugins that depend on it); the core update always goes ahead. A rollback puts the builds for the restored core back. The update result lists rebuilt and switched-off modules. Also: plugin.json records the real compiler instead of a fixed string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
76be1d3238
commit
da94fb49a4
16 files changed
+424
-33
No files matched your search
@@ -22,7 +22,7 @@ export interface ServerUpdateState {
|
||||
stateError: UiError | null;
|
||||
stateRevision: number;
|
||||
/** How the last update ended; kept here so the Settings card can show it after the user left and came back. */
|
||||
result: { committed: string; preexistingCharacters?: number } | { pending: UpdateTxn } | null;
|
||||
result: { committed: string; preexistingCharacters?: number; modulesRebuilt?: string[]; modulesOff?: { id: string; reason: string }[] } | { pending: UpdateTxn } | null;
|
||||
}
|
||||
|
||||
const EMPTY: ServerUpdateState = { preview: null, available: false, checking: false, applying: false, step: null, percent: 0, error: null, uiError: null, stateError: null, stateRevision: 0, result: null };
|
||||
@@ -105,7 +105,10 @@ export async function applyServerUpdate(id: string, opts?: { choices: Record<str
|
||||
}
|
||||
try {
|
||||
const out = await api.applyUpdate(id, opts?.choices ?? {}, opts?.source);
|
||||
set(id, { result: out.txn.state === "committed" ? { committed: out.txn.to_version ?? "", ...(out.preexisting_character_count ? { preexistingCharacters: out.preexisting_character_count } : {}) } : { pending: out.txn } });
|
||||
const mods = out.modules ?? [];
|
||||
const rebuilt = mods.filter((m) => m.result === "rebuilt" || m.result === "reused").map((m) => m.id);
|
||||
const off = mods.flatMap((m) => m.result === "disabled" ? [{ id: m.id, reason: m.reason }, ...m.also.map((a) => ({ id: a, reason: m.reason }))] : []);
|
||||
set(id, { result: out.txn.state === "committed" ? { committed: out.txn.to_version ?? "", ...(out.preexisting_character_count ? { preexistingCharacters: out.preexisting_character_count } : {}), ...(rebuilt.length ? { modulesRebuilt: rebuilt } : {}), ...(off.length ? { modulesOff: off } : {}) } : { pending: out.txn } });
|
||||
if (out.txn.state === "committed" && !wasRunning && !startAfterUpdate("server", id)) await api.stop(id).catch(() => undefined);
|
||||
return true;
|
||||
} catch (e) {
|
||||
|
||||
Reference in new issue
Block a user