Skip to content

Commit 5f13997

Browse files
committed
webui: save moudule only after load success
1 parent cee323f commit 5f13997

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

webui/page/kpm.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,17 +309,16 @@ async function uploadAndLoadModule() {
309309
};
310310

311311
dialog.querySelector('.confirm').onclick = async () => {
312-
if (!checkbox.checked) {
313-
await exec(`
314-
mkdir -p ${persistDir}/kpm
315-
cp -f "${modDir}/tmp/${file.name}" "${persistDir}/kpm/${info.name}.kpm"
316-
`);
317-
}
318-
319312
const success = await loadModule(`${modDir}/tmp/${file.name}`);
320313
if (success) {
321314
toast(`Successfully loaded ${info.name}`);
322315
refreshKpmList();
316+
if (!checkbox.checked) { // Save module to load on boot automatically
317+
exec(`
318+
mkdir -p ${persistDir}/kpm
319+
cp -f "${modDir}/tmp/${file.name}" "${persistDir}/kpm/${info.name}.kpm"
320+
`);
321+
}
323322
} else {
324323
toast(`Failed to load module ${info.name}`);
325324
}

0 commit comments

Comments
 (0)