diff --git a/MiGu.Server/Controllers/OpsController.cs b/MiGu.Server/Controllers/OpsController.cs
index 6d11299..8f2b2ed 100644
--- a/MiGu.Server/Controllers/OpsController.cs
+++ b/MiGu.Server/Controllers/OpsController.cs
@@ -133,6 +133,10 @@ public class OpsController : ControllerBase
// 即使 SimpleLite 默认放行 loopback,也带上 internal token,兼容其严格模式(AllowLoopback=false)。
if (!string.IsNullOrEmpty(_internalToken.Token))
msg.Headers.TryAddWithoutValidation("X-Platform-Internal-Token", _internalToken.Token);
+ // 运维面板已对 needConfirm 动作做过二次确认;内核 RequiresPlatformConfirm 方法需此头。
+ msg.Headers.TryAddWithoutValidation("X-Platform-Confirmed", "1");
+ if (!string.IsNullOrWhiteSpace(user))
+ msg.Headers.TryAddWithoutValidation("X-Platform-User", user);
using var resp = await client.SendAsync(msg);
var body = await resp.Content.ReadAsStringAsync();
var success = resp.IsSuccessStatusCode && ParseSuccess(body);
diff --git a/MiGu.Server/Launcher/SimpleLiteLauncher.cs b/MiGu.Server/Launcher/SimpleLiteLauncher.cs
index d9055c5..f8bac00 100644
--- a/MiGu.Server/Launcher/SimpleLiteLauncher.cs
+++ b/MiGu.Server/Launcher/SimpleLiteLauncher.cs
@@ -349,11 +349,10 @@ public sealed class SimpleLiteLauncher : IDisposable
/// 写 active-scenes.json 的结果(供向导保存接口回显)。
public readonly record struct ActiveScenesWriteResult(bool Ok, string? Path, string? Error);
- ///
- /// 关闭所有 SimpleLite 进程、同步 obj→bin 最新 DLL,再按 launchMode 重新拉起。
- ///
- public LaunchResult RestartForUpdate(string launchMode = "webonly")
+ /// 终止本机全部 SimpleLite 进程并清理 MiGu.Server 侧托管引用。
+ public int StopAll()
{
+ var killed = 0;
foreach (var proc in Process.GetProcessesByName("SimpleLite"))
{
try
@@ -361,12 +360,13 @@ public sealed class SimpleLiteLauncher : IDisposable
if (!proc.HasExited)
{
proc.Kill(entireProcessTree: true);
- _log.LogInformation("[SimpleLite] restart-for-update: killed pid={Pid}", proc.Id);
+ killed++;
+ _log.LogInformation("[SimpleLite] stop: killed pid={Pid}", proc.Id);
}
}
catch (Exception ex)
{
- _log.LogWarning("[SimpleLite] restart-for-update: kill pid={Pid} failed: {Msg}", proc.Id, ex.Message);
+ _log.LogWarning("[SimpleLite] stop: kill pid={Pid} failed: {Msg}", proc.Id, ex.Message);
}
finally
{
@@ -374,7 +374,7 @@ public sealed class SimpleLiteLauncher : IDisposable
}
}
- Thread.Sleep(1500);
+ if (killed > 0) Thread.Sleep(1500);
lock (_sync)
{
@@ -382,6 +382,23 @@ public sealed class SimpleLiteLauncher : IDisposable
_lastLaunchMode = null;
}
+ return killed;
+ }
+
+ /// 关闭全部 SimpleLite 后按 launchMode 重新拉起(不同步 DLL)。
+ public LaunchResult Restart(string launchMode = "webonly")
+ {
+ StopAll();
+ return MaybeStart(launchMode);
+ }
+
+ ///
+ /// 关闭所有 SimpleLite 进程、同步 obj→bin 最新 DLL,再按 launchMode 重新拉起。
+ ///
+ public LaunchResult RestartForUpdate(string launchMode = "webonly")
+ {
+ StopAll();
+
var synced = SimpleLiteBuildSync.TrySyncFromObjToBin(_env.ContentRootPath, _log);
var result = MaybeStart(launchMode);
if (!synced && result.Warning == null)
diff --git a/frontends/apps/simple-platform-vue/src/views/ServiceStatusView.vue b/frontends/apps/simple-platform-vue/src/views/ServiceStatusView.vue
index ecaec03..03d57c1 100644
--- a/frontends/apps/simple-platform-vue/src/views/ServiceStatusView.vue
+++ b/frontends/apps/simple-platform-vue/src/views/ServiceStatusView.vue
@@ -43,6 +43,28 @@
+
+
SimpleLite 操作
+
+
+ 重启 SimpleLite
+
+
+ 关闭 SimpleLite
+
+
+
将终止本机全部 SimpleLite 进程;重启后按当前启动模式重新拉起。
+
+
刷新
返回
@@ -54,34 +76,29 @@