diff --git a/server/chat-plugins/hosts.ts b/server/chat-plugins/hosts.ts
index a79b59b28811..c26639e6ee40 100644
--- a/server/chat-plugins/hosts.ts
+++ b/server/chat-plugins/hosts.ts
@@ -123,9 +123,33 @@ export const pages: PageTable = {
buf += `
None currently.
`;
} else {
buf += `IP | Reason |
`;
- Punishments.sharedIpBlacklist.forEach((reason, ip) => {
+ const sortedSharedIPBlacklist = [...Punishments.sharedIpBlacklist];
+ sortedSharedIPBlacklist.sort((a, b) => IPTools.ipSort(a[1], b[1]));
+
+ for (const [reason, ip] of sortedSharedIPBlacklist) {
buf += `${ip} | ${reason} |
`;
- });
+ }
+ buf += `
`;
+ }
+ buf += ``;
+ return buf;
+ },
+
+ sharedips(args, user, connection) {
+ this.title = `[Shared IPs]`;
+ checkCanPerform(this, user, 'globalban');
+
+ let buf = `IPs marked as shared
`;
+ if (!Punishments.sharedIps.size) {
+ buf += `
None currently.
`;
+ } else {
+ buf += `
IP | Location |
`;
+ const sortedSharedIPs = [...Punishments.sharedIps];
+ sortedSharedIPs.sort((a, b) => IPTools.ipSort(a[0], b[0]));
+
+ for (const [ip, location] of sortedSharedIPs) {
+ buf += `${ip} | ${location} |
`;
+ }
buf += `
`;
}
buf += `
`;
@@ -464,6 +488,14 @@ export const commands: ChatCommands = {
`/nomarkshared remove [IP] - Removes an IP from the nomarkshared list. Requires &`,
`/nomarkshared view - Lists all IPs prevented from being marked as shared. Requires @ &`,
],
+
+ sharedips: 'viewsharedips',
+ viewsharedips() {
+ return this.parse('/join view-sharedips');
+ },
+ viewsharedipshelp: [
+ `/viewsharedips — Lists IP addresses marked as shared. Requires: hosts manager @ &`,
+ ],
};
process.nextTick(() => {