java.lang.Object
net.i2p.router.web.HelperBase
net.i2p.router.web.ConfigUpdateHelper

public class ConfigUpdateHelperextends HelperBase
Helper class for managing I2P router update configuration and UI generation.

This class provides methods for configuring and displaying update settings including proxy configuration, update policies, refresh frequencies, and trusted key management. It integrates with the router console to generate HTML form elements for update configuration.

  • Field Details

    • _dontInstall

      private boolean _dontInstall
      Set when the user asks not to install the update.
    • _session

      protected HttpSession _session
      The web session this helper renders for.
    • PERIODS

      private static final long[] PERIODS
      The update check intervals offered on the page, in ms
  • Constructor Details

    • ConfigUpdateHelper

      public ConfigUpdateHelper()
      Create a helper with no update restrictions.
  • Method Details

    • storeSession

      public void storeSession(HttpSession session)
      For nonce validation and session-bound nonce generation.
      Parameters:
      session - the console HTTP session the page is being rendered into
    • setContextId

      public void setContextId(String contextId)
      Description copied from class: HelperBase
      Configure this bean to query a particular router context.
      Overrides:
      setContextId in class HelperBase
      Parameters:
      contextId - beginning few characters of the routerHash, or null to pick the first one we come across.
    • canInstall

      public boolean canInstall()
      Whether an offered update may actually be installed here.
      Returns:
      false when the current configuration forbids installing an update
    • updateAvailable

      public boolean updateAvailable()
      Whether the update check is offered on this page.
      Returns:
      true, since the router always offers an update check
    • getNewsURL

      public String getNewsURL()
      The URL of the packaged news feed.
      Returns:
      the news feed URL
    • getNewsURL

      public static String getNewsURL(I2PAppContext ctx)
      The URL of the packaged news feed.
      Parameters:
      ctx - the application context, unused here: the packaged URL is returned
      Returns:
      the news feed URL
    • getUpdateURL

      public String getUpdateURL()
      The update URL, from the configured property or the packaged default.
      Returns:
      the update URL, with any comma separating alternate hosts replaced by a newline
    • getProxyHost

      public String getProxyHost()
      The proxy host to use when fetching an update.
      Returns:
      the configured host, or a read-only marker when the router is already proxying for itself
    • getProxyPort

      public String getProxyPort()
      The proxy port to use when fetching an update.
      Returns:
      the configured port, or a read-only marker when the router is already proxying for itself
    • isInternal

      private boolean isInternal()
      This should almost always be true.
      Returns:
      true if settings are at defaults and proxy is registered
    • getUpdateThroughProxy

      public String getUpdateThroughProxy()
      The checkbox controlling whether updates are fetched through the proxy.
      Returns:
      checkbox markup, checked when updates are proxied
    • getNewsThroughProxy

      public String getNewsThroughProxy()
      The checkbox controlling whether news is fetched through the proxy.
      Returns:
      checkbox markup, checked when news fetching is proxied
    • getUpdateUnsigned

      public String getUpdateUnsigned()
      The checkbox controlling whether an update may be installed unsigned.
      Returns:
      checkbox markup reflecting the current setting
    • getUpdateDevSU3

      public String getUpdateDevSU3()
      The checkbox selecting the development SU3 channel over the signed release.
      Returns:
      checkbox markup reflecting the current setting
    • getRefreshFrequencySelectBox

      public String getRefreshFrequencySelectBox()
      The select box offering the update check intervals.
      Returns:
      select markup with the configured interval preselected
    • getUpdatePolicySelectBox

      public String getUpdatePolicySelectBox()
      Right now the jsp hides the whole select box if _dontInstall is true but this could change.
      Returns:
      the update policy select box
    • getTrustedKeys

      public String getTrustedKeys()
      The signing keys accepted for update verification.
      Returns:
      the trusted keys, formatted for display
    • getZipURL

      public String getZipURL()
      The URL of the full router zip download.
      Returns:
      the configured zip URL, or the packaged default
    • getDevSU3URL

      public String getDevSU3URL()
      The URL of the development SU3 download.
      Returns:
      the configured URL, or an empty string when it has not been set
    • getNewsStatus

      public String getNewsStatus()
      Whether the last news fetch succeeded, and when it last ran.
      Returns:
      the news status, formatted for display