mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
parent
23c72c8301
commit
06f81fc7f7
@ -234,16 +234,13 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getProtocolAndHost = (url: string): { protocol: string; host: string } | null => {
|
const getProtocolAndHost = (url: string): { protocol: string; host: string } | null => {
|
||||||
const regex = /^(https?:\/\/)([^\/]+)/;
|
if (url.startsWith('https://')) {
|
||||||
const match = url.match(regex);
|
return { protocol: 'https', host: url.replaceAll('https://', '') };
|
||||||
if (match) {
|
|
||||||
return {
|
|
||||||
protocol: match[1],
|
|
||||||
host: match[2],
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
console.log('err');
|
if (url.startsWith('http://')) {
|
||||||
return null;
|
return { protocol: 'http', host: url.replaceAll('http://', '') };
|
||||||
|
}
|
||||||
|
return { protocol: '', host: url };
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user