Console: Add tooltip to unban link

Don't show both ban and unban buttons if peer param provided
Don't put hash in form again after ban/unban POST
This commit is contained in:
zzz
2021-05-07 08:57:36 -04:00
parent e04695eed8
commit 8ab9d82dbd
3 changed files with 39 additions and 7 deletions

View File

@@ -56,6 +56,7 @@ class BanlistRenderer {
buf.append("<ul id=\"banlist\">");
String unban = _t("unban now");
for (Map.Entry<Hash, Banlist.Entry> e : entries.entrySet()) {
Hash key = e.getKey();
Banlist.Entry entry = e.getValue();
@@ -82,8 +83,9 @@ class BanlistRenderer {
buf.append(_t(entry.cause));
}
if (!key.equals(Hash.FAKE_HASH)) {
// note: CSS hides anchor text
buf.append(" <a href=\"configpeer?peer=").append(key.toBase64())
.append("#unsh\">[").append(_t("unban now")).append("]</a>");
.append("#unsh\" title=\"").append(unban).append("\">[").append(unban).append("]</a>");
}
buf.append("</li>\n");
}

View File

@@ -5,6 +5,7 @@ import java.math.BigInteger;
import java.util.Collections;
import java.util.List;
import net.i2p.data.Hash;
import net.i2p.router.Blocklist;
import net.i2p.router.web.HelperBase;
import net.i2p.util.Addresses;
@@ -132,6 +133,13 @@ public class ConfigPeerHelper extends HelperBase {
return out.toString();
}
/**
* @since 0.9.50
*/
public boolean isBanned(Hash h) {
return _context.banlist().isBanlisted(h);
}
/**
* Convert a (non-negative) two's complement IP to exactly 16 bytes
*