mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
feat(devices): hardware bans and alts need 3 matching IDs
A computer is taken for a banned one, and an account for an alt, only
when they share at least 3 hardware IDs (system, board, disk, the
client's own); one or two in common was too often someone else's.
Network card addresses still do not count. A hardware ban is refused
for an account with fewer than 3 IDs known, as it could match nobody.
MAC-only ("weak") alts no longer exist, so the flag is gone from the
panels.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
494f252c5b
commit
b22708a4ba
4 files changed
+61
-46
No files matched your search
+4
-4
@@ -141,19 +141,19 @@ const byDevice = query => {
|
||||
|
||||
// other accounts the same person may have: those that used one of its
|
||||
// computers (lib/devices.js), and those that signed in from one of its
|
||||
// addresses in the last 90 days. [{username, devices: [kind], weak,
|
||||
// addresses in the last 90 days. [{username, devices: [kind],
|
||||
// addresses: count, online, banned}], the likeliest first. the addresses
|
||||
// themselves are not given: moderators do not see them.
|
||||
const altsOf = account => {
|
||||
const found = new Map();
|
||||
const entry = username => {
|
||||
if (!found.has(username)) {
|
||||
found.set(username, {username, devices: [], weak: false, addresses: 0});
|
||||
found.set(username, {username, devices: [], addresses: 0});
|
||||
}
|
||||
return found.get(username);
|
||||
};
|
||||
for (const alt of devices.alts(account)) {
|
||||
Object.assign(entry(alt.username), {devices: alt.kinds, weak: alt.weak});
|
||||
Object.assign(entry(alt.username), {devices: alt.kinds});
|
||||
}
|
||||
const mine = new Set(account.logins.filter(login => login.ok && login.address && !limits.isLoopback(login.address)).map(login => login.address));
|
||||
if (mine.size) {
|
||||
@@ -170,7 +170,7 @@ const altsOf = account => {
|
||||
const other = accounts.byName(alt.username);
|
||||
return {...alt, online: Boolean(world.findOnline(alt.username)), banned: other ? world.moderation.banRemaining(other) : 0,
|
||||
deviceBanned: other ? devices.bannedId(other) !== 0 : false};
|
||||
}).sort((one, other) => Number(other.devices.length > 0 && !other.weak) - Number(one.devices.length > 0 && !one.weak)
|
||||
}).sort((one, other) => Number(other.devices.length > 0) - Number(one.devices.length > 0)
|
||||
|| other.devices.length - one.devices.length || other.addresses - one.addresses || one.username.localeCompare(other.username)).slice(0, 100);
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user