From a781f53c385c0ed4cd0aff8207e9ecf896201283 Mon Sep 17 00:00:00 2001 From: Flan's server Date: Sat, 26 Nov 2022 02:38:36 +0000 Subject: [PATCH] Removed tripcodes for now. Added optional tripcode removal config item in hot.js --- hot.js.example | 2 ++ server/server.js | 9 +++++++-- tripcode.js | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hot.js.example b/hot.js.example index f3f860a..8a699fb 100644 --- a/hot.js.example +++ b/hot.js.example @@ -25,6 +25,8 @@ this.hot = { INTER_BOARD_NAVIGATION: true, + /* Disable tripcodes: Set to `null` to stop adding them, set to a specific string to have all tripcodes return that string (doesn't apply to `SPECIAL_TRIPCODES`.) */ + NOTRIP: "(unbound)", SPECIAL_TRIPCODES: { kyubey: "/人◕ ‿‿ ◕人\", }, diff --git a/server/server.js b/server/server.js index fe3c7e2..30ced48 100644 --- a/server/server.js +++ b/server/server.js @@ -844,12 +844,17 @@ function allocate_post(msg, client, callback) { var parsed = common.parse_name(msg.name); post.name = parsed[0]; var spec = STATE.hot.SPECIAL_TRIPCODES; + const notrip = (n, s) => { + const b =n ? "!" : + s ? "!!" : undefined; + if(b) return b + (STATE.hot.NOTRIP || ""); + }; if (spec && parsed[1] && parsed[1] in spec) { post.trip = spec[parsed[1]]; } else if (parsed[1] || parsed[2]) { - var trip = "Can this just be a string?"; //tripcode.hash(parsed[1], parsed[2]); - if (trip) + const trip = notrip(parsed[1], parsed[2]); //tripcode.hash(parsed[1], parsed[2]); + if (trip && STATE.hot.NOTRIP !== null) post.trip = trip; } } diff --git a/tripcode.js b/tripcode.js index 6e2226a..34a214d 100644 --- a/tripcode.js +++ b/tripcode.js @@ -14,7 +14,7 @@ Tripcode.Algorithm = { Sha256T: hash.Kana.ALGO_SHA256_TRUNCATED, }; Tripcode.make = (algo, salt) => { - return new Tripcode(algo,salt);b + return new Tripcode(algo,salt); }; Object.freeze(Tripcode.Algorithm);