feat: add OpenResty version restriction for TCP/UDP proxy (#11350)

This commit is contained in:
CityFun 2025-12-16 16:33:59 +08:00 committed by GitHub
parent 6aca579854
commit c6376541ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 30 additions and 6 deletions

View file

@ -15,7 +15,7 @@ func Init() {
global.GPUMonitorDB = common.LoadDBConnByPath(path.Join(global.Dir.DbDir, "gpu_monitor.db"), "gpu_monitor") 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") 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") global.CoreDB = common.LoadDBConnByPath(path.Join(global.Dir.DbDir, "core.db"), "core")
} }
} }

View file

@ -17,7 +17,8 @@
</el-radio-button> </el-radio-button>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<SSLAlert :websiteType="website.type" class="mb-2" /> <SSLAlert :websiteType="website.type" class="mb-2" :versionNotMatch="versionNotMatch" />
<GroupSelect <GroupSelect
v-model="website.webSiteGroupId" v-model="website.webSiteGroupId"
:prop="'webSiteGroupId'" :prop="'webSiteGroupId'"
@ -389,7 +390,11 @@
</div> </div>
<template #footer> <template #footer>
<el-button @click="handleClose" :disabled="loading">{{ $t('commons.button.cancel') }}</el-button> <el-button @click="handleClose" :disabled="loading">{{ $t('commons.button.cancel') }}</el-button>
<el-button type="primary" @click="submit(websiteForm)" :disabled="loading"> <el-button
type="primary"
@click="submit(websiteForm)"
:disabled="loading || (website.type == 'stream' && versionNotMatch)"
>
{{ $t('commons.button.confirm') }} {{ $t('commons.button.confirm') }}
</el-button> </el-button>
</template> </template>
@ -437,6 +442,7 @@ import { getAccountName } from '@/utils/util';
import { Website } from '@/api/interface/website'; import { Website } from '@/api/interface/website';
import { getPathByType } from '@/api/modules/files'; import { getPathByType } from '@/api/modules/files';
import { getWebsiteTypes } from '@/global/mimetype'; import { getWebsiteTypes } from '@/global/mimetype';
import { compareVersion } from '@/utils/version';
type SSLItem = Website.SSLDTO & { type SSLItem = Website.SSLDTO & {
organization?: string; organization?: string;
@ -572,6 +578,7 @@ const runtimePorts = ref([]);
const WebsiteTypes = getWebsiteTypes(); const WebsiteTypes = getWebsiteTypes();
const installFormRef = ref(); const installFormRef = ref();
const lbFormRef = ref(); const lbFormRef = ref();
const versionNotMatch = ref();
const steamConfig = ref({ const steamConfig = ref({
name: '', name: '',
algorithm: 'default', algorithm: 'default',
@ -719,7 +726,11 @@ const getRuntimes = async () => {
} catch (error) {} } 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(); website.value = initData();
if (websiteForm.value) { if (websiteForm.value) {
websiteForm.value.resetFields(); websiteForm.value.resetFields();

View file

@ -25,7 +25,14 @@
:closable="false" :closable="false"
/> />
<el-alert v-if="websiteType == 'subsite'" :title="$t('website.subsiteHelper')" type="info" :closable="false" /> <el-alert v-if="websiteType == 'subsite'" :title="$t('website.subsiteHelper')" type="info" :closable="false" />
<el-alert v-if="websiteType == 'stream'" :title="$t('website.streamHelper')" type="info" :closable="false" /> <el-alert
v-if="websiteType == 'stream'"
:title="
versionNotMatch ? $t('xpack.waf.openRestyAlert', ['1.27.1.2-2-3-focal']) : $t('website.streamHelper')
"
:type="versionNotMatch ? 'error' : 'info'"
:closable="false"
/>
</div> </div>
</template> </template>
@ -35,5 +42,9 @@ defineProps({
type: String, type: String,
default: 'deployment', default: 'deployment',
}, },
versionNotMatch: {
type: Boolean,
default: false,
},
}); });
</script> </script>

View file

@ -346,6 +346,7 @@ const taskLogRef = ref();
const opRef = ref(); const opRef = ref();
const batchSetGroupRef = ref(); const batchSetGroupRef = ref();
const batchSetHttpsRef = ref(); const batchSetHttpsRef = ref();
const nginxVersion = ref();
const paginationConfig = reactive({ const paginationConfig = reactive({
cacheSizeKey: 'website-page-size', cacheSizeKey: 'website-page-size',
@ -568,7 +569,7 @@ const openDelete = (website: Website.Website) => {
}; };
const openCreate = () => { const openCreate = () => {
createRef.value.acceptParams(); createRef.value.acceptParams(nginxVersion.value);
}; };
const openGroup = () => { const openGroup = () => {
@ -588,6 +589,7 @@ const checkExist = (data: App.CheckInstalled) => {
containerName.value = data.containerName; containerName.value = data.containerName;
nginxStatus.value = data.status; nginxStatus.value = data.status;
websiteDir.value = data.websiteDir; websiteDir.value = data.websiteDir;
nginxVersion.value = data.version;
}; };
const checkDate = (date: Date) => { const checkDate = (date: Date) => {