diff --git a/backend/internal/httpapi/resource_crud_integration_test.go b/backend/internal/httpapi/resource_crud_integration_test.go
index 1ea6421..3bb427c 100644
--- a/backend/internal/httpapi/resource_crud_integration_test.go
+++ b/backend/internal/httpapi/resource_crud_integration_test.go
@@ -4,6 +4,7 @@ import (
"bytes"
"context"
"encoding/json"
+ "fmt"
"github.com/go-sql-driver/mysql"
"net/http"
"net/http/httptest"
@@ -17,6 +18,7 @@ import (
"sea-vhost/internal/store"
"strconv"
"strings"
+ "sync"
"testing"
"time"
)
@@ -118,6 +120,49 @@ func TestResourceCRUDMySQL(t *testing.T) {
must(e)
must(db.UpdateRuntimeJob(ctx, last.ID, "completed", "verified", "test"))
})
+ t.Run("Python submission returns its job and uses only the source isolator", func(t *testing.T) {
+ p := &pythonInstallPanel{Mock: panel.NewMock()}
+ isolator := pythonInstallIsolation{Mock: isolation.Mock{Root: root}, panel: p}
+ svc := service.NewProjects(db, p, isolator, "hosts.example.invalid", root, true, secret, "control.example.invalid")
+ api := New(config.Config{SessionSecret: secret, ManagementDomain: "control.example.invalid", CookieSecure: true, SessionTTL: time.Hour}, db, svc)
+ r := httptest.NewRequest("POST", "https://control.example.invalid/api/v1/admin/runtime-environments/Python/install", strings.NewReader(`{"version":"3.13.1"}`))
+ r.Header.Set("Origin", "https://control.example.invalid")
+ r.Header.Set("Content-Type", "application/json")
+ r.AddCookie(&http.Cookie{Name: "sea_session", Value: token})
+ w := httptest.NewRecorder()
+ api.Handler().ServeHTTP(w, r)
+ var submitted struct {
+ OK bool `json:"ok"`
+ JobID uint64 `json:"jobId"`
+ }
+ if w.Code != 202 || json.Unmarshal(w.Body.Bytes(), &submitted) != nil || !submitted.OK || submitted.JobID == 0 {
+ t.Fatalf("missing correlated installation task: %d %s", w.Code, w.Body.String())
+ }
+ workerCtx, stop := context.WithCancel(ctx)
+ done := make(chan struct{})
+ go func() { defer close(done); svc.RunRuntimeMaintenance(workerCtx) }()
+ defer func() { stop(); <-done }()
+ deadline := time.Now().Add(7 * time.Second)
+ for {
+ job, e := db.RuntimeJob(ctx, submitted.JobID)
+ if e != nil {
+ t.Fatal(e)
+ }
+ if job.Status == "completed" {
+ p.mu.Lock()
+ calls, installed := p.sourceCalls, p.installed
+ p.mu.Unlock()
+ if calls != 1 || !installed || job.TargetVersion != "3.13.1" || !strings.Contains(job.Message, "已安装并核验") {
+ t.Fatalf("unexpected Python installation result: %#v", job)
+ }
+ break
+ }
+ if time.Now().After(deadline) || job.Status == "failed" || job.Status == "interrupted" {
+ t.Fatalf("Python installation did not complete through isolator: %#v", job)
+ }
+ time.Sleep(50 * time.Millisecond)
+ }
+ })
account, err := db.CreateTenant(ctx, store.NewTenant{Slug: "crud-customer", Name: "CRUD 用户", Email: "crud-customer@example.invalid", DisplayName: "测试联系人", Password: "crud-customer-password-123", PlanID: 1})
must(err)
user, err := db.UserByLogin(ctx, "crud-customer@example.invalid")
@@ -485,6 +530,47 @@ type pendingStatePanel struct {
states map[int64]bool
}
+type pythonInstallPanel struct {
+ *panel.Mock
+ mu sync.Mutex
+ installed bool
+ sourceCalls int
+}
+
+func (p *pythonInstallPanel) RuntimeEnvironments(ctx context.Context) ([]panel.RuntimeEnvironment, error) {
+ items, err := p.Mock.RuntimeEnvironments(ctx)
+ p.mu.Lock()
+ installed := p.installed
+ p.mu.Unlock()
+ if installed {
+ for i := range items {
+ if items[i].Name == "Python" {
+ items[i].Installed = append(items[i].Installed, "3.13.1")
+ }
+ }
+ }
+ return items, err
+}
+func (p *pythonInstallPanel) InstallRuntimeEnvironment(context.Context, string, string) error {
+ return fmt.Errorf("unexpected panel installer; Python must use the source isolator")
+}
+
+type pythonInstallIsolation struct {
+ isolation.Mock
+ panel *pythonInstallPanel
+}
+
+func (i pythonInstallIsolation) InstallPythonRuntime(_ context.Context, version string) error {
+ if version != "3.13.1" {
+ return fmt.Errorf("unexpected Python version")
+ }
+ i.panel.mu.Lock()
+ defer i.panel.mu.Unlock()
+ i.panel.installed = true
+ i.panel.sourceCalls++
+ return nil
+}
+
type busyPatchPanel struct {
*panel.Mock
entered chan struct{}
diff --git a/backend/internal/httpapi/runtime_environments.go b/backend/internal/httpapi/runtime_environments.go
index fa3e8e7..3045c2e 100644
--- a/backend/internal/httpapi/runtime_environments.go
+++ b/backend/internal/httpapi/runtime_environments.go
@@ -49,11 +49,12 @@ func (s *Server) adminInstallRuntimeEnvironment(w http.ResponseWriter, r *http.R
}
input.Version = strings.TrimSpace(input.Version)
user := currentUser(r)
- if err := s.projects.InstallRuntimeEnvironment(r.Context(), runtimeName, input.Version); err != nil {
+ jobID, err := s.projects.SubmitRuntimeInstallation(r.Context(), runtimeName, input.Version)
+ if err != nil {
s.store.Log(r.Context(), nil, user.ID, "install", "runtime_environment", runtimeName+"/"+input.Version, requestClientIP(r), false, err.Error())
writeError(w, http.StatusBadGateway, "运行环境安装任务提交失败")
return
}
s.store.Log(r.Context(), nil, user.ID, "install", "runtime_environment", runtimeName+"/"+input.Version, requestClientIP(r), true, "提交 "+runtimeName+" "+input.Version+" 安装任务")
- writeJSON(w, http.StatusAccepted, map[string]bool{"ok": true})
+ writeJSON(w, http.StatusAccepted, map[string]any{"ok": true, "jobId": jobID})
}
diff --git a/backend/internal/panel/client.go b/backend/internal/panel/client.go
index 23b811c..d4ff943 100644
--- a/backend/internal/panel/client.go
+++ b/backend/internal/panel/client.go
@@ -430,11 +430,9 @@ func (c *Client) pythonInstallations(ctx context.Context) ([]pythonInstallation,
return result, nil
}
-func (c *Client) pythonLatestAvailableVersions(ctx context.Context) ([]string, error) {
- // The legacy Python manager list contains the first patch releases of many
- // branches (for example 3.12.0) and is not updated consistently. aaPanel's
- // project SDK catalog tracks the current stable patch of each branch even
- // when its bundled installer cannot fetch that release.
+func (c *Client) pythonCommonAvailableVersions(ctx context.Context) ([]string, error) {
+ // Match Websites -> Python Project -> Common Versions exactly. The full
+ // archive is not a fallback: it may advertise a different patch or branch.
body, err := c.request(ctx, http.MethodPost, "/project/python/list_py_version/stype", nil)
if err != nil {
return nil, fmt.Errorf("read latest Python versions: %w", err)
@@ -444,7 +442,6 @@ func (c *Client) pythonLatestAvailableVersions(ctx context.Context) ([]string, e
Msg string `json:"msg"`
SDK struct {
Streamline []runtimeSDK `json:"streamline"`
- All []runtimeSDK `json:"all"`
} `json:"sdk"`
}
if err = json.Unmarshal(body, &response); err != nil {
@@ -453,13 +450,13 @@ func (c *Client) pythonLatestAvailableVersions(ctx context.Context) ([]string, e
if failed(response.Status) {
return nil, fmt.Errorf("read latest Python versions: %s", safeMessage(response.Msg))
}
- versions := make([]string, 0, len(response.SDK.Streamline)+len(response.SDK.All))
- for _, item := range append(response.SDK.Streamline, response.SDK.All...) {
+ versions := make([]string, 0, len(response.SDK.Streamline))
+ for _, item := range response.SDK.Streamline {
versions = append(versions, item.Version)
}
versions = latestPythonBranchVersions(versions)
if len(versions) == 0 {
- return nil, errors.New("latest Python branch catalog is empty")
+ return nil, errors.New("宝塔 Python 项目的常用版本列表为空,请在面板刷新版本后重试")
}
return versions, nil
}
@@ -813,7 +810,7 @@ func (c *Client) RuntimeEnvironments(ctx context.Context) ([]RuntimeEnvironment,
items[2].ComponentInstallable = items[2].ComponentUpdateAvailable
}
installations, installedErr := c.pythonInstallations(ctx)
- available, availableErr := c.pythonLatestAvailableVersions(ctx)
+ available, availableErr := c.pythonCommonAvailableVersions(ctx)
if installedErr != nil || availableErr != nil {
items[2].ComponentStatus, items[2].Detail = RuntimeComponentFailed, "Python 版本清单暂不可用"
} else {
diff --git a/backend/internal/panel/client_test.go b/backend/internal/panel/client_test.go
index 19facde..9ae735e 100644
--- a/backend/internal/panel/client_test.go
+++ b/backend/internal/panel/client_test.go
@@ -125,6 +125,38 @@ func TestRuntimeCatalogUsesAaPanelProjectRoutes(t *testing.T) {
}
}
+func TestPythonAvailableVersionsUseCommonCatalogWithoutArchiveFallback(t *testing.T) {
+ for _, test := range []struct {
+ name, body string
+ want []string
+ }{
+ {"common differs from archive", `{"status":true,"sdk":{"streamline":[{"version":"3.12.15"},{"version":"3.13.17"}],"all":[{"version":"3.12.16"},{"version":"3.16.1"}]}}`, []string{"3.13.17", "3.12.15"}},
+ {"no common catalog", `{"status":true,"sdk":{"all":[{"version":"3.12.16"}]}}`, nil},
+ {"empty common catalog", `{"status":true,"sdk":{"streamline":[],"all":[{"version":"3.12.16"}]}}`, nil},
+ {"unsafe or prerelease entries", `{"status":true,"sdk":{"streamline":[{"version":"3.13.17"},{"version":"3.14.0rc1"},{"version":"../../../tmp"},{"version":"3.12.15;id"}]}}`, []string{"3.13.17"}},
+ } {
+ t.Run(test.name, func(t *testing.T) {
+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if r.URL.Path != "/project/python/list_py_version/stype" || r.Method != http.MethodPost {
+ t.Errorf("unexpected Python catalog request: %s %s", r.Method, r.URL.Path)
+ }
+ w.Header().Set("Content-Type", "application/json")
+ _, _ = w.Write([]byte(test.body))
+ }))
+ defer server.Close()
+ client := NewClient(server.URL, "test-key", false, time.Second)
+ got, err := client.pythonCommonAvailableVersions(context.Background())
+ if test.want == nil {
+ if err == nil || !strings.Contains(err.Error(), "常用版本") {
+ t.Fatalf("missing common catalog was silently accepted: %v", err)
+ }
+ } else if err != nil || !reflect.DeepEqual(got, test.want) {
+ t.Fatalf("got %v, %v; want %v", got, err, test.want)
+ }
+ })
+ }
+}
+
func TestRuntimeCapabilitiesDoNotFailAsAGroup(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
diff --git a/backend/internal/service/runtime_maintenance.go b/backend/internal/service/runtime_maintenance.go
index dc31095..a28e66a 100644
--- a/backend/internal/service/runtime_maintenance.go
+++ b/backend/internal/service/runtime_maintenance.go
@@ -57,9 +57,14 @@ func (s *Projects) InstallRuntimeEnvironment(ctx context.Context, name, version
if s.store == nil {
return s.installRuntimeEnvironmentLegacy(ctx, name, version)
}
+ _, err := s.SubmitRuntimeInstallation(ctx, name, version)
+ return err
+}
+
+func (s *Projects) SubmitRuntimeInstallation(ctx context.Context, name, version string) (uint64, error) {
items, err := s.panel.RuntimeEnvironments(ctx)
if err != nil {
- return err
+ return 0, err
}
allowed := false
for _, item := range items {
@@ -68,10 +73,9 @@ func (s *Projects) InstallRuntimeEnvironment(ctx context.Context, name, version
}
}
if !allowed {
- return errors.New("请选择清单中尚未安装的运行环境版本")
+ return 0, errors.New("请选择清单中尚未安装的运行环境版本")
}
- _, err = s.store.CreateRuntimeJob(ctx, store.RuntimeJob{Action: "install", Runtime: name, TargetVersion: version})
- return err
+ return s.store.CreateRuntimeJob(ctx, store.RuntimeJob{Action: "install", Runtime: name, TargetVersion: version})
}
func (s *Projects) SubmitPHPPatch(ctx context.Context, branch, target string) (uint64, error) {
items, err := s.panel.RuntimeEnvironments(ctx)
@@ -232,6 +236,7 @@ func (s *Projects) executeRuntimeJob(parent context.Context, job store.RuntimeJo
}
if err == nil && !installed && !installing {
if job.Runtime == "Python" {
+ slog.Info("installing Python from verified source", "job_id", job.ID, "node_id", job.NodeID, "version", job.TargetVersion)
err = s.isolation.InstallPythonRuntime(ctx, job.TargetVersion)
} else {
err = s.panel.InstallRuntimeEnvironment(ctx, job.Runtime, job.TargetVersion)
@@ -268,7 +273,11 @@ func (s *Projects) executeRuntimeJob(parent context.Context, job store.RuntimeJo
_ = s.store.EnqueueAdminNotification(finishCtx, "critical", "runtime", "运行环境维护失败", fmt.Sprintf("任务 #%d %s %s:%v", job.ID, job.Runtime, job.TargetVersion, err))
return
}
- _ = s.store.UpdateRuntimeJob(finishCtx, job.ID, "completed", "verified", "目标版本已核验;原本停止的站点保持停止,待启动后核验进程")
+ message := "目标版本已核验;原本停止的站点保持停止,待启动后核验进程"
+ if job.Action == "install" {
+ message = job.Runtime + " " + job.TargetVersion + " 已安装并核验"
+ }
+ _ = s.store.UpdateRuntimeJob(finishCtx, job.ID, "completed", "verified", message)
}
// Coordinate with host identity changes and unfinished site switches, not
diff --git a/docs/bt-api-compatibility.md b/docs/bt-api-compatibility.md
index f175fb7..55955a6 100644
--- a/docs/bt-api-compatibility.md
+++ b/docs/bt-api-compatibility.md
@@ -1,5 +1,13 @@
# 宝塔 API 兼容性记录
+## Python 常用版本与安装边界(2026-10-30)
+
+Python 待安装版本来自 `POST /project/python/list_py_version/stype` 的 `sdk.streamline`,对应面板“Python 项目 → 常用版本”;不合并 `sdk.all`,为空即报错。稳定版本格式和本系统支持分支继续校验,归档中的更新补丁不能越过面板常用列表进入选择器。
+
+36 上确认原生 `btpyvm.py` 使用 XML 解析 HTML 镜像目录会产生 `mismatched tag`,华为目录实测位置为第 7 行第 2 列。Sea vHost 的 Python 安装通过隔离服务执行官方摘要校验的源码构建,不调用此原生命令;本次没有改写宝塔代码。安装接口返回 `jobId`,前端显示同一编号,使用 Sea vHost 的维护记录跟踪结果。宝塔全局日志不能作为该任务执行路径的证据。
+
+下方保留其他基础接口与历史兼容记录。
+
公开接口基线:宝塔 Linux 面板官方 API `11.7.0-docs`。只读兼容性探测基线:宝塔 Linux 面板 12.0.0 + Debian 13;该探测未修改测试机资源。
| 能力 | 路由 / action | 策略 | Sea vHost 用途 |
diff --git a/docs/handover-2026-10-30.md b/docs/handover-2026-10-30.md
index 27111c6..8dd1697 100644
--- a/docs/handover-2026-10-30.md
+++ b/docs/handover-2026-10-30.md
@@ -2,6 +2,12 @@
交付日期:2026-10-30。当前目标为 36 机器上的单机生产测试环境,不使用早期 202 机器的端口映射或临时域名。本次整理不重装、不清空业务数据库、不修改现有账号密码。
+## Python 安装补充验收(rc.2)
+
+36 本机节点在 Sea vHost“环境配置”页提交 Python 3.14.9,任务 #38 于北京时间 2026-10-30 09:37 完成,页面显示“Python 3.14.9 已安装并核验”。已核验 `ssl`、`sqlite3`、`venv`、`ensurepip`,并以体验主机独立 Linux 身份创建和运行临时虚拟环境。测试临时目录已自动清理,未改变体验站点运行环境或现有账号密码。
+
+待安装列表仅采用宝塔 Python 项目的 `sdk.streamline` 常用版本。Sea vHost 使用带官方 SHA-256 校验的源码构建,未修改宝塔 `btpyvm.py`;宝塔原生 XML 目录解析异常仍属于面板自身问题。本次实装仅覆盖 3.14.9,不代表全部 Python 分支已逐一安装。
+
## 直接开始使用
- 控制台:。
diff --git a/docs/hosting-operations.md b/docs/hosting-operations.md
index e71cb75..d747a4c 100644
--- a/docs/hosting-operations.md
+++ b/docs/hosting-operations.md
@@ -39,11 +39,13 @@
## 网站、文件、环境与日志
-用户在“虚拟主机”选择名下主机,再点击“网站管理”;独立主机账号登录后直接进入主机详情。每个网站独立选择运行目录,主站默认 `/`,也可改为 `/public` 或其他主机内目录。目录必须位于主机根目录内。
+用户登录后,在“虚拟主机”的“选择虚拟主机”下拉框选择,选项为“主机名 · 显示名称”,再点击“网站管理”;选择同时决定本页的资源配置、运行目录、凭据和启停操作目标。“文件管理”和“资源图表”有各自的主机选择器,“操作日志”可按主机筛选;域名、FTP、数据库页面汇总该用户名下资源,并标明归属。独立主机账号只可管理自身,只有一台主机时不显示主机切换框。每个网站独立选择运行目录,主站默认 `/`,也可改为 `/public` 或其他主机内目录。目录必须位于主机根目录内。
在网站的“运行环境”中可切换同语言的已安装版本;管理员对该主机开启“允许切换运行环境”后,才可跨语言切换。系统先停站并保留文件、数据库,完成后由使用者检查兼容性并手动启动或部署。运行环境的安装与组件补丁更新在管理员“环境配置”页提交,不同任务可排队、同节点串行,重复任务拒绝。
-组件安装及 PHP 补丁更新交由宝塔执行,Sea vHost 跟踪进度,不因此锁住整个节点的主机操作。即使组件任务中断待核验,其他主机仍可保存文件和管理配置。站点版本迁移或跨语言切换仅保护所属主机;PHP 更新完成后只在刷新对应主机独立 FPM 的短暂阶段保护该主机,其他主机继续可用。
+组件安装(Python 解释器除外)及 PHP 补丁更新交由宝塔执行,Sea vHost 跟踪进度,不因此锁住整个节点的主机操作。即使组件任务中断待核验,其他主机仍可保存文件和管理配置。站点版本迁移或跨语言切换仅保护所属主机;PHP 更新完成后只在刷新对应主机独立 FPM 的短暂阶段保护该主机,其他主机继续可用。
+
+Python 待安装版本只读取宝塔“网站 → Python 项目 → 常用版本”,不再合并“全部版本”;当前仅提供本系统支持的稳定 CPython 分支。常用列表为空时停止提交,不用全部列表代替。Python 由隔离服务下载源码并按官方 HTTPS 元数据中的 SHA-256 校验后编译,解释器保存在 `/www/server/python_manager/versions/<版本>`,保留既有版本;创建网站时再注册给宝塔 Python 项目。环境页提交成功会显示 Sea vHost 任务编号,安装结果以同编号的维护记录为准,不能用宝塔全局安装日志代替该任务结果。
PHP 网站创建后即可上传程序。Node.js、Python、Go、Java 网站先创建,上传入口文件后点击“部署检查”→“检查文件”→“开始部署”。应用监听 `127.0.0.1`,使用系统注入的 `PORT`;Java 同时获得 `--server.port` 参数。Go 上传 Linux amd64 可执行程序,Java 上传可运行 JAR;Node 使用 `package.json` 的 `start` 脚本。
diff --git a/frontend/src/EnvironmentInstall.test.tsx b/frontend/src/EnvironmentInstall.test.tsx
new file mode 100644
index 0000000..1ee0c0f
--- /dev/null
+++ b/frontend/src/EnvironmentInstall.test.tsx
@@ -0,0 +1,21 @@
+import '@testing-library/jest-dom/vitest';
+import {cleanup,fireEvent,render,screen,waitFor} from '@testing-library/react';
+import {afterEach,expect,it,vi} from 'vitest';
+import {api,type RuntimeEnvironment} from './api';
+import {EnvironmentConfiguration} from './components/EnvironmentConfiguration';
+
+vi.mock('./components/RuntimeMaintenancePanel',()=>({RuntimeMaintenancePanel:()=>null}));
+afterEach(()=>{cleanup();vi.restoreAllMocks()});
+
+it('correlates the selected Python version with its actual Sea vHost task',async()=>{
+ const python:RuntimeEnvironment={name:'Python',componentTitle:'Python 项目管理器',componentStatus:'installed',componentInstallable:false,installed:[],available:['3.14.9','3.13.17'],installing:[],recommended:'3.14.9'};
+ vi.spyOn(api,'runtimeEnvironments').mockResolvedValue({environments:[python]});
+ const install=vi.spyOn(api,'installRuntimeEnvironment').mockResolvedValue({ok:true,jobId:38});
+ render();
+ expect(await screen.findByRole('combobox',{name:'Python 待安装版本'})).toHaveValue('3.14.9');
+ fireEvent.click(screen.getByRole('button',{name:'安装版本'}));
+ expect(screen.getByRole('alertdialog')).toHaveTextContent('Python 3.14.9');
+ fireEvent.click(screen.getByRole('button',{name:'确认继续'}));
+ await waitFor(()=>expect(install).toHaveBeenCalledWith('Python','3.14.9',1));
+ expect(await screen.findByText(/Python 3.14.9 已提交 Sea vHost 任务 #38/)).toBeInTheDocument();
+});
diff --git a/frontend/src/HostDetails.test.tsx b/frontend/src/HostDetails.test.tsx
index fa21696..a384401 100644
--- a/frontend/src/HostDetails.test.tsx
+++ b/frontend/src/HostDetails.test.tsx
@@ -14,6 +14,24 @@ it('opens real host configuration controls with administrator-assigned limits',(
fireEvent.click(screen.getByRole('button',{name:'设置运行目录'}));expect(onRunPath).toHaveBeenCalledWith(initialProjects[0]);
fireEvent.click(screen.getByRole('button',{name:'网站管理'}));expect(onSites).toHaveBeenCalledWith(initialProjects[0]);
});
+it('switches all host management actions to the selected host',()=>{
+ const onSites=vi.fn(),onFiles=vi.fn(),onCredentials=vi.fn(),onRunPath=vi.fn(),onToggle=vi.fn();
+ render();
+ const target=initialProjects[1];
+ fireEvent.change(screen.getByRole('combobox',{name:'选择虚拟主机'}),{target:{value:String(target.id)}});
+ expect(screen.getByRole('heading',{name:target.hostName})).toBeInTheDocument();
+ expect(screen.getByRole('link',{name:target.domain})).toBeInTheDocument();
+ fireEvent.click(screen.getByRole('button',{name:'网站管理'}));expect(onSites).toHaveBeenCalledWith(target);
+ fireEvent.click(screen.getByRole('button',{name:'设置运行目录'}));expect(onRunPath).toHaveBeenCalledWith(target);
+ fireEvent.click(screen.getByRole('button',{name:'文件管理'}));expect(onFiles).toHaveBeenCalledWith(target.id);
+ fireEvent.click(screen.getByRole('button',{name:'访问凭据'}));expect(onCredentials).toHaveBeenCalledWith(target);
+ fireEvent.click(screen.getByRole('button',{name:'停止主站'}));expect(onToggle).toHaveBeenCalledWith(target.id);
+});
+it('does not show a host switcher for a single-host login',()=>{
+ render();
+ expect(screen.queryByRole('combobox',{name:'选择虚拟主机'})).not.toBeInTheDocument();
+ expect(screen.getByRole('heading',{name:initialProjects[0].hostName})).toBeInTheDocument();
+});
it('loads and refreshes logs scoped to the signed-in host',async()=>{
const load=vi.spyOn(api,'activities').mockResolvedValue({activities:[{id:91,projectId:initialProjects[0].id,actor:'用户',action:'update',resourceType:'run_path',detail:'用户更新当前主机目录',success:true,createdAt:'2026-10-26T00:00:00Z'}]});
render();
diff --git a/frontend/src/api.ts b/frontend/src/api.ts
index 6256e5e..b962e44 100644
--- a/frontend/src/api.ts
+++ b/frontend/src/api.ts
@@ -235,7 +235,7 @@ export const api = {
migrateSiteRuntime: (siteID: number, version: string, allowBranchChange = false, entryFile = '') => request<{ jobId: number }>(`/api/v1/admin/runtime-maintenance/sites/${siteID}`, { method: 'POST', body: JSON.stringify({ version, allowBranchChange, entryFile }) }),
resumeRuntimeMaintenance: (id: number,nodeId?:number) => request<{ ok: boolean }>(`/api/v1/admin/runtime-maintenance/jobs/${id}/resume`+nodeQuery(nodeId), { method: 'POST' }),
installRuntimeComponent: (runtime: string,nodeId?:number) => request<{ ok: boolean }>(`/api/v1/admin/runtime-components/${encodeURIComponent(runtime)}/install`+nodeQuery(nodeId), { method: 'POST' }),
- installRuntimeEnvironment: (runtime: string, version: string,nodeId?:number) => request<{ ok: boolean }>(`/api/v1/admin/runtime-environments/${encodeURIComponent(runtime)}/install`+nodeQuery(nodeId), { method: 'POST', body: JSON.stringify({ version }) }),
+ installRuntimeEnvironment: (runtime: string, version: string,nodeId?:number) => request<{ ok: boolean; jobId?:number }>(`/api/v1/admin/runtime-environments/${encodeURIComponent(runtime)}/install`+nodeQuery(nodeId), { method: 'POST', body: JSON.stringify({ version }) }),
adoptPanelSite: (id: number, input: { tenantId: number; name: string; runtime: string; version: string; runPath: string; autoSSL: boolean;planId:number },nodeId?:number) => request<{ project: APIProject; credentials: Credentials }>(`/api/v1/admin/panel-sites/${id}/adopt`+nodeQuery(nodeId), { method: 'POST', body: JSON.stringify(input) }),
updateDomainMetadata: (id: number, input: Record) => request(`/api/v1/admin/domains/${id}/metadata`, { method: 'PUT', body: JSON.stringify(input) }),
provisionDomainDNS: (id: number, admin = false) => request<{ domain: DomainResource }>(`${admin ? '/api/v1/admin' : '/api/v1'}/domains/${id}/dns`, { method: 'POST' }),
diff --git a/frontend/src/components/EnvironmentConfiguration.tsx b/frontend/src/components/EnvironmentConfiguration.tsx
index 8d7aa3c..c4b82b9 100644
--- a/frontend/src/components/EnvironmentConfiguration.tsx
+++ b/frontend/src/components/EnvironmentConfiguration.tsx
@@ -66,8 +66,8 @@ export function EnvironmentConfiguration({nodeId,nodeSelector,hideHeading=false,
if (!version || !await confirm(`安装 ${item.name} ${version}?现有项目和已安装版本不会被删除。${sourceNotice}`)) return;
setBusy(`${item.name}:${version}`); setError(''); setNotice('');
try {
- await api.installRuntimeEnvironment(item.name, version,nodeId);
- setNotice(`${item.name} ${version} 安装任务已提交。`);
+ const result=await api.installRuntimeEnvironment(item.name, version,nodeId);
+ setNotice(`${item.name} ${version} 已提交 Sea vHost 任务${result.jobId?` #${result.jobId}`:''},请在下方维护任务记录查看结果。`);
await load();
} catch (installError) { setError(safeError(installError)); }
finally { setBusy(''); }