mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-16 08:10:58 +00:00
refactor: delete base64js
instead of base64 library you can use built-in JS functions `btoa()` and `atob()`
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user