diff --git a/backend/app/service/firewall.go b/backend/app/service/firewall.go index 777cbc0d3..d047bc9e6 100644 --- a/backend/app/service/firewall.go +++ b/backend/app/service/firewall.go @@ -647,7 +647,7 @@ func checkPortUsed(ports, proto string, apps []portOfApp) string { for _, app := range apps { if app.HttpPort == ports || app.HttpsPort == ports { - return fmt.Sprintf("%s (%s)", ports, app.AppName) + return fmt.Sprintf("(%s)", app.AppName) } } port, err := strconv.Atoi(ports) @@ -656,7 +656,7 @@ func checkPortUsed(ports, proto string, apps []portOfApp) string { return "" } if common.ScanPortWithProto(port, proto) { - return ports + return "inUsed" } return "" } diff --git a/backend/app/service/setting_clean.go b/backend/app/service/setting_clean.go index 0a402109a..e8914e350 100644 --- a/backend/app/service/setting_clean.go +++ b/backend/app/service/setting_clean.go @@ -102,6 +102,7 @@ func (u *SettingService) SystemScan() dto.CleanData { func (u *SettingService) SystemClean(req []dto.Clean) { size := uint64(0) + restart := false for _, item := range req { size += item.Size switch item.TreeType { @@ -121,9 +122,7 @@ func (u *SettingService) SystemClean(req []dto.Clean) { case "cache": dropFileOrDir(path.Join(global.CONF.System.BaseDir, "1panel/cache", item.Name)) - defer func() { - _, _ = cmd.Exec("systemctl restart 1panel.service") - }() + restart = true case "unused": dropFileOrDir(path.Join(global.CONF.System.BaseDir, "original", item.Name)) @@ -207,6 +206,15 @@ func (u *SettingService) SystemClean(req []dto.Clean) { _ = settingRepo.Update("LastCleanTime", time.Now().Format("2006-01-02 15:04:05")) _ = settingRepo.Update("LastCleanSize", fmt.Sprintf("%v", size)) _ = settingRepo.Update("LastCleanData", fmt.Sprintf("%v", len(req))) + + if restart { + go func() { + _, err := cmd.Exec("systemctl restart 1panel.service") + if err != nil { + global.LOG.Errorf("restart system port failed, err: %v", err) + } + }() + } } func loadSnapshotTree(fileOp fileUtils.FileOp) []dto.CleanTree { diff --git a/backend/utils/firewall/client/info.go b/backend/utils/firewall/client/info.go index ca87647aa..3a4723c1d 100644 --- a/backend/utils/firewall/client/info.go +++ b/backend/utils/firewall/client/info.go @@ -7,7 +7,6 @@ type FireInfo struct { Protocol string `json:"protocol"` // tcp udp tcp/udp Strategy string `json:"strategy"` // accept drop - APPName string `json:"appName"` UsedStatus string `json:"usedStatus"` Description string `json:"description"` } diff --git a/frontend/src/api/interface/host.ts b/frontend/src/api/interface/host.ts index be5661e41..35fc0ddc7 100644 --- a/frontend/src/api/interface/host.ts +++ b/frontend/src/api/interface/host.ts @@ -77,8 +77,8 @@ export namespace Host { port: string; protocol: string; strategy: string; - appName: string; - isUsed: boolean; + + usedStatus: string; description: string; } export interface UpdateDescription { diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index c3575f947..77e358567 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1233,7 +1233,9 @@ const message = { 'Temporary files generated during snapshots, upgrades, and obsolete file contents during version iterations', panelOriginal: 'System snapshot recovery backup files', upgrade: 'System upgrade backup files', + upgradeHelper: '(Recommend keeping the latest upgrade backup for system rollback)', cache: 'System cache files', + cacheHelper: '(Proceed with caution, clearing requires a service restart)', snapshot: 'System snapshot temporary files', snapshotTmp: 'System snapshot upload temporary files', snapshotLocal: 'System snapshot creation temporary files', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index 373de1320..350d5396a 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -1171,7 +1171,9 @@ const message = { systemHelper: '快照、升級等過程中產生的臨時文件以及版本叠代過程中廢棄的文件內容', panelOriginal: '系統快照恢復前備份文件', upgrade: '系統升級備份文件', + upgradeHelper: '( 建議保留最新的升級備份用於系統回滾 )', cache: '系統緩存文件', + cacheHelper: '( 謹慎操作,清理需要重啟服務 )', snapshot: '系統快照臨時文件', snapshotTmp: '系統快照上傳臨時文件', snapshotLocal: '系統快照製作臨時文件', @@ -1187,7 +1189,7 @@ const message = { website: '網站', app: '應用', database: '數據庫', - directory: '應用', + directory: '文件夾', systemLog: '系統日誌文件', systemLogHelper: '系統日誌信息、容器構建或鏡像拉取等日誌信息以及計劃任務中產生的日誌文件', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 6949030f4..6d3aac672 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1170,7 +1170,9 @@ const message = { systemHelper: '快照、升级等过程中产生的临时文件以及版本迭代过程中废弃的文件内容', panelOriginal: '系统快照恢复前备份文件', upgrade: '系统升级备份文件', + upgradeHelper: '( 建议保留最新的升级备份用于系统回滚 )', cache: '系统缓存文件', + cacheHelper: '( 谨慎操作,清理需要重启服务 )', snapshot: '系统快照临时文件', snapshotTmp: '系统快照上传临时文件', snapshotLocal: '系统快照制作临时文件', @@ -1186,7 +1188,7 @@ const message = { website: '网站', app: '应用', database: '数据库', - directory: '应用', + directory: '文件夹', systemLog: '系统日志文件', systemLogHelper: '系统日志信息、容器构建或镜像拉取等日志信息以及计划任务中产生的日志文件', diff --git a/frontend/src/views/host/firewall/port/index.vue b/frontend/src/views/host/firewall/port/index.vue index 9d589ee6b..635611738 100644 --- a/frontend/src/views/host/firewall/port/index.vue +++ b/frontend/src/views/host/firewall/port/index.vue @@ -104,7 +104,8 @@