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:
Diffstat (limited to 'web/assets/js/util/utils.js')
-rw-r--r--web/assets/js/util/utils.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/web/assets/js/util/utils.js b/web/assets/js/util/utils.js
index 30f1f6a2..a79ce3a0 100644
--- a/web/assets/js/util/utils.js
+++ b/web/assets/js/util/utils.js
@@ -478,4 +478,21 @@ class Wireguard {
privateKey: secretKey.length > 0 ? secretKey : this.keyToBase64(privateKey)
};
}
+}
+
+class Base64 {
+ static encode(content = "", safe = false) {
+ if (safe) {
+ return window.btoa(content)
+ .replace(/\+/g, '-')
+ .replace(/=/g, '')
+ .replace(/\//g, '_')
+ }
+
+ return window.btoa(content)
+ }
+
+ static decode(content = "") {
+ return window.atob(content)
+ }
} \ No newline at end of file