Upload 4 files
Browse files
SETUP.md
CHANGED
|
@@ -1,139 +1,32 @@
|
|
| 1 |
-
#
|
| 2 |
|
| 3 |
-
##
|
| 4 |
-
Das Chat-System nutzt jetzt **Firebase Realtime Database** damit Nachrichten,
|
| 5 |
-
DMs, Tickets und Voice-Presence für ALLE User sichtbar sind – nicht nur lokal.
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
## Schritt 1: Firebase-Projekt erstellen (kostenlos)
|
| 10 |
-
|
| 11 |
-
1. Gehe zu → https://console.firebase.google.com
|
| 12 |
-
2. Klicke **"Projekt erstellen"**
|
| 13 |
-
3. Gib einen Namen ein (z.B. `noahschat`) → Weiter → Projekt erstellen
|
| 14 |
-
4. Im Dashboard: Klicke **"Realtime Database"** (links im Menü)
|
| 15 |
-
5. Klicke **"Datenbank erstellen"**
|
| 16 |
-
6. Wähle **Europe-West1** als Standort
|
| 17 |
-
7. Starte im **Testmodus** (Regeln = offen für 30 Tage)
|
| 18 |
-
|
| 19 |
-
---
|
| 20 |
-
|
| 21 |
-
## Schritt 2: App-Konfiguration holen
|
| 22 |
-
|
| 23 |
-
1. Klicke auf das Zahnrad ⚙️ neben "Projektübersicht" → Projekteinstellungen
|
| 24 |
-
2. Scrolle runter zu **"Deine Apps"**
|
| 25 |
-
3. Klicke auf `</>` (Web-App hinzufügen)
|
| 26 |
-
4. App-Namen eingeben → App registrieren
|
| 27 |
-
5. Du siehst jetzt ein `firebaseConfig`-Objekt mit allen Werten
|
| 28 |
-
|
| 29 |
-
---
|
| 30 |
-
|
| 31 |
-
## Schritt 3: app.js anpassen
|
| 32 |
-
|
| 33 |
-
Öffne `app.js` und ersetze oben den `FIREBASE_CONFIG` Block:
|
| 34 |
-
|
| 35 |
-
```javascript
|
| 36 |
-
const FIREBASE_CONFIG = {
|
| 37 |
-
apiKey: "AIzaSy...", // ← dein Wert
|
| 38 |
-
authDomain: "noahschat.firebaseapp.com",
|
| 39 |
-
databaseURL: "https://noahschat-default-rtdb.europe-west1.firebasedatabase.app",
|
| 40 |
-
projectId: "noahschat",
|
| 41 |
-
storageBucket: "noahschat.appspot.com",
|
| 42 |
-
messagingSenderId: "123456789",
|
| 43 |
-
appId: "1:123456789:web:..."
|
| 44 |
-
};
|
| 45 |
-
```
|
| 46 |
-
|
| 47 |
-
---
|
| 48 |
|
| 49 |
-
##
|
|
|
|
| 50 |
|
| 51 |
-
|
|
|
|
|
|
|
| 52 |
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
".write": true
|
| 58 |
-
}
|
| 59 |
-
}
|
| 60 |
```
|
| 61 |
|
| 62 |
-
|
| 63 |
-
```json
|
| 64 |
-
{
|
| 65 |
-
"rules": {
|
| 66 |
-
"users": {
|
| 67 |
-
".read": true,
|
| 68 |
-
".write": true
|
| 69 |
-
},
|
| 70 |
-
"msgs": {
|
| 71 |
-
".read": true,
|
| 72 |
-
".write": true
|
| 73 |
-
},
|
| 74 |
-
"dms": {
|
| 75 |
-
".read": true,
|
| 76 |
-
".write": true
|
| 77 |
-
},
|
| 78 |
-
"online": {
|
| 79 |
-
".read": true,
|
| 80 |
-
".write": true
|
| 81 |
-
},
|
| 82 |
-
"voice_participants": {
|
| 83 |
-
".read": true,
|
| 84 |
-
".write": true
|
| 85 |
-
},
|
| 86 |
-
"tickets": {
|
| 87 |
-
".read": true,
|
| 88 |
-
".write": true
|
| 89 |
-
},
|
| 90 |
-
"pins": {
|
| 91 |
-
".read": true,
|
| 92 |
-
".write": true
|
| 93 |
-
},
|
| 94 |
-
"moderation": {
|
| 95 |
-
".read": true,
|
| 96 |
-
".write": true
|
| 97 |
-
},
|
| 98 |
-
"config": {
|
| 99 |
-
".read": true,
|
| 100 |
-
".write": true
|
| 101 |
-
},
|
| 102 |
-
"user_fps": {
|
| 103 |
-
".read": true,
|
| 104 |
-
".write": true
|
| 105 |
-
}
|
| 106 |
-
}
|
| 107 |
-
}
|
| 108 |
-
```
|
| 109 |
-
|
| 110 |
-
---
|
| 111 |
-
|
| 112 |
-
## Was jetzt funktioniert ✅
|
| 113 |
-
|
| 114 |
-
| Feature | Status |
|
| 115 |
-
|---------|--------|
|
| 116 |
-
| Nachrichten (geteilt) | ✅ Realtime via Firebase |
|
| 117 |
-
| DMs | ✅ Funktioniert für alle User |
|
| 118 |
-
| Voice Presence | ✅ Sichtbar für alle |
|
| 119 |
-
| Tickets | ✅ Für Admins sichtbar |
|
| 120 |
-
| Online-Status | ✅ Live-Update |
|
| 121 |
-
| Ban/Kick/Timeout | ✅ Server-übergreifend |
|
| 122 |
-
| AutoMod | ✅ |
|
| 123 |
-
| Pins | ✅ |
|
| 124 |
-
| Suche | ✅ |
|
| 125 |
|
| 126 |
---
|
| 127 |
|
| 128 |
-
##
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
Der gelbe Hinweis `⚠ LOKAL – Firebase fehlt!` verschwindet wenn Firebase konfiguriert ist.
|
| 134 |
-
|
| 135 |
-
---
|
| 136 |
|
| 137 |
## Owner-Account
|
| 138 |
-
-
|
| 139 |
-
-
|
|
|
|
| 1 |
+
# NoahsChat v4 — JSONBin.io Setup
|
| 2 |
|
| 3 |
+
## Setup (5 Minuten, kostenlos)
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
### 1. JSONBin Account erstellen
|
| 6 |
+
- https://jsonbin.io → kostenlos registrieren
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
### 2. API Key holen
|
| 9 |
+
- Dashboard → "API Keys" → Master Key kopieren
|
| 10 |
|
| 11 |
+
### 3. Einen Bin erstellen
|
| 12 |
+
- Dashboard → "+ Create Bin" → Inhalt: `{}` → Create
|
| 13 |
+
- Bin ID aus der URL kopieren
|
| 14 |
|
| 15 |
+
### 4. In app.js eintragen
|
| 16 |
+
```js
|
| 17 |
+
const JSONBIN_KEY = '$2a$10$DEIN_KEY_HIER';
|
| 18 |
+
const JSONBIN_BIN = 'DEINE_BIN_ID_HIER';
|
|
|
|
|
|
|
|
|
|
| 19 |
```
|
| 20 |
|
| 21 |
+
### 5. Alle 3 Dateien auf HF Space hochladen — fertig!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
---
|
| 24 |
|
| 25 |
+
## Geschwindigkeit
|
| 26 |
+
- Lesen: ~200-400ms
|
| 27 |
+
- Schreiben: ~300-600ms
|
| 28 |
+
- Nachrichten erscheinen sofort lokal, andere sehen sie nach ~3 Sekunden
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
## Owner-Account
|
| 31 |
+
- Username: Noah
|
| 32 |
+
- Passwort: Noah100419!
|
app.js
ADDED
|
@@ -0,0 +1,1168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// ═══════════════════════════════════════════════════════════════
|
| 2 |
+
// NOAHSCHAT v4 — JSONBin.io Backend
|
| 3 |
+
// ═══════════════════════════════════════════════════════════════
|
| 4 |
+
//
|
| 5 |
+
// SETUP (5 Minuten, kostenlos):
|
| 6 |
+
// 1. https://jsonbin.io → kostenlos registrieren
|
| 7 |
+
// 2. Dashboard → "API Keys" → Master Key kopieren
|
| 8 |
+
// 3. "+ Create Bin" → leeres JSON {} → Create → Bin ID kopieren
|
| 9 |
+
// (du brauchst NUR EINEN Bin für alles!)
|
| 10 |
+
// 4. JSONBIN_KEY und JSONBIN_BIN unten eintragen → fertig!
|
| 11 |
+
// ─────────────────────────────────────────────────────────────
|
| 12 |
+
|
| 13 |
+
const JSONBIN_KEY = '$2a$10$DEIN_MASTER_KEY_HIER'; // ← eintragen
|
| 14 |
+
const JSONBIN_BIN = 'DEINE_BIN_ID_HIER'; // ← eintragen
|
| 15 |
+
|
| 16 |
+
// ─── CONFIG ───────────────────────────────────────────────────
|
| 17 |
+
const OWNER_NAME = 'Noah';
|
| 18 |
+
const OWNER_PASS = 'Noah100419!';
|
| 19 |
+
const POLL_MS = 3000; // Polling-Intervall in ms
|
| 20 |
+
|
| 21 |
+
// ─── STATE ────────────────────────────────────────────────────
|
| 22 |
+
let currentUser = null;
|
| 23 |
+
let currentChannel = 'allgemein';
|
| 24 |
+
let currentDM = null;
|
| 25 |
+
let pollTimer = null;
|
| 26 |
+
let spamTs = [];
|
| 27 |
+
let captchaData = {};
|
| 28 |
+
let pendingSpamMsg = null;
|
| 29 |
+
let appConfig = {};
|
| 30 |
+
let voiceActive = false;
|
| 31 |
+
let voiceChannel = null;
|
| 32 |
+
let micMuted = false;
|
| 33 |
+
let deafened = false;
|
| 34 |
+
let translationEnabled = false;
|
| 35 |
+
let userLanguage = 'de';
|
| 36 |
+
let unreadCounts = {};
|
| 37 |
+
let lastMsgCounts = {};
|
| 38 |
+
|
| 39 |
+
// ─── IN-MEMORY DB CACHE ───────────────────────────────────────
|
| 40 |
+
// Die komplette DB liegt immer im RAM.
|
| 41 |
+
// Schreiben: sofort im Cache sichtbar, async zu JSONBin gesendet.
|
| 42 |
+
// Lesen: aus Cache (kein Extra-Request nötig).
|
| 43 |
+
// Polling lädt alle POLL_MS die DB neu von JSONBin.
|
| 44 |
+
let DB = null;
|
| 45 |
+
let isSaving = false;
|
| 46 |
+
let saveQueued = false;
|
| 47 |
+
|
| 48 |
+
const DB_DEFAULT = () => ({
|
| 49 |
+
users: {},
|
| 50 |
+
msgs: {},
|
| 51 |
+
dms: {},
|
| 52 |
+
online: {},
|
| 53 |
+
voice: {},
|
| 54 |
+
tickets: {},
|
| 55 |
+
pins: [],
|
| 56 |
+
moderation: { bans:{}, banned_fps:{}, kicked:{}, timeouts:{} },
|
| 57 |
+
config: {}
|
| 58 |
+
});
|
| 59 |
+
|
| 60 |
+
// ─── FINGERPRINT ──────────────────────────────────────────────
|
| 61 |
+
function getFingerprint() {
|
| 62 |
+
const s = navigator.userAgent + screen.width + screen.height + screen.colorDepth
|
| 63 |
+
+ (Intl.DateTimeFormat().resolvedOptions().timeZone||'') + navigator.language;
|
| 64 |
+
let h = 0;
|
| 65 |
+
for (let i = 0; i < s.length; i++) { h = ((h<<5)-h) + s.charCodeAt(i); h = h&h; }
|
| 66 |
+
return Math.abs(h).toString(36);
|
| 67 |
+
}
|
| 68 |
+
const MY_FP = getFingerprint();
|
| 69 |
+
|
| 70 |
+
// ─── JSONBIN API ──────────────────────────────────────────────
|
| 71 |
+
const isConfigured = () =>
|
| 72 |
+
!JSONBIN_KEY.includes('DEIN') && !JSONBIN_BIN.includes('DEINE');
|
| 73 |
+
|
| 74 |
+
async function apiLoad() {
|
| 75 |
+
if (!isConfigured()) {
|
| 76 |
+
const v = localStorage.getItem('nc_db');
|
| 77 |
+
DB = v ? JSON.parse(v) : DB_DEFAULT();
|
| 78 |
+
ensureFields();
|
| 79 |
+
return;
|
| 80 |
+
}
|
| 81 |
+
try {
|
| 82 |
+
const r = await fetch(`https://api.jsonbin.io/v3/b/${JSONBIN_BIN}/latest`, {
|
| 83 |
+
headers: { 'X-Master-Key': JSONBIN_KEY, 'X-Bin-Meta': 'false' }
|
| 84 |
+
});
|
| 85 |
+
if (!r.ok) throw new Error(r.status);
|
| 86 |
+
DB = await r.json();
|
| 87 |
+
ensureFields();
|
| 88 |
+
localStorage.setItem('nc_db', JSON.stringify(DB)); // Lokaler Backup
|
| 89 |
+
} catch(e) {
|
| 90 |
+
console.warn('Load fehlgeschlagen:', e);
|
| 91 |
+
// Fallback: letzten lokalen Stand nehmen
|
| 92 |
+
const v = localStorage.getItem('nc_db');
|
| 93 |
+
if (v) DB = JSON.parse(v);
|
| 94 |
+
else DB = DB_DEFAULT();
|
| 95 |
+
ensureFields();
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
async function apiSave() {
|
| 100 |
+
// Immer lokal speichern
|
| 101 |
+
localStorage.setItem('nc_db', JSON.stringify(DB));
|
| 102 |
+
if (!isConfigured()) return;
|
| 103 |
+
|
| 104 |
+
if (isSaving) { saveQueued = true; return; }
|
| 105 |
+
isSaving = true;
|
| 106 |
+
try {
|
| 107 |
+
const r = await fetch(`https://api.jsonbin.io/v3/b/${JSONBIN_BIN}`, {
|
| 108 |
+
method: 'PUT',
|
| 109 |
+
headers: {
|
| 110 |
+
'Content-Type': 'application/json',
|
| 111 |
+
'X-Master-Key': JSONBIN_KEY,
|
| 112 |
+
'X-Bin-Versioning': 'false' // Kein Versionsverlauf → schneller
|
| 113 |
+
},
|
| 114 |
+
body: JSON.stringify(DB)
|
| 115 |
+
});
|
| 116 |
+
if (!r.ok) console.warn('Save Fehler:', r.status);
|
| 117 |
+
} catch(e) {
|
| 118 |
+
console.warn('Save Exception:', e);
|
| 119 |
+
} finally {
|
| 120 |
+
isSaving = false;
|
| 121 |
+
if (saveQueued) { saveQueued = false; apiSave(); }
|
| 122 |
+
}
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
// Fehlende Felder ergänzen falls DB älter ist
|
| 126 |
+
function ensureFields() {
|
| 127 |
+
const def = DB_DEFAULT();
|
| 128 |
+
for (const k of Object.keys(def)) {
|
| 129 |
+
if (DB[k] === undefined) DB[k] = def[k];
|
| 130 |
+
}
|
| 131 |
+
if (!DB.moderation.bans) DB.moderation.bans = {};
|
| 132 |
+
if (!DB.moderation.banned_fps) DB.moderation.banned_fps = {};
|
| 133 |
+
if (!DB.moderation.kicked) DB.moderation.kicked = {};
|
| 134 |
+
if (!DB.moderation.timeouts) DB.moderation.timeouts = {};
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
// Hilfsfunktionen: Pfad-Zugriff (z.B. "users/noah")
|
| 138 |
+
function dbGet(path) {
|
| 139 |
+
const parts = path.split('/').filter(Boolean);
|
| 140 |
+
let o = DB;
|
| 141 |
+
for (const p of parts) { if (o==null) return undefined; o = o[p]; }
|
| 142 |
+
return o;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
function dbSet(path, val) {
|
| 146 |
+
const parts = path.split('/').filter(Boolean);
|
| 147 |
+
let o = DB;
|
| 148 |
+
for (let i = 0; i < parts.length-1; i++) {
|
| 149 |
+
if (o[parts[i]] == null) o[parts[i]] = {};
|
| 150 |
+
o = o[parts[i]];
|
| 151 |
+
}
|
| 152 |
+
o[parts[parts.length-1]] = val;
|
| 153 |
+
apiSave(); // Async, blockiert nicht
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
function dbDelete(path) {
|
| 157 |
+
const parts = path.split('/').filter(Boolean);
|
| 158 |
+
let o = DB;
|
| 159 |
+
for (let i = 0; i < parts.length-1; i++) {
|
| 160 |
+
if (o[parts[i]] == null) return;
|
| 161 |
+
o = o[parts[i]];
|
| 162 |
+
}
|
| 163 |
+
delete o[parts[parts.length-1]];
|
| 164 |
+
apiSave();
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
function dbPush(path, val) {
|
| 168 |
+
const key = Date.now().toString(36) + Math.random().toString(36).slice(2,5);
|
| 169 |
+
val._key = key;
|
| 170 |
+
dbSet(path+'/'+key, val);
|
| 171 |
+
return key;
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
// ─── ROLE HELPERS ─────────────────────────────────────────────
|
| 175 |
+
const ROLE_PRIORITY = { owner:5, admin:4, mod:3, vip:2, member:1 };
|
| 176 |
+
const ROLE_BADGE = { owner:'👑', admin:'🔰', mod:'⭐', vip:'💎', member:'' };
|
| 177 |
+
const ROLE_LABELS = { owner:'Owner', admin:'Admin', mod:'Moderator', vip:'VIP', member:'Mitglied' };
|
| 178 |
+
const ROLE_COLORS = { owner:'name-color-1', admin:'name-color-0', mod:'name-color-2', vip:'name-color-4', member:'' };
|
| 179 |
+
function hasRole(r) { return currentUser && ROLE_PRIORITY[currentUser.role] >= ROLE_PRIORITY[r]; }
|
| 180 |
+
|
| 181 |
+
// ─── CAPTCHA ──────────────────────────────────────────────────
|
| 182 |
+
function genCaptcha() {
|
| 183 |
+
const a=Math.floor(Math.random()*18)+2, b=Math.floor(Math.random()*18)+2;
|
| 184 |
+
if (Math.random()>.4) return {q:`${a} + ${b} = ?`, ans:a+b};
|
| 185 |
+
const big=Math.max(a,b), sm=Math.min(a,b);
|
| 186 |
+
return {q:`${big} − ${sm} = ?`, ans:big-sm};
|
| 187 |
+
}
|
| 188 |
+
function refreshCaptcha(id) {
|
| 189 |
+
const d=genCaptcha(); captchaData[id]=d;
|
| 190 |
+
const q=document.getElementById(id+'-q'); if(q) q.textContent=d.q;
|
| 191 |
+
const a=document.getElementById(id+'-a'); if(a) a.value='';
|
| 192 |
+
}
|
| 193 |
+
function verifyCaptcha(id) {
|
| 194 |
+
return captchaData[id] && parseInt(document.getElementById(id+'-a')?.value)===captchaData[id].ans;
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
// ─── AUTH TABS ────────────────────────────────────────────────
|
| 198 |
+
function switchTab(tab) {
|
| 199 |
+
['login','register'].forEach((t,i)=>{
|
| 200 |
+
document.getElementById('tab-'+t).style.display=t===tab?'':'none';
|
| 201 |
+
document.querySelectorAll('.auth-tab')[i].classList.toggle('active',t===tab);
|
| 202 |
+
});
|
| 203 |
+
document.getElementById('auth-error').textContent='';
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
// ─── REGISTER ─────────────────────────────────────────────────
|
| 207 |
+
async function doRegister() {
|
| 208 |
+
const u=document.getElementById('reg-user').value.trim();
|
| 209 |
+
const p=document.getElementById('reg-pass').value;
|
| 210 |
+
const p2=document.getElementById('reg-pass2').value;
|
| 211 |
+
const err=t=>document.getElementById('auth-error').textContent=t;
|
| 212 |
+
if (u.length<2) return err('Username mind. 2 Zeichen');
|
| 213 |
+
if (u.length>20) return err('Username max. 20 Zeichen');
|
| 214 |
+
if (!/^[a-zA-Z0-9_]+$/.test(u)) return err('Nur Buchstaben, Zahlen, _');
|
| 215 |
+
if (p.length<4) return err('Passwort mind. 4 Zeichen');
|
| 216 |
+
if (p!==p2) return err('Passwörter stimmen nicht überein');
|
| 217 |
+
if (!verifyCaptcha('reg')) { refreshCaptcha('reg'); return err('❌ Falsches Captcha!'); }
|
| 218 |
+
if (DB.moderation.bans?.[u.toLowerCase()]) return err('Dieser Account ist gesperrt.');
|
| 219 |
+
if (DB.moderation.banned_fps?.[MY_FP]) return showBanned();
|
| 220 |
+
if (DB.users[u.toLowerCase()]) return err('Username bereits vergeben');
|
| 221 |
+
dbSet(`users/${u.toLowerCase()}`, {
|
| 222 |
+
username:u, password:encode(p),
|
| 223 |
+
color:Math.floor(Math.random()*5), role:'member', joined:Date.now(),
|
| 224 |
+
settings:{lang:'de', translate:false, notif:true}
|
| 225 |
+
});
|
| 226 |
+
refreshCaptcha('reg');
|
| 227 |
+
showAuthSuccess('✓ Account erstellt! Du kannst dich jetzt einloggen.');
|
| 228 |
+
setTimeout(()=>{ switchTab('login'); document.getElementById('login-user').value=u; }, 1300);
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
// ─── LOGIN ────────────────────────────────────────────────────
|
| 232 |
+
async function doLogin() {
|
| 233 |
+
const u=document.getElementById('login-user').value.trim();
|
| 234 |
+
const p=document.getElementById('login-pass').value;
|
| 235 |
+
const err=t=>document.getElementById('auth-error').textContent=t;
|
| 236 |
+
if (!verifyCaptcha('login')) { refreshCaptcha('login'); return err('❌ Falsches Captcha!'); }
|
| 237 |
+
if (DB.moderation.banned_fps?.[MY_FP]) return showBanned();
|
| 238 |
+
const entry=DB.users[u.toLowerCase()];
|
| 239 |
+
if (!entry) return err('Falscher Username oder Passwort');
|
| 240 |
+
if (decode(entry.password)!==p)return err('Falscher Username oder Passwort');
|
| 241 |
+
if (DB.moderation.bans?.[u.toLowerCase()]) return err('🚫 Du bist von NoahsChat gebannt.');
|
| 242 |
+
currentUser={...entry};
|
| 243 |
+
refreshCaptcha('login');
|
| 244 |
+
dbSet(`users/${u.toLowerCase()}/_fp`, MY_FP);
|
| 245 |
+
dbSet(`online/${entry.username}`, Date.now());
|
| 246 |
+
userLanguage=entry.settings?.lang||'de';
|
| 247 |
+
translationEnabled=entry.settings?.translate||false;
|
| 248 |
+
launchApp();
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
// ─── LOGOUT ───────────────────────────────────────────────────
|
| 252 |
+
async function doLogout() {
|
| 253 |
+
if (!currentUser) return;
|
| 254 |
+
dbDelete(`online/${currentUser.username}`);
|
| 255 |
+
if (voiceActive) leaveVoice();
|
| 256 |
+
clearInterval(pollTimer);
|
| 257 |
+
currentUser=null;
|
| 258 |
+
document.getElementById('app').classList.remove('visible');
|
| 259 |
+
document.getElementById('auth-screen').style.display='flex';
|
| 260 |
+
document.getElementById('login-pass').value='';
|
| 261 |
+
refreshCaptcha('login');
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
// ─── LAUNCH APP ───────────────────────────────────────────────
|
| 265 |
+
async function launchApp() {
|
| 266 |
+
document.getElementById('auth-screen').style.display='none';
|
| 267 |
+
document.getElementById('app').classList.add('visible');
|
| 268 |
+
appConfig = DB.config || {};
|
| 269 |
+
if (!appConfig.channels) {
|
| 270 |
+
appConfig.channels = window.DEFAULT_CHANNELS||[];
|
| 271 |
+
appConfig.automod = window.DEFAULT_AUTOMOD||{};
|
| 272 |
+
dbSet('config', appConfig);
|
| 273 |
+
}
|
| 274 |
+
updateTopbar();
|
| 275 |
+
buildChannelList();
|
| 276 |
+
openChannel('allgemein');
|
| 277 |
+
startPolling();
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
// ─── POLLING ──────────────────────────────────────────────────
|
| 281 |
+
function startPolling() {
|
| 282 |
+
pollTimer = setInterval(pollTick, POLL_MS);
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
async function pollTick() {
|
| 286 |
+
if (!currentUser) return;
|
| 287 |
+
|
| 288 |
+
// DB neu laden → bekommt Änderungen anderer User
|
| 289 |
+
setSyncStatus('sync');
|
| 290 |
+
await apiLoad();
|
| 291 |
+
setSyncStatus('ok');
|
| 292 |
+
|
| 293 |
+
// Eigene Daten aktualisieren (Rolle könnte geändert worden sein)
|
| 294 |
+
const me = DB.users[currentUser.username.toLowerCase()];
|
| 295 |
+
if (me) {
|
| 296 |
+
currentUser = {...me};
|
| 297 |
+
updateTopbar();
|
| 298 |
+
userLanguage = me.settings?.lang||'de';
|
| 299 |
+
translationEnabled = me.settings?.translate||false;
|
| 300 |
+
}
|
| 301 |
+
|
| 302 |
+
// Heartbeat
|
| 303 |
+
DB.online[currentUser.username] = Date.now();
|
| 304 |
+
apiSave();
|
| 305 |
+
|
| 306 |
+
// Moderation-Checks
|
| 307 |
+
const mod = DB.moderation;
|
| 308 |
+
if (mod.bans?.[currentUser.username.toLowerCase()] || mod.banned_fps?.[MY_FP]) {
|
| 309 |
+
clearInterval(pollTimer); showBanned(); return;
|
| 310 |
+
}
|
| 311 |
+
const kick = mod.kicked?.[currentUser.username.toLowerCase()];
|
| 312 |
+
if (kick && Date.now()-kick.ts < 60000) { clearInterval(pollTimer); showKickedModal(); return; }
|
| 313 |
+
updateTimeoutBar();
|
| 314 |
+
|
| 315 |
+
// Online-User-Liste
|
| 316 |
+
const now = Date.now();
|
| 317 |
+
const onlineNames = Object.entries(DB.online)
|
| 318 |
+
.filter(([,ts])=>now-ts<12000).map(([u])=>u);
|
| 319 |
+
document.getElementById('online-count').textContent = onlineNames.length;
|
| 320 |
+
renderUserList(onlineNames);
|
| 321 |
+
updateDMList();
|
| 322 |
+
|
| 323 |
+
// Nachrichten anzeigen
|
| 324 |
+
if (currentDM) renderDMMessages(currentDM);
|
| 325 |
+
else {
|
| 326 |
+
renderChannelMessages(currentChannel);
|
| 327 |
+
// Unread-Badges für andere Channels
|
| 328 |
+
for (const ch of (appConfig.channels||[])) {
|
| 329 |
+
if (ch.id===currentChannel) continue;
|
| 330 |
+
const msgs = getMsgs(ch.id);
|
| 331 |
+
const key = 'ch_'+ch.id;
|
| 332 |
+
const prev = lastMsgCounts[key]||0;
|
| 333 |
+
if (msgs.length>prev) {
|
| 334 |
+
unreadCounts[key] = (unreadCounts[key]||0) + (msgs.length-prev);
|
| 335 |
+
updateBadge('badge-'+ch.id, unreadCounts[key]);
|
| 336 |
+
lastMsgCounts[key] = msgs.length;
|
| 337 |
+
}
|
| 338 |
+
}
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
// DM Unread-Badges
|
| 342 |
+
for (const entry of Object.values(DB.users)) {
|
| 343 |
+
if (entry.username===currentUser.username) continue;
|
| 344 |
+
if (currentDM===entry.username) continue;
|
| 345 |
+
const key = 'dm_'+entry.username.toLowerCase();
|
| 346 |
+
const msgs = getDMMsgs(getDMKey(currentUser.username, entry.username));
|
| 347 |
+
const prev = lastMsgCounts[key]||0;
|
| 348 |
+
if (msgs.length>prev) {
|
| 349 |
+
unreadCounts[key] = (unreadCounts[key]||0) + (msgs.length-prev);
|
| 350 |
+
lastMsgCounts[key] = msgs.length;
|
| 351 |
+
updateDMList();
|
| 352 |
+
}
|
| 353 |
+
}
|
| 354 |
+
|
| 355 |
+
// Abgelaufene Voice-Einträge aufräumen
|
| 356 |
+
for (const [vcId, parts] of Object.entries(DB.voice||{})) {
|
| 357 |
+
for (const [uname, data] of Object.entries(parts||{})) {
|
| 358 |
+
if (now-(data.ts||0) > 12000) dbDelete(`voice/${vcId}/${uname}`);
|
| 359 |
+
}
|
| 360 |
+
}
|
| 361 |
+
buildChannelList();
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
// ─── SYNC STATUS INDICATOR ────────────────────────────────────
|
| 365 |
+
function setSyncStatus(state) {
|
| 366 |
+
let el = document.getElementById('sync-dot');
|
| 367 |
+
if (!el) {
|
| 368 |
+
el = document.createElement('div');
|
| 369 |
+
el.id = 'sync-dot';
|
| 370 |
+
el.style.cssText = 'position:fixed;bottom:14px;left:50%;transform:translateX(-50%);z-index:9999;font-family:Orbitron,monospace;font-size:.55rem;letter-spacing:.12em;padding:3px 10px;background:rgba(5,10,15,0.9);border-radius:2px;border:1px solid;transition:all .3s;pointer-events:none';
|
| 371 |
+
document.body.appendChild(el);
|
| 372 |
+
}
|
| 373 |
+
if (state==='sync') {
|
| 374 |
+
el.textContent='⟳ SYNC...';
|
| 375 |
+
el.style.borderColor='rgba(0,212,255,0.3)';
|
| 376 |
+
el.style.color='var(--muted)';
|
| 377 |
+
el.style.opacity='1';
|
| 378 |
+
} else {
|
| 379 |
+
el.textContent='● LIVE';
|
| 380 |
+
el.style.borderColor='rgba(78,255,145,0.3)';
|
| 381 |
+
el.style.color='var(--green)';
|
| 382 |
+
setTimeout(()=>{ if(el) el.style.opacity='0'; }, 1500);
|
| 383 |
+
}
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
// ─── TOPBAR ───────────────────────────────────────────────────
|
| 387 |
+
function updateTopbar() {
|
| 388 |
+
const av=document.getElementById('topbar-avatar');
|
| 389 |
+
av.textContent=currentUser.username[0].toUpperCase();
|
| 390 |
+
av.className=`user-avatar-sm av-color-${currentUser.color}`;
|
| 391 |
+
document.getElementById('topbar-username').textContent=currentUser.username;
|
| 392 |
+
document.getElementById('topbar-role-badge').textContent=ROLE_BADGE[currentUser.role]||'';
|
| 393 |
+
}
|
| 394 |
+
|
| 395 |
+
// ─── SIDEBAR ──────────────────────────────────────────────────
|
| 396 |
+
function buildChannelList() {
|
| 397 |
+
const channels=appConfig.channels||window.DEFAULT_CHANNELS||[];
|
| 398 |
+
const list=document.getElementById('channel-list');
|
| 399 |
+
list.innerHTML='';
|
| 400 |
+
const cats={info:'Info',chat:'Text-Channels',fun:'Community',staff:'Staff'};
|
| 401 |
+
const grouped={};
|
| 402 |
+
for (const ch of channels) {
|
| 403 |
+
const cat=ch.category||'chat';
|
| 404 |
+
if (!grouped[cat]) grouped[cat]=[];
|
| 405 |
+
grouped[cat].push(ch);
|
| 406 |
+
}
|
| 407 |
+
for (const [catId,label] of Object.entries(cats)) {
|
| 408 |
+
const chs=grouped[catId]; if (!chs) continue;
|
| 409 |
+
if (catId==='staff'&&!hasRole('mod')) continue;
|
| 410 |
+
const catEl=document.createElement('div');
|
| 411 |
+
catEl.className='channel-category';
|
| 412 |
+
catEl.textContent='— '+label;
|
| 413 |
+
list.appendChild(catEl);
|
| 414 |
+
for (const ch of chs) {
|
| 415 |
+
if (ch.adminOnly&&!hasRole('admin')) {
|
| 416 |
+
if (catId==='staff') continue;
|
| 417 |
+
const div=document.createElement('div');
|
| 418 |
+
div.className='channel-item ch-locked';
|
| 419 |
+
div.innerHTML=`<span class="channel-icon">${ch.icon}</span><span class="channel-name">${ch.name}</span><span style="font-size:.65rem;color:var(--muted)">🔒</span>`;
|
| 420 |
+
list.appendChild(div); continue;
|
| 421 |
+
}
|
| 422 |
+
if (ch.modOnly&&!hasRole('mod')) continue;
|
| 423 |
+
const div=document.createElement('div');
|
| 424 |
+
div.className='channel-item'+(ch.id===currentChannel&&!currentDM?' active':'');
|
| 425 |
+
div.dataset.channel=ch.id;
|
| 426 |
+
div.innerHTML=`<span class="channel-icon">${ch.icon}</span><span class="channel-name">${ch.name}</span><span class="unread-badge" id="badge-${ch.id}" style="display:none"></span>`;
|
| 427 |
+
div.onclick=()=>openChannel(ch.id);
|
| 428 |
+
list.appendChild(div);
|
| 429 |
+
}
|
| 430 |
+
}
|
| 431 |
+
// Voice Channels
|
| 432 |
+
const vcCat=document.createElement('div');
|
| 433 |
+
vcCat.className='channel-category';
|
| 434 |
+
vcCat.textContent='— Voice Channels';
|
| 435 |
+
list.appendChild(vcCat);
|
| 436 |
+
for (const vc of [{id:'voice-allgemein',name:'Allgemein',icon:'🔊'},{id:'voice-gaming',name:'Gaming',icon:'🎮'},{id:'voice-musik',name:'Musik',icon:'🎵'}]) {
|
| 437 |
+
const isActive=voiceActive&&voiceChannel===vc.id;
|
| 438 |
+
const div=document.createElement('div');
|
| 439 |
+
div.className='channel-item'+(isActive?' active':'');
|
| 440 |
+
div.innerHTML=`<span class="channel-icon">${vc.icon}</span><span class="channel-name">${vc.name}</span>`;
|
| 441 |
+
div.onclick=()=>joinVoice(vc.id,vc.name);
|
| 442 |
+
list.appendChild(div);
|
| 443 |
+
for (const p of Object.values(DB.voice?.[vc.id]||{})) {
|
| 444 |
+
const pe=document.createElement('div');
|
| 445 |
+
pe.style.cssText='padding:3px 14px 3px 32px;font-size:.78rem;color:var(--green);display:flex;gap:6px;align-items:center;pointer-events:none';
|
| 446 |
+
pe.innerHTML=`<span>🎙</span><span>${escHtml(p.name)}</span>${p.muted?'<span style="color:var(--muted)">🔇</span>':''}`;
|
| 447 |
+
list.appendChild(pe);
|
| 448 |
+
}
|
| 449 |
+
}
|
| 450 |
+
}
|
| 451 |
+
|
| 452 |
+
// ─── CHANNELS ─────────────────────────────────────────────────
|
| 453 |
+
function openChannel(chId) {
|
| 454 |
+
currentChannel=chId; currentDM=null;
|
| 455 |
+
document.querySelectorAll('.channel-item').forEach(el=>el.classList.remove('active'));
|
| 456 |
+
document.querySelector(`[data-channel="${chId}"]`)?.classList.add('active');
|
| 457 |
+
document.querySelectorAll('.dm-item').forEach(el=>el.classList.remove('active'));
|
| 458 |
+
const ch=(appConfig.channels||[]).find(c=>c.id===chId)||{name:chId,icon:'💬',sub:''};
|
| 459 |
+
document.getElementById('chat-title').textContent=ch.icon+' '+ch.name;
|
| 460 |
+
document.getElementById('chat-sub').textContent=ch.sub||'';
|
| 461 |
+
document.getElementById('topbar-channel-name').textContent='# '+ch.name;
|
| 462 |
+
unreadCounts['ch_'+chId]=0; updateBadge('badge-'+chId,0);
|
| 463 |
+
const locked=(ch.adminOnly&&!hasRole('admin'))||(ch.readOnly&&!hasRole('admin'))||(ch.modOnly&&!hasRole('mod'));
|
| 464 |
+
document.getElementById('msg-input').disabled=locked;
|
| 465 |
+
document.getElementById('send-btn').disabled=locked;
|
| 466 |
+
document.getElementById('msg-input').placeholder=locked?'🔒 Du kannst hier nicht schreiben':'Nachricht schreiben...';
|
| 467 |
+
renderChannelMessages(chId);
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
function getMsgs(chId) {
|
| 471 |
+
return Object.values(DB.msgs[chId]||{}).sort((a,b)=>a.ts-b.ts);
|
| 472 |
+
}
|
| 473 |
+
|
| 474 |
+
function renderChannelMessages(chId) {
|
| 475 |
+
const msgs=getMsgs(chId);
|
| 476 |
+
lastMsgCounts['ch_'+chId]=msgs.length;
|
| 477 |
+
renderMessages(msgs);
|
| 478 |
+
}
|
| 479 |
+
|
| 480 |
+
// ─── DMs ──────────────────────────────────────────────────────
|
| 481 |
+
function getDMKey(a,b) { return [a.toLowerCase(),b.toLowerCase()].sort().join('__'); }
|
| 482 |
+
|
| 483 |
+
function getDMMsgs(key) {
|
| 484 |
+
return Object.values(DB.dms[key]||{}).sort((a,b)=>a.ts-b.ts);
|
| 485 |
+
}
|
| 486 |
+
|
| 487 |
+
function openDM(username) {
|
| 488 |
+
currentDM=username; currentChannel=null;
|
| 489 |
+
document.querySelectorAll('.channel-item').forEach(el=>el.classList.remove('active'));
|
| 490 |
+
document.querySelectorAll('.dm-item').forEach(el=>{
|
| 491 |
+
el.classList.toggle('active',el.dataset.user===username.toLowerCase());
|
| 492 |
+
});
|
| 493 |
+
document.getElementById('chat-title').textContent='@ '+username;
|
| 494 |
+
document.getElementById('chat-sub').textContent='Direktnachricht – privat';
|
| 495 |
+
document.getElementById('topbar-channel-name').textContent='@ '+username;
|
| 496 |
+
document.getElementById('msg-input').disabled=false;
|
| 497 |
+
document.getElementById('send-btn').disabled=false;
|
| 498 |
+
document.getElementById('msg-input').placeholder=`Nachricht an @${username}...`;
|
| 499 |
+
unreadCounts['dm_'+username.toLowerCase()]=0;
|
| 500 |
+
updateDMList();
|
| 501 |
+
renderDMMessages(username);
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
function renderDMMessages(username) {
|
| 505 |
+
const key=getDMKey(currentUser.username,username);
|
| 506 |
+
const msgs=getDMMsgs(key);
|
| 507 |
+
lastMsgCounts['dm_'+username.toLowerCase()]=msgs.length;
|
| 508 |
+
renderMessages(msgs,true);
|
| 509 |
+
}
|
| 510 |
+
|
| 511 |
+
// ─── RENDER MESSAGES ──────────────────────────────────────────
|
| 512 |
+
function renderMessages(msgs, isDM=false) {
|
| 513 |
+
const c=document.getElementById('messages');
|
| 514 |
+
const atBottom=c.scrollHeight-c.scrollTop<=c.clientHeight+80;
|
| 515 |
+
if (!msgs.length) {
|
| 516 |
+
c.innerHTML='<div class="empty-chat"><div class="empty-chat-icon">💬</div><p>Noch keine Nachrichten. Schreib was!</p></div>';
|
| 517 |
+
return;
|
| 518 |
+
}
|
| 519 |
+
let html='', lastDay='', lastAuthor='', lastTime=0;
|
| 520 |
+
for (let i=0; i<msgs.length; i++) {
|
| 521 |
+
const m=msgs[i];
|
| 522 |
+
if (m.system) { html+=`<div class="msg-system">⚙ ${escHtml(m.text)}</div>`; lastAuthor=''; continue; }
|
| 523 |
+
if (m.automod){ html+=`<div class="msg-automod">🤖 AutoMod: ${escHtml(m.text)}</div>`; lastAuthor=''; continue; }
|
| 524 |
+
const date=new Date(m.ts);
|
| 525 |
+
const day=date.toLocaleDateString('de-DE',{day:'2-digit',month:'2-digit',year:'numeric'});
|
| 526 |
+
const time=date.toLocaleTimeString('de-DE',{hour:'2-digit',minute:'2-digit'});
|
| 527 |
+
if (day!==lastDay) { html+=`<div class="day-divider">${day}</div>`; lastDay=day; lastAuthor=''; }
|
| 528 |
+
const color=m.color??0;
|
| 529 |
+
const consec=m.author===lastAuthor&&(m.ts-lastTime)<5*60000;
|
| 530 |
+
lastAuthor=m.author; lastTime=m.ts;
|
| 531 |
+
const initials=(m.author||'?')[0].toUpperCase();
|
| 532 |
+
const role=m.role||'member';
|
| 533 |
+
const badge=ROLE_BADGE[role]||'';
|
| 534 |
+
const nc=ROLE_COLORS[role]||`name-color-${color}`;
|
| 535 |
+
const canDel=hasRole('mod')||m.author===currentUser?.username;
|
| 536 |
+
const canPin=hasRole('mod')&&!isDM;
|
| 537 |
+
const safeT=escHtml((m.text||'').substring(0,50));
|
| 538 |
+
html+=`<div class="msg ${consec?'consecutive':''}" data-key="${m._key||''}">
|
| 539 |
+
<div class="msg-avatar av-color-${color}" onclick="onAvatarClick(event,'${escHtml(m.author)}')">${initials}</div>
|
| 540 |
+
<div class="msg-content">
|
| 541 |
+
<div class="msg-header">
|
| 542 |
+
<span class="msg-name ${nc}" onclick="onAvatarClick(event,'${escHtml(m.author)}')">${escHtml(m.author)}${badge?` <span class="msg-role-badge">${badge}</span>`:''}</span>
|
| 543 |
+
<span class="msg-time">${time}</span>
|
| 544 |
+
<div class="msg-actions">
|
| 545 |
+
${canPin?`<button class="msg-action-btn" onclick="pinMsg('${escHtml(m.author)}','${safeT}')">📌</button>`:''}
|
| 546 |
+
${canDel?`<button class="msg-action-btn danger" onclick="deleteMsg('${m._key||''}',${isDM})">🗑</button>`:''}
|
| 547 |
+
</div>
|
| 548 |
+
</div>
|
| 549 |
+
<div class="msg-text">${formatMsg(m.text)}</div>
|
| 550 |
+
</div>
|
| 551 |
+
</div>`;
|
| 552 |
+
}
|
| 553 |
+
c.innerHTML=html;
|
| 554 |
+
if (atBottom) c.scrollTop=c.scrollHeight;
|
| 555 |
+
}
|
| 556 |
+
|
| 557 |
+
function formatMsg(text) {
|
| 558 |
+
return escHtml(text)
|
| 559 |
+
.replace(/\*\*(.*?)\*\*/g,'<strong>$1</strong>')
|
| 560 |
+
.replace(/\*(.*?)\*/g,'<em>$1</em>')
|
| 561 |
+
.replace(/`(.*?)`/g,'<code style="background:rgba(0,212,255,0.08);padding:1px 5px;border-radius:2px;font-family:monospace">$1</code>')
|
| 562 |
+
.replace(/(https?:\/\/[^\s]+)/g,'<a href="$1" target="_blank" rel="noopener">$1</a>');
|
| 563 |
+
}
|
| 564 |
+
|
| 565 |
+
// ─── SEND ────────���────────────────────────────────────────────
|
| 566 |
+
async function sendMessage() {
|
| 567 |
+
const input=document.getElementById('msg-input');
|
| 568 |
+
const text=input.value.trim();
|
| 569 |
+
if (!text||!currentUser) return;
|
| 570 |
+
const mod=DB.moderation;
|
| 571 |
+
const to=mod.timeouts?.[currentUser.username.toLowerCase()];
|
| 572 |
+
if (to&&to.until>Date.now()) { showToast('Du bist stummgeschaltet!','var(--warn)'); return; }
|
| 573 |
+
if (!currentDM) {
|
| 574 |
+
const ch=(appConfig.channels||[]).find(c=>c.id===currentChannel);
|
| 575 |
+
if (ch?.adminOnly&&!hasRole('admin')) return;
|
| 576 |
+
if (ch?.readOnly&&!hasRole('admin')) return;
|
| 577 |
+
if (ch?.modOnly&&!hasRole('mod')) return;
|
| 578 |
+
const am=autoModCheck(text);
|
| 579 |
+
if (am.blocked) { showToast('🤖 AutoMod: '+am.reason,'var(--warn)'); input.value=''; input.style.height=''; return; }
|
| 580 |
+
}
|
| 581 |
+
const now=Date.now();
|
| 582 |
+
spamTs=spamTs.filter(t=>now-t<(appConfig.automod?.spamWindow||10000));
|
| 583 |
+
spamTs.push(now);
|
| 584 |
+
if (spamTs.length>(appConfig.automod?.spamThreshold||5)) {
|
| 585 |
+
pendingSpamMsg=text; input.value=''; input.style.height='';
|
| 586 |
+
showSpamCaptchaModal(); return;
|
| 587 |
+
}
|
| 588 |
+
input.value=''; input.style.height='';
|
| 589 |
+
const msg={author:currentUser.username,color:currentUser.color,role:currentUser.role,text,ts:Date.now()};
|
| 590 |
+
if (currentDM) {
|
| 591 |
+
const key=getDMKey(currentUser.username,currentDM);
|
| 592 |
+
if (!DB.dms[key]) DB.dms[key]={};
|
| 593 |
+
dbPush(`dms/${key}`,msg);
|
| 594 |
+
renderDMMessages(currentDM);
|
| 595 |
+
} else {
|
| 596 |
+
if (!DB.msgs[currentChannel]) DB.msgs[currentChannel]={};
|
| 597 |
+
dbPush(`msgs/${currentChannel}`,msg);
|
| 598 |
+
renderChannelMessages(currentChannel);
|
| 599 |
+
document.getElementById('messages').scrollTop=9999999;
|
| 600 |
+
}
|
| 601 |
+
}
|
| 602 |
+
|
| 603 |
+
function autoModCheck(text) {
|
| 604 |
+
const am=appConfig.automod||{};
|
| 605 |
+
if (!am.enabled) return {blocked:false};
|
| 606 |
+
if (am.maxMsgLength&&text.length>am.maxMsgLength) return {blocked:true,reason:`Zu lang (max. ${am.maxMsgLength})`};
|
| 607 |
+
const lower=text.toLowerCase();
|
| 608 |
+
for (const w of (am.bannedWords||[])) { if(lower.includes(w.toLowerCase())) return {blocked:true,reason:'Verbotenes Wort'}; }
|
| 609 |
+
if (am.capsFilter&&text.length>10) {
|
| 610 |
+
const caps=(text.match(/[A-ZÄÖÜ]/g)||[]).length;
|
| 611 |
+
if (caps/text.length>(am.capsThreshold||0.7)) return {blocked:true,reason:'Zu viele Großbuchstaben'};
|
| 612 |
+
}
|
| 613 |
+
return {blocked:false};
|
| 614 |
+
}
|
| 615 |
+
|
| 616 |
+
function deleteMsg(key,isDM=false) {
|
| 617 |
+
if (!key) return;
|
| 618 |
+
if (isDM&¤tDM) {
|
| 619 |
+
const dmKey=getDMKey(currentUser.username,currentDM);
|
| 620 |
+
const m=DB.dms[dmKey]?.[key];
|
| 621 |
+
if (!m||(m.author!==currentUser.username&&!hasRole('mod'))) return;
|
| 622 |
+
dbDelete(`dms/${dmKey}/${key}`);
|
| 623 |
+
renderDMMessages(currentDM);
|
| 624 |
+
} else {
|
| 625 |
+
const m=DB.msgs[currentChannel]?.[key];
|
| 626 |
+
if (!m||(m.author!==currentUser.username&&!hasRole('mod'))) return;
|
| 627 |
+
dbDelete(`msgs/${currentChannel}/${key}`);
|
| 628 |
+
renderChannelMessages(currentChannel);
|
| 629 |
+
}
|
| 630 |
+
}
|
| 631 |
+
|
| 632 |
+
function pinMsg(author,text) {
|
| 633 |
+
if (!Array.isArray(DB.pins)) DB.pins=[];
|
| 634 |
+
DB.pins.push({author,text,by:currentUser.username,ts:Date.now(),channel:currentChannel});
|
| 635 |
+
if (DB.pins.length>50) DB.pins.shift();
|
| 636 |
+
apiSave();
|
| 637 |
+
showToast('📌 Nachricht angepinnt','var(--green)');
|
| 638 |
+
}
|
| 639 |
+
|
| 640 |
+
function handleKey(e) { if(e.key==='Enter'&&!e.shiftKey){e.preventDefault();sendMessage();} }
|
| 641 |
+
function autoResize(el) { el.style.height='auto'; el.style.height=Math.min(el.scrollHeight,120)+'px'; }
|
| 642 |
+
|
| 643 |
+
// ─── TIMEOUT BAR ──────────────────────────────────────────────
|
| 644 |
+
function updateTimeoutBar() {
|
| 645 |
+
const t=DB.moderation.timeouts?.[currentUser.username.toLowerCase()];
|
| 646 |
+
const bar=document.getElementById('timeout-bar');
|
| 647 |
+
if (t&&t.until>Date.now()) {
|
| 648 |
+
bar.style.display='';
|
| 649 |
+
document.getElementById('timeout-until').textContent=
|
| 650 |
+
new Date(t.until).toLocaleTimeString('de-DE',{hour:'2-digit',minute:'2-digit',second:'2-digit'});
|
| 651 |
+
document.getElementById('msg-input').disabled=true;
|
| 652 |
+
document.getElementById('send-btn').disabled=true;
|
| 653 |
+
} else {
|
| 654 |
+
bar.style.display='none';
|
| 655 |
+
if (!currentDM) {
|
| 656 |
+
const ch=(appConfig.channels||[]).find(c=>c.id===currentChannel);
|
| 657 |
+
const locked=(ch?.adminOnly&&!hasRole('admin'))||(ch?.readOnly&&!hasRole('admin'));
|
| 658 |
+
document.getElementById('msg-input').disabled=!!locked;
|
| 659 |
+
document.getElementById('send-btn').disabled=!!locked;
|
| 660 |
+
}
|
| 661 |
+
}
|
| 662 |
+
}
|
| 663 |
+
|
| 664 |
+
function updateBadge(id,count) {
|
| 665 |
+
const el=document.getElementById(id); if (!el) return;
|
| 666 |
+
if (count>0){el.style.display='';el.textContent=count>99?'99+':count;}
|
| 667 |
+
else el.style.display='none';
|
| 668 |
+
}
|
| 669 |
+
|
| 670 |
+
// ─── VOICE ────────────────────────────────────────────────────
|
| 671 |
+
function joinVoice(vcId,vcName) {
|
| 672 |
+
if (voiceActive&&voiceChannel===vcId) { leaveVoice(); return; }
|
| 673 |
+
if (voiceActive) leaveVoice();
|
| 674 |
+
voiceActive=true; voiceChannel=vcId; micMuted=false; deafened=false;
|
| 675 |
+
if (!DB.voice[vcId]) DB.voice[vcId]={};
|
| 676 |
+
dbSet(`voice/${vcId}/${currentUser.username}`,{name:currentUser.username,muted:false,ts:Date.now()});
|
| 677 |
+
document.getElementById('voice-panel').classList.add('active');
|
| 678 |
+
document.getElementById('voice-channel-name').textContent='🔊 '+vcName;
|
| 679 |
+
document.getElementById('voice-mute-btn').textContent='🎙 Stumm';
|
| 680 |
+
document.getElementById('voice-deaf-btn').textContent='🔔 Taub';
|
| 681 |
+
document.getElementById('voice-mute-btn').classList.remove('active');
|
| 682 |
+
document.getElementById('voice-deaf-btn').classList.remove('active');
|
| 683 |
+
buildChannelList();
|
| 684 |
+
showToast(`🔊 Beigetreten: ${vcName}`,'var(--green)');
|
| 685 |
+
}
|
| 686 |
+
function leaveVoice() {
|
| 687 |
+
if (!voiceActive) return;
|
| 688 |
+
dbDelete(`voice/${voiceChannel}/${currentUser.username}`);
|
| 689 |
+
voiceActive=false; voiceChannel=null;
|
| 690 |
+
document.getElementById('voice-panel').classList.remove('active');
|
| 691 |
+
buildChannelList();
|
| 692 |
+
showToast('Voice verlassen','var(--muted)');
|
| 693 |
+
}
|
| 694 |
+
function toggleMute() {
|
| 695 |
+
micMuted=!micMuted;
|
| 696 |
+
const btn=document.getElementById('voice-mute-btn');
|
| 697 |
+
btn.textContent=micMuted?'🔇 Stumm':'🎙 Stumm';
|
| 698 |
+
btn.classList.toggle('active',micMuted);
|
| 699 |
+
if (voiceActive) dbSet(`voice/${voiceChannel}/${currentUser.username}/muted`,micMuted);
|
| 700 |
+
}
|
| 701 |
+
function toggleDeafen() {
|
| 702 |
+
deafened=!deafened;
|
| 703 |
+
const btn=document.getElementById('voice-deaf-btn');
|
| 704 |
+
btn.textContent=deafened?'🔕 Taub':'🔔 Taub';
|
| 705 |
+
btn.classList.toggle('active',deafened);
|
| 706 |
+
}
|
| 707 |
+
|
| 708 |
+
// ─── USER LIST ────────────────────────────────────────────────
|
| 709 |
+
function renderUserList(onlineNames) {
|
| 710 |
+
const listEl=document.getElementById('user-list');
|
| 711 |
+
listEl.innerHTML='';
|
| 712 |
+
const groups={owner:[],admin:[],mod:[],vip:[],member:[]};
|
| 713 |
+
for (const u of Object.values(DB.users)) {
|
| 714 |
+
if (groups[u.role||'member']) groups[u.role||'member'].push(u);
|
| 715 |
+
else groups.member.push(u);
|
| 716 |
+
}
|
| 717 |
+
for (const [roleId,users] of Object.entries(groups)) {
|
| 718 |
+
if (!users.length) continue;
|
| 719 |
+
const hdr=document.createElement('div');
|
| 720 |
+
hdr.className='role-group-header';
|
| 721 |
+
hdr.innerHTML=`<span>${ROLE_LABELS[roleId]}</span><span style="color:var(--muted);font-size:.7rem">${users.length}</span>`;
|
| 722 |
+
listEl.appendChild(hdr);
|
| 723 |
+
for (const u of users) {
|
| 724 |
+
const isMe=u.username===currentUser?.username;
|
| 725 |
+
const isOnline=onlineNames.includes(u.username);
|
| 726 |
+
const div=document.createElement('div');
|
| 727 |
+
div.className='user-item'+(isMe?' me':'')+(!isOnline?' offline':'');
|
| 728 |
+
div.innerHTML=`<div class="${isOnline?'online-dot':'offline-dot'}"></div>
|
| 729 |
+
<div class="user-avatar-sm av-color-${u.color??0}">${u.username[0].toUpperCase()}</div>
|
| 730 |
+
<span>${escHtml(u.username)}${ROLE_BADGE[u.role]?' '+ROLE_BADGE[u.role]:''}</span>`;
|
| 731 |
+
if (!isMe) div.onclick=e=>{e.stopPropagation();showUserCtx(e,u.username);};
|
| 732 |
+
listEl.appendChild(div);
|
| 733 |
+
}
|
| 734 |
+
}
|
| 735 |
+
}
|
| 736 |
+
|
| 737 |
+
function updateDMList() {
|
| 738 |
+
const dmEl=document.getElementById('dm-list');
|
| 739 |
+
dmEl.innerHTML='';
|
| 740 |
+
for (const u of Object.values(DB.users)) {
|
| 741 |
+
if (u.username===currentUser?.username) continue;
|
| 742 |
+
const unread=unreadCounts['dm_'+u.username.toLowerCase()]||0;
|
| 743 |
+
const div=document.createElement('div');
|
| 744 |
+
div.className=`channel-item dm-item ${currentDM===u.username?'active':''}`;
|
| 745 |
+
div.dataset.user=u.username.toLowerCase();
|
| 746 |
+
div.innerHTML=`<span class="channel-icon">@</span><span class="channel-name">${escHtml(u.username)}</span>${unread>0?`<span class="unread-badge">${unread}</span>`:''}`;
|
| 747 |
+
div.onclick=()=>openDM(u.username);
|
| 748 |
+
dmEl.appendChild(div);
|
| 749 |
+
}
|
| 750 |
+
}
|
| 751 |
+
|
| 752 |
+
// ─── CONTEXT MENU ─────────────────────────────────────────────
|
| 753 |
+
function onAvatarClick(e,username) {
|
| 754 |
+
e.preventDefault(); e.stopPropagation();
|
| 755 |
+
hideCtx();
|
| 756 |
+
if (username===currentUser?.username) return;
|
| 757 |
+
showUserCtx(e,username);
|
| 758 |
+
}
|
| 759 |
+
function showUserCtx(e,username) {
|
| 760 |
+
e.preventDefault(); e.stopPropagation();
|
| 761 |
+
hideCtx();
|
| 762 |
+
const menu=document.getElementById('context-menu');
|
| 763 |
+
menu.innerHTML='';
|
| 764 |
+
const h=document.createElement('div'); h.className='ctx-header'; h.textContent=username; menu.appendChild(h);
|
| 765 |
+
addCtxItem(menu,'💬 Direktnachricht','',()=>{hideCtx();openDM(username);});
|
| 766 |
+
addCtxItem(menu,'👤 Profil','',()=>{hideCtx();showProfileModal(username);});
|
| 767 |
+
if (hasRole('mod')) {
|
| 768 |
+
addCtxDivider(menu);
|
| 769 |
+
addCtxItem(menu,'👢 Kicken','warn',()=>{hideCtx();openKickModal(username);});
|
| 770 |
+
addCtxItem(menu,'⏱ Timeout','warn',()=>{hideCtx();openTimeoutModal(username);});
|
| 771 |
+
addCtxItem(menu,'🗑 Nachrichten löschen','warn',()=>{hideCtx();clearUserMsgs(username);});
|
| 772 |
+
}
|
| 773 |
+
if (hasRole('admin')) {
|
| 774 |
+
addCtxItem(menu,'🚫 Bannen','danger',()=>{hideCtx();openBanModal(username);});
|
| 775 |
+
addCtxDivider(menu);
|
| 776 |
+
addCtxItem(menu,'🎖 Rolle ändern','',()=>{hideCtx();openRoleModal(username);});
|
| 777 |
+
}
|
| 778 |
+
menu.style.left=Math.min(e.clientX,window.innerWidth-210)+'px';
|
| 779 |
+
menu.style.top=Math.min(e.clientY,window.innerHeight-200)+'px';
|
| 780 |
+
menu.style.display='';
|
| 781 |
+
}
|
| 782 |
+
function addCtxItem(menu,label,cls,fn){const i=document.createElement('div');i.className='ctx-item'+(cls?' '+cls:'');i.textContent=label;i.onclick=fn;menu.appendChild(i);}
|
| 783 |
+
function addCtxDivider(menu){const d=document.createElement('div');d.className='ctx-divider';menu.appendChild(d);}
|
| 784 |
+
function hideCtx(){document.getElementById('context-menu').style.display='none';}
|
| 785 |
+
document.addEventListener('click',hideCtx);
|
| 786 |
+
|
| 787 |
+
// ─── MODERATION ───────────────────────────────────────────────
|
| 788 |
+
function openKickModal(u) {
|
| 789 |
+
showModal(`<div class="modal-title">👢 Kick: ${escHtml(u)}</div>
|
| 790 |
+
<div class="modal-sub">Der User wird aus dem Chat geworfen.</div>
|
| 791 |
+
<div class="modal-field"><label>Grund (optional)</label><input type="text" id="m-reason" placeholder="z.B. Regelverstoß"></div>
|
| 792 |
+
<div class="modal-btns">
|
| 793 |
+
<button class="modal-btn secondary" onclick="clearModal()">Abbrechen</button>
|
| 794 |
+
<button class="modal-btn warn-btn" onclick="doKick('${escHtml(u)}')">Kicken</button>
|
| 795 |
+
</div>`);
|
| 796 |
+
}
|
| 797 |
+
function doKick(u) {
|
| 798 |
+
const reason=document.getElementById('m-reason')?.value||'';
|
| 799 |
+
if (!DB.moderation.kicked) DB.moderation.kicked={};
|
| 800 |
+
DB.moderation.kicked[u.toLowerCase()]={by:currentUser.username,ts:Date.now(),reason};
|
| 801 |
+
apiSave();
|
| 802 |
+
sysMsg(`${u} wurde von ${currentUser.username} gekickt.${reason?' Grund: '+reason:''}`);
|
| 803 |
+
clearModal(); showToast(`${u} gekickt`,'var(--warn)');
|
| 804 |
+
}
|
| 805 |
+
function openTimeoutModal(u) {
|
| 806 |
+
showModal(`<div class="modal-title">⏱ Timeout: ${escHtml(u)}</div>
|
| 807 |
+
<div class="modal-sub">Stummschalten für eine bestimmte Zeit.</div>
|
| 808 |
+
<div class="modal-field"><label>Dauer</label>
|
| 809 |
+
<select id="m-dur">
|
| 810 |
+
<option value="60000">1 Minute</option><option value="300000">5 Minuten</option>
|
| 811 |
+
<option value="600000">10 Minuten</option><option value="1800000">30 Minuten</option>
|
| 812 |
+
<option value="3600000">1 Stunde</option><option value="86400000">24 Stunden</option>
|
| 813 |
+
</select></div>
|
| 814 |
+
<div class="modal-field"><label>Grund</label><input type="text" id="m-reason" placeholder="z.B. Spam"></div>
|
| 815 |
+
<div class="modal-btns">
|
| 816 |
+
<button class="modal-btn secondary" onclick="clearModal()">Abbrechen</button>
|
| 817 |
+
<button class="modal-btn warn-btn" onclick="doTimeout('${escHtml(u)}')">Timeout</button>
|
| 818 |
+
</div>`);
|
| 819 |
+
}
|
| 820 |
+
function doTimeout(u) {
|
| 821 |
+
const dur=parseInt(document.getElementById('m-dur').value);
|
| 822 |
+
const reason=document.getElementById('m-reason')?.value||'';
|
| 823 |
+
if (!DB.moderation.timeouts) DB.moderation.timeouts={};
|
| 824 |
+
DB.moderation.timeouts[u.toLowerCase()]={until:Date.now()+dur,by:currentUser.username,reason};
|
| 825 |
+
apiSave();
|
| 826 |
+
sysMsg(`${u} stummgeschaltet für ${Math.round(dur/60000)} Min.${reason?' Grund: '+reason:''}`);
|
| 827 |
+
clearModal(); showToast(`${u} stummgeschaltet`,'var(--warn)');
|
| 828 |
+
}
|
| 829 |
+
function openBanModal(u) {
|
| 830 |
+
showModal(`<div class="modal-title" style="color:var(--danger)">🚫 Ban: ${escHtml(u)}</div>
|
| 831 |
+
<div class="modal-sub">Permanenter Bann.</div>
|
| 832 |
+
<div class="modal-field"><label>Grund</label><input type="text" id="m-reason" placeholder="Banngrund (Pflicht)"></div>
|
| 833 |
+
<div class="modal-btns">
|
| 834 |
+
<button class="modal-btn secondary" onclick="clearModal()">Abbrechen</button>
|
| 835 |
+
<button class="modal-btn danger-btn" onclick="doBan('${escHtml(u)}')">BANNEN</button>
|
| 836 |
+
</div>`);
|
| 837 |
+
}
|
| 838 |
+
function doBan(u) {
|
| 839 |
+
const reason=document.getElementById('m-reason')?.value||'';
|
| 840 |
+
if (!reason) { showToast('Bitte einen Grund angeben!','var(--danger)'); return; }
|
| 841 |
+
if (!DB.moderation.bans) DB.moderation.bans={};
|
| 842 |
+
DB.moderation.bans[u.toLowerCase()]={by:currentUser.username,ts:Date.now(),reason};
|
| 843 |
+
const fp=DB.users[u.toLowerCase()]?._fp;
|
| 844 |
+
if (fp) { if (!DB.moderation.banned_fps) DB.moderation.banned_fps={}; DB.moderation.banned_fps[fp]=true; }
|
| 845 |
+
apiSave();
|
| 846 |
+
sysMsg(`${u} wurde von ${currentUser.username} gebannt. Grund: ${reason}`);
|
| 847 |
+
clearModal(); showToast(`${u} gebannt`,'var(--danger)');
|
| 848 |
+
}
|
| 849 |
+
function openRoleModal(u) {
|
| 850 |
+
showModal(`<div class="modal-title">🎖 Rolle: ${escHtml(u)}</div>
|
| 851 |
+
<div class="modal-sub">Rolle des Users ändern.</div>
|
| 852 |
+
<div class="modal-field"><label>Neue Rolle</label>
|
| 853 |
+
<select id="m-role">
|
| 854 |
+
<option value="member">Mitglied</option><option value="vip">💎 VIP</option>
|
| 855 |
+
<option value="mod">⭐ Moderator</option>
|
| 856 |
+
${currentUser.role==='owner'?'<option value="admin">🔰 Admin</option>':''}
|
| 857 |
+
</select></div>
|
| 858 |
+
<div class="modal-btns">
|
| 859 |
+
<button class="modal-btn secondary" onclick="clearModal()">Abbrechen</button>
|
| 860 |
+
<button class="modal-btn primary" onclick="doSetRole('${escHtml(u)}')">Speichern</button>
|
| 861 |
+
</div>`);
|
| 862 |
+
}
|
| 863 |
+
function doSetRole(u) {
|
| 864 |
+
const newRole=document.getElementById('m-role').value;
|
| 865 |
+
const target=DB.users[u.toLowerCase()]; if (!target) return clearModal();
|
| 866 |
+
if (target.role==='owner'){showToast('Owner-Rolle kann nicht geändert werden','var(--danger)');return clearModal();}
|
| 867 |
+
if (currentUser.role!=='owner'&&ROLE_PRIORITY[target.role]>=ROLE_PRIORITY[currentUser.role]){
|
| 868 |
+
showToast('Keine Berechtigung','var(--danger)');return clearModal();
|
| 869 |
+
}
|
| 870 |
+
DB.users[u.toLowerCase()].role=newRole;
|
| 871 |
+
apiSave();
|
| 872 |
+
sysMsg(`${u} → Rolle "${ROLE_LABELS[newRole]}" (von ${currentUser.username})`);
|
| 873 |
+
clearModal(); showToast(`${u} → ${ROLE_LABELS[newRole]}`,'var(--green)');
|
| 874 |
+
}
|
| 875 |
+
function clearUserMsgs(u) {
|
| 876 |
+
if (!hasRole('mod')) return;
|
| 877 |
+
const ch=DB.msgs[currentChannel]||{};
|
| 878 |
+
for (const [k,m] of Object.entries(ch)) { if (m.author===u) delete DB.msgs[currentChannel][k]; }
|
| 879 |
+
apiSave();
|
| 880 |
+
renderChannelMessages(currentChannel);
|
| 881 |
+
showToast(`Nachrichten von ${u} gelöscht`,'var(--warn)');
|
| 882 |
+
}
|
| 883 |
+
function sysMsg(text) {
|
| 884 |
+
if (!currentChannel) return;
|
| 885 |
+
if (!DB.msgs[currentChannel]) DB.msgs[currentChannel]={};
|
| 886 |
+
dbPush(`msgs/${currentChannel}`,{system:true,text,ts:Date.now()});
|
| 887 |
+
}
|
| 888 |
+
|
| 889 |
+
// ─── PROFILE ──────────────────────────────────────────────────
|
| 890 |
+
function showProfileModal(username) {
|
| 891 |
+
const u=DB.users[username.toLowerCase()]; if (!u) return;
|
| 892 |
+
showModal(`<div class="modal-title">👤 ${escHtml(u.username)} ${ROLE_BADGE[u.role]||''}</div>
|
| 893 |
+
<div class="modal-sub">Rolle: ${ROLE_LABELS[u.role]||'Mitglied'} · Beigetreten: ${new Date(u.joined||Date.now()).toLocaleDateString('de-DE')}</div>
|
| 894 |
+
<div style="text-align:center;margin:14px 0">
|
| 895 |
+
<div class="user-avatar-sm av-color-${u.color}" style="width:60px;height:60px;font-size:1.5rem;margin:0 auto 12px">${u.username[0].toUpperCase()}</div>
|
| 896 |
+
</div>
|
| 897 |
+
<div class="modal-btns">
|
| 898 |
+
<button class="modal-btn secondary" onclick="clearModal()">Schließen</button>
|
| 899 |
+
<button class="modal-btn primary" onclick="clearModal();openDM('${escHtml(u.username)}')">💬 DM senden</button>
|
| 900 |
+
</div>`);
|
| 901 |
+
}
|
| 902 |
+
|
| 903 |
+
// ─── SETTINGS ─────────────────────────────────────────────────
|
| 904 |
+
const _st={};
|
| 905 |
+
function openSettings() {
|
| 906 |
+
const s=currentUser.settings||{};
|
| 907 |
+
showModal(`<div class="modal-title">⚙️ Einstellungen</div>
|
| 908 |
+
<div class="modal-tabs">
|
| 909 |
+
<button class="modal-tab active" onclick="switchSettingsTab('konto',this)">Konto</button>
|
| 910 |
+
<button class="modal-tab" onclick="switchSettingsTab('darstellung',this)">Darstellung</button>
|
| 911 |
+
${hasRole('mod')?'<button class="modal-tab" onclick="switchSettingsTab(\'automod\',this)">AutoMod</button>':''}
|
| 912 |
+
${hasRole('admin')?'<button class="modal-tab" onclick="switchSettingsTab(\'tickets\',this)">Tickets</button>':''}
|
| 913 |
+
</div>
|
| 914 |
+
<div id="settings-tab-konto">
|
| 915 |
+
<div class="settings-section"><h4>Konto</h4>
|
| 916 |
+
<div class="modal-field"><label>Neuer Username</label><input type="text" id="s-user" placeholder="${escHtml(currentUser.username)}"></div>
|
| 917 |
+
<div class="modal-field"><label>Neues Passwort</label><input type="password" id="s-pass" placeholder="Leer = keine Änderung"></div>
|
| 918 |
+
<div class="modal-field"><label>Passwort bestätigen</label><input type="password" id="s-pass2"></div>
|
| 919 |
+
</div>
|
| 920 |
+
<div class="settings-section"><h4>Benachrichtigungen</h4>
|
| 921 |
+
<div class="toggle-row"><label>DM-Benachrichtigungen</label>
|
| 922 |
+
<div class="toggle ${s.notif!==false?'on':''}" id="toggle-notif" onclick="toggleST('notif')"></div>
|
| 923 |
+
</div>
|
| 924 |
+
</div>
|
| 925 |
+
</div>
|
| 926 |
+
<div id="settings-tab-darstellung" style="display:none">
|
| 927 |
+
<div class="settings-section"><h4>Avatar-Farbe</h4>
|
| 928 |
+
<div style="display:flex;gap:10px;margin:10px 0">
|
| 929 |
+
${[0,1,2,3,4].map(i=>`<div class="user-avatar-sm av-color-${i}" style="width:36px;height:36px;cursor:pointer${currentUser.color===i?';box-shadow:0 0 8px currentColor':''}" onclick="setAvatarColor(${i})">${currentUser.username[0].toUpperCase()}</div>`).join('')}
|
| 930 |
+
</div>
|
| 931 |
+
</div>
|
| 932 |
+
</div>
|
| 933 |
+
${hasRole('mod')?`<div id="settings-tab-automod" style="display:none">
|
| 934 |
+
<div class="settings-section"><h4>AutoMod</h4>
|
| 935 |
+
<div class="toggle-row"><label>AutoMod aktiv</label><div class="toggle ${appConfig.automod?.enabled?'on':''}" id="toggle-am" onclick="toggleST('am')"></div></div>
|
| 936 |
+
<div class="modal-field"><label>Max. Nachrichtenlänge</label><input type="number" id="s-maxlen" value="${appConfig.automod?.maxMsgLength||800}"></div>
|
| 937 |
+
<div class="modal-field"><label>Spam-Grenze (Nachrichten/10s)</label><input type="number" id="s-spam" value="${appConfig.automod?.spamThreshold||5}"></div>
|
| 938 |
+
<div class="modal-field"><label>Verbotene Wörter</label>
|
| 939 |
+
<div id="bw-tags">${(appConfig.automod?.bannedWords||[]).map(w=>`<span class="tag">${escHtml(w)}<button class="tag-remove" onclick="removeBW('${escHtml(w)}')">×</button></span>`).join('')}</div>
|
| 940 |
+
<div style="display:flex;gap:6px;margin-top:6px">
|
| 941 |
+
<input class="tag-input" type="text" id="new-bw" placeholder="Wort hinzufügen" style="flex:1">
|
| 942 |
+
<button class="modal-btn primary" style="flex:none;width:auto;padding:5px 12px;font-size:.7rem" onclick="addBW()">+</button>
|
| 943 |
+
</div>
|
| 944 |
+
</div>
|
| 945 |
+
<div class="toggle-row"><label>Caps-Filter</label><div class="toggle ${appConfig.automod?.capsFilter?'on':''}" id="toggle-caps" onclick="toggleST('caps')"></div></div>
|
| 946 |
+
<div class="toggle-row"><label>Link-Filter</label><div class="toggle ${appConfig.automod?.linkFilter?'on':''}" id="toggle-links" onclick="toggleST('links')"></div></div>
|
| 947 |
+
</div>
|
| 948 |
+
</div>`:''}
|
| 949 |
+
${hasRole('admin')?`<div id="settings-tab-tickets" style="display:none">
|
| 950 |
+
<div class="settings-section"><h4>Ticket-System</h4><div id="admin-tickets-list">Wird geladen...</div></div>
|
| 951 |
+
</div>`:''}
|
| 952 |
+
<div class="modal-btns">
|
| 953 |
+
<button class="modal-btn secondary" onclick="clearModal()">Schließen</button>
|
| 954 |
+
<button class="modal-btn primary" onclick="saveSettings()">Speichern</button>
|
| 955 |
+
</div>`,true);
|
| 956 |
+
if (hasRole('admin')) setTimeout(loadAdminTickets,100);
|
| 957 |
+
}
|
| 958 |
+
function toggleST(id){const el=document.getElementById('toggle-'+id);if(!el)return;const on=!el.classList.contains('on');el.classList.toggle('on',on);_st[id]=on;}
|
| 959 |
+
function switchSettingsTab(tab,btn){
|
| 960 |
+
document.querySelectorAll('[id^="settings-tab-"]').forEach(el=>el.style.display='none');
|
| 961 |
+
document.querySelectorAll('.modal-tab').forEach(el=>el.classList.remove('active'));
|
| 962 |
+
const el=document.getElementById('settings-tab-'+tab);if(el)el.style.display='';
|
| 963 |
+
if(btn)btn.classList.add('active');
|
| 964 |
+
if(tab==='tickets')loadAdminTickets();
|
| 965 |
+
}
|
| 966 |
+
function addBW(){const i=document.getElementById('new-bw');const w=i.value.trim().toLowerCase();if(!w)return;if(!appConfig.automod)appConfig.automod={};if(!appConfig.automod.bannedWords)appConfig.automod.bannedWords=[];if(!appConfig.automod.bannedWords.includes(w)){appConfig.automod.bannedWords.push(w);document.getElementById('bw-tags').insertAdjacentHTML('beforeend',`<span class="tag">${escHtml(w)}<button class="tag-remove" onclick="removeBW('${escHtml(w)}')">×</button></span>`);}i.value='';}
|
| 967 |
+
function removeBW(w){if(!appConfig.automod?.bannedWords)return;appConfig.automod.bannedWords=appConfig.automod.bannedWords.filter(x=>x!==w);const el=document.getElementById('bw-tags');if(el)el.innerHTML=appConfig.automod.bannedWords.map(x=>`<span class="tag">${escHtml(x)}<button class="tag-remove" onclick="removeBW('${escHtml(x)}')">×</button></span>`).join('');}
|
| 968 |
+
function setAvatarColor(c){currentUser.color=c;DB.users[currentUser.username.toLowerCase()].color=c;apiSave();updateTopbar();}
|
| 969 |
+
function saveSettings(){
|
| 970 |
+
const me=DB.users[currentUser.username.toLowerCase()];if(!me)return clearModal();
|
| 971 |
+
const newU=document.getElementById('s-user')?.value.trim();
|
| 972 |
+
if(newU&&newU!==currentUser.username){
|
| 973 |
+
if(newU.length<2||newU.length>20){showToast('Username: 2-20 Zeichen','var(--danger)');return;}
|
| 974 |
+
if(!/^[a-zA-Z0-9_]+$/.test(newU)){showToast('Nur Buchstaben, Zahlen, _','var(--danger)');return;}
|
| 975 |
+
if(DB.users[newU.toLowerCase()]&&newU.toLowerCase()!==currentUser.username.toLowerCase()){showToast('Username bereits vergeben','var(--danger)');return;}
|
| 976 |
+
delete DB.users[currentUser.username.toLowerCase()];
|
| 977 |
+
me.username=newU;
|
| 978 |
+
DB.users[newU.toLowerCase()]=me;
|
| 979 |
+
currentUser.username=newU;
|
| 980 |
+
}
|
| 981 |
+
const np=document.getElementById('s-pass')?.value,np2=document.getElementById('s-pass2')?.value;
|
| 982 |
+
if(np){if(np.length<4){showToast('Passwort mind. 4 Zeichen','var(--danger)');return;}if(np!==np2){showToast('Passwörter stimmen nicht überein','var(--danger)');return;}me.password=encode(np);}
|
| 983 |
+
if(!me.settings)me.settings={};
|
| 984 |
+
if('notif' in _st)me.settings.notif=_st.notif;
|
| 985 |
+
if(hasRole('mod')&&appConfig.automod){
|
| 986 |
+
const ml=document.getElementById('s-maxlen'),sp=document.getElementById('s-spam');
|
| 987 |
+
if(ml)appConfig.automod.maxMsgLength=parseInt(ml.value)||800;
|
| 988 |
+
if(sp)appConfig.automod.spamThreshold=parseInt(sp.value)||5;
|
| 989 |
+
if('am' in _st)appConfig.automod.enabled=_st.am;
|
| 990 |
+
if('caps' in _st)appConfig.automod.capsFilter=_st.caps;
|
| 991 |
+
if('links' in _st)appConfig.automod.linkFilter=_st.links;
|
| 992 |
+
DB.config.automod=appConfig.automod;
|
| 993 |
+
}
|
| 994 |
+
DB.users[me.username.toLowerCase()]=me;
|
| 995 |
+
apiSave();
|
| 996 |
+
currentUser={...me};
|
| 997 |
+
updateTopbar();clearModal();
|
| 998 |
+
showToast('✓ Einstellungen gespeichert','var(--green)');
|
| 999 |
+
}
|
| 1000 |
+
|
| 1001 |
+
// ─── TICKETS ──────────────────────────────────────────────────
|
| 1002 |
+
function openCreateTicket(){
|
| 1003 |
+
showModal(`<div class="modal-title">🎫 Ticket erstellen</div>
|
| 1004 |
+
<div class="modal-sub">Wende dich an das Team!</div>
|
| 1005 |
+
<div class="modal-field"><label>Kategorie</label>
|
| 1006 |
+
<select id="t-cat"><option value="support">❓ Support</option><option value="report">🚨 Meldung</option><option value="appeal">⚖️ Ban-Appeal</option><option value="other">💭 Sonstiges</option></select></div>
|
| 1007 |
+
<div class="modal-field"><label>Betreff</label><input type="text" id="t-title" maxlength="80"></div>
|
| 1008 |
+
<div class="modal-field"><label>Beschreibung</label><textarea id="t-desc" rows="4"></textarea></div>
|
| 1009 |
+
<div class="modal-btns">
|
| 1010 |
+
<button class="modal-btn secondary" onclick="clearModal()">Abbrechen</button>
|
| 1011 |
+
<button class="modal-btn primary" onclick="submitTicket()">Erstellen</button>
|
| 1012 |
+
</div>`);
|
| 1013 |
+
}
|
| 1014 |
+
function submitTicket(){
|
| 1015 |
+
const cat=document.getElementById('t-cat')?.value;
|
| 1016 |
+
const title=document.getElementById('t-title')?.value.trim();
|
| 1017 |
+
const desc=document.getElementById('t-desc')?.value.trim();
|
| 1018 |
+
if(!title||!desc){showToast('Bitte alle Felder ausfüllen','var(--danger)');return;}
|
| 1019 |
+
const id='TKT-'+String(Date.now()).slice(-5);
|
| 1020 |
+
if(!DB.tickets)DB.tickets={};
|
| 1021 |
+
dbPush('tickets',{id,cat,title,desc,author:currentUser.username,status:'open',ts:Date.now()});
|
| 1022 |
+
clearModal();showToast(`🎫 Ticket ${id} erstellt`,'var(--green)');
|
| 1023 |
+
}
|
| 1024 |
+
function loadAdminTickets(){
|
| 1025 |
+
const el=document.getElementById('admin-tickets-list');if(!el)return;
|
| 1026 |
+
const tickets=Object.values(DB.tickets||{}).sort((a,b)=>b.ts-a.ts);
|
| 1027 |
+
if(!tickets.length){el.innerHTML='<div style="color:var(--muted);text-align:center;padding:20px;font-size:.85rem">Keine Tickets</div>';return;}
|
| 1028 |
+
el.innerHTML=tickets.map(t=>`<div class="ticket-item ${t.status}" onclick="openTicketDetail('${escHtml(t._key||t.id)}')">
|
| 1029 |
+
<div class="ticket-meta">${t.id} · ${t.cat} · ${new Date(t.ts).toLocaleDateString('de-DE')} · ${t.author}</div>
|
| 1030 |
+
<div class="ticket-title">${escHtml(t.title)}</div>
|
| 1031 |
+
<div style="font-size:.75rem;color:${t.status==='open'?'var(--green)':'var(--muted)'}">● ${t.status==='open'?'Offen':'Geschlossen'}</div>
|
| 1032 |
+
</div>`).join('');
|
| 1033 |
+
}
|
| 1034 |
+
function openTicketDetail(key){
|
| 1035 |
+
const t=DB.tickets[key];if(!t)return;
|
| 1036 |
+
showModal(`<div class="modal-title">🎫 ${escHtml(t.id)}: ${escHtml(t.title)}</div>
|
| 1037 |
+
<div class="modal-sub">Von ${escHtml(t.author)} · ${new Date(t.ts).toLocaleDateString('de-DE')} · ${t.status}</div>
|
| 1038 |
+
<div style="background:rgba(0,0,0,0.3);padding:12px;border:1px solid var(--border);font-size:.9rem;margin-bottom:14px;border-radius:2px">${escHtml(t.desc)}</div>
|
| 1039 |
+
${hasRole('mod')?`<div class="modal-btns">
|
| 1040 |
+
<button class="modal-btn secondary" onclick="clearModal()">Schließen</button>
|
| 1041 |
+
<button class="modal-btn ${t.status==='open'?'danger-btn':'success-btn'}" onclick="toggleTicket('${key}')">
|
| 1042 |
+
${t.status==='open'?'Ticket schließen':'Ticket öffnen'}</button></div>`
|
| 1043 |
+
:`<div class="modal-btns"><button class="modal-btn secondary" onclick="clearModal()">Schließen</button></div>`},true);
|
| 1044 |
+
}
|
| 1045 |
+
function toggleTicket(key){
|
| 1046 |
+
const t=DB.tickets[key];if(!t)return;
|
| 1047 |
+
t.status=t.status==='open'?'closed':'open';
|
| 1048 |
+
apiSave();clearModal();
|
| 1049 |
+
showToast(`Ticket ${t.id} ${t.status==='open'?'geöffnet':'geschlossen'}`,'var(--accent)');
|
| 1050 |
+
}
|
| 1051 |
+
|
| 1052 |
+
// ─── SEARCH & PINS ────────────────────────────────────────────
|
| 1053 |
+
async function openSearchModal(){
|
| 1054 |
+
showModal(`<div class="modal-title">🔍 Nachrichten durchsuchen</div>
|
| 1055 |
+
<div class="modal-field"><label>Suchbegriff</label>
|
| 1056 |
+
<input type="text" id="search-q" placeholder="Suche im aktuellen Channel..." oninput="liveSearch(this.value)">
|
| 1057 |
+
</div>
|
| 1058 |
+
<div id="search-results" style="max-height:300px;overflow-y:auto;margin-top:10px"></div>
|
| 1059 |
+
<div class="modal-btns"><button class="modal-btn secondary" onclick="clearModal()">Schließen</button></div>`);
|
| 1060 |
+
}
|
| 1061 |
+
function liveSearch(query){
|
| 1062 |
+
const res=document.getElementById('search-results');
|
| 1063 |
+
if(!query||query.length<2){res.innerHTML='';return;}
|
| 1064 |
+
const msgs=getMsgs(currentChannel).filter(m=>!m.system&&m.text?.toLowerCase().includes(query.toLowerCase()));
|
| 1065 |
+
if(!msgs.length){res.innerHTML='<div style="color:var(--muted);text-align:center;padding:12px;font-size:.85rem">Keine Ergebnisse</div>';return;}
|
| 1066 |
+
res.innerHTML=msgs.slice(-20).map(m=>`<div style="padding:8px 0;border-bottom:1px solid var(--border)">
|
| 1067 |
+
<div style="font-size:.72rem;color:var(--muted);font-family:Orbitron,monospace">${m.author} · ${new Date(m.ts).toLocaleDateString('de-DE')}</div>
|
| 1068 |
+
<div style="font-size:.9rem;color:var(--text)">${escHtml(m.text).replace(new RegExp(escHtml(query),'gi'),s=>`<mark style="background:rgba(0,212,255,0.2);color:var(--accent)">${s}</mark>`)}</div>
|
| 1069 |
+
</div>`).join('');
|
| 1070 |
+
}
|
| 1071 |
+
async function openPinsModal(){
|
| 1072 |
+
const pins=Array.isArray(DB.pins)?DB.pins.filter(p=>p.channel===currentChannel):[];
|
| 1073 |
+
showModal(`<div class="modal-title">📌 Angepinnte Nachrichten</div>
|
| 1074 |
+
<div style="max-height:350px;overflow-y:auto">
|
| 1075 |
+
${!pins.length?'<div style="color:var(--muted);text-align:center;padding:20px;font-size:.85rem">Keine angepinnten Nachrichten</div>':
|
| 1076 |
+
pins.map(p=>`<div style="padding:10px 0;border-bottom:1px solid var(--border)">
|
| 1077 |
+
<div style="font-size:.7rem;color:var(--muted);font-family:Orbitron,monospace">📌 ${p.author} · angeheftet von ${p.by}</div>
|
| 1078 |
+
<div style="font-size:.9rem;color:var(--text);margin-top:4px">${escHtml(p.text)}</div>
|
| 1079 |
+
</div>`).join('')}
|
| 1080 |
+
</div>
|
| 1081 |
+
<div class="modal-btns"><button class="modal-btn secondary" onclick="clearModal()">Schließen</button></div>`);
|
| 1082 |
+
}
|
| 1083 |
+
|
| 1084 |
+
// ─── SPAM CAPTCHA ─────────────────────────────────────────────
|
| 1085 |
+
function showSpamCaptchaModal(){
|
| 1086 |
+
const d=genCaptcha();captchaData.spam=d;
|
| 1087 |
+
showModal(`<div class="modal-title">🤖 Anti-Spam Prüfung</div>
|
| 1088 |
+
<div class="modal-sub">Du schreibst zu schnell. Löse das Captcha.</div>
|
| 1089 |
+
<div class="captcha-modal-question" id="spam-q">${d.q}</div>
|
| 1090 |
+
<div class="modal-field"><label>Antwort</label><input type="number" id="spam-a" placeholder="?" onkeydown="if(event.key==='Enter')spamSubmit()"></div>
|
| 1091 |
+
<div class="auth-error" id="spam-err"></div>
|
| 1092 |
+
<div class="modal-btns">
|
| 1093 |
+
<button class="modal-btn secondary" onclick="clearModal()">Abbrechen</button>
|
| 1094 |
+
<button class="modal-btn primary" onclick="spamSubmit()">Bestätigen</button>
|
| 1095 |
+
</div>`);
|
| 1096 |
+
}
|
| 1097 |
+
async function spamSubmit(){
|
| 1098 |
+
const ans=parseInt(document.getElementById('spam-a')?.value);
|
| 1099 |
+
if(ans!==captchaData.spam?.ans){
|
| 1100 |
+
const d=genCaptcha();captchaData.spam=d;
|
| 1101 |
+
const q=document.getElementById('spam-q');if(q)q.textContent=d.q;
|
| 1102 |
+
const e=document.getElementById('spam-err');if(e)e.textContent='❌ Falsche Antwort!';
|
| 1103 |
+
return;
|
| 1104 |
+
}
|
| 1105 |
+
clearModal();spamTs=[];
|
| 1106 |
+
if(pendingSpamMsg){await sendMessage();pendingSpamMsg=null;}
|
| 1107 |
+
}
|
| 1108 |
+
|
| 1109 |
+
// ─── MODAL SYSTEM ─────────────────────────────────────────────
|
| 1110 |
+
function showModal(html,wide=false){
|
| 1111 |
+
clearModal();
|
| 1112 |
+
const o=document.createElement('div');
|
| 1113 |
+
o.className='modal-overlay';o.id='active-modal';
|
| 1114 |
+
o.innerHTML=`<div class="modal${wide?' wide':''}">${html}</div>`;
|
| 1115 |
+
o.onclick=e=>{if(e.target===o)clearModal();};
|
| 1116 |
+
document.getElementById('modal-container').appendChild(o);
|
| 1117 |
+
}
|
| 1118 |
+
function clearModal(){document.getElementById('active-modal')?.remove();}
|
| 1119 |
+
function showKickedModal(){
|
| 1120 |
+
showModal(`<div class="modal-title">👢 Du wurdest gekickt</div>
|
| 1121 |
+
<div class="modal-sub">Ein Moderator hat dich aus dem Chat entfernt.</div>
|
| 1122 |
+
<div class="modal-btns"><button class="modal-btn primary" onclick="doLogout();clearModal()">Zum Login</button></div>`);
|
| 1123 |
+
}
|
| 1124 |
+
|
| 1125 |
+
// ─── HELPERS ──────────────────────────────────────────────────
|
| 1126 |
+
function encode(s){try{return btoa(unescape(encodeURIComponent(s)));}catch{return btoa(s);}}
|
| 1127 |
+
function decode(s){try{return decodeURIComponent(escape(atob(s)));}catch{try{return atob(s);}catch{return '';}}}
|
| 1128 |
+
function escHtml(str){return String(str||'').replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,''');}
|
| 1129 |
+
function showBanned(){document.getElementById('banned-screen').style.display='flex';document.getElementById('auth-screen').style.display='none';document.getElementById('app').classList.remove('visible');}
|
| 1130 |
+
function showAuthSuccess(msg){const el=document.getElementById('auth-error');el.style.color='var(--green)';el.textContent=msg;setTimeout(()=>{el.style.color='';el.textContent='';},3000);}
|
| 1131 |
+
function showToast(msg,color='var(--accent)'){const t=document.createElement('div');t.className='toast';t.style.borderColor=color;t.style.color=color;t.textContent=msg;document.body.appendChild(t);setTimeout(()=>t.remove(),3000);}
|
| 1132 |
+
|
| 1133 |
+
// ─── INIT ─────────────────────────────────────────────────────
|
| 1134 |
+
(async function init(){
|
| 1135 |
+
refreshCaptcha('login');
|
| 1136 |
+
refreshCaptcha('reg');
|
| 1137 |
+
|
| 1138 |
+
// DB laden
|
| 1139 |
+
showToast('⟳ Verbinde...','var(--muted)');
|
| 1140 |
+
await apiLoad();
|
| 1141 |
+
|
| 1142 |
+
if (!isConfigured()) {
|
| 1143 |
+
showToast('⚠ JSONBin nicht konfiguriert – lokaler Modus','var(--warn)');
|
| 1144 |
+
} else {
|
| 1145 |
+
showToast('✓ Verbunden','var(--green)');
|
| 1146 |
+
}
|
| 1147 |
+
|
| 1148 |
+
// Ban-Check
|
| 1149 |
+
if (DB.moderation.banned_fps?.[MY_FP]) { showBanned(); return; }
|
| 1150 |
+
|
| 1151 |
+
// Owner sicherstellen
|
| 1152 |
+
const ownerKey=OWNER_NAME.toLowerCase();
|
| 1153 |
+
if (!DB.users[ownerKey]) {
|
| 1154 |
+
DB.users[ownerKey]={username:OWNER_NAME,password:encode(OWNER_PASS),color:1,role:'owner',joined:Date.now(),settings:{lang:'de',translate:false,notif:true}};
|
| 1155 |
+
apiSave();
|
| 1156 |
+
} else {
|
| 1157 |
+
DB.users[ownerKey].role='owner';
|
| 1158 |
+
}
|
| 1159 |
+
|
| 1160 |
+
// Config laden
|
| 1161 |
+
appConfig=DB.config||{};
|
| 1162 |
+
if (!appConfig.channels) {
|
| 1163 |
+
appConfig.channels=window.DEFAULT_CHANNELS||[];
|
| 1164 |
+
appConfig.automod=window.DEFAULT_AUTOMOD||{};
|
| 1165 |
+
DB.config=appConfig;
|
| 1166 |
+
apiSave();
|
| 1167 |
+
}
|
| 1168 |
+
})();
|
index.html
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="de">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>NoahsChat</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
</head>
|
| 9 |
+
<body>
|
| 10 |
+
|
| 11 |
+
<!-- BANNED SCREEN -->
|
| 12 |
+
<div id="banned-screen">
|
| 13 |
+
<div class="banned-icon">🚫</div>
|
| 14 |
+
<div class="banned-title">GEBANNT</div>
|
| 15 |
+
<div class="banned-sub" id="banned-sub">Du wurdest permanent von NoahsChat gebannt.</div>
|
| 16 |
+
</div>
|
| 17 |
+
|
| 18 |
+
<!-- AUTH SCREEN -->
|
| 19 |
+
<div id="auth-screen">
|
| 20 |
+
<div class="auth-box">
|
| 21 |
+
<div class="auth-logo">Noahs<span>Chat</span></div>
|
| 22 |
+
<div class="auth-tagline">by NoahsAPP · v2.0</div>
|
| 23 |
+
|
| 24 |
+
<div class="auth-tabs">
|
| 25 |
+
<button class="auth-tab active" onclick="switchTab('login')">Login</button>
|
| 26 |
+
<button class="auth-tab" onclick="switchTab('register')">Registrieren</button>
|
| 27 |
+
</div>
|
| 28 |
+
|
| 29 |
+
<!-- LOGIN -->
|
| 30 |
+
<div id="tab-login">
|
| 31 |
+
<div class="auth-field">
|
| 32 |
+
<label>Username</label>
|
| 33 |
+
<input type="text" id="login-user" placeholder="dein username" autocomplete="off" onkeydown="if(event.key==='Enter')doLogin()">
|
| 34 |
+
</div>
|
| 35 |
+
<div class="auth-field">
|
| 36 |
+
<label>Passwort</label>
|
| 37 |
+
<input type="password" id="login-pass" placeholder="••••••••" onkeydown="if(event.key==='Enter')doLogin()">
|
| 38 |
+
</div>
|
| 39 |
+
<div class="captcha-box">
|
| 40 |
+
<div>
|
| 41 |
+
<div style="font-size:.6rem;color:var(--muted);letter-spacing:.15em;text-transform:uppercase;margin-bottom:4px">Anti-Bot</div>
|
| 42 |
+
<div class="captcha-question" id="login-q">? + ? = ?</div>
|
| 43 |
+
</div>
|
| 44 |
+
<input class="captcha-input" type="number" id="login-a" placeholder="?" onkeydown="if(event.key==='Enter')doLogin()">
|
| 45 |
+
<button class="captcha-refresh" onclick="refreshCaptcha('login')" title="Neu">↺</button>
|
| 46 |
+
</div>
|
| 47 |
+
<button class="auth-btn" onclick="doLogin()">Einloggen ▶</button>
|
| 48 |
+
</div>
|
| 49 |
+
|
| 50 |
+
<!-- REGISTER -->
|
| 51 |
+
<div id="tab-register" style="display:none">
|
| 52 |
+
<div class="auth-field">
|
| 53 |
+
<label>Username</label>
|
| 54 |
+
<input type="text" id="reg-user" placeholder="wähle einen username" autocomplete="off">
|
| 55 |
+
</div>
|
| 56 |
+
<div class="auth-field">
|
| 57 |
+
<label>Passwort</label>
|
| 58 |
+
<input type="password" id="reg-pass" placeholder="mindestens 4 Zeichen">
|
| 59 |
+
</div>
|
| 60 |
+
<div class="auth-field">
|
| 61 |
+
<label>Passwort bestätigen</label>
|
| 62 |
+
<input type="password" id="reg-pass2" placeholder="nochmal eingeben" onkeydown="if(event.key==='Enter')doRegister()">
|
| 63 |
+
</div>
|
| 64 |
+
<div class="captcha-box">
|
| 65 |
+
<div>
|
| 66 |
+
<div style="font-size:.6rem;color:var(--muted);letter-spacing:.15em;text-transform:uppercase;margin-bottom:4px">Anti-Bot</div>
|
| 67 |
+
<div class="captcha-question" id="reg-q">? + ? = ?</div>
|
| 68 |
+
</div>
|
| 69 |
+
<input class="captcha-input" type="number" id="reg-a" placeholder="?" onkeydown="if(event.key==='Enter')doRegister()">
|
| 70 |
+
<button class="captcha-refresh" onclick="refreshCaptcha('reg')" title="Neu">↺</button>
|
| 71 |
+
</div>
|
| 72 |
+
<button class="auth-btn" onclick="doRegister()">Account erstellen ▶</button>
|
| 73 |
+
</div>
|
| 74 |
+
|
| 75 |
+
<div class="auth-error" id="auth-error"></div>
|
| 76 |
+
</div>
|
| 77 |
+
</div>
|
| 78 |
+
|
| 79 |
+
<!-- MAIN APP -->
|
| 80 |
+
<div id="app">
|
| 81 |
+
|
| 82 |
+
<!-- TOPBAR -->
|
| 83 |
+
<div class="topbar">
|
| 84 |
+
<a href="#" class="topbar-logo">Noahs<span>APP</span></a>
|
| 85 |
+
<div class="topbar-sep"></div>
|
| 86 |
+
<div class="topbar-channel">
|
| 87 |
+
<span id="topbar-channel-name"># allgemein</span>
|
| 88 |
+
</div>
|
| 89 |
+
<div class="topbar-actions">
|
| 90 |
+
<button class="icon-btn" onclick="openCreateTicket()" title="Ticket erstellen">🎫</button>
|
| 91 |
+
<button class="icon-btn" onclick="openSettings()" title="Einstellungen">⚙️</button>
|
| 92 |
+
<div class="topbar-sep"></div>
|
| 93 |
+
<div class="topbar-user">
|
| 94 |
+
<div class="user-avatar-sm" id="topbar-avatar" onclick="openSettings()"></div>
|
| 95 |
+
<span id="topbar-username" style="font-weight:700"></span>
|
| 96 |
+
<span class="topbar-role-badge" id="topbar-role-badge"></span>
|
| 97 |
+
<button class="logout-btn" onclick="doLogout()">Logout</button>
|
| 98 |
+
</div>
|
| 99 |
+
</div>
|
| 100 |
+
</div>
|
| 101 |
+
|
| 102 |
+
<!-- SIDEBAR -->
|
| 103 |
+
<div class="sidebar">
|
| 104 |
+
<div class="sidebar-scroll">
|
| 105 |
+
|
| 106 |
+
<!-- Channels -->
|
| 107 |
+
<div class="sidebar-section">
|
| 108 |
+
Channels
|
| 109 |
+
<span id="online-count" style="color:var(--green);font-family:'Orbitron',monospace">0</span>
|
| 110 |
+
</div>
|
| 111 |
+
<div id="channel-list"></div>
|
| 112 |
+
|
| 113 |
+
<div class="sidebar-divider"></div>
|
| 114 |
+
|
| 115 |
+
<!-- DMs -->
|
| 116 |
+
<div class="sidebar-section">Direktnachrichten</div>
|
| 117 |
+
<div id="dm-list"></div>
|
| 118 |
+
|
| 119 |
+
<div class="sidebar-divider"></div>
|
| 120 |
+
|
| 121 |
+
<!-- Members -->
|
| 122 |
+
<div class="sidebar-section">Mitglieder</div>
|
| 123 |
+
<div id="user-list"></div>
|
| 124 |
+
|
| 125 |
+
</div>
|
| 126 |
+
|
| 127 |
+
<!-- Voice Panel -->
|
| 128 |
+
<div class="voice-panel" id="voice-panel">
|
| 129 |
+
<div class="voice-status-bar">
|
| 130 |
+
<div class="voice-active-dot"></div>
|
| 131 |
+
<div class="voice-name" id="voice-channel-name">🔊 Voice</div>
|
| 132 |
+
<div class="voice-controls">
|
| 133 |
+
<button class="voice-ctrl" id="voice-mute-btn" onclick="toggleMute()">🎙 Stumm</button>
|
| 134 |
+
<button class="voice-ctrl" id="voice-deaf-btn" onclick="toggleDeafen()">🔔 Taub</button>
|
| 135 |
+
<button class="voice-ctrl" style="color:var(--danger)" onclick="leaveVoice()">✕</button>
|
| 136 |
+
</div>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
</div>
|
| 140 |
+
|
| 141 |
+
<!-- CHAT AREA -->
|
| 142 |
+
<div class="chat-area">
|
| 143 |
+
<div class="chat-header">
|
| 144 |
+
<div class="chat-header-info">
|
| 145 |
+
<div class="chat-header-title" id="chat-title">💬 allgemein</div>
|
| 146 |
+
<div class="chat-header-sub" id="chat-sub">Allgemeiner Chat für alle</div>
|
| 147 |
+
</div>
|
| 148 |
+
<div class="chat-header-actions">
|
| 149 |
+
<button class="icon-btn" id="search-btn" title="Suchen" onclick="openSearchModal()">🔍</button>
|
| 150 |
+
<button class="icon-btn" id="pins-btn" title="Angepinnte Nachrichten" onclick="openPinsModal()">📌</button>
|
| 151 |
+
</div>
|
| 152 |
+
</div>
|
| 153 |
+
|
| 154 |
+
<div class="messages" id="messages">
|
| 155 |
+
<div class="empty-chat">
|
| 156 |
+
<div class="empty-chat-icon">💬</div>
|
| 157 |
+
<p>Noch keine Nachrichten. Schreib was!</p>
|
| 158 |
+
</div>
|
| 159 |
+
</div>
|
| 160 |
+
|
| 161 |
+
<div id="timeout-bar" class="timeout-bar" style="display:none">
|
| 162 |
+
⏱ Du bist stummgeschaltet bis <span id="timeout-until"></span>
|
| 163 |
+
</div>
|
| 164 |
+
|
| 165 |
+
<div class="input-area">
|
| 166 |
+
<textarea class="msg-input" id="msg-input" placeholder="Nachricht schreiben..."
|
| 167 |
+
rows="1" onkeydown="handleKey(event)" oninput="autoResize(this)"></textarea>
|
| 168 |
+
<button class="send-btn" id="send-btn" onclick="sendMessage()">SEND</button>
|
| 169 |
+
</div>
|
| 170 |
+
</div>
|
| 171 |
+
|
| 172 |
+
</div>
|
| 173 |
+
|
| 174 |
+
<!-- CONTEXT MENU -->
|
| 175 |
+
<div id="context-menu" style="display:none"></div>
|
| 176 |
+
|
| 177 |
+
<!-- MODAL CONTAINER -->
|
| 178 |
+
<div id="modal-container"></div>
|
| 179 |
+
|
| 180 |
+
<script>
|
| 181 |
+
// ─── DEFAULT DATA (from data.json equivalent) ─────────────────
|
| 182 |
+
window.DEFAULT_CHANNELS = [
|
| 183 |
+
{ id: 'ankuendigungen', name: 'ankündigungen', icon: '📢', sub: 'Wichtige Ankündigungen', adminOnly: true, category: 'info' },
|
| 184 |
+
{ id: 'regeln', name: 'regeln', icon: '📋', sub: 'Serverregeln', readOnly: true, category: 'info' },
|
| 185 |
+
{ id: 'allgemein', name: 'allgemein', icon: '💬', sub: 'Allgemeiner Chat für alle', category: 'chat' },
|
| 186 |
+
{ id: 'gaming', name: 'gaming', icon: '🎮', sub: 'Alles rund ums Gaming', category: 'chat' },
|
| 187 |
+
{ id: 'roblox', name: 'roblox', icon: '🧱', sub: 'Roblox & NoahsHacks', category: 'chat' },
|
| 188 |
+
{ id: 'musik', name: 'musik', icon: '🎵', sub: 'Musik & Playlists', category: 'chat' },
|
| 189 |
+
{ id: 'memes', name: 'memes', icon: '😂', sub: 'Memes & Witze', category: 'fun' },
|
| 190 |
+
{ id: 'off-topic', name: 'off-topic', icon: '💭', sub: 'Alles andere', category: 'fun' },
|
| 191 |
+
{ id: 'kunst', name: 'kunst', icon: '🎨', sub: 'Kreative Werke', category: 'fun' },
|
| 192 |
+
{ id: 'technik', name: 'technik', icon: '💻', sub: 'Tech & Coding', category: 'fun' },
|
| 193 |
+
{ id: 'voicetext', name: 'voice-lounge', icon: '🔊', sub: 'Begleitchat für Voice', category: 'chat' },
|
| 194 |
+
{ id: 'moderators', name: 'mod-logs', icon: '🛡', sub: 'Moderationslog', modOnly: true, category: 'staff' },
|
| 195 |
+
{ id: 'admin', name: 'admin-bereich', icon: '⚙️', sub: 'Nur für Admins', adminOnly: true, category: 'staff' }
|
| 196 |
+
];
|
| 197 |
+
|
| 198 |
+
window.DEFAULT_AUTOMOD = {
|
| 199 |
+
enabled: true,
|
| 200 |
+
maxMsgLength: 800,
|
| 201 |
+
spamThreshold: 5,
|
| 202 |
+
spamWindow: 10000,
|
| 203 |
+
bannedWords: ['scheiß', 'hurensohn', 'wichser', 'fick', 'arschloch'],
|
| 204 |
+
linkFilter: false,
|
| 205 |
+
capsFilter: true,
|
| 206 |
+
capsThreshold: 0.7
|
| 207 |
+
};
|
| 208 |
+
</script>
|
| 209 |
+
|
| 210 |
+
<!-- Search & Pins modals -->
|
| 211 |
+
<script>
|
| 212 |
+
async function openSearchModal() {
|
| 213 |
+
showModal(`
|
| 214 |
+
<div class="modal-title">🔍 Nachrichten durchsuchen</div>
|
| 215 |
+
<div class="modal-field">
|
| 216 |
+
<label>Suchbegriff</label>
|
| 217 |
+
<input type="text" id="search-q" placeholder="Suche im aktuellen Channel..." oninput="liveSearch(this.value)">
|
| 218 |
+
</div>
|
| 219 |
+
<div id="search-results" style="max-height:300px;overflow-y:auto;margin-top:10px"></div>
|
| 220 |
+
<div class="modal-btns">
|
| 221 |
+
<button class="modal-btn secondary" onclick="clearModal()">Schließen</button>
|
| 222 |
+
</div>`);
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
async function liveSearch(query) {
|
| 226 |
+
const results = document.getElementById('search-results');
|
| 227 |
+
if (!query || query.length < 2) { results.innerHTML = ''; return; }
|
| 228 |
+
const msgs = (await DB.get('msgs_' + currentChannel)) || [];
|
| 229 |
+
const found = msgs.filter(m => !m.system && m.text && m.text.toLowerCase().includes(query.toLowerCase()));
|
| 230 |
+
if (!found.length) { results.innerHTML = '<div style="color:var(--muted);text-align:center;padding:12px;font-size:.85rem">Keine Ergebnisse</div>'; return; }
|
| 231 |
+
results.innerHTML = found.slice(-20).map(m => `
|
| 232 |
+
<div style="padding:8px 0;border-bottom:1px solid var(--border)">
|
| 233 |
+
<div style="font-size:.72rem;color:var(--muted);font-family:Orbitron,monospace">${m.author} · ${new Date(m.ts).toLocaleDateString('de-DE')}</div>
|
| 234 |
+
<div style="font-size:.9rem;color:var(--text)">${escHtml(m.text).replace(new RegExp(escHtml(query),'gi'), s => `<mark style="background:rgba(0,212,255,0.2);color:var(--accent)">${s}</mark>`)}</div>
|
| 235 |
+
</div>`).join('');
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
async function openPinsModal() {
|
| 239 |
+
const pins = (await DB.get('pins')) || [];
|
| 240 |
+
const relevant = pins.filter(p => p.channel === currentChannel);
|
| 241 |
+
showModal(`
|
| 242 |
+
<div class="modal-title">📌 Angepinnte Nachrichten</div>
|
| 243 |
+
<div style="max-height:350px;overflow-y:auto">
|
| 244 |
+
${!relevant.length ? '<div style="color:var(--muted);text-align:center;padding:20px;font-size:.85rem">Keine angepinnten Nachrichten</div>' :
|
| 245 |
+
relevant.map(p => `
|
| 246 |
+
<div style="padding:10px 0;border-bottom:1px solid var(--border)">
|
| 247 |
+
<div style="font-size:.7rem;color:var(--muted);font-family:Orbitron,monospace">📌 ${p.author} · angeheftet von ${p.by}</div>
|
| 248 |
+
<div style="font-size:.9rem;color:var(--text);margin-top:4px">${escHtml(p.text)}</div>
|
| 249 |
+
</div>`).join('')}
|
| 250 |
+
</div>
|
| 251 |
+
<div class="modal-btns">
|
| 252 |
+
<button class="modal-btn secondary" onclick="clearModal()">Schließen</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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@300;400;600;700&family=Space+Mono:wght@400;700&display=swap');
|
| 2 |
+
|
| 3 |
+
:root {
|
| 4 |
+
--bg: #050a0f;
|
| 5 |
+
--surface: #0a1520;
|
| 6 |
+
--surface2: #0d1c2e;
|
| 7 |
+
--surface3: #071018;
|
| 8 |
+
--border: rgba(0,212,255,0.12);
|
| 9 |
+
--accent: #00d4ff;
|
| 10 |
+
--accent2: #ff6b35;
|
| 11 |
+
--green: #4eff91;
|
| 12 |
+
--glow: rgba(0,212,255,0.25);
|
| 13 |
+
--text: #e0f4ff;
|
| 14 |
+
--muted: #4a7a99;
|
| 15 |
+
--danger: #ff4466;
|
| 16 |
+
--warn: #ffaa00;
|
| 17 |
+
--purple: #a855f7;
|
| 18 |
+
--gold: #ffd600;
|
| 19 |
+
--sidebar-w: 240px;
|
| 20 |
+
--topbar-h: 52px;
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
* { margin:0; padding:0; box-sizing:border-box; }
|
| 24 |
+
|
| 25 |
+
body {
|
| 26 |
+
background: var(--bg);
|
| 27 |
+
color: var(--text);
|
| 28 |
+
font-family: 'Rajdhani', sans-serif;
|
| 29 |
+
height: 100vh;
|
| 30 |
+
overflow: hidden;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
::-webkit-scrollbar { width: 4px; }
|
| 34 |
+
::-webkit-scrollbar-track { background: transparent; }
|
| 35 |
+
::-webkit-scrollbar-thumb { background: rgba(0,212,255,0.2); border-radius: 2px; }
|
| 36 |
+
|
| 37 |
+
/* ─── BANNED SCREEN ─── */
|
| 38 |
+
#banned-screen {
|
| 39 |
+
position: fixed; inset:0; z-index:9999;
|
| 40 |
+
display: none; align-items:center; justify-content:center;
|
| 41 |
+
background: rgba(5,0,5,0.98); flex-direction:column; gap:16px;
|
| 42 |
+
text-align:center;
|
| 43 |
+
}
|
| 44 |
+
.banned-icon { font-size:4rem; }
|
| 45 |
+
.banned-title { font-family:'Orbitron',monospace; font-size:1.5rem; color:var(--danger); font-weight:900; }
|
| 46 |
+
.banned-sub { color:var(--muted); font-size:0.9rem; letter-spacing:.1em; }
|
| 47 |
+
|
| 48 |
+
/* ─── AUTH SCREEN ─── */
|
| 49 |
+
#auth-screen {
|
| 50 |
+
position: fixed; inset:0; z-index:1000;
|
| 51 |
+
display: flex; align-items:center; justify-content:center;
|
| 52 |
+
background: var(--bg);
|
| 53 |
+
}
|
| 54 |
+
#auth-screen::before {
|
| 55 |
+
content:''; position:absolute; inset:0;
|
| 56 |
+
background-image: linear-gradient(rgba(0,212,255,0.04) 1px, transparent 1px), linear-gradient(90deg,rgba(0,212,255,0.04) 1px,transparent 1px);
|
| 57 |
+
background-size:60px 60px;
|
| 58 |
+
animation: gridMove 20s linear infinite;
|
| 59 |
+
}
|
| 60 |
+
@keyframes gridMove { to { transform:translateY(60px); } }
|
| 61 |
+
|
| 62 |
+
.auth-box {
|
| 63 |
+
position:relative; z-index:1;
|
| 64 |
+
background: linear-gradient(135deg, rgba(10,21,32,0.98), rgba(5,10,15,0.99));
|
| 65 |
+
border: 1px solid rgba(0,212,255,0.2);
|
| 66 |
+
padding: 44px 40px;
|
| 67 |
+
width:100%; max-width:440px;
|
| 68 |
+
clip-path: polygon(0 0,calc(100% - 24px) 0,100% 24px,100% 100%,24px 100%,0 calc(100% - 24px));
|
| 69 |
+
animation: boxIn 0.5s ease-out;
|
| 70 |
+
}
|
| 71 |
+
@keyframes boxIn { from { opacity:0; transform:translateY(30px) scale(0.97); } }
|
| 72 |
+
|
| 73 |
+
.auth-logo { font-family:'Orbitron',monospace; font-size:2rem; font-weight:900; color:var(--accent); text-shadow:0 0 30px var(--glow); margin-bottom:4px; text-align:center; }
|
| 74 |
+
.auth-logo span { color:var(--accent2); }
|
| 75 |
+
.auth-tagline { text-align:center; color:var(--muted); font-size:0.75rem; letter-spacing:.3em; text-transform:uppercase; margin-bottom:30px; }
|
| 76 |
+
|
| 77 |
+
.auth-tabs { display:flex; margin-bottom:24px; border-bottom:1px solid var(--border); }
|
| 78 |
+
.auth-tab { flex:1; padding:10px; background:none; border:none; color:var(--muted); cursor:pointer; font-family:'Orbitron',monospace; font-size:.7rem; letter-spacing:.2em; text-transform:uppercase; transition:color .2s; border-bottom:2px solid transparent; margin-bottom:-1px; }
|
| 79 |
+
.auth-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
|
| 80 |
+
|
| 81 |
+
.auth-field { margin-bottom:14px; }
|
| 82 |
+
.auth-field label { display:block; font-size:.72rem; letter-spacing:.2em; color:var(--muted); text-transform:uppercase; margin-bottom:6px; }
|
| 83 |
+
.auth-field input {
|
| 84 |
+
width:100%; padding:11px 15px;
|
| 85 |
+
background:rgba(0,0,0,0.4);
|
| 86 |
+
border:1px solid var(--border);
|
| 87 |
+
color:var(--text); font-family:'Rajdhani',sans-serif; font-size:1rem; font-weight:600;
|
| 88 |
+
outline:none; transition:border-color .2s,box-shadow .2s;
|
| 89 |
+
clip-path:polygon(6px 0%,100% 0%,calc(100% - 6px) 100%,0% 100%);
|
| 90 |
+
}
|
| 91 |
+
.auth-field input:focus { border-color:rgba(0,212,255,0.5); box-shadow:0 0 20px rgba(0,212,255,0.1); }
|
| 92 |
+
|
| 93 |
+
.captcha-box {
|
| 94 |
+
background:rgba(0,0,0,0.4); border:1px solid rgba(0,212,255,0.15);
|
| 95 |
+
padding:12px 14px; margin-bottom:14px;
|
| 96 |
+
display:flex; align-items:center; gap:12px;
|
| 97 |
+
clip-path:polygon(6px 0%,100% 0%,calc(100% - 6px) 100%,0% 100%);
|
| 98 |
+
}
|
| 99 |
+
.captcha-question { font-family:'Orbitron',monospace; font-size:1rem; font-weight:700; color:var(--accent); flex:1; }
|
| 100 |
+
.captcha-input { width:70px; padding:8px 10px; background:rgba(0,0,0,0.5); border:1px solid var(--border); color:var(--text); font-family:'Orbitron',monospace; font-size:0.95rem; font-weight:700; outline:none; text-align:center; }
|
| 101 |
+
.captcha-input:focus { border-color:rgba(0,212,255,0.5); }
|
| 102 |
+
.captcha-refresh { background:none; border:none; cursor:pointer; color:var(--muted); font-size:1.1rem; transition:color .2s; padding:4px; }
|
| 103 |
+
.captcha-refresh:hover { color:var(--accent); }
|
| 104 |
+
|
| 105 |
+
.auth-btn { width:100%; padding:13px; background:var(--accent); border:none; color:var(--bg); cursor:pointer; font-family:'Orbitron',monospace; font-size:.78rem; font-weight:700; letter-spacing:.2em; text-transform:uppercase; clip-path:polygon(8px 0%,100% 0%,calc(100% - 8px) 100%,0% 100%); transition:all .2s; margin-top:6px; }
|
| 106 |
+
.auth-btn:hover { background:#33ddff; transform:translateY(-2px); box-shadow:0 8px 30px rgba(0,212,255,0.3); }
|
| 107 |
+
.auth-error { color:var(--danger); font-size:.85rem; text-align:center; margin-top:10px; min-height:20px; letter-spacing:.05em; }
|
| 108 |
+
|
| 109 |
+
/* ─── MAIN APP ─── */
|
| 110 |
+
#app { display:none; height:100vh; grid-template-columns:var(--sidebar-w) 1fr; grid-template-rows:var(--topbar-h) 1fr; }
|
| 111 |
+
#app.visible { display:grid; }
|
| 112 |
+
|
| 113 |
+
/* ─── TOPBAR ─── */
|
| 114 |
+
.topbar {
|
| 115 |
+
grid-column: 1 / -1;
|
| 116 |
+
background:rgba(5,10,15,0.98); border-bottom:1px solid var(--border);
|
| 117 |
+
display:flex; align-items:center; padding:0 16px; gap:12px;
|
| 118 |
+
backdrop-filter:blur(10px); position:relative; z-index:100;
|
| 119 |
+
}
|
| 120 |
+
.topbar-logo { font-family:'Orbitron',monospace; font-size:1rem; font-weight:900; color:var(--accent); text-shadow:0 0 15px var(--glow); text-decoration:none; white-space:nowrap; }
|
| 121 |
+
.topbar-logo span { color:var(--accent2); }
|
| 122 |
+
.topbar-sep { width:1px; height:24px; background:var(--border); }
|
| 123 |
+
.topbar-channel { flex:1; font-family:'Orbitron',monospace; font-size:.7rem; color:var(--muted); letter-spacing:.12em; }
|
| 124 |
+
.topbar-channel span { color:var(--accent); }
|
| 125 |
+
.topbar-actions { display:flex; align-items:center; gap:8px; }
|
| 126 |
+
.topbar-user { display:flex; align-items:center; gap:8px; font-size:.9rem; font-weight:600; }
|
| 127 |
+
.user-avatar-sm { width:30px; height:30px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-family:'Orbitron',monospace; font-size:.7rem; font-weight:900; border:1px solid var(--accent); color:var(--accent); background:rgba(0,212,255,0.08); flex-shrink:0; cursor:pointer; }
|
| 128 |
+
.topbar-role-badge { font-size:.85rem; }
|
| 129 |
+
.icon-btn { background:none; border:1px solid var(--border); color:var(--muted); padding:5px 10px; cursor:pointer; font-size:.85rem; transition:all .2s; clip-path:polygon(4px 0%,100% 0%,calc(100% - 4px) 100%,0% 100%); }
|
| 130 |
+
.icon-btn:hover { color:var(--accent); border-color:rgba(0,212,255,0.4); }
|
| 131 |
+
.logout-btn { background:none; border:1px solid rgba(255,68,102,0.3); color:var(--danger); padding:5px 10px; cursor:pointer; font-family:'Rajdhani',sans-serif; font-size:.8rem; letter-spacing:.1em; transition:all .2s; clip-path:polygon(4px 0%,100% 0%,calc(100% - 4px) 100%,0% 100%); }
|
| 132 |
+
.logout-btn:hover { background:rgba(255,68,102,0.1); border-color:var(--danger); }
|
| 133 |
+
|
| 134 |
+
/* ─── SIDEBAR ─── */
|
| 135 |
+
.sidebar { background:var(--surface3); border-right:1px solid var(--border); display:flex; flex-direction:column; overflow:hidden; }
|
| 136 |
+
.sidebar-scroll { flex:1; overflow-y:auto; padding-bottom:12px; }
|
| 137 |
+
|
| 138 |
+
.sidebar-section { padding:14px 14px 5px; font-family:'Orbitron',monospace; font-size:.56rem; letter-spacing:.3em; color:var(--muted); text-transform:uppercase; display:flex; align-items:center; justify-content:space-between; }
|
| 139 |
+
.sidebar-section button { background:none; border:none; color:var(--muted); cursor:pointer; font-size:1rem; line-height:1; padding:0 2px; transition:color .2s; }
|
| 140 |
+
.sidebar-section button:hover { color:var(--accent); }
|
| 141 |
+
|
| 142 |
+
.channel-category { padding:10px 14px 4px; font-family:'Orbitron',monospace; font-size:.52rem; letter-spacing:.25em; color:rgba(74,122,153,0.6); text-transform:uppercase; }
|
| 143 |
+
|
| 144 |
+
.channel-item { display:flex; align-items:center; gap:7px; padding:6px 14px; cursor:pointer; transition:background .15s,color .15s; font-size:.88rem; font-weight:600; color:var(--muted); position:relative; user-select:none; }
|
| 145 |
+
.channel-item:hover { background:rgba(0,212,255,0.05); color:var(--text); }
|
| 146 |
+
.channel-item.active { background:rgba(0,212,255,0.08); color:var(--accent); border-left:2px solid var(--accent); }
|
| 147 |
+
.channel-icon { font-size:.82rem; opacity:.7; }
|
| 148 |
+
.channel-name { flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
| 149 |
+
.unread-badge { background:var(--accent2); color:#fff; font-size:.6rem; font-weight:700; padding:1px 5px; border-radius:10px; font-family:'Orbitron',monospace; flex-shrink:0; }
|
| 150 |
+
.ch-locked { opacity:.4; cursor:default; }
|
| 151 |
+
.ch-locked:hover { background:none; color:var(--muted); }
|
| 152 |
+
|
| 153 |
+
.voice-channel { display:flex; align-items:center; gap:7px; padding:6px 14px; cursor:pointer; transition:background .15s; font-size:.88rem; font-weight:600; color:var(--muted); flex-direction:column; align-items:flex-start; }
|
| 154 |
+
.voice-ch-header { display:flex; align-items:center; gap:7px; width:100%; }
|
| 155 |
+
.voice-ch-header:hover { color:var(--text); }
|
| 156 |
+
.voice-ch-participants { padding-left:22px; display:flex; flex-direction:column; gap:2px; }
|
| 157 |
+
.voice-participant { font-size:.78rem; color:var(--green); display:flex; align-items:center; gap:5px; }
|
| 158 |
+
.voice-participant.muted { color:var(--muted); }
|
| 159 |
+
|
| 160 |
+
.sidebar-divider { height:1px; background:var(--border); margin:6px 14px; }
|
| 161 |
+
|
| 162 |
+
/* Role groups */
|
| 163 |
+
.role-group-header { display:flex; align-items:center; gap:6px; padding:8px 14px 3px; font-family:'Orbitron',monospace; font-size:.55rem; letter-spacing:.2em; text-transform:uppercase; color:var(--muted); cursor:pointer; }
|
| 164 |
+
.role-group-header:hover { color:var(--text); }
|
| 165 |
+
|
| 166 |
+
.user-item { display:flex; align-items:center; gap:8px; padding:5px 14px; cursor:pointer; transition:background .15s; font-size:.86rem; font-weight:600; color:var(--muted); }
|
| 167 |
+
.user-item:hover { background:rgba(0,212,255,0.05); color:var(--text); }
|
| 168 |
+
.user-item.me { cursor:default; }
|
| 169 |
+
.user-item.me:hover { background:none; }
|
| 170 |
+
.user-item.offline { opacity:.5; }
|
| 171 |
+
|
| 172 |
+
.online-dot { width:7px; height:7px; border-radius:50%; background:var(--green); box-shadow:0 0 5px var(--green); flex-shrink:0; }
|
| 173 |
+
.offline-dot { width:7px; height:7px; border-radius:50%; background:var(--muted); flex-shrink:0; }
|
| 174 |
+
.away-dot { width:7px; height:7px; border-radius:50%; background:var(--warn); flex-shrink:0; }
|
| 175 |
+
|
| 176 |
+
/* ─── CHAT AREA ─── */
|
| 177 |
+
.chat-area { display:flex; flex-direction:column; background:var(--bg); overflow:hidden; }
|
| 178 |
+
.chat-header { padding:10px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:12px; background:rgba(5,10,15,0.85); }
|
| 179 |
+
.chat-header-info { flex:1; }
|
| 180 |
+
.chat-header-title { font-family:'Orbitron',monospace; font-size:.85rem; font-weight:700; color:var(--text); }
|
| 181 |
+
.chat-header-sub { font-size:.76rem; color:var(--muted); letter-spacing:.05em; }
|
| 182 |
+
.chat-header-actions { display:flex; gap:6px; }
|
| 183 |
+
|
| 184 |
+
.messages { flex:1; overflow-y:auto; padding:16px 20px; display:flex; flex-direction:column; gap:1px; }
|
| 185 |
+
|
| 186 |
+
.day-divider { display:flex; align-items:center; gap:10px; margin:12px 0; color:var(--muted); font-size:.64rem; letter-spacing:.2em; text-transform:uppercase; font-family:'Orbitron',monospace; }
|
| 187 |
+
.day-divider::before, .day-divider::after { content:''; flex:1; height:1px; background:var(--border); }
|
| 188 |
+
|
| 189 |
+
.msg { display:flex; gap:10px; padding:3px 8px 3px; border-radius:2px; transition:background .15s; animation:msgIn .2s ease-out; }
|
| 190 |
+
@keyframes msgIn { from { opacity:0; transform:translateY(5px); } }
|
| 191 |
+
.msg:hover { background:rgba(255,255,255,0.02); }
|
| 192 |
+
.msg.consecutive { padding-top:0; }
|
| 193 |
+
.msg.consecutive .msg-avatar { opacity:0; pointer-events:none; }
|
| 194 |
+
.msg.consecutive .msg-header { display:none; }
|
| 195 |
+
|
| 196 |
+
.msg-avatar { width:34px; height:34px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-family:'Orbitron',monospace; font-size:.7rem; font-weight:900; flex-shrink:0; margin-top:2px; border:1px solid rgba(0,212,255,0.2); background:rgba(0,212,255,0.06); color:var(--accent); cursor:pointer; }
|
| 197 |
+
.msg-content { flex:1; min-width:0; }
|
| 198 |
+
.msg-header { display:flex; align-items:baseline; gap:8px; margin-bottom:2px; flex-wrap:wrap; }
|
| 199 |
+
.msg-name { font-family:'Orbitron',monospace; font-size:.7rem; font-weight:700; color:var(--accent); cursor:pointer; }
|
| 200 |
+
.msg-name:hover { text-decoration:underline; }
|
| 201 |
+
.msg-role-badge { font-size:.72rem; }
|
| 202 |
+
.msg-time { font-size:.65rem; color:var(--muted); letter-spacing:.05em; }
|
| 203 |
+
.msg-translated { font-size:.72rem; color:var(--muted); font-style:italic; margin-top:2px; border-left:2px solid rgba(0,212,255,0.2); padding-left:6px; }
|
| 204 |
+
.msg-text { font-size:.96rem; line-height:1.5; color:var(--text); word-break:break-word; font-weight:400; }
|
| 205 |
+
.msg-text a { color:var(--accent); text-decoration:none; }
|
| 206 |
+
.msg-text a:hover { text-decoration:underline; }
|
| 207 |
+
.msg-actions { display:none; gap:4px; margin-left:auto; }
|
| 208 |
+
.msg:hover .msg-actions { display:flex; }
|
| 209 |
+
.msg-action-btn { background:none; border:1px solid var(--border); color:var(--muted); padding:2px 7px; cursor:pointer; font-size:.7rem; border-radius:2px; transition:all .15s; }
|
| 210 |
+
.msg-action-btn:hover { color:var(--accent); border-color:rgba(0,212,255,0.4); }
|
| 211 |
+
.msg-action-btn.danger:hover { color:var(--danger); border-color:rgba(255,68,102,0.4); }
|
| 212 |
+
|
| 213 |
+
.msg-system { padding:5px 8px; font-size:.76rem; color:var(--muted); font-style:italic; letter-spacing:.04em; text-align:center; }
|
| 214 |
+
.msg-automod { padding:5px 8px; font-size:.76rem; color:var(--warn); letter-spacing:.04em; text-align:center; border:1px solid rgba(255,170,0,0.15); background:rgba(255,170,0,0.04); margin:4px 0; border-radius:2px; }
|
| 215 |
+
|
| 216 |
+
.pinned-banner { background:rgba(0,212,255,0.06); border:1px solid rgba(0,212,255,0.15); padding:8px 14px; font-size:.82rem; color:var(--muted); display:flex; gap:8px; align-items:center; }
|
| 217 |
+
.pinned-banner span { color:var(--accent); font-weight:700; }
|
| 218 |
+
|
| 219 |
+
.timeout-bar { padding:10px 20px; background:rgba(255,170,0,0.08); border-top:1px solid rgba(255,170,0,0.2); color:var(--warn); font-family:'Orbitron',monospace; font-size:.64rem; text-align:center; }
|
| 220 |
+
|
| 221 |
+
.input-area { padding:12px 20px; border-top:1px solid var(--border); background:rgba(5,10,15,0.8); display:flex; gap:8px; align-items:flex-end; }
|
| 222 |
+
.msg-input { flex:1; background:rgba(0,0,0,0.5); border:1px solid var(--border); color:var(--text); padding:10px 14px; font-family:'Rajdhani',sans-serif; font-size:.97rem; font-weight:500; outline:none; resize:none; min-height:42px; max-height:120px; transition:border-color .2s,box-shadow .2s; clip-path:polygon(6px 0%,100% 0%,calc(100% - 6px) 100%,0% 100%); line-height:1.4; }
|
| 223 |
+
.msg-input:focus { border-color:rgba(0,212,255,0.4); box-shadow:0 0 20px rgba(0,212,255,0.08); }
|
| 224 |
+
.msg-input::placeholder { color:var(--muted); }
|
| 225 |
+
.msg-input:disabled { opacity:.4; cursor:not-allowed; }
|
| 226 |
+
.send-btn { padding:10px 16px; background:var(--accent); border:none; color:var(--bg); cursor:pointer; font-family:'Orbitron',monospace; font-size:.65rem; font-weight:700; letter-spacing:.15em; clip-path:polygon(6px 0%,100% 0%,calc(100% - 6px) 100%,0% 100%); transition:all .2s; flex-shrink:0; height:42px; }
|
| 227 |
+
.send-btn:hover { background:#33ddff; transform:translateY(-1px); }
|
| 228 |
+
.send-btn:disabled { opacity:.4; cursor:not-allowed; transform:none; }
|
| 229 |
+
|
| 230 |
+
.empty-chat { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; color:var(--muted); text-align:center; gap:10px; }
|
| 231 |
+
.empty-chat-icon { font-size:2.5rem; opacity:.3; }
|
| 232 |
+
.empty-chat p { font-family:'Orbitron',monospace; font-size:.64rem; letter-spacing:.1em; }
|
| 233 |
+
|
| 234 |
+
/* ─── VOICE PANEL ─── */
|
| 235 |
+
.voice-panel { display:none; flex-direction:column; border-top:1px solid var(--border); background:var(--surface3); }
|
| 236 |
+
.voice-panel.active { display:flex; }
|
| 237 |
+
.voice-status-bar { padding:8px 14px; display:flex; align-items:center; gap:8px; font-size:.8rem; }
|
| 238 |
+
.voice-active-dot { width:8px; height:8px; border-radius:50%; background:var(--green); box-shadow:0 0 8px var(--green); animation:pulse 2s infinite; flex-shrink:0; }
|
| 239 |
+
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:.4} }
|
| 240 |
+
.voice-name { flex:1; font-family:'Orbitron',monospace; font-size:.65rem; color:var(--green); }
|
| 241 |
+
.voice-controls { display:flex; gap:4px; }
|
| 242 |
+
.voice-ctrl { background:none; border:1px solid var(--border); color:var(--muted); padding:4px 8px; cursor:pointer; font-size:.75rem; transition:all .15s; clip-path:polygon(3px 0%,100% 0%,calc(100% - 3px) 100%,0% 100%); }
|
| 243 |
+
.voice-ctrl:hover { color:var(--accent); border-color:rgba(0,212,255,0.4); }
|
| 244 |
+
.voice-ctrl.active { color:var(--danger); border-color:rgba(255,68,102,0.4); }
|
| 245 |
+
|
| 246 |
+
/* ─── TICKET PANEL ─── */
|
| 247 |
+
.ticket-item { padding:8px 14px; border-left:2px solid var(--border); margin:4px 0; transition:border-color .2s; cursor:pointer; }
|
| 248 |
+
.ticket-item:hover { border-left-color:var(--accent); background:rgba(0,212,255,0.03); }
|
| 249 |
+
.ticket-item.open { border-left-color:var(--green); }
|
| 250 |
+
.ticket-item.closed { border-left-color:var(--muted); opacity:.6; }
|
| 251 |
+
.ticket-meta { font-size:.7rem; color:var(--muted); font-family:'Orbitron',monospace; }
|
| 252 |
+
.ticket-title { font-size:.88rem; font-weight:600; color:var(--text); }
|
| 253 |
+
|
| 254 |
+
/* ─── CONTEXT MENU ─── */
|
| 255 |
+
#context-menu { position:fixed; z-index:5000; background:rgba(10,21,32,0.98); border:1px solid rgba(0,212,255,0.2); padding:6px 0; min-width:190px; clip-path:polygon(0 0,calc(100% - 10px) 0,100% 10px,100% 100%,0 100%); animation:ctxIn .15s ease-out; box-shadow:0 8px 40px rgba(0,0,0,0.5); }
|
| 256 |
+
@keyframes ctxIn { from { opacity:0; transform:scale(0.95); } }
|
| 257 |
+
.ctx-header { padding:8px 14px 6px; font-family:'Orbitron',monospace; font-size:.63rem; color:var(--accent); letter-spacing:.2em; border-bottom:1px solid var(--border); margin-bottom:4px; }
|
| 258 |
+
.ctx-item { padding:8px 14px; cursor:pointer; font-size:.88rem; font-weight:600; color:var(--text); display:flex; align-items:center; gap:8px; transition:background .1s; }
|
| 259 |
+
.ctx-item:hover { background:rgba(0,212,255,0.08); }
|
| 260 |
+
.ctx-item.danger { color:var(--danger); }
|
| 261 |
+
.ctx-item.danger:hover { background:rgba(255,68,102,0.08); }
|
| 262 |
+
.ctx-item.warn { color:var(--warn); }
|
| 263 |
+
.ctx-item.warn:hover { background:rgba(255,170,0,0.08); }
|
| 264 |
+
.ctx-item.success { color:var(--green); }
|
| 265 |
+
.ctx-item.success:hover { background:rgba(78,255,145,0.08); }
|
| 266 |
+
.ctx-divider { height:1px; background:var(--border); margin:4px 0; }
|
| 267 |
+
|
| 268 |
+
/* ─── MODALS ─── */
|
| 269 |
+
.modal-overlay { position:fixed; inset:0; z-index:6000; background:rgba(0,0,0,0.75); display:flex; align-items:center; justify-content:center; backdrop-filter:blur(4px); animation:fadeIn .2s ease-out; }
|
| 270 |
+
@keyframes fadeIn { from { opacity:0; } }
|
| 271 |
+
.modal { background:linear-gradient(135deg,rgba(10,21,32,0.99),rgba(5,10,15,0.99)); border:1px solid rgba(0,212,255,0.2); padding:30px 28px; width:100%; max-width:440px; max-height:90vh; overflow-y:auto; clip-path:polygon(0 0,calc(100% - 20px) 0,100% 20px,100% 100%,20px 100%,0 calc(100% - 20px)); animation:boxIn .3s ease-out; }
|
| 272 |
+
.modal.wide { max-width:600px; }
|
| 273 |
+
.modal-title { font-family:'Orbitron',monospace; font-size:.95rem; font-weight:700; color:var(--accent); margin-bottom:5px; }
|
| 274 |
+
.modal-sub { font-size:.84rem; color:var(--muted); margin-bottom:20px; }
|
| 275 |
+
.modal-field { margin-bottom:13px; }
|
| 276 |
+
.modal-field label { display:block; font-size:.7rem; letter-spacing:.15em; color:var(--muted); text-transform:uppercase; margin-bottom:5px; }
|
| 277 |
+
.modal-field input, .modal-field select, .modal-field textarea { width:100%; padding:10px 13px; background:rgba(0,0,0,0.5); border:1px solid var(--border); color:var(--text); font-family:'Rajdhani',sans-serif; font-size:.94rem; font-weight:600; outline:none; transition:border-color .2s; clip-path:polygon(5px 0%,100% 0%,calc(100% - 5px) 100%,0% 100%); }
|
| 278 |
+
.modal-field input:focus, .modal-field select:focus, .modal-field textarea:focus { border-color:rgba(0,212,255,0.5); }
|
| 279 |
+
.modal-field select option { background:#0a1520; }
|
| 280 |
+
.modal-field textarea { resize:vertical; min-height:80px; }
|
| 281 |
+
.modal-field .hint { font-size:.72rem; color:var(--muted); margin-top:4px; }
|
| 282 |
+
.modal-tabs { display:flex; margin-bottom:20px; border-bottom:1px solid var(--border); }
|
| 283 |
+
.modal-tab { flex:1; padding:8px; background:none; border:none; color:var(--muted); cursor:pointer; font-family:'Orbitron',monospace; font-size:.62rem; letter-spacing:.15em; text-transform:uppercase; transition:color .2s; border-bottom:2px solid transparent; margin-bottom:-1px; }
|
| 284 |
+
.modal-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
|
| 285 |
+
.modal-btns { display:flex; gap:8px; margin-top:18px; }
|
| 286 |
+
.modal-btn { flex:1; padding:11px; border:none; cursor:pointer; font-family:'Orbitron',monospace; font-size:.65rem; font-weight:700; letter-spacing:.15em; clip-path:polygon(6px 0%,100% 0%,calc(100% - 6px) 100%,0% 100%); transition:all .2s; }
|
| 287 |
+
.modal-btn.primary { background:var(--accent); color:var(--bg); }
|
| 288 |
+
.modal-btn.primary:hover { background:#33ddff; }
|
| 289 |
+
.modal-btn.secondary { background:transparent; color:var(--muted); border:1px solid var(--border); }
|
| 290 |
+
.modal-btn.secondary:hover { color:var(--text); border-color:rgba(0,212,255,0.3); }
|
| 291 |
+
.modal-btn.danger-btn { background:var(--danger); color:#fff; }
|
| 292 |
+
.modal-btn.danger-btn:hover { background:#ff6680; }
|
| 293 |
+
.modal-btn.warn-btn { background:var(--warn); color:#000; }
|
| 294 |
+
.modal-btn.warn-btn:hover { background:#ffcc44; }
|
| 295 |
+
.modal-btn.success-btn { background:var(--green); color:#000; }
|
| 296 |
+
.modal-btn.success-btn:hover { background:#7fffb2; }
|
| 297 |
+
.captcha-modal-question { font-family:'Orbitron',monospace; font-size:2rem; font-weight:900; color:var(--accent); text-align:center; letter-spacing:.1em; margin:16px 0; text-shadow:0 0 20px var(--glow); }
|
| 298 |
+
|
| 299 |
+
/* ─── SETTINGS ─── */
|
| 300 |
+
.settings-section { margin-bottom:20px; }
|
| 301 |
+
.settings-section h4 { font-family:'Orbitron',monospace; font-size:.65rem; letter-spacing:.2em; color:var(--muted); text-transform:uppercase; margin-bottom:12px; padding-bottom:6px; border-bottom:1px solid var(--border); }
|
| 302 |
+
.toggle-row { display:flex; align-items:center; justify-content:space-between; padding:8px 0; border-bottom:1px solid rgba(0,212,255,0.06); }
|
| 303 |
+
.toggle-row label { font-size:.88rem; color:var(--text); }
|
| 304 |
+
.toggle { width:40px; height:20px; background:rgba(0,0,0,0.5); border:1px solid var(--border); border-radius:10px; cursor:pointer; position:relative; transition:background .2s; }
|
| 305 |
+
.toggle.on { background:rgba(0,212,255,0.3); border-color:rgba(0,212,255,0.5); }
|
| 306 |
+
.toggle::after { content:''; position:absolute; top:2px; left:2px; width:14px; height:14px; border-radius:50%; background:var(--muted); transition:all .2s; }
|
| 307 |
+
.toggle.on::after { left:22px; background:var(--accent); }
|
| 308 |
+
|
| 309 |
+
/* ─── AUTOMOD TAGS ─── */
|
| 310 |
+
.tag { display:inline-flex; align-items:center; gap:5px; background:rgba(0,212,255,0.08); border:1px solid rgba(0,212,255,0.2); color:var(--accent); padding:3px 10px; border-radius:2px; font-size:.78rem; margin:3px 2px; }
|
| 311 |
+
.tag-remove { background:none; border:none; color:var(--muted); cursor:pointer; font-size:.9rem; line-height:1; padding:0 1px; }
|
| 312 |
+
.tag-remove:hover { color:var(--danger); }
|
| 313 |
+
.tag-input { background:rgba(0,0,0,0.4); border:1px solid var(--border); color:var(--text); padding:5px 10px; font-family:'Rajdhani',sans-serif; font-size:.88rem; outline:none; margin-top:6px; }
|
| 314 |
+
.tag-input:focus { border-color:rgba(0,212,255,0.4); }
|
| 315 |
+
|
| 316 |
+
/* ─── TOAST ─── */
|
| 317 |
+
.toast { position:fixed; bottom:20px; right:20px; background:rgba(10,21,32,0.98); border:1px solid var(--accent); color:var(--accent); padding:10px 16px; font-family:'Orbitron',monospace; font-size:.65rem; letter-spacing:.12em; z-index:9999; animation:toastIn .3s ease-out; clip-path:polygon(6px 0%,100% 0%,calc(100% - 6px) 100%,0% 100%); max-width:300px; }
|
| 318 |
+
@keyframes toastIn { from { opacity:0; transform:translateY(20px); } }
|
| 319 |
+
|
| 320 |
+
/* ─── AVATAR COLORS ─── */
|
| 321 |
+
.av-color-0 { border-color:rgba(0,212,255,0.3)!important; color:#00d4ff!important; background:rgba(0,212,255,0.06)!important; }
|
| 322 |
+
.av-color-1 { border-color:rgba(255,107,53,0.3)!important; color:#ff6b35!important; background:rgba(255,107,53,0.06)!important; }
|
| 323 |
+
.av-color-2 { border-color:rgba(168,85,247,0.3)!important; color:#a855f7!important; background:rgba(168,85,247,0.06)!important; }
|
| 324 |
+
.av-color-3 { border-color:rgba(78,255,145,0.3)!important; color:#4eff91!important; background:rgba(78,255,145,0.06)!important; }
|
| 325 |
+
.av-color-4 { border-color:rgba(255,214,0,0.3)!important; color:#ffd600!important; background:rgba(255,214,0,0.06)!important; }
|
| 326 |
+
.name-color-0 { color:#00d4ff!important; }
|
| 327 |
+
.name-color-1 { color:#ff6b35!important; }
|
| 328 |
+
.name-color-2 { color:#a855f7!important; }
|
| 329 |
+
.name-color-3 { color:#4eff91!important; }
|
| 330 |
+
.name-color-4 { color:#ffd600!important; }
|
| 331 |
+
|
| 332 |
+
/* ─── TICKET BADGE ─── */
|
| 333 |
+
.ticket-badge { background:var(--purple); color:#fff; font-size:.6rem; font-weight:700; padding:1px 5px; border-radius:10px; font-family:'Orbitron',monospace; }
|
| 334 |
+
|
| 335 |
+
/* ─── SCROLLBAR CUSTOM ─── */
|
| 336 |
+
.messages::-webkit-scrollbar { width:3px; }
|
| 337 |
+
.sidebar-scroll::-webkit-scrollbar { width:3px; }
|
| 338 |
+
|
| 339 |
+
/* ─── RESPONSIVE ─── */
|
| 340 |
+
@media (max-width:768px) {
|
| 341 |
+
:root { --sidebar-w: 0px; }
|
| 342 |
+
.sidebar { display:none; }
|
| 343 |
+
#app.visible { grid-template-columns:1fr; }
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
/* ─── MISC ─── */
|
| 347 |
+
.divider { height:1px; background:var(--border); margin:10px 0; }
|
| 348 |
+
.txt-accent { color:var(--accent); }
|
| 349 |
+
.txt-danger { color:var(--danger); }
|
| 350 |
+
.txt-warn { color:var(--warn); }
|
| 351 |
+
.txt-green { color:var(--green); }
|
| 352 |
+
.txt-muted { color:var(--muted); }
|
| 353 |
+
.fw700 { font-weight:700; }
|
| 354 |
+
.mono { font-family:'Orbitron',monospace; font-size:.75rem; }
|