java.lang.Object
net.i2p.router.web.HelperBase
net.i2p.router.web.helpers.ConfigClientsHelper

public class ConfigClientsHelperextends HelperBase
Helper for clients configuration page rendering and form processing.
  • Field Details

    • _edit

      private String _edit
      Name of the app selected for editing, if any.
    • BIND_ALL_INTERFACES

      public static final String BIND_ALL_INTERFACES
      From ClientListenerRunner.
      See Also:
    • PROP_DISABLE_EXTERNAL

      public static final String PROP_DISABLE_EXTERNAL
      From ClientManager.
      See Also:
    • PROP_ENABLE_SSL

      public static final String PROP_ENABLE_SSL
      From ClientManager.
      See Also:
    • PROP_AUTH

      public static final String PROP_AUTH
      From ClientMessageEventListener.
      See Also:
    • PROP_DISABLE_LOOPBACK

      public static final String PROP_DISABLE_LOOPBACK
      From ClientManager.
      See Also:
    • PROP_ENABLE_CLIENT_CHANGE

      public static final String PROP_ENABLE_CLIENT_CHANGE
      Enable/disable client configuration changes in the web UI.
      See Also:
    • PROP_ENABLE_PLUGIN_INSTALL

      public static final String PROP_ENABLE_PLUGIN_INSTALL
      Enable/disable plugin installation in the web UI.
      See Also:
    • VALID_EMAIL_ADDRESS_REGEX

      private static final Pattern VALID_EMAIL_ADDRESS_REGEX
      Simple regex from https://stackoverflow.com/questions/8204680/java-regex-email not the massive RFC 822 compliant one modified so .i2p will work.
  • Constructor Details

    • ConfigClientsHelper

      public ConfigClientsHelper()
      Creates a helper; the container calls it with no arguments before rendering the page.
  • Method Details

    • isClientChangeEnabled

      public boolean isClientChangeEnabled()
      Whether client configuration changes are allowed.
      Returns:
      true if enabled, false otherwise
    • isPluginInstallEnabled

      public boolean isPluginInstallEnabled()
      Whether plugin installation is enabled.
      Returns:
      true if enabled, false otherwise
    • isPluginUpdateEnabled

      public boolean isPluginUpdateEnabled()
      Whether any plugins have updates available.
      Returns:
      true if updates available, false otherwise
    • getPort

      public String getPort()
      Get the configured I2CP port.
      Returns:
      the port number string
    • i2cpModeChecked

      public String i2cpModeChecked(int mode)
      Get checked attribute for I2CP mode radio buttons.
      Parameters:
      mode - the mode number (0=disabled, 1=clear, 2=SSL)
      Returns:
      CHECKED if this mode is selected, otherwise ""
    • getAuth

      public String getAuth()
      Whether I2CP authentication is enabled.
      Returns:
      CHECKED if enabled, otherwise ""
    • getDisableLoopback

      public String getDisableLoopback()
      Whether local-local loopback delivery is disabled.
      Returns:
      CHECKED if disabled, otherwise ""
    • intfcAddresses

      public String[] intfcAddresses()
      Get available network interface addresses.
      Returns:
      array of address strings
    • isIFSelected

      public boolean isIFSelected(String addr)
      Whether the given address is the selected I2CP interface.
      Parameters:
      addr - the address to check
      Returns:
      true if selected, false otherwise
    • setEdit

      public void setEdit(String edit)
      Set the edit mode for a specific client or for adding a new client.
      Parameters:
      edit - the edit command string
    • getForm1

      public String getForm1()
      Generate the clients configuration table HTML.
      Returns:
      the HTML string
    • getForm2

      public String getForm2()
      Generate the webapps configuration table HTML.
      Returns:
      the HTML string
    • showPlugins

      public boolean showPlugins()
      Whether plugins are enabled.
      Returns:
      true if plugins are enabled for this router
    • getForm3

      public String getForm3()
      Generate the plugins configuration table HTML.
      Returns:
      the HTML string
    • renderForm

      private void renderForm(StringBuilder buf, String index, String name, boolean urlify, boolean enabled, boolean ro, boolean preventDisable, String escapedDesc, boolean edit, boolean showEditButton, boolean showUpdateButton, boolean showStopButton, boolean showDeleteButton, boolean showStartButton)
      Misnamed, renders a single line in a table for a single client/webapp/plugin.
      Parameters:
      buf - the builder the table row is appended to
      index - the client's config index, used to name its form fields
      name - will be escaped here
      urlify - true to render the name as a link to the app instead of a label
      enabled - true to check the enable checkbox
      ro - trumps edit and showEditButton
      preventDisable - true to disable the enable checkbox so the app cannot be turned off
      escapedDesc - description, must be HTML escaped, except for plugins
      edit - true when the row is being rendered as an editable form
      showEditButton - true to offer the edit button
      showUpdateButton - true to offer the update button
      showStopButton - true to offer the stop button
      showDeleteButton - true to offer the delete button
      showStartButton - true to offer the start button
    • stripHTML

      public static String stripHTML(Properties props, String key)
      Like in DataHelper but doesn't convert null to "" There's a lot worse things a plugin could do but...
      Parameters:
      props - the properties to retrieve from
      key - the property key
      Returns:
      the stripped value, or null