mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 21:50:28 +08:00 
			
		
		
		
	配置初始化时增加context参数
This commit is contained in:
		@@ -82,7 +82,7 @@ func (this *IndexAction) RunGet(params struct{}) {
 | 
				
			|||||||
						this.ErrorPage(err)
 | 
											this.ErrorPage(err)
 | 
				
			||||||
						return
 | 
											return
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					_ = httpsConfig.Init()
 | 
										_ = httpsConfig.Init(nil)
 | 
				
			||||||
					if httpsConfig.IsOn && len(httpsConfig.Listen) > 0 {
 | 
										if httpsConfig.IsOn && len(httpsConfig.Listen) > 0 {
 | 
				
			||||||
						restAccessAddrs = append(restAccessAddrs, httpsConfig.FullAddresses()...)
 | 
											restAccessAddrs = append(restAccessAddrs, httpsConfig.FullAddresses()...)
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -118,7 +118,7 @@ func (this *UpdatePopupAction) RunPost(params struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// 校验
 | 
						// 校验
 | 
				
			||||||
	certConfig.IsCA = params.IsCA
 | 
						certConfig.IsCA = params.IsCA
 | 
				
			||||||
	err = certConfig.Init()
 | 
						err = certConfig.Init(nil)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		if params.IsCA {
 | 
							if params.IsCA {
 | 
				
			||||||
			this.Fail("证书校验错误:" + err.Error())
 | 
								this.Fail("证书校验错误:" + err.Error())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -85,7 +85,7 @@ func (this *UploadPopupAction) RunPost(params struct {
 | 
				
			|||||||
		CertData: certData,
 | 
							CertData: certData,
 | 
				
			||||||
		KeyData:  keyData,
 | 
							KeyData:  keyData,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	err := certConfig.Init()
 | 
						err := certConfig.Init(nil)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		if params.IsCA {
 | 
							if params.IsCA {
 | 
				
			||||||
			this.Fail("证书校验错误:" + err.Error())
 | 
								this.Fail("证书校验错误:" + err.Error())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,14 +65,14 @@ func (this *SettingAction) RunPost(params struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// TODO 校验配置
 | 
						// TODO 校验配置
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	reverseProxyConfig := &serverconfigs.ReverseProxyConfig{}
 | 
						var reverseProxyConfig = &serverconfigs.ReverseProxyConfig{}
 | 
				
			||||||
	err := json.Unmarshal(params.ReverseProxyJSON, reverseProxyConfig)
 | 
						err := json.Unmarshal(params.ReverseProxyJSON, reverseProxyConfig)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		this.ErrorPage(err)
 | 
							this.ErrorPage(err)
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = reverseProxyConfig.Init()
 | 
						err = reverseProxyConfig.Init(nil)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		this.Fail("配置校验失败:" + err.Error())
 | 
							this.Fail("配置校验失败:" + err.Error())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,14 +65,14 @@ func (this *SettingAction) RunPost(params struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// TODO 校验配置
 | 
						// TODO 校验配置
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	reverseProxyConfig := &serverconfigs.ReverseProxyConfig{}
 | 
						var reverseProxyConfig = &serverconfigs.ReverseProxyConfig{}
 | 
				
			||||||
	err := json.Unmarshal(params.ReverseProxyJSON, reverseProxyConfig)
 | 
						err := json.Unmarshal(params.ReverseProxyJSON, reverseProxyConfig)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		this.ErrorPage(err)
 | 
							this.ErrorPage(err)
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = reverseProxyConfig.Init()
 | 
						err = reverseProxyConfig.Init(nil)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		this.Fail("配置校验失败:" + err.Error())
 | 
							this.Fail("配置校验失败:" + err.Error())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,7 +72,7 @@ func (this *SettingAction) RunPost(params struct {
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = reverseProxyConfig.Init()
 | 
						err = reverseProxyConfig.Init(nil)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		this.Fail("配置校验失败:" + err.Error())
 | 
							this.Fail("配置校验失败:" + err.Error())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,7 +53,7 @@ func (this *IndexAction) RunGet(params struct {
 | 
				
			|||||||
			this.ErrorPage(err)
 | 
								this.ErrorPage(err)
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		_ = httpsConfig.Init()
 | 
							_ = httpsConfig.Init(nil)
 | 
				
			||||||
		for _, port := range httpsConfig.AllPorts() {
 | 
							for _, port := range httpsConfig.AllPorts() {
 | 
				
			||||||
			if lists.ContainsInt(httpPorts, port) {
 | 
								if lists.ContainsInt(httpPorts, port) {
 | 
				
			||||||
				conflictingPorts = append(conflictingPorts, port)
 | 
									conflictingPorts = append(conflictingPorts, port)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,7 +43,7 @@ func (this *IndexAction) RunGet(params struct {
 | 
				
			|||||||
		httpsConfig.IsOn = true
 | 
							httpsConfig.IsOn = true
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	_ = httpsConfig.Init()
 | 
						_ = httpsConfig.Init(nil)
 | 
				
			||||||
	var httpsPorts = httpsConfig.AllPorts()
 | 
						var httpsPorts = httpsConfig.AllPorts()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 检查http和https端口冲突
 | 
						// 检查http和https端口冲突
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@ func FindLocationConfig(parentAction *actionutils.ParentAction, locationId int64
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = locationConfig.Init()
 | 
						err = locationConfig.Init(nil)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		parentAction.ErrorPage(err)
 | 
							parentAction.ErrorPage(err)
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,14 +56,14 @@ func (this *SettingAction) RunPost(params struct {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// TODO 校验配置
 | 
						// TODO 校验配置
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	reverseProxyConfig := &serverconfigs.ReverseProxyConfig{}
 | 
						var reverseProxyConfig = &serverconfigs.ReverseProxyConfig{}
 | 
				
			||||||
	err := json.Unmarshal(params.ReverseProxyJSON, reverseProxyConfig)
 | 
						err := json.Unmarshal(params.ReverseProxyJSON, reverseProxyConfig)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		this.ErrorPage(err)
 | 
							this.ErrorPage(err)
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = reverseProxyConfig.Init()
 | 
						err = reverseProxyConfig.Init(nil)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		this.Fail("配置校验失败:" + err.Error())
 | 
							this.Fail("配置校验失败:" + err.Error())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,7 +62,7 @@ func (this *SettingAction) RunPost(params struct {
 | 
				
			|||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = reverseProxyConfig.Init()
 | 
						err = reverseProxyConfig.Init(nil)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		this.Fail("配置校验失败:" + err.Error())
 | 
							this.Fail("配置校验失败:" + err.Error())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,7 +47,7 @@ func (this *UpdateHTTPSPopupAction) RunGet(params struct{}) {
 | 
				
			|||||||
			CertData: certData,
 | 
								CertData: certData,
 | 
				
			||||||
			KeyData:  keyData,
 | 
								KeyData:  keyData,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		_ = certConfig.Init()
 | 
							_ = certConfig.Init(nil)
 | 
				
			||||||
		certConfig.CertData = nil
 | 
							certConfig.CertData = nil
 | 
				
			||||||
		certConfig.KeyData = nil
 | 
							certConfig.KeyData = nil
 | 
				
			||||||
		certConfigs = append(certConfigs, certConfig)
 | 
							certConfigs = append(certConfigs, certConfig)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user