Monorepo for Aesthetic.Computer aesthetic.computer
at main 22 lines 810 B view raw
1// redact, 25.02.08.01.45 2// Used for redacting user information like chat messages and masking it 3// before rendering and/or sending to clients. 4 5// 🛎️ See also `/system/public/aesthetic-computer/lib/redact.mjs` as this file 6// is copied but versioned separate for deployment reasons. 7 8// Modify a message object into a 'redacted' state. 9export function redact(msg) { 10 // console.log("💌 Redacting:", msg); 11 msg.redactedText = msg.text; 12 msg.text = msg.text.replace(/\S/g, "_"); // Replace non-space chars with 13 // underscores. 14 // msg.from = "redacted"; 15} 16 17// Revert a message out of a 'redacted' state. 18export function unredact(msg) { 19 // console.log("💌 Unredacting:", msg); 20 msg.text = msg.redactedText || msg.text; 21 // msg.from = "redacted"; 22}