Changeset acdaa60


Ignore:
Timestamp:
Feb 3, 2016 1:20:22 PM (5 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
4e55edc0
Parents:
bf51d5d9
Message:

Console: Custom icons for non-webapp plugins, from cacapo (ticket #1550)

Location:
apps/routerconsole
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/NavHelper.java

    rbf51d5d9 racdaa60  
    1414    private static final Map<String, String> _tooltips = new ConcurrentHashMap<String, String>(4);
    1515    private static final Map<String, String> _icons = new ConcurrentHashMap<String, String>(4);
     16    private static final Map<String, byte[]> _binary = new ConcurrentHashMap<String, byte[]>(4);
    1617   
    1718    /**
     
    4142    }
    4243   
     44
     45    public static byte[] getBinary(String name){
     46        if(name != null)
     47            return _binary.get(name);
     48        else
     49            return null;
     50    }
     51
     52
     53    public static void setBinary(String name, byte[] arr){
     54        _binary.put(name, arr);
     55    }
     56
     57
    4358    /**
    4459     *  Translated string is loaded by PluginStarter
  • apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java

    rbf51d5d9 racdaa60  
    2323import net.i2p.app.ClientAppState;
    2424import net.i2p.data.DataHelper;
     25import net.i2p.data.Base64;
    2526import net.i2p.router.RouterContext;
    2627import net.i2p.router.RouterVersion;
     
    353354            }
    354355        }
     356
     357
     358    //handle console icons for plugins without web-resources through prop icon-code
     359    String fullprop = props.getProperty("icon-code");
     360    if(fullprop != null && fullprop.length() > 1){
     361        byte[] decoded = Base64.decode(fullprop);
     362        if(decoded != null) {
     363            NavHelper.setBinary(appName, decoded);
     364            iconfile = "/Plugins/pluginicon?plugin=" + appName;
     365        } else {
     366            iconfile = "/themes/console/images/plugin.png";
     367        }
     368    }
     369
    355370
    356371        // load and start things in clients.config
  • apps/routerconsole/jsp/web.xml

    rbf51d5d9 racdaa60  
    1515
    1616    <!-- precompiled servlets -->
     17
     18    <servlet>
     19      <servlet-name>net.i2p.router.web.CodedIconRendererServlet</servlet-name>
     20      <servlet-class>net.i2p.router.web.CodedIconRendererServlet</servlet-class>
     21    </servlet>
     22
     23    <servlet-mapping>
     24      <servlet-name>net.i2p.router.web.CodedIconRendererServlet</servlet-name>
     25      <url-pattern>/Plugins/*</url-pattern>
     26    </servlet-mapping>
     27
     28
    1729   
    1830    <!-- yeah, i'm lazy, using a jsp instead of a servlet.. -->
Note: See TracChangeset for help on using the changeset viewer.