java.lang.Object
net.i2p.router.web.FormHandler
net.i2p.router.web.ConfigUpdateHandler
Handler for router update configuration.
Nested Class Summary
Nested classes/interfaces inherited from class FormHandler
FormHandler.Message, FormHandler.RateLimitEntryModifier and TypeClassDescriptionstatic classMessage class to encapsulate the message text and the canClose flag.(package private) static classOne window's POST count.Field Summary
Modifier and TypeFieldDescriptionprivate StringThe URL of the development stream.private booleanTrue to fetch the news through the proxy.private StringThe URL of the news feed.private StringThe proxy host for the downloads.private StringThe proxy port for the downloads.private longInterval between the update checks.private StringThe signing keys trusted for the updates.private booleanTrue to follow the development stream.private StringThe policy for applying the updates.private booleanTrue to download updates through the proxy.private booleanTrue to accept the unsigned updates.private StringThe URL of the update stream.private StringThe URL of the i2pzip update stream.static final StringCurrent default, i2pnews.i2p, run by echelonstatic final StringDefault proxy host.static final StringDefault proxy port as String.static final intDefault proxy port as int.static final longDefault refresh frequency (36 hours).static final StringDefault refresh frequency as String.static final booleanDefault for update through proxy.static final booleanDefault for fetching news through proxy.static final StringDefault update policy.static final booleanDefault false.static final StringThese are only for .sud and .su2.static final StringIf true, the development SU3 URL; no default.static final StringProperty for news URL.static final StringProperty for update proxy host.static final StringProperty for update proxy port.static final StringProperty for news refresh frequency.static final StringProperty for update through proxy.static final StringProperty for fetching news through proxy.static final StringProperty for trusted update keys.static final StringIf true, offer development SU3 builds; default false.static final StringDefault false - use for distros.static final StringProperty for update policy.static final StringProperty for unsigned update flag.static final StringProperty for update URL.static final StringNo default.private static final StringDirectory holding the trusted SU3 signing certificates.static final booleanOnly enabled if we have trusted public key certificates installed.Fields inherited from class FormHandler
_action, _context, _log, _method, _out, _requestWrapper, _session, _settings, RATE_LIMIT_GLOBAL_KEY, RATE_LIMIT_MAP, RATE_LIMIT_MAX_POSTS, RATE_LIMIT_WINDOW_MSModifier and TypeFieldDescriptionprotected StringForm action.protected RouterContextRouter context.protected LogClass logger.protected StringRequest method.protected WriterOutput writer.protected RequestWrapperOnly for multipart/form-data.protected HttpSessionHTTP session for nonce validation.protected MapNot for multipart/form-data, will be null.(package private) static final StringThe single budget key the console charges POSTs to.(package private) static final ConcurrentHashMap<String, FormHandler.RateLimitEntry> Live budgets, keyed by the value passed to checkRateLimit().(package private) static final intPOSTs admitted per window per key before further ones are refused.(package private) static final intLength of one rate-limit window, in ms.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionprotected voidImplement this to perform the final processing (in turn, adding formNotice and formError messages, etc)static intproxyPort(I2PAppContext ctx) Convenience method for updaters.voidsetDevSU3URL(String url) Set the development SU3 URL.voidSet whether to fetch news through proxy.voidsetNewsURL(String url) Record the news URL to fetch.voidsetProxyHost(String host) Record the proxy host to fetch through.voidsetProxyPort(String port) Record the proxy port to fetch through.voidsetRefreshFrequency(String freq) Record the interval between update checks.voidsetTrustedKeys(String keys) Record the signing keys accepted for update verification.voidsetUpdateDevSU3(String foo) Set whether to update development SU3 builds.voidsetUpdatePolicy(String policy) Record the policy to apply when an update is offered.voidEnable update proxying.voidsetUpdateUnsigned(String foo) Allow updates to be installed without a signature.voidsetUpdateURL(String url) Record the update URL to fetch.voidRecord the zip download URL used for unsigned updates.Methods inherited from class FormHandler
_t, _t, _t, _x, addFormError, addFormError, addFormErrorNoEscape, addFormErrorNoEscape, addFormNotice, addFormNotice, addFormNoticeNoEscape, addFormNoticeNoEscape, checkRateLimit, cleanupRateLimits, getAllMessages, getErrors, getJettyString, getNotices, isAdvanced, resolveEffectiveAction, setAction, setContextId, setNonce, setRequestWrapper, setSettings, storeMethod, storeSession, storeWriterModifier and TypeMethodDescriptionTranslate a string.Translate a string with a parameter This is a lot more expensive than _t(s), so use sparingly.Translate a string with two parameters.static StringMark a string for extraction by xgettext and translation.protected voidaddFormError(String errorMsg) Add an error message to display Use if it does not include a link.protected voidaddFormError(String errorMsg, boolean canClose) Add an error message to display Use if it does not include a link.protected voidAdd an error message to display Use if it includes a link or other formatting.protected voidaddFormErrorNoEscape(String msg, boolean canClose) Add an error message to display Use if it includes a link or other formatting.protected voidaddFormNotice(String msg) Add a non-error message to display Use if it does not include a link.protected voidaddFormNotice(String msg, boolean canClose) Add a non-error message to display Use if it does not include a link.protected voidAdd a non-error message to display Use if it includes a link or other formatting.protected voidaddFormNoticeNoEscape(String msg, boolean canClose) Add a non-error message to display Use if it includes a link or other formatting.(package private) static booleancheckRateLimit(String key, long now) Check and record one form submission against the budget for key.(package private) static voidcleanupRateLimits(long now) Remove budgets that have seen no POST for two full windows.Display everything, wrap it in a div for consistent presentation.Display any error messages (processing the form if it hasn't been yet).protected StringgetJettyString(String key) FormHandler.setSettings(Map)must have been called previously Curses Jetty for returning arrays.Display any non-error messages (processing the form if it hasn't been yet).booleanSame as HelperBase.static StringresolveEffectiveAction(String action, Map<?, ?> settings) Resolve which operation the user actually requested.voidAction value.voidsetContextId(String contextId) Configure this bean to query a particular router context.voidNonce value.voidOnly set by formhandler.jsi for multipart/form-data.voidsetSettings(Map settings) For many forms, it's easiest just to put all the parameters here.voidstoreMethod(String val) Call this to prevent changes using GET.voidstoreSession(HttpSession session) For nonce validation.voidstoreWriter(Writer out) Store the output writer for inline form processing.
Field Details
_newsURL
The URL of the news feed._refreshFrequency
private long _refreshFrequencyInterval between the update checks._updateURL
The URL of the update stream._updatePolicy
The policy for applying the updates._proxyHost
The proxy host for the downloads._proxyPort
The proxy port for the downloads._updateThroughProxy
private boolean _updateThroughProxyTrue to download updates through the proxy._newsThroughProxy
private boolean _newsThroughProxyTrue to fetch the news through the proxy._trustedKeys
The signing keys trusted for the updates._updateUnsigned
private boolean _updateUnsignedTrue to accept the unsigned updates._zipURL
The URL of the i2pzip update stream._updateDevSU3
private boolean _updateDevSU3True to follow the development stream._devSU3URL
The URL of the development stream.PROP_NEWS_URL
DEFAULT_NEWS_URL_SU3
Current default, i2pnews.i2p, run by echelonNOTE: If you change, also change in Android: app/src/main/java/net/i2p/android/apps/NewsFetcher.java.
- See Also:
PROP_REFRESH_FREQUENCY
Property for news refresh frequency.- See Also:
DEFAULT_REFRESH_FREQ
public static final long DEFAULT_REFRESH_FREQDefault refresh frequency (36 hours).- See Also:
DEFAULT_REFRESH_FREQUENCY
Default refresh frequency as String.PROP_UPDATE_POLICY
Property for update policy.- See Also:
DEFAULT_UPDATE_POLICY
Default update policy.- See Also:
PROP_SHOULD_PROXY
Property for update through proxy.- See Also:
DEFAULT_SHOULD_PROXY
public static final boolean DEFAULT_SHOULD_PROXYDefault for update through proxy.- See Also:
PROP_SHOULD_PROXY_NEWS
Property for fetching news through proxy.- See Also:
DEFAULT_SHOULD_PROXY_NEWS
public static final boolean DEFAULT_SHOULD_PROXY_NEWSDefault for fetching news through proxy.- See Also:
PROP_PROXY_HOST
Property for update proxy host.- See Also:
DEFAULT_PROXY_HOST
PROP_PROXY_PORT
Property for update proxy port.- See Also:
DEFAULT_PROXY_PORT_INT
public static final int DEFAULT_PROXY_PORT_INTDefault proxy port as int.- See Also:
DEFAULT_PROXY_PORT
Default proxy port as String.DEFAULT_UPDATE_UNSIGNED
PROP_UPDATE_UNSIGNED
Property for unsigned update flag.- See Also:
PROP_UPDATE_DISABLED
Default false - use for distros.- See Also:
PROP_ZIP_URL
PROP_UPDATE_URL
PROP_UPDATE_DEV_SU3
If true, offer development SU3 builds; default false.- See Also:
PROP_DEV_SU3_URL
If true, the development SU3 URL; no default.- See Also:
DEFAULT_UPDATE_URL
These are only for .sud and .su2. Do NOT use this for .su3.- See Also:
SU3_CERT_DIR
Directory holding the trusted SU3 signing certificates.- See Also:
USE_SU3_UPDATE
public static final boolean USE_SU3_UPDATEOnly enabled if we have trusted public key certificates installed.PROP_TRUSTED_KEYS
Property for trusted update keys.- See Also:
Constructor Details
ConfigUpdateHandler
public ConfigUpdateHandler()ConfigUpdateHandler default constructor.
Method Details
proxyPort
Convenience method for updaters.- Parameters:
ctx- the context for retrieving configuration- Returns:
- the configured value, else the registered HTTP proxy, else the default
processForm
protected void processForm()Description copied from class:FormHandlerImplement this to perform the final processing (in turn, adding formNotice and formError messages, etc)Will only be called if _action is non-null and the nonce is valid.
- Specified by:
processFormin classFormHandler
setNewsURL
setRefreshFrequency
Record the interval between update checks.- Parameters:
freq- the interval in milliseconds; unparseable input is ignored
setUpdateURL
setUpdatePolicy
Record the policy to apply when an update is offered.- Parameters:
policy- the update policy
setTrustedKeys
Record the signing keys accepted for update verification.- Parameters:
keys- the trusted keys
setUpdateThroughProxy
Enable update proxying.- Parameters:
foo- ignored; this setter only ever turns the option on
setProxyHost
Record the proxy host to fetch through.- Parameters:
host- the proxy host
setProxyPort
Record the proxy port to fetch through.- Parameters:
port- the proxy port
setUpdateUnsigned
Allow updates to be installed without a signature.- Parameters:
foo- ignored; this setter only ever turns the option on
setZipURL
Record the zip download URL used for unsigned updates.- Parameters:
url- the zip URL to download
setNewsThroughProxy
Set whether to fetch news through proxy.- Parameters:
foo- ignored; the value only marks the setting as enabled
setUpdateDevSU3
Set whether to update development SU3 builds.- Parameters:
foo- ignored; the value only marks the setting as enabled
setDevSU3URL
Set the development SU3 URL.- Parameters:
url- the development SU3 zip URL to download