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:
-rw-r--r--web/assets/js/util/index.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/web/assets/js/util/index.js b/web/assets/js/util/index.js
index 13bf68b1..e69f3341 100644
--- a/web/assets/js/util/index.js
+++ b/web/assets/js/util/index.js
@@ -142,7 +142,7 @@ class RandomUtil {
let length = 32;
if ([SSMethods.BLAKE3_AES_128_GCM].includes(method)) {
- length = 16;
+ length = 16;
}
const array = new Uint8Array(length);
@@ -154,28 +154,28 @@ class RandomUtil {
static randomBase32String(length = 16) {
const array = new Uint8Array(length);
-
+
window.crypto.getRandomValues(array);
-
+
const base32Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
let result = '';
let bits = 0;
let buffer = 0;
-
+
for (let i = 0; i < array.length; i++) {
buffer = (buffer << 8) | array[i];
bits += 8;
-
+
while (bits >= 5) {
bits -= 5;
result += base32Chars[(buffer >>> bits) & 0x1F];
}
}
-
+
if (bits > 0) {
result += base32Chars[(buffer << (5 - bits)) & 0x1F];
}
-
+
return result;
}
}
@@ -908,7 +908,10 @@ class IntlUtil {
const language = LanguageManager.getLanguage()
const now = new Date()
- const diff = Math.round((date - now) / (1000 * 60 * 60 * 24))
+ // Handle delayed start (negative expiryTime values)
+ const diff = date < 0
+ ? Math.round(date / (1000 * 60 * 60 * 24))
+ : Math.round((date - now) / (1000 * 60 * 60 * 24))
const formatter = new Intl.RelativeTimeFormat(language, { numeric: 'auto' })
return formatter.format(diff, 'day');