Remove per-source speed, fix device dirty check, and add frontend caching

Speed is now exclusively controlled via sync clocks — CSS sources no longer
carry their own speed/cycle_speed fields. Streams default to 1.0× when no
clock is assigned. Also fixes false-positive dirty check on the device
settings modal (array reference comparison) and converts several frontend
modules to use DataCache for consistent API response caching.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-01 22:07:54 +03:00
parent aa1e4a6afc
commit 39e41dfce7
15 changed files with 56 additions and 187 deletions

View File

@@ -3,7 +3,7 @@
*/
import {
calibrationTestState, EDGE_TEST_COLORS,
calibrationTestState, EDGE_TEST_COLORS, displaysCache,
} from '../core/state.js';
import { API_BASE, getHeaders, fetchWithAuth } from '../core/api.js';
import { t } from '../core/i18n.js';
@@ -134,9 +134,9 @@ export async function toggleCalibrationOverlay() {
export async function showCalibration(deviceId) {
try {
const [response, displaysResponse] = await Promise.all([
const [response, displays] = await Promise.all([
fetchWithAuth(`/devices/${deviceId}`),
fetchWithAuth('/config/displays'),
displaysCache.fetch().catch(() => []),
]);
if (!response.ok) { showToast(t('calibration.error.load_failed'), 'error'); return; }
@@ -145,15 +145,10 @@ export async function showCalibration(deviceId) {
const calibration = device.calibration;
const preview = document.querySelector('.calibration-preview');
if (displaysResponse.ok) {
const displaysData = await displaysResponse.json();
const displayIndex = device.settings?.display_index ?? 0;
const display = (displaysData.displays || []).find(d => d.index === displayIndex);
if (display && display.width && display.height) {
preview.style.aspectRatio = `${display.width} / ${display.height}`;
} else {
preview.style.aspectRatio = '';
}
const displayIndex = device.settings?.display_index ?? 0;
const display = displays.find(d => d.index === displayIndex);
if (display && display.width && display.height) {
preview.style.aspectRatio = `${display.width} / ${display.height}`;
} else {
preview.style.aspectRatio = '';
}