java.lang.Object
net.i2p.router.web.HelperBase
net.i2p.router.web.ConfigUpdateHelper
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 Summary
FieldsModifier and TypeFieldDescriptionprivate booleanSet when the user asks not to install the update.protected HttpSessionThe web session this helper renders for.private static final long[]The update check intervals offered on the page, in msFields inherited from class HelperBase
_context, _log, _out, CHECKED, PROP_ADVANCED, SELECTEDModifier and TypeFieldDescriptionprotected RouterContextThe router context.protected LogThe log instance.protected WriterThe writer for output.static final StringChecked attribute for HTML checkboxes.static final StringProperty key for advanced mode.static final StringSelected attribute for HTML select options.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionbooleanWhether an offered update may actually be installed here.The URL of the development SU3 download.Whether the last news fetch succeeded, and when it last ran.The checkbox controlling whether news is fetched through the proxy.The URL of the packaged news feed.static StringgetNewsURL(I2PAppContext ctx) The URL of the packaged news feed.The proxy host to use when fetching an update.The proxy port to use when fetching an update.The select box offering the update check intervals.The signing keys accepted for update verification.The checkbox selecting the development SU3 channel over the signed release.Right now the jsp hides the whole select box if _dontInstall is true but this could change.The checkbox controlling whether updates are fetched through the proxy.The checkbox controlling whether an update may be installed unsigned.The update URL, from the configured property or the packaged default.The URL of the full router zip download.private booleanThis should almost always be true.voidsetContextId(String contextId) Configure this bean to query a particular router context.voidstoreSession(HttpSession session) For nonce validation and session-bound nonce generation.booleanWhether the update check is offered on this page.Methods inherited from class HelperBase
_t, _t, _t, _x, getChecked, isAdvanced, ngettext, storeWriterModifier and TypeMethodDescriptionTranslate a string.Translate a string with a parameter.Translate a string with two parameters.static StringMark a string for extraction by xgettext and translation.protected StringgetChecked(String prop) Get the checked attribute for a boolean property.booleanCheck if advanced mode is enabled.Translate a string with plural forms (ngettext).voidstoreWriter(Writer out) Store the writer for output.
Field Details
_dontInstall
private boolean _dontInstallSet when the user asks not to install the update._session
The web session this helper renders for.PERIODS
private static final long[] PERIODSThe update check intervals offered on the page, in ms
Constructor Details
ConfigUpdateHelper
public ConfigUpdateHelper()Create a helper with no update restrictions.
Method Details
storeSession
For nonce validation and session-bound nonce generation.- Parameters:
session- the console HTTP session the page is being rendered into
setContextId
Description copied from class:HelperBaseConfigure this bean to query a particular router context.- Overrides:
setContextIdin classHelperBase- 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
getNewsURL
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
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
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
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
The checkbox controlling whether updates are fetched through the proxy.- Returns:
- checkbox markup, checked when updates are proxied
getNewsThroughProxy
The checkbox controlling whether news is fetched through the proxy.- Returns:
- checkbox markup, checked when news fetching is proxied
getUpdateUnsigned
The checkbox controlling whether an update may be installed unsigned.- Returns:
- checkbox markup reflecting the current setting
getUpdateDevSU3
The checkbox selecting the development SU3 channel over the signed release.- Returns:
- checkbox markup reflecting the current setting
getRefreshFrequencySelectBox
The select box offering the update check intervals.- Returns:
- select markup with the configured interval preselected
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
The signing keys accepted for update verification.- Returns:
- the trusted keys, formatted for display
getZipURL
The URL of the full router zip download.- Returns:
- the configured zip URL, or the packaged default
getDevSU3URL
The URL of the development SU3 download.- Returns:
- the configured URL, or an empty string when it has not been set
getNewsStatus
Whether the last news fetch succeeded, and when it last ran.- Returns:
- the news status, formatted for display