Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b8b2041

Browse files
fix: Fix Docker proxy error issue (1Panel-dev#9790)
refs 1Panel-dev#9780
1 parent c45bb60 commit b8b2041

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

‎core/app/service/setting.go‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,11 @@ func (u *SettingService) UpdateBindInfo(req dto.BindInfo) error {
189189
}
190190

191191
func (u *SettingService) UpdateProxy(req dto.ProxyUpdate) error {
192-
if err := settingRepo.Update("ProxyUrl", req.ProxyUrl); err != nil {
192+
proxyUrl := req.ProxyUrl
193+
if req.ProxyType == "https" || req.ProxyType == "http" {
194+
proxyUrl = req.ProxyType + "://" + req.ProxyUrl
195+
}
196+
if err := settingRepo.Update("ProxyUrl", proxyUrl); err != nil {
193197
return err
194198
}
195199
if err := settingRepo.Update("ProxyType", req.ProxyType); err != nil {
@@ -675,16 +679,17 @@ func (u *SettingService) GetAppstoreConfig() (*dto.AppstoreConfig, error) {
675679
}
676680

677681
func loadDockerProxy(req dto.ProxyUpdate) string {
678-
if len(req.ProxyType) == 0 || req.ProxyType == "close" || !req.ProxyDocker {
682+
if req.ProxyType == "" || req.ProxyType == "close" || !req.ProxyDocker {
679683
return ""
680684
}
681-
proxyPasswd:=""
682-
if len(req.ProxyUser) != 0 {
683-
proxyPasswd = req.ProxyPasswd+"@"
684-
}
685-
proxyUrl:=req.ProxyType+"://" + req.ProxyUser+":"+proxyPasswd+req.ProxyUrl+":"+req.ProxyPort
686-
ifreq.ProxyType=="http"||req.ProxyType=="https" {
687-
req.ProxyUrl=req.ProxyType+"://"+req.ProxyUrl
685+
varaccountstring
686+
if req.ProxyUser != "" {
687+
account = req.ProxyUser
688+
ifreq.ProxyPasswd!="" {
689+
account+=":" + req.ProxyPasswd
690+
}
691+
account+="@"
688692
}
689-
return proxyUrl
693+
694+
return fmt.Sprintf("%s://%s%s:%s", req.ProxyType, account, req.ProxyUrl, req.ProxyPort)
690695
}

‎frontend/src/views/setting/panel/proxy/index.vue‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ const submitChangePassword = async (formEl: FormInstance | undefined) => {
156156
params.proxyPasswdKeep = form.proxyPasswdKeepItem ? 'Enable' : 'Disable';
157157
}
158158
if (form.proxyType === 'http' || form.proxyType === 'https') {
159-
params.proxyUrl = form.proxyType+'://'+form.proxyUrl;
159+
params.proxyUrl = form.proxyUrl;
160160
}
161161
if (isMasterProductPro.value && (params.proxyDocker || proxyDockerVisible.value)) {
162162
dockerProxyRef.value.acceptParams({
@@ -197,7 +197,7 @@ const onSubmit = async () => {
197197
params.proxyPasswdKeep = form.proxyPasswdKeepItem ? 'Enable' : 'Disable';
198198
}
199199
if (form.proxyType === 'http' || form.proxyType === 'https') {
200-
params.proxyUrl = form.proxyType+'://'+form.proxyUrl;
200+
params.proxyUrl = form.proxyUrl;
201201
}
202202
await updateProxy(params);
203203
emit('search');

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /