Files
urutau/internal/server/web/login.js
T
Lucas RayanandClaude Opus 5.5 b4a2c2c9ec
Release / Plan (reuse the published image?) (push) Successful in 4s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 1m29s
CI / Tests (Linux, race detector) (push) Failing after 1m48s
CI / Dependency audit (push) Successful in 21s
Release / ci (push) Failing after 1m50s
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Skipped
Release / Gitea release (push) Skipped
feat: Urutau 1.0.0, lightweight threat intelligence and web analytics
Always-on Go service (stdlib only) that follows the Traefik JSON access
log, the sshd log and the fail2ban log of a host, classifies attacks,
scores sources, keeps bounded aggregates with snapshots, and serves an
embedded dashboard with live updates, offline geolocation (DB-IP Lite),
privacy-friendly traffic analytics, an exportable blocklist and
token-authenticated federation between instances.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 16:13:34 -03:00

33 lines
2.1 KiB
JavaScript

(function () {
'use strict';
var D = window.URUTAU_I18N;
function get(k) { try { return localStorage.getItem(k); } catch (e) { return null; } }
function set(k, v) { try { localStorage.setItem(k, v); } catch (e) { /* ignore */ } }
var lang = get('urutau.lang') || ((navigator.language || 'en').toLowerCase().indexOf('pt') === 0 ? 'pt-BR' : 'en');
if (!D[lang]) lang = 'en';
var theme = get('urutau.theme');
if (theme === 'light' || theme === 'dark') document.documentElement.setAttribute('data-theme', theme);
function t(k) { return D[lang][k] || D.en[k] || k; }
function apply() {
document.documentElement.lang = lang;
document.querySelectorAll('[data-i18n]').forEach(function (n) { n.textContent = t(n.getAttribute('data-i18n')); });
document.querySelectorAll('[data-i18n-ph]').forEach(function (n) { n.setAttribute('placeholder', t(n.getAttribute('data-i18n-ph'))); });
document.querySelectorAll('[data-i18n-aria]').forEach(function (n) { n.setAttribute('aria-label', t(n.getAttribute('data-i18n-aria'))); });
document.querySelectorAll('[data-i18n-title]').forEach(function (n) { n.setAttribute('title', t(n.getAttribute('data-i18n-title'))); });
document.getElementById('lang').textContent = lang === 'en' ? 'PT' : 'EN';
var e = new URLSearchParams(location.search).get('e');
try {
var nav = performance.getEntriesByType('navigation')[0];
if (nav && nav.responseStatus === 429) e = 'rate';
} catch (x) { /* ignore */ }
document.getElementById('msg').textContent = e === 'bad' ? t('login.err.bad') : e === 'rate' ? t('login.err.rate') : '';
}
document.getElementById('lang').addEventListener('click', function () { lang = lang === 'en' ? 'pt-BR' : 'en'; set('urutau.lang', lang); apply(); });
document.getElementById('theme').addEventListener('click', function () {
var cur = document.documentElement.getAttribute('data-theme') || (matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark');
var next = cur === 'dark' ? 'light' : 'dark';
document.documentElement.setAttribute('data-theme', next); set('urutau.theme', next);
});
apply();
})();