Extract YAML validation to separate module

- Created yaml-validator.js with pure validation functions
- Removed redundant checkYAMLFormatting function (rely on js-yaml)
- Fixed function shadowing issues by using window._validateYAMLPure
- Updated nginx config to serve JS files with correct MIME type
- Improved error reporting with line/column numbers from js-yaml
This commit is contained in:
robojerk 2025-10-31 13:28:38 -07:00
parent 4e108c7d7f
commit 8d2def360e
4 changed files with 201 additions and 116 deletions

View file

@ -18,7 +18,7 @@ RUN pip install --no-cache-dir -r backend/requirements.txt
COPY backend/ /app/backend/
# Copy frontend files
COPY index.html manage.html /usr/share/nginx/html/
COPY index.html manage.html yaml-validator.js /usr/share/nginx/html/
# Configure nginx
RUN echo 'server {\n\
@ -27,8 +27,10 @@ RUN echo 'server {\n\
root /usr/share/nginx/html;\n\
index index.html;\n\
\n\
location / {\n\
try_files $uri $uri/ /index.html;\n\
# Serve JavaScript files with correct MIME type (must come before location /)\n\
location ~* \\.js$ {\n\
default_type application/javascript;\n\
try_files $uri =404;\n\
}\n\
\n\
location /api {\n\
@ -36,6 +38,10 @@ RUN echo 'server {\n\
proxy_set_header Host $host;\n\
proxy_set_header X-Real-IP $remote_addr;\n\
}\n\
\n\
location / {\n\
try_files $uri $uri/ /index.html;\n\
}\n\
}' > /etc/nginx/sites-available/default
# Configure supervisor