net.i2p.router.web

## Class NewsHelper

- java.lang.Object
- - net.i2p.router.web.HelperBase
  - - net.i2p.router.web.ContentHelper
    - - net.i2p.router.web.NewsHelper

-     public class NewsHelper
      extends ContentHelper

  If news file does not exist, use file from the initialNews directory in $I2P

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `NEWS_FILE`
    `static String` | `PROP_LAST_CHECKED`
    `static String` | `PROP_LAST_LANG`
    `static String` | `PROP_LAST_NEW_ENTRY`
    `static String` | `PROP_LAST_UPDATE_TIME`
    `static String` | `PROP_LAST_UPDATED`
    `static String` | `PROP_TRANSLATE` Default true

    - ### Fields inherited from class net.i2p.router.web.ContentHelper

      `_page`

    - ### Fields inherited from class net.i2p.router.web.HelperBase

      `_context, _out, CHECKED, PROP_ADVANCED, SELECTED`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NewsHelper()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `devSU3UpdateConstraint()` Translated message about new version available but constrained
    `static String` | `devSU3UpdateVersion()`
    `static String` | `devSU3VersionDownloaded()` Already downloaded but not installed version
    `static boolean` | `dontInstall(RouterContext ctx)`
    `String` | `getContent()` If we haven't downloaded news yet, use the translated initial news file
    `static String` | `getUpdateStatus()`
    `static boolean` | `isAnyUpdateInProgress()` If ANY update is in progress.
    `static boolean` | `isBaseReadonly(RouterContext ctx)`
    `static boolean` | `isDevSU3UpdateAvailable(RouterContext ctx)` Will be false if already downloaded or if dev update disabled.
    `static boolean` | `isExternalRestartPending()` A router update had been downloaded and handled by an UpdatePostProcessor.
    `static boolean` | `isUnsignedUpdateAvailable(RouterContext ctx)` Will be false if already downloaded or if dev update disabled.
    `static boolean` | `isUpdateAvailable()` Release update only.
    `static boolean` | `isUpdateDisabled(RouterContext ctx)`
    `static boolean` | `isUpdateInProgress()` If a signed or unsigned router update is in progress.
    `static long` | `lastChecked(RouterContext ctx)`
    `static long` | `lastUpdated(RouterContext ctx)` When the news was last downloaded
    `boolean` | `shouldShowNews()` Is the news newer than the last time it was hidden?
    `static boolean` | `shouldShowNews(RouterContext ctx)`
    `void` | `showNews(boolean yes)` Save config with the timestamp of the current news to hide, or 0 to show
    `static void` | `showNews(RouterContext ctx, boolean yes)` Save config with the timestamp of the current news to hide, or 0 to show
    `String` | `status()`
    `static String` | `status(RouterContext ctx)`
    `static String` | `unsignedUpdateConstraint()` Translated message about new version available but constrained
    `static String` | `unsignedUpdateVersion()`
    `static String` | `unsignedVersionDownloaded()` Already downloaded but not installed version
    `static String` | `updateConstraint()` Release update only.
    `static String` | `updateVersion()` Release update only.
    `static String` | `updateVersionDownloaded()` Release update only.

    - ### Methods inherited from class net.i2p.router.web.ContentHelper

      `getTextContent, setLang, setMaxLines, setPage, setStartAtBeginning`

    - ### Methods inherited from class net.i2p.router.web.HelperBase

      `_t, _t, _t, _x, getChecked, isAdvanced, ngettext, setContextId, storeWriter`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### NEWS_FILE

          public static final String NEWS_FILE

      See Also:
        Constant Field Values

    - #### PROP_LAST_CHECKED

          public static final String PROP_LAST_CHECKED

      See Also:
        Constant Field Values

    - #### PROP_LAST_LANG

          public static final String PROP_LAST_LANG

      See Also:
        Constant Field Values

    - #### PROP_LAST_NEW_ENTRY

          public static final String PROP_LAST_NEW_ENTRY

      See Also:
        Constant Field Values

    - #### PROP_LAST_UPDATE_TIME

          public static final String PROP_LAST_UPDATE_TIME

      See Also:
        Constant Field Values

    - #### PROP_LAST_UPDATED

          public static final String PROP_LAST_UPDATED

      See Also:
        Constant Field Values

    - #### PROP_TRANSLATE

          public static final String PROP_TRANSLATE

      Default true
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### NewsHelper

          public NewsHelper()

  - ### Method Detail

    - #### devSU3UpdateConstraint

          public static String devSU3UpdateConstraint()

      Translated message about new version available but constrained
      Returns:
        null if none

    - #### devSU3UpdateVersion

          public static String devSU3UpdateVersion()

      Returns:
        null if none

    - #### devSU3VersionDownloaded

          public static String devSU3VersionDownloaded()

      Already downloaded but not installed version
      Returns:
        null if none

    - #### dontInstall

          public static boolean dontInstall(RouterContext ctx)

    - #### getContent

          public String getContent()

      If we haven't downloaded news yet, use the translated initial news file
      Overrides:
        `getContent` in class `ContentHelper`

    - #### getUpdateStatus

          public static String getUpdateStatus()

      Returns:
        "" if none

    - #### isAnyUpdateInProgress

          public static boolean isAnyUpdateInProgress()

      If ANY update is in progress.

    - #### isBaseReadonly

          public static boolean isBaseReadonly(RouterContext ctx)

    - #### isDevSU3UpdateAvailable

          public static boolean isDevSU3UpdateAvailable(RouterContext ctx)

      Will be false if already downloaded or if dev update disabled.

    - #### isExternalRestartPending

          public static boolean isExternalRestartPending()

      A router update had been downloaded and handled by an UpdatePostProcessor. It will provide wrapper-like function to install the update and restart after shutdown.

    - #### isUnsignedUpdateAvailable

          public static boolean isUnsignedUpdateAvailable(RouterContext ctx)

      Will be false if already downloaded or if dev update disabled.

    - #### isUpdateAvailable

          public static boolean isUpdateAvailable()

      Release update only. Will be false if already downloaded.

    - #### isUpdateDisabled

          public static boolean isUpdateDisabled(RouterContext ctx)

    - #### isUpdateInProgress

          public static boolean isUpdateInProgress()

      If a signed or unsigned router update is in progress. Does NOT cover plugins, news, etc.

    - #### lastChecked

          public static long lastChecked(RouterContext ctx)

    - #### lastUpdated

          public static long lastUpdated(RouterContext ctx)

      When the news was last downloaded

    - #### shouldShowNews

          public boolean shouldShowNews()

      Is the news newer than the last time it was hidden?

    - #### shouldShowNews

          public static boolean shouldShowNews(RouterContext ctx)

    - #### showNews

          public void showNews(boolean yes)

      Save config with the timestamp of the current news to hide, or 0 to show

    - #### showNews

          public static void showNews(RouterContext ctx,
                                      boolean yes)

      Save config with the timestamp of the current news to hide, or 0 to show

    - #### status

          public String status()

      Returns:
        HTML

    - #### status

          public static String status(RouterContext ctx)

      Returns:
        HTML

    - #### unsignedUpdateConstraint

          public static String unsignedUpdateConstraint()

      Translated message about new version available but constrained
      Returns:
        null if none

    - #### unsignedUpdateVersion

          public static String unsignedUpdateVersion()

      Returns:
        null if none

    - #### unsignedVersionDownloaded

          public static String unsignedVersionDownloaded()

      Already downloaded but not installed version
      Returns:
        null if none

    - #### updateConstraint

          public static String updateConstraint()

      Release update only. Translated message about new version available but constrained
      Returns:
        null if none

    - #### updateVersion

          public static String updateVersion()

      Release update only. Available version, will be null if already downloaded.
      Returns:
        null if none

    - #### updateVersionDownloaded

          public static String updateVersionDownloaded()

      Release update only. Already downloaded but not installed version.
      Returns:
        null if none