справлено подключение js-yaml: теперь валидация yaml работает корректно при сохранении настроек

This commit is contained in:
Vlad 2025-07-11 12:14:11 +03:00
parent 49fd9ac916
commit a4f6dd4d93
2 changed files with 9 additions and 4 deletions

View File

@ -11,6 +11,7 @@
- Добавлен вывод температуры и облачности с weatherapi.com, настройки (api_key, lat, lon, cache_ttl) вынесены в config.yaml
- Поддержка настройки времени кэширования погоды через weather.cache_ttl (минуты, по умолчанию 60)
- В шапке вместо приветствия теперь крупно текущее время, дата на русском
- Дата и время теперь на одной строке, одинакового размера и цвета, хорошо видны на тёмном фоне
## [init] Стартовая инициализация структуры Flask-приложения
- Создана структура каталогов: templates/, static/

View File

@ -9,6 +9,7 @@
<link rel="stylesheet" href="/static/main.289a6408.css">
<link rel="stylesheet" href="/static/flame.css">
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.1.0/js-yaml.min.js"></script>
</head>
<body style="--color-primary: #FFFDEA; --color-accent: #5c5c5c; --color-background: #1a1a1a;">
<div id="root">
@ -16,9 +17,9 @@
<div><input type="text" class="SearchBar_SearchBar__MQiwu" placeholder="Поиск..."></div>
<header class="Header_Header__GCJdR">
<span class="Header_HeaderMain__oLoBB">
<div style="display:flex; flex-direction:column; align-items:flex-start; gap:4px;">
<span style="font-size:2.2em; font-weight:bold;">{{ current_time }}</span>
<span style="font-size:1.1em;">{{ now }}</span>
<div style="display:flex; flex-direction:row; align-items:center; gap:12px;">
<span style="font-size:1.1em; color: var(--color-primary);">{{ current_time }}</span>
<span style="font-size:1.1em; color: var(--color-primary);">{{ now }}</span>
</div>
<div class="WeatherWidget_WeatherWidget__3XlYt">
<div><canvas id="weather-icon" width="50" height="50"></canvas></div>
@ -87,7 +88,6 @@
<div class="NotificationCenter_NotificationCenter__Tfgzh" style="height: 0px;"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/monaco-editor@0.44.0/min/vs/loader.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.1.0/js-yaml.min.js"></script>
<script>feather.replace()</script>
<script>
let monacoEditor;
@ -138,6 +138,10 @@ cancelBtn.onclick = function() {
saveBtn.onclick = function() {
const yamlText = monacoEditor.getValue();
if (!window.jsyaml || typeof window.jsyaml.load !== 'function') {
errorDiv.textContent = 'Ошибка: js-yaml не загружен. Проверьте подключение скрипта.';
return;
}
try {
window.jsyaml.load(yamlText); // Проверка синтаксиса
fetch('/api/config', {