diff options
| author | Shishkevich D. <135337715+shishkevichd@users.noreply.github.com> | 2025-03-08 08:33:34 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-08 08:33:34 +0300 |
| commit | 751f564c4a65aac41446b42f881cbe86260dbbee (patch) | |
| tree | 5ebe0981c6bc59016cb76a80f156f1745e75c01b | |
| parent | 6658f648e696712d5bca3083d613203fbb5ff2df (diff) | |
fix: base64 encoding on vmess/shadowsocks inbounds (#2736)
| -rw-r--r-- | web/assets/js/util/index.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/web/assets/js/util/index.js b/web/assets/js/util/index.js index 57a6b95d..99c76377 100644 --- a/web/assets/js/util/index.js +++ b/web/assets/js/util/index.js @@ -515,17 +515,22 @@ class ClipboardManager { class Base64 { static encode(content = "", safe = false) { if (safe) { - return window.btoa(content) + return Base64.encode(content) .replace(/\+/g, '-') .replace(/=/g, '') .replace(/\//g, '_') } - return window.btoa(content) + return window.btoa( + String.fromCharCode(...new TextEncoder().encode(content)) + ) } static decode(content = "") { - return window.atob(content) + return new TextDecoder() + .decode( + Uint8Array.from(window.atob(content), c => c.charCodeAt(0)) + ) } } |
