22b95ed072
Миграция 031_physics_11_hub.sql: - hub textbook 'physics-11' (cyan, sort 12, para_count 45) - 8 children по главам: ch1 cyan, ch2 violet, ch3 amber, ch4 blue, ch5 pink, ch6 green, ch7 rose, ch8 indigo frontend/js/phys-fx.js (~360 строк): - Глобальный requestAnimationFrame-цикл (Ticker) с подписками - util.subscribe/unsubscribe + IntersectionObserver-пауза невидимых - util.svgFrame, util.axes, util.slider — общие хелперы - PHYS.Oscillogram: гарм. колебания с амплитудой/частотой/фазой/затуханием - PHYS.SpringMass: пружинный маятник (T=2π√(m/k)) с зигзаг-пружиной - PHYS.Pendulum: математический маятник (T=2π√(l/g)) с дугой frontend/textbooks/physics_11_hub.html: - Header cyan-gradient + watermark ФИЗИКА - 4-кол grid карточек глав (8 шт., responsive) - Прогресс-бар курса + API /api/textbooks/physics-11/children frontend/textbooks/physics_11_ch1..ch8.html: - Stub-страницы по образцу geometry_10_r1..r4 (W0) - Список параграфов с ключевыми формулами + 'Будет добавлено в волне WN' - Каждая глава со своей темой (gradient, watermark, цветами) - phys-fx.js подключён сразу (ready для W1+) backend/scripts/gen_phys11_stubs.js — генератор для повторных сборок.
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