]> git.ardis.lu - cloudflare-workers/commitdiff
Decode HTML entities
authorArdis Lu <ardisglu@gmail.com>
Sat, 21 Jan 2023 22:01:51 +0000 (14:01 -0800)
committerArdis Lu <ardisglu@gmail.com>
Sat, 21 Jan 2023 22:01:51 +0000 (14:01 -0800)
Workers runtime does not automatically do this for text

buttcoin.png
buttcoin/index.js
buttcoin/package.json
package-lock.json

index ab1f75a82a0508ec78fdc05d749a7b8d6692942c..15b8f821880f6bab0a1a68ef87ebcf2b4fb1535b 100644 (file)
Binary files a/buttcoin.png and b/buttcoin.png differ
index a1988ff37e458d2d12a90720f13cb58af3f72bf2..1699bbc963466c9dfa4cc8fe6893f75b4de74926 100644 (file)
@@ -1,3 +1,5 @@
+import { decode } from 'html-entities';
+
 class SetBase {
   constructor(origin) {
     this.origin = origin;
@@ -31,7 +33,7 @@ class ReplaceBitcoin {
         .replaceAll('Bitcoin', 'Buttcoin')
         .replaceAll('BITCOIN', 'BUTTCOIN')
         .replaceAll(/bitcoin/gi, 'buttcoin'); // Any other mixed case just become buttcoin
-      text.replace(buttText);
+      text.replace(decode(buttText));
       this.#buffer = '';
     }
     else {
index ffe601ff0dc4d12b8ece192e313b5b58e2d220d3..aea4a767add8c18aaa19d0b9e4e79bfd72656ae2 100644 (file)
@@ -9,6 +9,9 @@
     "dev": "wrangler dev",
     "publish": "wrangler publish"
   },
+  "dependencies": {
+    "html-entities": "^2.3.3"
+  },
   "repository": {
     "type": "git",
     "url": "https://github.com/ardislu/cloudflare-workers.git"
index d0e2c77737465e4b6d7f63315bdacb926ece0b3c..7e5a8f66e1b9cb262e9c0a4f629f07cfbfdffec1 100644 (file)
         "uuid",
         "hash",
         "style",
-        "unroll"
+        "unroll",
+        "buttcoin"
       ],
       "devDependencies": {
         "wrangler": "^2.8.0"
       }
     },
+    "buttcoin": {
+      "version": "0.2.0",
+      "license": "ISC",
+      "dependencies": {
+        "html-entities": "^2.3.3"
+      }
+    },
     "cors": {
       "version": "0.2.0",
       "license": "ISC"
         "node": ">=10.16.0"
       }
     },
+    "node_modules/buttcoin": {
+      "resolved": "buttcoin",
+      "link": true
+    },
     "node_modules/camelcase": {
       "version": "5.3.1",
       "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
       "resolved": "hash",
       "link": true
     },
+    "node_modules/html-entities": {
+      "version": "2.3.3",
+      "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz",
+      "integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA=="
+    },
     "node_modules/html-rewriter-wasm": {
       "version": "0.4.1",
       "resolved": "https://registry.npmjs.org/html-rewriter-wasm/-/html-rewriter-wasm-0.4.1.tgz",
         "streamsearch": "^1.1.0"
       }
     },
+    "buttcoin": {
+      "version": "file:buttcoin",
+      "requires": {
+        "html-entities": "^2.3.3"
+      }
+    },
     "camelcase": {
       "version": "5.3.1",
       "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
     "hash": {
       "version": "file:hash"
     },
+    "html-entities": {
+      "version": "2.3.3",
+      "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz",
+      "integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA=="
+    },
     "html-rewriter-wasm": {
       "version": "0.4.1",
       "resolved": "https://registry.npmjs.org/html-rewriter-wasm/-/html-rewriter-wasm-0.4.1.tgz",
This page took 0.049743 seconds and 4 git commands to generate.