refactor: comprehensive code quality, security, and release readiness improvements
Some checks failed
Lint & Test / test (push) Failing after 48s
Some checks failed
Lint & Test / test (push) Failing after 48s
Security: tighten CORS defaults, add webhook rate limiting, fix XSS in automations, guard WebSocket JSON.parse, validate ADB address input, seal debug exception leak, URL-encode WS tokens, CSS.escape in selectors. Code quality: add Pydantic models for brightness/power endpoints, fix thread safety and name uniqueness in DeviceStore, immutable update pattern, split 6 oversized files into 16 focused modules, enable TypeScript strictNullChecks (741→102 errors), type state variables, add dom-utils helper, migrate 3 modules from inline onclick to event delegation, ProcessorDependencies dataclass. Performance: async store saves, health endpoint log level, command palette debounce, optimized entity-events comparison, fix service worker precache list. Testing: expand from 45 to 293 passing tests — add store tests (141), route tests (25), core logic tests (42), E2E flow tests (33), organize into tests/api/, tests/storage/, tests/core/, tests/e2e/. DevOps: CI test pipeline, pre-commit config, Dockerfile multi-stage build with non-root user and health check, docker-compose improvements, version bump to 0.2.0. Docs: rewrite CLAUDE.md (202→56 lines), server/CLAUDE.md (212→76), create contexts/server-operations.md, fix .js→.ts references, fix env var prefix in README, rewrite INSTALLATION.md, add CONTRIBUTING.md and .env.example.
This commit is contained in:
@@ -24,7 +24,7 @@ export function openDisplayPicker(callback: (index: number, display?: Display |
|
||||
set_displayPickerCallback(callback);
|
||||
set_displayPickerSelectedIndex((selectedIndex !== undefined && selectedIndex !== null && selectedIndex !== '') ? Number(selectedIndex) : null);
|
||||
_pickerEngineType = engineType || null;
|
||||
const lightbox = document.getElementById('display-picker-lightbox');
|
||||
const lightbox = document.getElementById('display-picker-lightbox')!;
|
||||
|
||||
// Use "Select a Device" title for engines with own display lists (camera, scrcpy, etc.)
|
||||
const titleEl = lightbox.querySelector('.display-picker-title');
|
||||
@@ -41,7 +41,7 @@ export function openDisplayPicker(callback: (index: number, display?: Display |
|
||||
} else if (_cachedDisplays && _cachedDisplays.length > 0) {
|
||||
renderDisplayPickerLayout(_cachedDisplays);
|
||||
} else {
|
||||
const canvas = document.getElementById('display-picker-canvas');
|
||||
const canvas = document.getElementById('display-picker-canvas')!;
|
||||
canvas.innerHTML = '<div class="loading-spinner"></div>';
|
||||
displaysCache.fetch().then(displays => {
|
||||
if (displays && displays.length > 0) {
|
||||
@@ -55,7 +55,7 @@ export function openDisplayPicker(callback: (index: number, display?: Display |
|
||||
}
|
||||
|
||||
async function _fetchAndRenderEngineDisplays(engineType: string): Promise<void> {
|
||||
const canvas = document.getElementById('display-picker-canvas');
|
||||
const canvas = document.getElementById('display-picker-canvas')!;
|
||||
canvas.innerHTML = '<div class="loading-spinner"></div>';
|
||||
|
||||
try {
|
||||
@@ -133,7 +133,7 @@ window._adbConnectFromPicker = async function () {
|
||||
export function closeDisplayPicker(event?: Event): void {
|
||||
if (event && event.target && (event.target as HTMLElement).closest('.display-picker-content')) return;
|
||||
const lightbox = document.getElementById('display-picker-lightbox');
|
||||
lightbox.classList.remove('active');
|
||||
lightbox?.classList.remove('active');
|
||||
set_displayPickerCallback(null);
|
||||
_pickerEngineType = null;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ export function selectDisplay(displayIndex: number): void {
|
||||
}
|
||||
|
||||
export function renderDisplayPickerLayout(displays: any[], engineType: string | null = null): void {
|
||||
const canvas = document.getElementById('display-picker-canvas');
|
||||
const canvas = document.getElementById('display-picker-canvas')!;
|
||||
|
||||
if (!displays || displays.length === 0) {
|
||||
canvas.innerHTML = `<div class="loading">${t('displays.none')}</div>`;
|
||||
|
||||
Reference in New Issue
Block a user