mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-02-08 01:20:07 +08:00
feat: 容器端口跳转增加 IPv4 IPv6 判断 (#3212)
This commit is contained in:
parent
02f41ba45d
commit
cb6b9965ec
@ -24,15 +24,15 @@
|
|||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { getSettingInfo } from '@/api/modules/setting';
|
import { getSettingInfo } from '@/api/modules/setting';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { MsgError } from '@/utils/message';
|
import { MsgError, MsgWarning } from '@/utils/message';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { checkDomain, checkIp } from '@/utils/util';
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const dialogVisible = ref();
|
const dialogVisible = ref();
|
||||||
|
|
||||||
interface DialogProps {
|
interface DialogProps {
|
||||||
port: any;
|
port: any;
|
||||||
|
ip: string;
|
||||||
protocol: string;
|
protocol: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,11 +47,19 @@ const acceptParams = async (params: DialogProps): Promise<void> => {
|
|||||||
dialogVisible.value = true;
|
dialogVisible.value = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!checkIp(res.data.systemIP) || !checkDomain(res.data.systemIP)) {
|
if (res.data.systemIP.indexOf(':') === -1) {
|
||||||
|
if (params.ip && params.ip === 'ipv6') {
|
||||||
|
MsgWarning(i18n.global.t('setting.systemIPWarning1', ['IPv4']));
|
||||||
|
return;
|
||||||
|
}
|
||||||
window.open(`${protocol}://${res.data.systemIP}:${params.port}`, '_blank');
|
window.open(`${protocol}://${res.data.systemIP}:${params.port}`, '_blank');
|
||||||
return;
|
} else {
|
||||||
|
if (params.ip && params.ip === 'ipv4') {
|
||||||
|
MsgWarning(i18n.global.t('setting.systemIPWarning1', ['IPv6']));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
window.open(`${protocol}://[${res.data.systemIP}]:${params.port}`, '_blank');
|
||||||
}
|
}
|
||||||
window.open(`${protocol}://[${res.data.systemIP}]:${params.port}`, '_blank');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const goRouter = async (path: string) => {
|
const goRouter = async (path: string) => {
|
||||||
|
@ -1180,6 +1180,7 @@ const message = {
|
|||||||
'If you do not operate the panel for more than {0} seconds, the panel automatically logs out',
|
'If you do not operate the panel for more than {0} seconds, the panel automatically logs out',
|
||||||
systemIP: 'System Address',
|
systemIP: 'System Address',
|
||||||
systemIPWarning: 'The server address is not currently set. Please set it in the control panel first!',
|
systemIPWarning: 'The server address is not currently set. Please set it in the control panel first!',
|
||||||
|
systemIPWarning1: 'The current server address is set to {0}, and quick redirection is not possible!',
|
||||||
defaultNetwork: 'Network Card',
|
defaultNetwork: 'Network Card',
|
||||||
syncTime: 'Server Time',
|
syncTime: 'Server Time',
|
||||||
timeZone: 'Time Zone',
|
timeZone: 'Time Zone',
|
||||||
|
@ -1121,6 +1121,7 @@ const message = {
|
|||||||
sessionTimeoutHelper: '如果用戶超過 {0} 秒未操作面板,面板將自動退出登錄',
|
sessionTimeoutHelper: '如果用戶超過 {0} 秒未操作面板,面板將自動退出登錄',
|
||||||
systemIP: '服務器地址',
|
systemIP: '服務器地址',
|
||||||
systemIPWarning: '當前未設置服務器地址,請先在面板設置中設置!',
|
systemIPWarning: '當前未設置服務器地址,請先在面板設置中設置!',
|
||||||
|
systemIPWarning1: '當前服務器地址設置為 {0},無法快速跳轉!',
|
||||||
defaultNetwork: '默認網卡',
|
defaultNetwork: '默認網卡',
|
||||||
changePassword: '密碼修改',
|
changePassword: '密碼修改',
|
||||||
oldPassword: '原密碼',
|
oldPassword: '原密碼',
|
||||||
|
@ -1122,6 +1122,7 @@ const message = {
|
|||||||
sessionTimeoutHelper: '如果用户超过 {0} 秒未操作面板,面板将自动退出登录',
|
sessionTimeoutHelper: '如果用户超过 {0} 秒未操作面板,面板将自动退出登录',
|
||||||
systemIP: '服务器地址',
|
systemIP: '服务器地址',
|
||||||
systemIPWarning: '当前未设置服务器地址,请先在面板设置中设置!',
|
systemIPWarning: '当前未设置服务器地址,请先在面板设置中设置!',
|
||||||
|
systemIPWarning1: '当前服务器地址设置为 {0},无法快速跳转!',
|
||||||
defaultNetwork: '默认网卡',
|
defaultNetwork: '默认网卡',
|
||||||
changePassword: '密码修改',
|
changePassword: '密码修改',
|
||||||
oldPassword: '原密码',
|
oldPassword: '原密码',
|
||||||
|
@ -330,12 +330,15 @@ const goDashboard = async (port: any) => {
|
|||||||
MsgWarning(i18n.global.t('container.unExposedPort'));
|
MsgWarning(i18n.global.t('container.unExposedPort'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!port || port.indexOf(':') === -1 || port.indexOf('->') === -1) {
|
if (port.indexOf(':') === -1) {
|
||||||
MsgWarning(i18n.global.t('commons.msg.errPort'));
|
MsgWarning(i18n.global.t('commons.msg.errPort'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let portEx = port.match(/:(\d+)/)[1];
|
let portEx = port.match(/:(\d+)/)[1];
|
||||||
dialogPortJumpRef.value.acceptParams({ port: portEx });
|
|
||||||
|
let matches = port.match(new RegExp(':', 'g'));
|
||||||
|
let ip = matches && matches.length > 1 ? 'ipv6' : 'ipv4';
|
||||||
|
dialogPortJumpRef.value.acceptParams({ port: portEx, ip: ip });
|
||||||
};
|
};
|
||||||
|
|
||||||
const goSetting = async () => {
|
const goSetting = async () => {
|
||||||
|
@ -128,6 +128,7 @@ const checkExist = (data: App.CheckInstalled) => {
|
|||||||
endpoint: '/api/v1/databases/redis/exec',
|
endpoint: '/api/v1/databases/redis/exec',
|
||||||
args: '',
|
args: '',
|
||||||
error: '',
|
error: '',
|
||||||
|
initCmd: '',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -141,6 +142,7 @@ const initTerminal = async () => {
|
|||||||
endpoint: '/api/v1/databases/redis/exec',
|
endpoint: '/api/v1/databases/redis/exec',
|
||||||
args: '',
|
args: '',
|
||||||
error: '',
|
error: '',
|
||||||
|
initCmd: '',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user