diff --git a/core/src/main/java/hudson/PluginManager.java b/core/src/main/java/hudson/PluginManager.java index 649cc045b482..a7d74fcee478 100644 --- a/core/src/main/java/hudson/PluginManager.java +++ b/core/src/main/java/hudson/PluginManager.java @@ -1803,13 +1803,7 @@ public HttpResponse doProxyConfigure(StaplerRequest req) throws IOException, Ser jenkins.checkPermission(Jenkins.ADMINISTER); ProxyConfiguration pc = req.bindJSON(ProxyConfiguration.class, req.getSubmittedForm()); - if (pc.name == null) { - jenkins.proxy = null; - ProxyConfiguration.getXmlFile().delete(); - } else { - jenkins.proxy = pc; - jenkins.proxy.save(); - } + ProxyConfigurationManager.saveProxyConfiguration(pc); return new HttpRedirect("advanced"); } diff --git a/core/src/main/java/hudson/ProxyConfigurationManager.java b/core/src/main/java/hudson/ProxyConfigurationManager.java new file mode 100644 index 000000000000..52f15f84c87e --- /dev/null +++ b/core/src/main/java/hudson/ProxyConfigurationManager.java @@ -0,0 +1,72 @@ +/* + * The MIT License + * + * Copyright (c) 2023, CloudBees Inc, and other contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package hudson; + +import edu.umd.cs.findbugs.annotations.NonNull; +import hudson.model.Descriptor; +import java.io.IOException; +import jenkins.model.GlobalConfiguration; +import jenkins.model.Jenkins; +import net.sf.json.JSONObject; +import org.kohsuke.accmod.Restricted; +import org.kohsuke.accmod.restrictions.NoExternalUse; +import org.kohsuke.stapler.StaplerRequest; + +@Extension @Restricted(NoExternalUse.class) +public class ProxyConfigurationManager extends GlobalConfiguration { + + @NonNull + @Override + public String getDisplayName() { + return Messages.ProxyConfigurationManager_DisplayName(); + } + + public Descriptor getProxyDescriptor() { + return Jenkins.get().getDescriptor(ProxyConfiguration.class); + } + + @Override + public boolean configure(StaplerRequest req, JSONObject json) throws FormException { + ProxyConfiguration pc = req.bindJSON(ProxyConfiguration.class, json); + try { + saveProxyConfiguration(pc); + } catch (IOException e) { + throw new FormException(e.getMessage(), e, null); + } + return true; + } + + public static void saveProxyConfiguration(ProxyConfiguration pc) throws IOException { + Jenkins jenkins = Jenkins.get(); + if (pc.name == null) { + jenkins.proxy = null; + ProxyConfiguration.getXmlFile().delete(); + } else { + jenkins.proxy = pc; + jenkins.proxy.save(); + } + } + +} diff --git a/core/src/main/resources/hudson/Messages.properties b/core/src/main/resources/hudson/Messages.properties index aca1dc5ff295..f819794b72ed 100644 --- a/core/src/main/resources/hudson/Messages.properties +++ b/core/src/main/resources/hudson/Messages.properties @@ -127,3 +127,5 @@ PluginWrapper.NoSuchPlugin=No such plugin found with the name ''{0}'' PluginWrapper.Error.Disabling=There was an error disabling the ''{0}'' plugin. Error: ''{1}'' TcpSlaveAgentListener.PingAgentProtocol.displayName=Ping protocol +ProxyConfigurationManager.DisplayName=Proxy Configuration +ProxyConfigurationManager.Description=Configure the http proxy used by Jenkins diff --git a/core/src/main/resources/hudson/PluginManager/advanced.jelly b/core/src/main/resources/hudson/PluginManager/advanced.jelly index 347c9b463124..5d7184c3552e 100644 --- a/core/src/main/resources/hudson/PluginManager/advanced.jelly +++ b/core/src/main/resources/hudson/PluginManager/advanced.jelly @@ -37,22 +37,11 @@ THE SOFTWARE. +
+ ${%proxyMovedBlurb(rootURL+"/manage/configure")} +
+
-
-

${%HTTP Proxy Configuration}

- - - - - - - - - - - - -
diff --git a/core/src/main/resources/hudson/PluginManager/advanced.properties b/core/src/main/resources/hudson/PluginManager/advanced.properties index a60f0274e9af..5fe88b5809ad 100644 --- a/core/src/main/resources/hudson/PluginManager/advanced.properties +++ b/core/src/main/resources/hudson/PluginManager/advanced.properties @@ -23,3 +23,5 @@ deploytext=\ You can select a plugin file from your local system or provide a URL to install \ a plugin from outside the configured update site(s). + +proxyMovedBlurb=The Proxy configuration form has been moved to Configure System page diff --git a/core/src/main/resources/hudson/PluginManager/advanced_fr.properties b/core/src/main/resources/hudson/PluginManager/advanced_fr.properties index 70e4bf603a44..d99993b01f90 100644 --- a/core/src/main/resources/hudson/PluginManager/advanced_fr.properties +++ b/core/src/main/resources/hudson/PluginManager/advanced_fr.properties @@ -33,3 +33,4 @@ Server=Serveur User\ name=Nom d''utilisateur No\ Proxy\ Host=Pas de proxy pour Password=Mot de passe +proxyMovedBlurb=La configuration du Proxy a été déplacé ici Page du configuration du System \ No newline at end of file diff --git a/core/src/main/resources/hudson/ProxyConfigurationManager/config.jelly b/core/src/main/resources/hudson/ProxyConfigurationManager/config.jelly new file mode 100644 index 000000000000..98cfd0e1fbb0 --- /dev/null +++ b/core/src/main/resources/hudson/ProxyConfigurationManager/config.jelly @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + diff --git a/core/src/main/resources/hudson/model/Messages.properties b/core/src/main/resources/hudson/model/Messages.properties index c6e48911de7c..e0721b8fd0af 100644 --- a/core/src/main/resources/hudson/model/Messages.properties +++ b/core/src/main/resources/hudson/model/Messages.properties @@ -289,10 +289,10 @@ UpdateCenter.Status.CheckingJavaNet=Checking update center connectivity UpdateCenter.Status.Success=Success UpdateCenter.Status.UnknownHostException=\ Failed to resolve host name {0}. \ - Perhaps you need to configure HTTP proxy? + Perhaps you need to configure HTTP proxy? UpdateCenter.Status.ConnectionFailed=\ Failed to connect to {0}. \ - Perhaps you need to configure HTTP proxy? + Perhaps you need to configure HTTP proxy? UpdateCenter.init=Initialing update center UpdateCenter.CoreUpdateMonitor.DisplayName=Jenkins Update Notification diff --git a/core/src/main/resources/hudson/model/Messages_bg.properties b/core/src/main/resources/hudson/model/Messages_bg.properties index 42a23b5d8af1..b6468b07f70e 100644 --- a/core/src/main/resources/hudson/model/Messages_bg.properties +++ b/core/src/main/resources/hudson/model/Messages_bg.properties @@ -400,10 +400,10 @@ UpdateCenter.Status.Success=\ Успех UpdateCenter.Status.UnknownHostException=\ Неуспешна проверка на адреса „{0}“.\ - Вероятно трябва да настроите\ + Вероятно трябва да настроите\ сървър-посредник за HTTP. UpdateCenter.Status.ConnectionFailed=\ - Вероятно трябва да настроите\ + Вероятно трябва да настроите\ сървър-посредник за HTTP. UpdateCenter.init=\ Инициализиране на центъра за обновяване diff --git a/core/src/main/resources/hudson/model/Messages_de.properties b/core/src/main/resources/hudson/model/Messages_de.properties index 1a413b4822bb..917c6238b57e 100644 --- a/core/src/main/resources/hudson/model/Messages_de.properties +++ b/core/src/main/resources/hudson/model/Messages_de.properties @@ -291,10 +291,10 @@ UpdateCenter.Status.CheckingJavaNet=Überprüfe Zugang zu jenkins-ci.org-Server UpdateCenter.Status.Success=Erfolgreich UpdateCenter.Status.UnknownHostException=\ Hostname {0} konnte nicht aufgelöst werden. \ - Eventuell sollten Sie einen HTTP-Proxy konfigurieren? + Eventuell sollten Sie einen HTTP-Proxy konfigurieren? UpdateCenter.Status.ConnectionFailed=\ Es konnte keine Verbindung zu {0} aufgebaut werden. \ - Eventuell sollten Sie einen HTTP-Proxy konfigurieren? + Eventuell sollten Sie einen HTTP-Proxy konfigurieren? UpdateCenter.init=Initialisiere das Update Center UpdateCenter.CoreUpdateMonitor.DisplayName=Jenkins-Update-Benachrichtigungen UpdateCenter.DisplayName=Update-Center diff --git a/core/src/main/resources/hudson/model/Messages_es.properties b/core/src/main/resources/hudson/model/Messages_es.properties index 881ee8c98c7e..d57de3106e8e 100644 --- a/core/src/main/resources/hudson/model/Messages_es.properties +++ b/core/src/main/resources/hudson/model/Messages_es.properties @@ -176,10 +176,10 @@ UpdateCenter.Status.CheckingJavaNet=Probando conectividad con jenkins-ci.org UpdateCenter.Status.Success=Correcto UpdateCenter.Status.UnknownHostException=\ Nombre de servidor imposible de resolver {0}. \ - Quizás tengas que configurar to proxy + Quizás tengas que configurar to proxy UpdateCenter.Status.ConnectionFailed=\ Imposible de conectar con {0}. \ - Quizás tengas que configurar to proxy + Quizás tengas que configurar to proxy UpdateCenter.init=Inicializando centro de actualizaciones UpdateCenter.PluginCategory.builder=Plugins relacionados con la forma de ejecutar trabajos UpdateCenter.PluginCategory.buildwrapper=Plugins que añaden tareas relacionadas con la ejecución diff --git a/core/src/main/resources/hudson/model/Messages_fr.properties b/core/src/main/resources/hudson/model/Messages_fr.properties index a7b94dbac835..073805ad5139 100644 --- a/core/src/main/resources/hudson/model/Messages_fr.properties +++ b/core/src/main/resources/hudson/model/Messages_fr.properties @@ -274,10 +274,10 @@ UpdateCenter.Status.CheckingJavaNet=Vérification de la connexion à jenkins-ci. UpdateCenter.Status.Success=Succès UpdateCenter.Status.UnknownHostException=\ Impossible de résoudre le nom de host {0}. \ - Peut-être devez-vous configurer un proxy HTTP? + Peut-être devez-vous configurer un proxy HTTP? UpdateCenter.Status.ConnectionFailed=\ Echec lors de la connexion à {0}. \ - Peut-être devez-vous configurer le proxy HTTP. + Peut-être devez-vous configurer le proxy HTTP. UpdateCenter.init=Initialisation du centre de mise à jour UpdateCenter.CoreUpdateMonitor.DisplayName=Notification de mise à jour de Jenkins diff --git a/core/src/main/resources/hudson/model/Messages_it.properties b/core/src/main/resources/hudson/model/Messages_it.properties index 594c10afac37..23938f9ea828 100644 --- a/core/src/main/resources/hudson/model/Messages_it.properties +++ b/core/src/main/resources/hudson/model/Messages_it.properties @@ -437,11 +437,11 @@ UpdateCenter.Status.CheckingJavaNet=Controllo connettività al Centro \ aggiornamenti in corso UpdateCenter.Status.ConnectionFailed=Impossibile \ connettersi a {0}. Forse è necessario \ - configurare il proxy HTTP? + configurare il proxy HTTP? UpdateCenter.Status.Success=Operazione completata UpdateCenter.Status.UnknownHostException=Impossibile \ risolvere il nome host {0}. Forse è necessario \ - configurare il proxy HTTP? + configurare il proxy HTTP? User.IllegalFullname="{0}" è vietato come nome completo per motivi di sicurezza. User.IllegalUsername="{0}" è vietato come nome utente per motivi di sicurezza. View.ConfigurePermission.Description=Questo permesso consente agli utenti di \ diff --git a/core/src/main/resources/hudson/model/Messages_ja.properties b/core/src/main/resources/hudson/model/Messages_ja.properties index 3fc987f24017..475606108217 100644 --- a/core/src/main/resources/hudson/model/Messages_ja.properties +++ b/core/src/main/resources/hudson/model/Messages_ja.properties @@ -215,10 +215,10 @@ UpdateCenter.Status.CheckingJavaNet=jenkins-ci.orgとの接続をチェックし UpdateCenter.Status.Success=成功 UpdateCenter.Status.UnknownHostException=\ ホスト名 {0}の解決に失敗しました。 \ - たぶん、HTTPプロクシーを設定する必要があります。 + たぶん、HTTPプロクシーを設定する必要があります。 UpdateCenter.Status.ConnectionFailed=\ {0} との接続に失敗しました。 \ - たぶん、HTTPプロクシーを設定する必要があります。 + たぶん、HTTPプロクシーを設定する必要があります。 UpdateCenter.init=アップデートセンターの初期化中 UpdateCenter.PluginCategory.builder=ビルドツール UpdateCenter.PluginCategory.buildwrapper=ビルドラッパー diff --git a/core/src/main/resources/hudson/model/Messages_lt.properties b/core/src/main/resources/hudson/model/Messages_lt.properties index 60ff2702330d..3248fdb97d67 100644 --- a/core/src/main/resources/hudson/model/Messages_lt.properties +++ b/core/src/main/resources/hudson/model/Messages_lt.properties @@ -234,10 +234,10 @@ UpdateCenter.Status.CheckingJavaNet=Tikrinamas prisijungimas prie atnaujinimų c UpdateCenter.Status.Success=Sėkmė UpdateCenter.Status.UnknownHostException=\ Nepavyko išspręsti stoties pavadinimo {0}. \ - Gal jums reikia sukonfigūruoti HTTP šliuzą? + Gal jums reikia sukonfigūruoti HTTP šliuzą? UpdateCenter.Status.ConnectionFailed=\ Nepavyko prisijungti prie {0}. \ - Gal jums reikia sukonfigūruoti HTTP šliuzą? + Gal jums reikia sukonfigūruoti HTTP šliuzą? UpdateCenter.init=Inicializuojamas atnaujinimų centras UpdateCenter.PluginCategory.android=Android kūrimas UpdateCenter.PluginCategory.builder=Kūrimo įrankiai diff --git a/core/src/main/resources/hudson/model/Messages_pt_BR.properties b/core/src/main/resources/hudson/model/Messages_pt_BR.properties index c7dbe7f6adde..9643b131f2a9 100644 --- a/core/src/main/resources/hudson/model/Messages_pt_BR.properties +++ b/core/src/main/resources/hudson/model/Messages_pt_BR.properties @@ -132,7 +132,7 @@ Slave.Remote.Director.Mandatory=Diretório remoto é obrigatório Run.InProgressDuration={0} e contando UpdateCenter.Status.UnknownHostException=\ Erro ao resolver o nome do hospedeiro {0}. \ - Talvez você precise configurar um proxy HTTP? + Talvez você precise configurar um proxy HTTP? Hudson.NotUsesUTF8ToDecodeURL=não use caracteres UTF-8 nas URLs UpdateCenter.Status.CheckingInternet=Checando conexão com a Internet View.DeletePermission.Description=\ @@ -203,7 +203,7 @@ Hudson.NotANegativeNumber=Número não negativo UpdateCenter.PluginCategory.misc=Diversos UpdateCenter.Status.ConnectionFailed=\ Erro ao conectar em {0}. \ - Talvez voê precise configurar um proxy HTTP? + Talvez voê precise configurar um proxy HTTP? UpdateCenter.PluginCategory.maven=Maven UpdateCenter.PluginCategory.upload=Carregadores de artefatos Permalink.LastUnstableBuild=Última construção instável diff --git a/core/src/main/resources/hudson/model/Messages_sr.properties b/core/src/main/resources/hudson/model/Messages_sr.properties index fe5ca1b3adba..3802bd4820e8 100644 --- a/core/src/main/resources/hudson/model/Messages_sr.properties +++ b/core/src/main/resources/hudson/model/Messages_sr.properties @@ -201,9 +201,9 @@ UpdateCenter.Status.CheckingInternet=Провера везом са интерн UpdateCenter.Status.CheckingJavaNet=Провера везом са центар за aжурирање UpdateCenter.Status.Success=Успех UpdateCenter.Status.UnknownHostException=Неуспешна провера адресе {0}. \ -Можда морате поставити HTTP proxy? +Можда морате поставити HTTP proxy? UpdateCenter.Status.ConnectionFailed=Неуспешно повезивање са {0}. \ -Можда морате поставити HTTP proxy? +Можда морате поставити HTTP proxy? UpdateCenter.init=Инициализација центра за ажурирање UpdateCenter.PluginCategory.builder=Алати за изградњу UpdateCenter.PluginCategory.buildwrapper=Скрипт омотачи за изградњу diff --git a/core/src/main/resources/hudson/model/Messages_zh_TW.properties b/core/src/main/resources/hudson/model/Messages_zh_TW.properties index 04c6a60ca31e..b0a151aced77 100644 --- a/core/src/main/resources/hudson/model/Messages_zh_TW.properties +++ b/core/src/main/resources/hudson/model/Messages_zh_TW.properties @@ -214,10 +214,10 @@ UpdateCenter.Status.CheckingJavaNet=檢查是否能連到更新中心 UpdateCenter.Status.Success=成功 UpdateCenter.Status.UnknownHostException=\ 無法解析主機名稱 {0}。\ - 說不定您應該要設定 HTTP 代理伺服器? + 說不定您應該要設定 HTTP 代理伺服器? UpdateCenter.Status.ConnectionFailed=\ 無法連線到{0}。\ - 說不定您應該要設定 HTTP 代理伺服器? + 說不定您應該要設定 HTTP 代理伺服器? UpdateCenter.init=初始化更新中心 UpdateCenter.PluginCategory.builder=建置工具 UpdateCenter.PluginCategory.buildwrapper=建置包裝程式