java.lang.Object
net.i2p.router.web.HelperBase
net.i2p.router.web.helpers.HomeHelper
Helper for router console home page and configuration. Renders main dashboard with service links, favorites, monitoring, and quick access to router management features. Supports both /home and /confighome pages.
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classIgnore case, current locale.Field Summary
FieldsModifier and TypeFieldDescription(package private) static final StringAdvanced services list.(package private) static final StringDefault favorites list.(package private) static final StringDefault services list, comma-separated.private static final StringPath prefix for the app icons.(package private) static final StringDefault services list for new installs.(package private) static final StringConfig opts property.(package private) static final StringFavorites list property.(package private) static final StringMonitoring property.(package private) static final StringSearch property.(package private) static final StringService list property.private static final charSeparator between app names in the config property.private static final StringThe separator as a string, for splitting.Fields 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 TypeMethodDescription(package private) static Collection<App> buildApps(RouterContext ctx, String config) Parse the config string into the set of apps to offer.(package private) static Collection<App> buildSearchApps(String config) Config string.private StringconfigTable(String prop, String dflt) Builds the table of app config links.The favorites table for the config page.The search engines table for the config page.The services table for the config page.The favorites table for the home page.Builds the HTTP proxy status check for the home page.The services table for the home page.private Collection<App> hideUnreachable(Collection<App> apps) Drop sites that are gone from the Sites of Interest listing.private StringhomeTable(String prop, String dflt, Collection<App> toAdd) Builds the table of apps shown on the home page.booleanWhether the console is in advanced mode.private StringrenderApps(Collection<App> apps) Renders one app's icon and links.private StringrenderConfig(Collection<App> apps) Renders one app's config link.(package private) static voidsaveApps(RouterContext ctx, String prop, Collection<App> apps, boolean full) Write the app list back out to the named property.booleanTrue if bandwidth is not yet configured.booleanTrue if search should be shown.booleanTrue if no language has been configured.Methods inherited from class HelperBase
_t, _t, _t, _x, getChecked, ngettext, setContextId, 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.Translate a string with plural forms (ngettext).voidsetContextId(String contextId) Configure this bean to query a particular router context.voidstoreWriter(Writer out) Store the writer for output.
Field Details
S
private static final char SSeparator between app names in the config property.- See Also:
I
PROP_SERVICES
PROP_FAVORITES
PROP_CONFIG
PROP_MONITORING
PROP_SEARCH
DEFAULT_SERVICES
Default services list, comma-separated.NEWINSTALL_SERVICES
Default services list for new installs.ADVANCED_SERVICES
Advanced services list.DEFAULT_FAVORITES
Default favorites list.SS
The separator as a string, for splitting.
Constructor Details
HomeHelper
public HomeHelper()Construct the home page helper.
Method Details
shouldShowWelcome
public boolean shouldShowWelcome()True if no language has been configured.- Returns:
- true if routerconsole.lang is unset
shouldShowBandwidthConfig
public boolean shouldShowBandwidthConfig()True if bandwidth is not yet configured.- Returns:
- true if i2np.bandwidth.outboundKBytesPerSecond is unset
shouldShowSearch
public boolean shouldShowSearch()True if search should be shown.- Returns:
- true if routerconsole.showSearch is set
isAdvanced
public boolean isAdvanced()Whether the console is in advanced mode.- Overrides:
isAdvancedin classHelperBase- Returns:
- true if i2pconsole.advanced is set
getServices
The services table for the home page.- Returns:
- the rendered table html, new-user or advanced layout
getFavorites
getConfigServices
The services table for the config page.- Returns:
- the rendered table html
getConfigFavorites
The favorites table for the config page.- Returns:
- the rendered table html
getConfigSearch
The search engines table for the config page.- Returns:
- the rendered table html
getProxyStatus
Builds the HTTP proxy status check for the home page. It loads a one-pixel image through the proxy, so the alt text only shows when the browser is not configured to use it.- Returns:
- a translated warning if the proxy port is down, else an img tag
homeTable
Builds the table of apps shown on the home page.- Parameters:
prop- property naming the apps to showdflt- the default app listtoAdd- apps added to the property are also shown- Returns:
- the table markup
hideUnreachable
Drop sites that are gone from the Sites of Interest listing.Applies only to the favourites shown on the home and sitemap pages. The config table is left complete so a link that is merely down can still be seen and removed.
A site is dropped when the naming service cannot resolve it, or when the addressbook checker's last probe of it failed. A site that resolves but has not been probed yet is kept, so a cold results file does not empty the page. Links that are not I2P names - clearnet, and the console's own paths - are never dropped, since neither source can judge them.
- Parameters:
apps- the configured links- Returns:
- those that should still be shown
configTable
buildApps
Parse the config string into the set of apps to offer.- Parameters:
ctx- context used to translate app names and descriptionsconfig- the configuration, four S-separated fields per app- Returns:
- collection of apps
buildSearchApps
Config string.- Parameters:
config- the config string- Returns:
- collection of search apps
saveApps
Write the app list back out to the named property.- Parameters:
ctx- context whose property store receives the valueprop- the property nameapps- the apps to savefull- whether to save full data
renderApps
Renders one app's icon and links.- Parameters:
apps- the apps to render- Returns:
- the markup for the apps
renderConfig
Renders one app's config link.- Parameters:
apps- the apps to render- Returns:
- the markup for the links