Update templates/ltxvideo.html
Browse files- templates/ltxvideo.html +29 -25
templates/ltxvideo.html
CHANGED
|
@@ -953,16 +953,27 @@
|
|
| 953 |
}
|
| 954 |
async function checkFreeUserCredit() {
|
| 955 |
if (!userFingerprint) return; const creditInfoDiv = document.getElementById('credit-info-section'); const upgradeBtn = document.getElementById('upgrade-button'); const genBtn = document.getElementById('generateButton');
|
| 956 |
-
|
| 957 |
-
|
| 958 |
-
|
| 959 |
-
|
| 960 |
-
|
| 961 |
-
|
| 962 |
-
|
| 963 |
-
|
| 964 |
-
|
| 965 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 966 |
}
|
| 967 |
function startCountdown(resetTimestamp) {
|
| 968 |
if (countdownInterval) clearInterval(countdownInterval); const creditInfoDiv = document.getElementById('credit-info-section');
|
|
@@ -1228,11 +1239,7 @@
|
|
| 1228 |
}
|
| 1229 |
|
| 1230 |
if (userSubscriptionStatus === 'free') {
|
| 1231 |
-
|
| 1232 |
-
method: 'POST',
|
| 1233 |
-
headers: {'Content-Type': 'application/json'},
|
| 1234 |
-
body: JSON.stringify({ fingerprint: userFingerprint })
|
| 1235 |
-
});
|
| 1236 |
checkFreeUserCredit();
|
| 1237 |
}
|
| 1238 |
|
|
@@ -1585,19 +1592,16 @@
|
|
| 1585 |
}
|
| 1586 |
|
| 1587 |
if (userSubscriptionStatus !== 'paid') {
|
| 1588 |
-
|
| 1589 |
-
|
| 1590 |
-
const
|
| 1591 |
-
|
| 1592 |
-
|
| 1593 |
-
|
|
|
|
| 1594 |
setUiLock(false);
|
| 1595 |
return;
|
| 1596 |
}
|
| 1597 |
-
} catch (err) {
|
| 1598 |
-
alert(!navigator.onLine ? "عدم اتصال به اینترنت." : "خطا در سیستم اعتبار سنجی.");
|
| 1599 |
-
setUiLock(false);
|
| 1600 |
-
return;
|
| 1601 |
}
|
| 1602 |
}
|
| 1603 |
|
|
|
|
| 953 |
}
|
| 954 |
async function checkFreeUserCredit() {
|
| 955 |
if (!userFingerprint) return; const creditInfoDiv = document.getElementById('credit-info-section'); const upgradeBtn = document.getElementById('upgrade-button'); const genBtn = document.getElementById('generateButton');
|
| 956 |
+
if (userSubscriptionStatus !== 'paid') { creditInfoDiv.style.display = 'block'; }
|
| 957 |
+
|
| 958 |
+
const lastGen = localStorage.getItem('ltx_last_gen_time');
|
| 959 |
+
if (lastGen && userSubscriptionStatus !== 'paid') {
|
| 960 |
+
const lastGenTime = parseInt(lastGen, 10);
|
| 961 |
+
const now = Date.now();
|
| 962 |
+
const oneDayMs = 24 * 60 * 60 * 1000;
|
| 963 |
+
const timeLeft = lastGenTime + oneDayMs - now;
|
| 964 |
+
|
| 965 |
+
if (timeLeft > 0) {
|
| 966 |
+
genBtn.disabled = true;
|
| 967 |
+
upgradeBtn.style.display = 'block';
|
| 968 |
+
startCountdown(Math.floor((lastGenTime + oneDayMs) / 1000));
|
| 969 |
+
return;
|
| 970 |
+
}
|
| 971 |
+
}
|
| 972 |
+
|
| 973 |
+
genBtn.disabled = false;
|
| 974 |
+
upgradeBtn.style.display = 'none';
|
| 975 |
+
if(countdownInterval) clearInterval(countdownInterval);
|
| 976 |
+
creditInfoDiv.textContent = `شما ۱ اعتبار ساخت ویدیوی رایگان روزانه دارید.`;
|
| 977 |
}
|
| 978 |
function startCountdown(resetTimestamp) {
|
| 979 |
if (countdownInterval) clearInterval(countdownInterval); const creditInfoDiv = document.getElementById('credit-info-section');
|
|
|
|
| 1239 |
}
|
| 1240 |
|
| 1241 |
if (userSubscriptionStatus === 'free') {
|
| 1242 |
+
localStorage.setItem('ltx_last_gen_time', Date.now().toString());
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1243 |
checkFreeUserCredit();
|
| 1244 |
}
|
| 1245 |
|
|
|
|
| 1592 |
}
|
| 1593 |
|
| 1594 |
if (userSubscriptionStatus !== 'paid') {
|
| 1595 |
+
const lastGen = localStorage.getItem('ltx_last_gen_time');
|
| 1596 |
+
if (lastGen) {
|
| 1597 |
+
const lastGenTime = parseInt(lastGen, 10);
|
| 1598 |
+
const now = Date.now();
|
| 1599 |
+
const oneDayMs = 24 * 60 * 60 * 1000;
|
| 1600 |
+
if (lastGenTime + oneDayMs > now) {
|
| 1601 |
+
alert("محدودیت ساخت ویدیوی رایگان شما برای امروز به پایان رسیده است.");
|
| 1602 |
setUiLock(false);
|
| 1603 |
return;
|
| 1604 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1605 |
}
|
| 1606 |
}
|
| 1607 |
|