diff options
| author | Adam Soltys <[email protected]> | 2025-03-12 11:41:36 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-03-12 11:41:36 -0700 |
| commit | f699c0739d09feb8960b2f5255e9998843682f6f (patch) | |
| tree | ed5623a8daf68a96e1ce8f554fbd4f4c353af9f9 | |
| parent | fd97662441c55773cd92b03520e8e16b42bfab1e (diff) | |
| download | coinos-ui-f699c0739d09feb8960b2f5255e9998843682f6f.tar.gz coinos-ui-f699c0739d09feb8960b2f5255e9998843682f6f.zip | |
handle peanuts
| -rw-r--r-- | src/lib/parse.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/parse.ts b/src/lib/parse.ts index 949b38db..ba264be7 100644 --- a/src/lib/parse.ts +++ b/src/lib/parse.ts @@ -70,6 +70,27 @@ export default async (s, host) => { } } + if (t.match(/^🥜([\uFE00-\uFE0F]|[\uE0100-\uE01EF]+)$/)) { + t = Array.from(t) + .slice(1) + .map((char) => { + const codePoint = char.codePointAt(0); + + // Handle Variation Selectors (VS1-VS16): U+FE00 to U+FE0F + if (codePoint >= 0xfe00 && codePoint <= 0xfe0f) { + const byteValue = codePoint - 0xfe00; // Maps FE00->0, FE01->1, ..., FE0F->15 + return String.fromCharCode(byteValue); + } + + // Handle Variation Selectors Supplement (VS17-VS256): U+E0100 to U+E01EF + if (codePoint >= 0xe0100 && codePoint <= 0xe01ef) { + const byteValue = codePoint - 0xe0100 + 16; // Maps E0100->16, E0101->17, ..., E01EF->255 + return String.fromCharCode(byteValue); + } + }) + .join(""); + } + if (t.startsWith("cashu")) { const { id } = await post("/cash", { token: t }); redirect(307, `/ecash/${id}`); |
