Changeset 5fd20fc


Ignore:
Timestamp:
Nov 30, 2011 11:15:22 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
f6cff78
Parents:
9ae0768
Message:
  • i2psnark:
    • Retry link on torrent download fail
    • Clear URL after clicking 'add torrent'
    • Message tweaks
    • CSS tweaks
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java

    r9ae0768 r5fd20fc  
    247247        }
    248248        out.write("</div>\n");
     249        String newURL = req.getParameter("newURL");
     250        if (newURL != null && newURL.trim().length() > 0 && req.getMethod().equals("GET"))
     251            _manager.addMessage(_("Click \"Add torrent\" button to fetch torrent"));
    249252        out.write("<div class=\"page\"><div class=\"mainsection\"><div class=\"snarkMessages\"><table><tr><td align=\"left\"><pre>");
    250253        List msgs = _manager.getMessages();
     
    492495            if (newURL != null) {
    493496                if (newURL.startsWith("http://")) {
     497                    if (!_manager.util().connected())
     498                        _manager.addMessage(_("Opening the I2P tunnel"));
    494499                    _manager.addMessage(_("Fetching {0}", urlify(newURL)));
    495500                    I2PAppThread fetch = new I2PAppThread(new FetchAndAdd(_manager, newURL), "Fetch and add", true);
     
    11751180
    11761181    private void writeAddForm(PrintWriter out, HttpServletRequest req) throws IOException {
     1182        // display incoming parameter if a GET so links will work
    11771183        String newURL = req.getParameter("newURL");
    1178         if ( (newURL == null) || (newURL.trim().length() <= 0) )
     1184        if (newURL == null || newURL.trim().length() <= 0 || req.getMethod().equals("POST"))
    11791185            newURL = "";
    11801186        else
     
    12211227            baseFile = DataHelper.stripHTML(baseFile);    // XSS
    12221228       
    1223         out.write("<div class=\"newtorrentsection\"><div class=\"snarkNewTorrent\">\n");
     1229        out.write("<a name=\"add\"></a><div class=\"newtorrentsection\"><div class=\"snarkNewTorrent\">\n");
    12241230        // *not* enctype="multipart/form-data", so that the input type=file sends the filename, not the file
    12251231        out.write("<form action=\"_post\" method=\"POST\">\n");
     
    20412047                }
    20422048            } else {
    2043                 _manager.addMessage(_("Torrent was not retrieved from {0}", urlify(_url)));
     2049                // Generate a retry link, but sadly can't have a form inside a table
     2050                // So make this an ugly GET
     2051                StringBuilder buf = new StringBuilder(1024);
     2052                // FIXME don't lose peer setting
     2053                //String peerParam = req.getParameter("p");
     2054                //if (peerParam != null)
     2055                //    buf.append("<input type=\"hidden\" name=\"p\" value=\"").append(peerParam).append("\" >\n");
     2056                buf.append(_("Torrent was not retrieved from {0}", urlify(_url)));
     2057                String link = _url.replace("&", "&amp;").replace(" ", "%20").replace(":", "%3A").replace("/", "%2F");
     2058                buf.append(" - [<a href=\"/i2psnark/?newURL=").append(link).append("#add\" >");
     2059                buf.append(_("Retry"));
     2060                buf.append("</a>]");
     2061                _manager.addMessage(buf.toString());
    20442062            }
    20452063        } finally {
     
    20482066    }
    20492067
     2068    private String _(String s) {
     2069        return _manager.util().getString(s);
     2070    }
     2071
    20502072    private String _(String s, String o) {
    20512073        return _manager.util().getString(s, o);
  • installer/resources/themes/snark/ubergine/snark.css

    r9ae0768 r5fd20fc  
    9696     height: 70px;
    9797     width: auto;
    98      background: #101 url('/themes/snark/ubergine/images/hat.png') no-repeat scroll right center;
     98     background: #2a192a url('/themes/snark/ubergine/images/hat.png') no-repeat scroll right center;
    9999}
    100100
    101101.snarkMessages a:link, .snarkMessages a:visited {
    102      color: #37f !important;
     102     color: #69f !important;
    103103}
    104104
    105105.snarkMessages a:hover {
    106      color: #59f !important;
     106     color: #f90 !important;
    107107}
    108108
     
    117117     text-align: left !important;
    118118     height: 8px;
    119      color: #13f;
     119     color: #35f;
    120120     font-weight: bold !important;
    121121}
     
    516516
    517517input[type=text]:active, input[type=text]:hover, input.r:hover {
    518      background: #f60;
     518     background: #d60;
    519519     color: #fff;
    520520}
Note: See TracChangeset for help on using the changeset viewer.