77e4dffb43
Закладывает уникальный визуальный язык и engine'ы для редизайна Физики 8. CSS: - phys8-design-system.css (12 КБ): 3 темы (thermal/electric/spectrum), тематические hero-палитры, watermarks, animations (thermal-shift, electric-pulse, spectrum-drift, wm-breathe/flicker/rotate, noise overlay), staggered fade-in для виджетов, soft elevation на карточках, monospace для физ. величин, topic-aware progress bars, mobile responsive (≤768px), prefers-reduced-motion. - phys8-interactives.css (10 КБ): .p8-draggable + .p8-droptarget с hover-effects, .p8-palette (для circuit-builder), .p8-scrubber, .p8-readout табло, .p8-tooltip, .p8-sandbox canvas wrapper, .p8-thermometer + .p8-compass-needle SVG-композиции, glow-utility. JS: - phys8-anim.js (6 КБ): easing-функции (quad/cubic/expo/back/elastic/ bounce/spring), tween-engine с onUpdate/onComplete, raf-wrapper, oscillate, stagger, onVisible (IntersectionObserver). Экспорт P8Anim. - phys8-drag.js (12 КБ): универсальный drag-engine. P8Drag.attach() для DOM/SVG, P8Drag.attachCanvas() для логических объектов с hit-test, P8Drag.attachPalette() для drag-from-palette-to-drop, constraints (lockX/Y, bounds, snap-to-grid), touch + mouse + pointer. - phys8-helpers.js (18 КБ): тематические хелперы. P8Helpers.thermal (tempColor 0-1, heatFlowArrow, molecule, thermometerSVG, convectionCellParticles), .em (chargeSVG, circuitComponent для battery/resistor/lamp/ammeter/voltmeter/switch, fieldLineFrom), .optics (rayLine, lensSVG converging/diverging, mirrorPlane), .svg utils (el, create, linearGradient, radialGradient, gradientArrow, labeledText). Линковка (redesign_p8_phase0.cjs): - 2 CSS-link после katex CDN - 3 JS-link после phys.js/xp.js - body class p8-theme-thermal/electric/spectrum на ch1/ch2/ch3 - hub и lab — без темы (нейтральный пурпурный brand)
backend/scripts
Operational scripts for LearnSpace backend.
Cron setup (production)
# Daily backup at 4am
0 4 * * * /path/to/repo/backend/scripts/backup.sh
# Weekly verification at 6am Sunday (cron mails on non-zero exit)
0 6 * * 0 /path/to/repo/backend/scripts/verify-backup.sh
Scripts
backup.sh
Creates a safe SQLite snapshot via VACUUM INTO. Keeps last 7 backups (configurable via KEEP=14).
./backup.sh # default: ../data/learnspace.db → ../../backups/
./backup.sh /path/to/db /path/to/backups
KEEP=14 ./backup.sh
verify-backup.sh
Restores the latest backup to /tmp, runs PRAGMA integrity_check, compares row counts vs production.
Exit codes:
0— all checks passed2— no backup files found3— latest backup older than 48h (backup job may have stopped)4—integrity_checkfailed (backup is corrupt)5— user count diverged >5% from production
./verify-backup.sh
BACKUP_DIR=/custom/backups PROD_DB=/custom/db.sqlite ./verify-backup.sh
check-route-auth.js
Scans src/routes/*.js for :id-bearing routes without an auth-guard middleware.
Fails if new unprotected routes exceed the current baseline.
npm run lint:routes
import-content.js (coming in Task 8)
Imports question collections from YAML manifests into the database.
npm run import:content -- ../content/phys/ct-2024.yaml
Deploy order (first time / fresh server)
npm install
npm run migrate
npm run seed:permissions
npm start