Security hardening, multi-site portability, and a documentation and API-surface sweep

This commit is contained in:
2026-08-14 16:28:34 -04:00
parent 72f8da0e58
commit 265ca2eb01
76 changed files with 3684 additions and 811 deletions

View File

@@ -2,7 +2,7 @@
import os
from flask import Blueprint, request, current_app, send_from_directory
from flask import Blueprint, request, current_app
from flask_jwt_extended import jwt_required, get_jwt_identity
from werkzeug.utils import secure_filename
@@ -11,6 +11,7 @@ from shopdb.core.models import Setting, AuditLog
from shopdb.utils.responses import success_response, error_response, ErrorCodes
from shopdb.utils.authz import require_permission, require_role
from shopdb.utils.uploads import send_upload
settings_bp = Blueprint('settings', __name__)
@@ -189,7 +190,7 @@ def upload_map_blueprint():
@settings_bp.route('/map-blueprint/<path:filename>', methods=['GET'])
def serve_map_blueprint(filename):
"""Serve an uploaded blueprint image (public - kiosks read it)."""
return send_from_directory(_map_dir(), filename)
return send_upload(_map_dir(), filename)
@settings_bp.route('/branding-logo', methods=['POST'])
@@ -234,7 +235,7 @@ def upload_branding_logo():
@settings_bp.route('/branding/<path:filename>', methods=['GET'])
def serve_branding_logo(filename):
"""Serve an uploaded branding logo (public - kiosks/print pages read it)."""
return send_from_directory(_branding_dir(), filename)
return send_upload(_branding_dir(), filename)
@settings_bp.route('', methods=['GET'])
@@ -520,10 +521,10 @@ def build_default_settings():
},
{
'key': 'pc_access_domain',
'value': 'device.geaerospace.net',
'value': 'device.geaerospace.net', # ADR-015-OK: GE Aerospace-wide domain, and only the DEFAULT of a documented setting every site can override.
'valuetype': 'string',
'category': 'site',
'description': 'Domain appended to a PC hostname to build remote-access links (host.device.geaerospace.net). Blank = use the hostname as-is.'
'description': 'Domain appended to a PC hostname to build remote-access links (host.device.geaerospace.net). Blank = use the hostname as-is.' # ADR-015-OK: GE Aerospace-wide domain, and only the DEFAULT of a documented setting every site can override.
},
{
'key': 'employeeid_pattern',
@@ -541,7 +542,7 @@ def build_default_settings():
},
{
'key': 'printer_hostname_template',
'value': 'Printer-{ip}.printer.geaerospace.net',
'value': 'Printer-{ip}.printer.geaerospace.net', # ADR-015-OK: GE Aerospace-wide domain, and only the DEFAULT of a documented setting every site can override.
'valuetype': 'string',
'category': 'site',
'description': 'Template for a printer hostname built from its IP. {ip} is the dash-separated IP address.'