From 2ebe5addde77f810433604f8e5468e9d45464992 Mon Sep 17 00:00:00 2001 From: zhengkunwang223 <1paneldev@sina.com> Date: Tue, 30 Dec 2025 10:45:01 +0800 Subject: [PATCH] feat: optimize disk mount logic --- agent/app/service/disk_utils.go | 19 ++++++++++++++++++- frontend/src/lang/modules/en.ts | 2 ++ frontend/src/lang/modules/es-es.ts | 2 ++ frontend/src/lang/modules/ja.ts | 2 ++ frontend/src/lang/modules/ko.ts | 2 ++ frontend/src/lang/modules/ms.ts | 2 ++ frontend/src/lang/modules/pt-br.ts | 2 ++ frontend/src/lang/modules/ru.ts | 2 ++ frontend/src/lang/modules/tr.ts | 2 ++ frontend/src/lang/modules/zh-Hant.ts | 2 ++ frontend/src/lang/modules/zh.ts | 2 ++ .../src/views/website/website/html/index.vue | 2 +- 12 files changed, 39 insertions(+), 2 deletions(-) diff --git a/agent/app/service/disk_utils.go b/agent/app/service/disk_utils.go index b01a23cef..e237cfa8a 100644 --- a/agent/app/service/disk_utils.go +++ b/agent/app/service/disk_utils.go @@ -463,6 +463,11 @@ func isPointMounted(mountPoint string) bool { } func addToFstabWithOptions(device, mountPoint, filesystem, options string) error { + uuid, err := getDeviceUUID(device) + if err != nil { + return fmt.Errorf("failed to get UUID for device %s: %v", device, err) + } + if filesystem == "" { fsType, err := getFilesystemType(device) if err != nil { @@ -476,7 +481,7 @@ func addToFstabWithOptions(device, mountPoint, filesystem, options string) error options = "defaults" } - entry := fmt.Sprintf("%s %s %s %s 0 2\n", device, mountPoint, filesystem, options) + entry := fmt.Sprintf("UUID=%s %s %s %s 0 2\n", uuid, mountPoint, filesystem, options) file, err := os.OpenFile("/etc/fstab", os.O_APPEND|os.O_WRONLY, 0644) if err != nil { @@ -568,3 +573,15 @@ func parseSizeToBytes(sizeStr string) int64 { return val } } + +func getDeviceUUID(device string) (string, error) { + output, err := cmd.RunDefaultWithStdoutBashC(fmt.Sprintf("blkid -s UUID -o value %s", device)) + if err != nil { + return "", err + } + uuid := strings.TrimSpace(output) + if uuid == "" { + return "", fmt.Errorf("no UUID found for device %s", device) + } + return uuid, nil +} diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 7fd81e9bc..f8d242d3d 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -2755,6 +2755,8 @@ const message = { streamPortsHelper: 'Set the external listening port number, clients will access the service through this port, separated by commas, e.g., 5222,5223', streamHelper: 'TCP/UDP Port Forwarding and Load Balancing', + + syncHtmlHelper: 'Sync to PHP and static websites', }, php: { short_open_tag: 'Short tag support', diff --git a/frontend/src/lang/modules/es-es.ts b/frontend/src/lang/modules/es-es.ts index 3a9fc56a1..1c499bbda 100644 --- a/frontend/src/lang/modules/es-es.ts +++ b/frontend/src/lang/modules/es-es.ts @@ -2747,6 +2747,8 @@ const message = { streamPortsHelper: 'Configura el número de puerto de escucha externo, los clientes accederán al servicio a través de este puerto, separado por comas, p. ej., 5222,5223', streamHelper: 'Reenvío de Puertos y Balanceo de Carga TCP/UDP', + + syncHtmlHelper: 'Sincronizar con PHP y sitios web estáticos', }, php: { short_open_tag: 'Soporte de etiquetas cortas', diff --git a/frontend/src/lang/modules/ja.ts b/frontend/src/lang/modules/ja.ts index 24c2cb399..3bb0fdc69 100644 --- a/frontend/src/lang/modules/ja.ts +++ b/frontend/src/lang/modules/ja.ts @@ -2679,6 +2679,8 @@ const message = { streamPortsHelper: '外部リスニングポート番号を設定します。クライアントはこのポートを通じてサービスにアクセスします。カンマで区切ってください。例:5222,5223', streamHelper: 'TCP/UDP ポート転送とロードバランシング', + + syncHtmlHelper: 'PHP と静的ウェブサイトに同期', }, php: { short_open_tag: '短いタグサポート', diff --git a/frontend/src/lang/modules/ko.ts b/frontend/src/lang/modules/ko.ts index 279c2a3be..a5d62a325 100644 --- a/frontend/src/lang/modules/ko.ts +++ b/frontend/src/lang/modules/ko.ts @@ -2634,6 +2634,8 @@ const message = { streamPortsHelper: '외부 수신 포트 번호를 설정합니다. 클라이언트는 이 포트를 통해 서비스에 액세스합니다. 쉼표로 구분하세요. 예: 5222,5223', streamHelper: 'TCP/UDP 포트 포워딩 및 로드 밸런싱', + + syncHtmlHelper: 'PHP 및 정적 웹사이트에 동기화', }, php: { short_open_tag: '짧은 태그 지원', diff --git a/frontend/src/lang/modules/ms.ts b/frontend/src/lang/modules/ms.ts index 4d5f4e675..de39086e4 100644 --- a/frontend/src/lang/modules/ms.ts +++ b/frontend/src/lang/modules/ms.ts @@ -2736,6 +2736,8 @@ const message = { streamPortsHelper: 'Tetapkan nombor port pendengaran luaran, pelanggan akan mengakses perkhidmatan melalui port ini, dipisahkan dengan koma, cth., 5222,5223', streamHelper: 'Penerusan Port dan Pengimbangan Beban TCP/UDP', + + syncHtmlHelper: 'Segerakkan ke PHP dan laman web statik', }, php: { short_open_tag: 'Sokongan tag pendek', diff --git a/frontend/src/lang/modules/pt-br.ts b/frontend/src/lang/modules/pt-br.ts index 81bded418..e704e143a 100644 --- a/frontend/src/lang/modules/pt-br.ts +++ b/frontend/src/lang/modules/pt-br.ts @@ -2741,6 +2741,8 @@ const message = { streamPortsHelper: 'Defina o número da porta de escuta externa, os clientes acessarão o serviço através desta porta, separados por vírgulas, por exemplo: 5222,5223', streamHelper: 'Encaminhamento de Portas e Balanceamento de Carga TCP/UDP', + + syncHtmlHelper: 'Sincronizar com PHP e sites estáticos', }, php: { short_open_tag: 'Suporte para short tags', diff --git a/frontend/src/lang/modules/ru.ts b/frontend/src/lang/modules/ru.ts index 22bf7b016..0bfe6b4b4 100644 --- a/frontend/src/lang/modules/ru.ts +++ b/frontend/src/lang/modules/ru.ts @@ -2736,6 +2736,8 @@ const message = { streamPortsHelper: 'Установите номер внешнего порта прослушивания, клиенты будут получать доступ к службе через этот порт, разделяйте запятыми, например: 5222,5223', streamHelper: 'Перенаправление портов и балансировка нагрузки TCP/UDP', + + syncHtmlHelper: 'Синхронизировать с PHP и статическими сайтами', }, php: { short_open_tag: 'Поддержка коротких тегов', diff --git a/frontend/src/lang/modules/tr.ts b/frontend/src/lang/modules/tr.ts index 829601003..92d1b9c3a 100644 --- a/frontend/src/lang/modules/tr.ts +++ b/frontend/src/lang/modules/tr.ts @@ -2793,6 +2793,8 @@ const message = { streamPortsHelper: 'Harici dinleme bağlantı noktası numarasını ayarlayın, istemciler bu bağlantı noktası üzerinden hizmete erişecektir, virgülle ayırın, örn.: 5222,5223', streamHelper: 'TCP/UDP Port Yönlendirme ve Yük Dengeleme', + + syncHtmlHelper: 'PHP ve statik web siteleriyle senkronize et', }, php: { short_open_tag: 'Kısa etiket desteği', diff --git a/frontend/src/lang/modules/zh-Hant.ts b/frontend/src/lang/modules/zh-Hant.ts index a71fb48bc..cb0dbe6fd 100644 --- a/frontend/src/lang/modules/zh-Hant.ts +++ b/frontend/src/lang/modules/zh-Hant.ts @@ -2565,6 +2565,8 @@ const message = { streamPorts: '監聽端口', streamPortsHelper: '設定對外監聽的埠號,客戶端將透過此埠存取服務,按逗號分割,例如:5222,5223', streamHelper: 'TCP/UDP 端口轉發與負載均衡', + + syncHtmlHelper: '同步到 PHP 和靜態網站', }, php: { short_open_tag: '短標籤支援', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index a73f72158..2d0233bcf 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -2562,6 +2562,8 @@ const message = { streamPorts: '监听端口', streamPortsHelper: '设置对外监听的端口号,客户端将通过此端口访问服务,按逗号分割,例如:5222,5223', streamHelper: 'TCP/UDP 端口转发与负载均衡', + + syncHtmlHelper: '同步到 PHP 和静态网站', }, php: { short_open_tag: '短标签支持', diff --git a/frontend/src/views/website/website/html/index.vue b/frontend/src/views/website/website/html/index.vue index 087231671..7dc8f6440 100644 --- a/frontend/src/views/website/website/html/index.vue +++ b/frontend/src/views/website/website/html/index.vue @@ -13,7 +13,7 @@