@@ -130,8 +130,8 @@ import { getAppInstallParams, updateAppInstallParams, updateInstallConfig } from
130130import { reactive , ref } from ' vue' ;
131131import { FormInstance } from ' element-plus' ;
132132import { Rules , checkNumberRange } from ' @/global/form-rules' ;
133- import { MsgSuccess } from ' @/utils/message' ;
134- import { getLabel , splitHttp } from ' @/utils/util' ;
133+ import { MsgError , MsgSuccess } from ' @/utils/message' ;
134+ import { getLabel , splitHttp , checkIpV4V6 , checkDomain } from ' @/utils/util' ;
135135import i18n from ' @/lang' ;
136136
137137interface ParamProps {
@@ -176,6 +176,31 @@ const webUI = reactive({
176176 domain: ' ' ,
177177});
178178
179+ function checkWebUI() {
180+ if (webUI .domain !== ' ' ) {
181+ let domain = webUI .domain ;
182+ let port = null ;
183+ if (domain .includes (' :' )) {
184+ const parts = domain .split (' :' );
185+ domain = parts [0 ];
186+ port = parts [1 ];
187+
188+ if (! checkPort (port )) {
189+ return false ;
190+ }
191+ }
192+ if (checkIpV4V6 (domain ) && checkDomain (domain )) {
193+ return false ;
194+ }
195+ }
196+ return true ;
197+ }
198+
199+ function checkPort(port : string ) {
200+ const portNum = parseInt (port , 10 );
201+ return ! isNaN (portNum ) && portNum > 0 && portNum <= 65535 ;
202+ }
203+
179204const acceptParams = async (props : ParamProps ) => {
180205 submitModel .value .installId = props .id ;
181206 params .value = [];
@@ -297,6 +322,10 @@ const updateAppConfig = async () => {
297322 if (! webUI .domain || webUI .domain === ' ' ) {
298323 req .webUI = ' ' ;
299324 }
325+ if (! checkWebUI ()) {
326+ MsgError (i18n .global .t (' commons.rule.host' ));
327+ return ;
328+ }
300329 await updateInstallConfig (req );
301330 MsgSuccess (i18n .global .t (' commons.msg.updateSuccess' ));
302331 handleClose ();
0 commit comments