Change the wording of that because it wouldnt be correct for ipv6

merge-requests/208/head
fatchan 4 years ago
parent 7974f1d8c3
commit b21189f762
  1. 10
      models/forms/banposter.js
  2. 2
      models/forms/editpost.js
  3. 2
      models/forms/makepost.js
  4. 2
      views/mixins/ban.pug

@ -23,20 +23,20 @@ module.exports = async (req, res, next) => {
}, {}); }, {});
for (let ip in ipPosts) { for (let ip in ipPosts) {
const thisIpPosts = ipPosts[ip]; const thisIpPosts = ipPosts[ip];
let subnet = '/32'; let type = 'single';
let banIp = { let banIp = {
single: ip, single: ip,
raw: thisIpPosts[0].ip.raw raw: thisIpPosts[0].ip.raw
}; };
if (req.body.ban_h) { if (req.body.ban_h) {
subnet = '/16'; type = 'half';
banIp.single = thisIpPosts[0].ip.hrange; banIp.single = thisIpPosts[0].ip.hrange;
} else if (req.body.ban_q) { } else if (req.body.ban_q) {
subnet = '/24'; type = 'quarter';
banIp.single = thisIpPosts[0].ip.qrange; banIp.single = thisIpPosts[0].ip.qrange;
} }
bans.push({ bans.push({
subnet, type,
'ip': banIp, 'ip': banIp,
'reason': banReason, 'reason': banReason,
'board': banBoard, 'board': banBoard,
@ -74,7 +74,7 @@ module.exports = async (req, res, next) => {
[...new Set(ips)].forEach(ip => { [...new Set(ips)].forEach(ip => {
bans.push({ bans.push({
'ip': ip, 'ip': ip,
'subnet': '/32', 'type': 'single',
'reason': banReason, 'reason': banReason,
'board': banBoard, 'board': banBoard,
'posts': null, 'posts': null,

@ -52,7 +52,7 @@ todo: handle some more situations
'single': res.locals.ip.single, 'single': res.locals.ip.single,
'raw': res.locals.ip.raw, 'raw': res.locals.ip.raw,
}, },
'subnet': '/32', 'type': 'single',
'reason': 'global word filter auto ban', 'reason': 'global word filter auto ban',
'board': null, 'board': null,
'posts': null, 'posts': null,

@ -137,7 +137,7 @@ module.exports = async (req, res, next) => {
'single': res.locals.ip.single, 'single': res.locals.ip.single,
'raw': res.locals.ip.raw, 'raw': res.locals.ip.raw,
}, },
'subnet': '/32', 'type': 'single',
'reason': `${hitGlobalFilter ? 'global ' :''}word filter auto ban`, 'reason': `${hitGlobalFilter ? 'global ' :''}word filter auto ban`,
'board': banBoard, 'board': banBoard,
'posts': null, 'posts': null,

@ -12,7 +12,7 @@ mixin ban(ban, banpage)
td= ban.reason td= ban.reason
- const ip = permLevel > ipHashPermLevel ? ban.ip.single.slice(-10) : ban.ip.raw; - const ip = permLevel > ipHashPermLevel ? ban.ip.single.slice(-10) : ban.ip.raw;
td #{ip} td #{ip}
td #{ban.subnet} td #{ban.type}
td #{ban.issuer} td #{ban.issuer}
- const banDate = new Date(ban.date); - const banDate = new Date(ban.date);
td: time.right.reltime(datetime=banDate.toISOString()) #{banDate.toLocaleString(undefined, {hour12:false})} td: time.right.reltime(datetime=banDate.toISOString()) #{banDate.toLocaleString(undefined, {hour12:false})}

Loading…
Cancel
Save