/* ===== RadiusFreeUsers.js ===== */ Vue.component('radius-free-users', { template: `
Freie NAT Benutzer {{ filteredNat.length }}
{{ filteredNat.length }} Treffer gefunden
Freie STF Benutzer {{ filteredStf.length }}
{{ filteredStf.length }} Treffer gefunden
`, data: () => ({ nat: [], stf: [], loadingNat: false, loadingStf: false, _initialized: false }), computed: { filteredNat() { return this.nat.filter(this.isTrulyFree); }, filteredStf() { return this.stf.filter(this.isTrulyFree); } }, methods: { initIfNeeded(){ if (this._initialized) return; this._initialized = true; this.reloadNat(); this.reloadStf(); }, isTrulyFree(user) { return !/frei[a-z]/.test((user.Info || '').toLowerCase()); }, normalizeUsers(arr){ if (!Array.isArray(arr)) return []; return arr.map(u => ({ Username: (u.Username || u.username || '').trim(), Info: (u.Info || u.info || '').toString().replace(/\s+$/,'') })).filter(u => u.Username); }, async reloadNat() { this.nat = []; this.loadingNat = true; try { const r = await fetch(window.TT_CONFIG.BASE_PATH + '/Radius/proxyUnsecureHTTPRequestToRadius?action2=free_user&filter=nat'); this.nat = this.normalizeUsers(r.ok ? (await r.json()).users : []); } catch { this.nat = []; } this.loadingNat = false; }, async reloadStf() { this.stf = []; this.loadingStf = true; try { const r = await fetch(window.TT_CONFIG.BASE_PATH + '/Radius/proxyUnsecureHTTPRequestToRadius?action2=free_user&filter=stf'); this.stf = this.normalizeUsers(r.ok ? (await r.json()).users : []); } catch { this.stf = []; } this.loadingStf = false; } } });