Analysis / recommendations (AMBOSS parity, verified on next.amboss.com): - GET /study-tools/recommendations ranks focus areas by the study time most likely to raise the score. Readiness is the learner's accuracy in a category shrunk toward their own overall accuracy in proportion to sample size, so two unlucky answers do not read as a knowledge gap; it unlocks after 40 answers. Relevance is the share of the bank a category holds. Counts roll up through the category tree, so a system inherits its children's questions. It is deliberately not called EPC and does not claim to predict an exam. - New /analysis page: Performance and Recommendations tabs, readiness summary, adaptive-session box, and expandable focus rows showing questions seen, answered correctly, the linked article and a per-topic practice action. Per-category educator grants: - category_grants table (migration p8b9c0d1e253) plus utils/category_grants.py resolving a grant to the category and all of its descendants. - Question create, edit, delete, bulk and the manager summary now accept a moderator OR an educator granted the affected categories, and refuse moves that would push a question out of the holder's scope. Summary counts are scoped to the grant. - Moderator endpoints to list, add and revoke grants, plus /my-grants driving the nav link and the manager's scope banner; grantable-users avoids handing moderators the admin-only user list. - GrantsPanel in the question manager: grant, list and revoke with inline confirmation. Question page: - The category trail was a fixed 78px band that wrapped into several rows and pushed the stem down the page, followed by three more stacked strips. It is now one scrollable meta line (breadcrumb + difficulty + type) and a single AMBOSS-style action bar (Mark / Listen / Listen through / Clear) between the stem and the options. Difficulty is exposed on the runner payload. Deploy fix: index.html shipped with no cache header, so browsers kept serving the previous bundle references and a release looked like nothing had changed. nginx now sends no-cache for HTML and immutable long-cache for hashed assets. Tests: 16 new backend (recommendation shrinkage, roll-up, locking, grant scope across create/edit/delete/bulk/summary, moderator gate) and 10 new frontend. Full suites green: 88 backend, 116 frontend, build clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014yhHB8Pc7oQqyqn2Vo9DXA
80 lines
3.2 KiB
Nginx Configuration File
80 lines
3.2 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Gzip compression
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript;
|
|
gzip_min_length 1024;
|
|
gzip_proxied any;
|
|
gzip_comp_level 6;
|
|
|
|
# Security headers
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://challenges.cloudflare.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://challenges.cloudflare.com; media-src 'self' blob:; connect-src 'self' https://challenges.cloudflare.com; font-src 'self' https://fonts.gstatic.com; frame-src 'self' https://challenges.cloudflare.com;" always;
|
|
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
|
|
|
|
# API proxy to backend
|
|
location /api/ {
|
|
resolver 127.0.0.11 valid=10s;
|
|
set $backend http://backend:8000;
|
|
proxy_pass $backend;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
# Large file uploads
|
|
client_max_body_size 500M;
|
|
proxy_request_buffering off;
|
|
proxy_read_timeout 600s;
|
|
}
|
|
|
|
# SCORM content — no frame-blocking headers, allow scripts
|
|
location /uploads/scorm/ {
|
|
resolver 127.0.0.11 valid=10s;
|
|
set $backend http://backend:8000;
|
|
proxy_pass $backend;
|
|
proxy_set_header Host $host;
|
|
proxy_hide_header X-Frame-Options;
|
|
proxy_force_ranges on; # Pinned backend FileResponse does not implement byte ranges.
|
|
# Local add_header prevents inheriting the app CSP; preserve backend SVG sandbox.
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
}
|
|
|
|
# Uploaded images proxy to backend
|
|
location /uploads/ {
|
|
resolver 127.0.0.11 valid=10s;
|
|
set $backend http://backend:8000;
|
|
proxy_pass $backend;
|
|
proxy_set_header Host $host;
|
|
# Backend owns private/no-store and Vary; never cache protected media.
|
|
proxy_force_ranges on;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
}
|
|
|
|
# Hashed build assets are immutable — a new build gets a new filename.
|
|
location /assets/ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
}
|
|
|
|
# index.html must never be cached, or a deploy keeps serving the old
|
|
# bundle references and the app appears unchanged after a release.
|
|
location = /index.html {
|
|
add_header Cache-Control "no-cache, must-revalidate" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
}
|
|
|
|
# SPA fallback
|
|
location / {
|
|
add_header Cache-Control "no-cache, must-revalidate" always;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|