From c6376541ed3762b3896585fec398399d1034982f Mon Sep 17 00:00:00 2001 From: CityFun <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 16 Dec 2025 16:33:59 +0800 Subject: [PATCH] feat: add OpenResty version restriction for TCP/UDP proxy (#11350) --- agent/init/db/db.go | 2 +- .../src/views/website/website/create/index.vue | 17 ++++++++++++++--- .../website/website/create/site-alert/index.vue | 13 ++++++++++++- frontend/src/views/website/website/index.vue | 4 +++- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/agent/init/db/db.go b/agent/init/db/db.go index 2deffee2d..783222332 100644 --- a/agent/init/db/db.go +++ b/agent/init/db/db.go @@ -15,7 +15,7 @@ func Init() { global.GPUMonitorDB = common.LoadDBConnByPath(path.Join(global.Dir.DbDir, "gpu_monitor.db"), "gpu_monitor") global.AlertDB = common.LoadDBConnByPath(path.Join(global.Dir.DbDir, "alert.db"), "alert") - if _, err := os.Stat("/usr/bin/1panel-core"); err == nil { + if _, err := os.Stat(path.Join(global.Dir.DbDir, "core.db")); err == nil { global.CoreDB = common.LoadDBConnByPath(path.Join(global.Dir.DbDir, "core.db"), "core") } } diff --git a/frontend/src/views/website/website/create/index.vue b/frontend/src/views/website/website/create/index.vue index cf10b03d5..991d631df 100644 --- a/frontend/src/views/website/website/create/index.vue +++ b/frontend/src/views/website/website/create/index.vue @@ -17,7 +17,8 @@ - + + @@ -437,6 +442,7 @@ import { getAccountName } from '@/utils/util'; import { Website } from '@/api/interface/website'; import { getPathByType } from '@/api/modules/files'; import { getWebsiteTypes } from '@/global/mimetype'; +import { compareVersion } from '@/utils/version'; type SSLItem = Website.SSLDTO & { organization?: string; @@ -572,6 +578,7 @@ const runtimePorts = ref([]); const WebsiteTypes = getWebsiteTypes(); const installFormRef = ref(); const lbFormRef = ref(); +const versionNotMatch = ref(); const steamConfig = ref({ name: '', algorithm: 'default', @@ -719,7 +726,11 @@ const getRuntimes = async () => { } catch (error) {} }; -const acceptParams = async () => { +const acceptParams = async (openrestyVersion: string) => { + versionNotMatch.value = false; + if (!compareVersion(openrestyVersion, '1.27.1.2-3-3-focal')) { + versionNotMatch.value = true; + } website.value = initData(); if (websiteForm.value) { websiteForm.value.resetFields(); diff --git a/frontend/src/views/website/website/create/site-alert/index.vue b/frontend/src/views/website/website/create/site-alert/index.vue index ebbaf8701..939a745fe 100644 --- a/frontend/src/views/website/website/create/site-alert/index.vue +++ b/frontend/src/views/website/website/create/site-alert/index.vue @@ -25,7 +25,14 @@ :closable="false" /> - + @@ -35,5 +42,9 @@ defineProps({ type: String, default: 'deployment', }, + versionNotMatch: { + type: Boolean, + default: false, + }, }); diff --git a/frontend/src/views/website/website/index.vue b/frontend/src/views/website/website/index.vue index 8f4f8bf82..b72614b86 100644 --- a/frontend/src/views/website/website/index.vue +++ b/frontend/src/views/website/website/index.vue @@ -346,6 +346,7 @@ const taskLogRef = ref(); const opRef = ref(); const batchSetGroupRef = ref(); const batchSetHttpsRef = ref(); +const nginxVersion = ref(); const paginationConfig = reactive({ cacheSizeKey: 'website-page-size', @@ -568,7 +569,7 @@ const openDelete = (website: Website.Website) => { }; const openCreate = () => { - createRef.value.acceptParams(); + createRef.value.acceptParams(nginxVersion.value); }; const openGroup = () => { @@ -588,6 +589,7 @@ const checkExist = (data: App.CheckInstalled) => { containerName.value = data.containerName; nginxStatus.value = data.status; websiteDir.value = data.websiteDir; + nginxVersion.value = data.version; }; const checkDate = (date: Date) => {