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:
authorSanaei <ho3ein.sanaei@gmail.com>2025-03-07 14:40:35 +0300
committerGitHub <noreply@github.com>2025-03-07 14:40:35 +0300
commit42fa64770bab9f9fb52e0cdb6d5dd82d66f19c35 (patch)
tree17d8a98faecccbda02b98ede48adf020d5e8d2f9 /web/assets/js/model
parent2d8cca3a2ec1ae9034b7bc28a2fb5f2260f43e1a (diff)
parent0a207b8a2c0629b7f1996025a40a10fbe58d05d0 (diff)
Merge pull request #2732 from shishkevichd/refactor/refactor-1
Code refactoring
Diffstat (limited to 'web/assets/js/model')
-rw-r--r--web/assets/js/model/dbinbound.js4
-rw-r--r--web/assets/js/model/inbound.js20
2 files changed, 12 insertions, 12 deletions
diff --git a/web/assets/js/model/dbinbound.js b/web/assets/js/model/dbinbound.js
index aeae1a75..45301ddd 100644
--- a/web/assets/js/model/dbinbound.js
+++ b/web/assets/js/model/dbinbound.js
@@ -25,11 +25,11 @@ class DBInbound {
}
get totalGB() {
- return toFixed(this.total / ONE_GB, 2);
+ return NumberFormatter.toFixed(this.total / SizeFormatter.ONE_GB, 2);
}
set totalGB(gb) {
- this.total = toFixed(gb * ONE_GB, 0);
+ this.total = NumberFormatter.toFixed(gb * SizeFormatter.ONE_GB, 0);
}
get isVMess() {
diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js
index d3d7d297..5c3235e1 100644
--- a/web/assets/js/model/inbound.js
+++ b/web/assets/js/model/inbound.js
@@ -1302,7 +1302,7 @@ class Inbound extends XrayCommonClass {
}
}
- return 'vmess://' + base64(JSON.stringify(obj, null, 2));
+ return 'vmess://' + Base64.encode(JSON.stringify(obj, null, 2));
}
genVLESSLink(address = '', port = this.port, forceTls, remark = '', clientId, flow) {
@@ -1474,7 +1474,7 @@ class Inbound extends XrayCommonClass {
if (this.isSS2022) password.push(settings.password);
if (this.isSSMultiUser) password.push(clientPassword);
- let link = `ss://${safeBase64(settings.method + ':' + password.join(':'))}@${address}:${port}`;
+ let link = `ss://${Base64.encode(`${settings.method}:${password.join(':')}`, true)}@${address}:${port}`;
const url = new URL(link);
for (const [key, value] of params) {
url.searchParams.set(key, value)
@@ -1837,11 +1837,11 @@ Inbound.VmessSettings.VMESS = class extends XrayCommonClass {
}
}
get _totalGB() {
- return toFixed(this.totalGB / ONE_GB, 2);
+ return NumberFormatter.toFixed(this.totalGB / SizeFormatter.ONE_GB, 2);
}
set _totalGB(gb) {
- this.totalGB = toFixed(gb * ONE_GB, 0);
+ this.totalGB = NumberFormatter.toFixed(gb * SizeFormatter.ONE_GB, 0);
}
};
@@ -1947,11 +1947,11 @@ Inbound.VLESSSettings.VLESS = class extends XrayCommonClass {
}
}
get _totalGB() {
- return toFixed(this.totalGB / ONE_GB, 2);
+ return NumberFormatter.toFixed(this.totalGB / SizeFormatter.ONE_GB, 2);
}
set _totalGB(gb) {
- this.totalGB = toFixed(gb * ONE_GB, 0);
+ this.totalGB = NumberFormatter.toFixed(gb * SizeFormatter.ONE_GB, 0);
}
};
Inbound.VLESSSettings.Fallback = class extends XrayCommonClass {
@@ -2099,11 +2099,11 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass {
}
}
get _totalGB() {
- return toFixed(this.totalGB / ONE_GB, 2);
+ return NumberFormatter.toFixed(this.totalGB / SizeFormatter.ONE_GB, 2);
}
set _totalGB(gb) {
- this.totalGB = toFixed(gb * ONE_GB, 0);
+ this.totalGB = NumberFormatter.toFixed(gb * SizeFormatter.ONE_GB, 0);
}
};
@@ -2263,11 +2263,11 @@ Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
}
}
get _totalGB() {
- return toFixed(this.totalGB / ONE_GB, 2);
+ return NumberFormatter.toFixed(this.totalGB / SizeFormatter.ONE_GB, 2);
}
set _totalGB(gb) {
- this.totalGB = toFixed(gb * ONE_GB, 0);
+ this.totalGB = NumberFormatter.toFixed(gb * SizeFormatter.ONE_GB, 0);
}
};