Changeset 4727706


Ignore:
Timestamp:
Mar 23, 2017 1:54:02 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
1ab67de
Parents:
ca6ce37
Message:

Plugins: Add version number to console messages when downloading/starting,
and linkify plugin name

Location:
apps/routerconsole/java/src/net/i2p/router
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/update/PluginUpdateRunner.java

    rca6ce37 r4727706  
    481481                    // we don't need the original file anymore.
    482482                    to.delete();
    483                     statusDone("<b>" + _t("Plugin will be installed on next restart.") + "</b>");
     483                    statusDone("<b>" + _t("Plugin will be installed on next restart.") + ' ' + appName + ' ' + version + "</b>");
    484484                    return;
    485485                }
     
    499499                if (Boolean.valueOf(props.getProperty("update-only")).booleanValue()) {
    500500                    to.delete();
    501                     statusDone("<b>" + _t("Plugin is for upgrades only, but the plugin is not installed") + "</b>");
     501                    statusDone("<b>" + _t("Plugin is for upgrades only, but the plugin is not installed") + ". " + appName + ' ' + version + "</b>");
    502502                    return;
    503503                }
     
    519519            // install != update. Changing the user's settings like this is probabbly a bad idea.
    520520            if (Boolean.valueOf( props.getProperty("dont-start-at-install")).booleanValue()) {
    521                 statusDone("<b>" + _t("Plugin {0} installed", appName) + "</b>");
     521                statusDone("<b>" + _t("Plugin {0} installed", appName + ' ' + version) + "</b>");
    522522                if(!update) {
    523523                    Properties pluginProps = PluginStarter.pluginProperties();
     
    535535                        String link;
    536536                        if (linkName != null && linkURL != null)
    537                             link = "<a target=\"_blank\" href=\"" + linkURL + "\"/>" + linkName + "</a>";
     537                            link = "<a target=\"_blank\" href=\"" + linkURL + "\"/>" + linkName + ' ' + version + "</a>";
    538538                        else
    539                             link = appName;
     539                            link = appName + ' ' + version;
    540540                        statusDone("<b>" + _t("Plugin {0} installed and started", link) + "</b>");
    541541                    }
    542542                    else
    543                         statusDone("<b>" + _t("Plugin {0} installed but failed to start, check logs", appName) + "</b>");
     543                        statusDone("<b>" + _t("Plugin {0} installed but failed to start, check logs", appName + ' ' + version) + "</b>");
    544544                } catch (Throwable e) {
    545                     statusDone("<b>" + _t("Plugin {0} installed but failed to start", appName) + ": " + e + "</b>");
    546                     _log.error("Error starting plugin " + appName, e);
     545                    statusDone("<b>" + _t("Plugin {0} installed but failed to start", appName + ' ' + version) + ": " + e + "</b>");
     546                    _log.error("Error starting plugin " + appName + ' ' + version, e);
    547547                }
    548548            } else {
    549                 statusDone("<b>" + _t("Plugin {0} installed", appName) + "</b>");
     549                statusDone("<b>" + _t("Plugin {0} installed", appName + ' ' + version) + "</b>");
    550550            }
    551551        }
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java

    rca6ce37 r4727706  
    574574        try {
    575575            PluginStarter.startPlugin(_context, app);
    576             addFormNotice(_t("Started plugin {0}", app));
     576            // linkify the app name for the message if available
     577            Properties props = PluginStarter.pluginProperties(_context, app);
     578            String name = ConfigClientsHelper.stripHTML(props, "consoleLinkName_" + Messages.getLanguage(_context));
     579            if (name == null)
     580                name = ConfigClientsHelper.stripHTML(props, "consoleLinkName");
     581            String url = ConfigClientsHelper.stripHTML(props, "consoleLinkURL");
     582            if (name != null && url != null && name.length() > 0 && url.length() > 0) {
     583                app = "<a href=\"" + url + "\">" + name + "</a>";
     584                addFormNoticeNoEscape(_t("Started plugin {0}", app));
     585            } else {
     586                addFormNotice(_t("Started plugin {0}", app));
     587            }
    577588        } catch (Throwable e) {
    578589            addFormError(_t("Error starting plugin {0}", app) + ": " + e);
Note: See TracChangeset for help on using the changeset viewer.