mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-17 12:58:51 +08:00
feat: add OpenResty version restriction for TCP/UDP proxy (#11350)
This commit is contained in:
parent
6aca579854
commit
c6376541ed
4 changed files with 30 additions and 6 deletions
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@
|
|||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<SSLAlert :websiteType="website.type" class="mb-2" />
|
||||
<SSLAlert :websiteType="website.type" class="mb-2" :versionNotMatch="versionNotMatch" />
|
||||
|
||||
<GroupSelect
|
||||
v-model="website.webSiteGroupId"
|
||||
:prop="'webSiteGroupId'"
|
||||
|
|
@ -389,7 +390,11 @@
|
|||
</div>
|
||||
<template #footer>
|
||||
<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') }}
|
||||
</el-button>
|
||||
</template>
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -25,7 +25,14 @@
|
|||
: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>
|
||||
</template>
|
||||
|
||||
|
|
@ -35,5 +42,9 @@ defineProps({
|
|||
type: String,
|
||||
default: 'deployment',
|
||||
},
|
||||
versionNotMatch: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue