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
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-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))
+ )
}
}