Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShishkevich D. <135337715+shishkevichd@users.noreply.github.com>2025-03-08 08:33:34 +0300
committerGitHub <noreply@github.com>2025-03-08 08:33:34 +0300
commit751f564c4a65aac41446b42f881cbe86260dbbee (patch)
tree5ebe0981c6bc59016cb76a80f156f1745e75c01b
parent6658f648e696712d5bca3083d613203fbb5ff2df (diff)
fix: base64 encoding on vmess/shadowsocks inbounds (#2736)
-rw-r--r--web/assets/js/util/index.js11
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))
+ )
}
}