aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/parse.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-03-12 11:41:36 -0700
committerAdam Soltys <[email protected]>2025-03-12 11:41:36 -0700
commita1e3dc2ad901a97b1ff1e719f0d532633bf19331 (patch)
treeed5623a8daf68a96e1ce8f554fbd4f4c353af9f9 /src/lib/parse.ts
parenta9f33b77a028b3a6f1e5620dcdf0e7fe0734826d (diff)
downloadcoinos-ui-a1e3dc2ad901a97b1ff1e719f0d532633bf19331.tar.gz
coinos-ui-a1e3dc2ad901a97b1ff1e719f0d532633bf19331.zip
handle peanuts
Diffstat (limited to 'src/lib/parse.ts')
-rw-r--r--src/lib/parse.ts21
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}`);