72b6879f4b
- Refactored max_bot from nested packages to flat module structure - Q2: Extended BotUser model (patronymic, email, org, address, vcf_raw, contact_hash, phone_verified, email_verified, last_interaction, total_conversations, total_tickets) - Q2: VCF parser (FN, N, TEL, EMAIL, ORG, ADR), upsert on re-contact, NLP history context (_get_user_history_context -> YandexGPT) - Q1: Broadcast preview modal with 10s confirmation timer - Q3: CSS var(--white)->var(--bg-card), var(--text)->var(--text-primary) - Q4: bot_settings showNotification(), editable max_bot_id - Q5: Webhook secret passthrough via X-Max-Bot-Api-Secret - Masking sensitive keys, dialog_cleared handler, migrate via _add_column_if_not_exists() - Rate limit (asyncio.sleep 0.5 per 10), dead code removed, conv.intent context in contact.py - Portal pages: bot_consent, bot_kb (edit), bot_settings, bot_test, bot_tickets, portal_settings - Tests: 21/21 passing, added test_yandex_gpt.py, test_email_sender.py - Deploy: deploy_full.sh, schema.sql, seed_knowledge_base.sql
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
(function() {
|
|
var STORAGE_KEY = 'aegisone_service_theme';
|
|
var themes = ['system', 'dark', 'light'];
|
|
|
|
function getSystemTheme() {
|
|
return window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
|
|
}
|
|
|
|
function applyTheme(theme) {
|
|
var resolved = theme === 'system' ? getSystemTheme() : theme;
|
|
document.documentElement.setAttribute('data-theme', resolved);
|
|
var names = { system: 'Авто', dark: 'Тёмная', light: 'Светлая' };
|
|
var icons = { system: '🖥', dark: '🌙', light: '☀️' };
|
|
var btn = document.getElementById('theme-btn');
|
|
if (btn) {
|
|
btn.textContent = icons[theme] || '🖥';
|
|
btn.title = names[theme] || 'Авто';
|
|
}
|
|
}
|
|
|
|
function getNextTheme(current) {
|
|
var idx = themes.indexOf(current);
|
|
return themes[(idx + 1) % themes.length];
|
|
}
|
|
|
|
function toggleTheme() {
|
|
var current = localStorage.getItem(STORAGE_KEY) || 'system';
|
|
var next = getNextTheme(current);
|
|
localStorage.setItem(STORAGE_KEY, next);
|
|
applyTheme(next);
|
|
}
|
|
|
|
var saved = localStorage.getItem(STORAGE_KEY) || 'system';
|
|
applyTheme(saved);
|
|
|
|
window.matchMedia('(prefers-color-scheme: light)').addEventListener('change', function() {
|
|
var current = localStorage.getItem(STORAGE_KEY) || 'system';
|
|
if (current === 'system') {
|
|
applyTheme('system');
|
|
}
|
|
});
|
|
|
|
window.toggleTheme = toggleTheme;
|
|
})();
|