Spaces:
Running
Running
Update web_app/dashboard.html
Browse files- web_app/dashboard.html +12 -4
web_app/dashboard.html
CHANGED
|
@@ -794,17 +794,25 @@ async function verifyChannel() {
|
|
| 794 |
box.style.display = 'block';
|
| 795 |
|
| 796 |
if (d.ok) {
|
| 797 |
-
const
|
|
|
|
|
|
|
|
|
|
| 798 |
box.className = d.is_admin ? 'verify-box ok' : 'verify-box err';
|
| 799 |
-
box.innerHTML = `<strong>${d.title}</strong> (
|
| 800 |
if (d.is_admin) {
|
| 801 |
verified = true;
|
| 802 |
document.getElementById('add-ch-form').style.display = 'block';
|
| 803 |
document.getElementById('add-ch-btn').disabled = false;
|
| 804 |
-
// Auto-fill key and label
|
| 805 |
-
const
|
|
|
|
| 806 |
document.getElementById('new-ch-key').value = key;
|
| 807 |
document.getElementById('new-ch-label').value = d.title;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 808 |
}
|
| 809 |
} else {
|
| 810 |
box.className = 'verify-box err';
|
|
|
|
| 794 |
box.style.display = 'block';
|
| 795 |
|
| 796 |
if (d.ok) {
|
| 797 |
+
const usernameDisplay = d.username ? `@${d.username}` : `ID: ${d.id}`;
|
| 798 |
+
const adminIcon = d.is_admin
|
| 799 |
+
? '<span style="color:var(--green)">✅ Bot is admin — ready to add!</span>'
|
| 800 |
+
: '<span style="color:var(--yellow)">⚠️ Bot is NOT admin — grant admin rights first, then verify again</span>';
|
| 801 |
box.className = d.is_admin ? 'verify-box ok' : 'verify-box err';
|
| 802 |
+
box.innerHTML = `<strong>${d.title}</strong> (${usernameDisplay})<br>Type: ${d.type}<br>${adminIcon}`;
|
| 803 |
if (d.is_admin) {
|
| 804 |
verified = true;
|
| 805 |
document.getElementById('add-ch-form').style.display = 'block';
|
| 806 |
document.getElementById('add-ch-btn').disabled = false;
|
| 807 |
+
// Auto-fill key and label from verified data
|
| 808 |
+
const rawKey = d.username || id.replace('@','');
|
| 809 |
+
const key = rawKey.toLowerCase().replace(/[^a-z0-9]/g,'_');
|
| 810 |
document.getElementById('new-ch-key').value = key;
|
| 811 |
document.getElementById('new-ch-label').value = d.title;
|
| 812 |
+
} else {
|
| 813 |
+
verified = false;
|
| 814 |
+
document.getElementById('add-ch-form').style.display = 'none';
|
| 815 |
+
document.getElementById('add-ch-btn').disabled = true;
|
| 816 |
}
|
| 817 |
} else {
|
| 818 |
box.className = 'verify-box err';
|