diff --git a/.dockerignore b/.dockerignore index 6cbb4dd4..a688fef9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -26,4 +26,5 @@ docker-compose.yml node_modules/ **/node_modules/ -api/data \ No newline at end of file +api/data +api/src/sysreptor_plugins/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 46209b10..13c77a3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## Upcoming +* Experimental plugin system +* Disable static file compression + + ## v2024.81 - 2024-10-25 * Fix mermaid diagram labels not rendered * Disable CSP trusted types enforcement because of incompatibilities diff --git a/Dockerfile b/Dockerfile index a4513cd7..e5ff9a3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -198,6 +198,7 @@ FROM --platform=$BUILDPLATFORM api-dev AS api-test # Copy source code COPY --chown=user:user api/src /app/api/ COPY --chown=user:user plugins /app/plugins/ +RUN mkdir -p /app/api/sysreptor_plugins/ && chmod 777 /app/api/sysreptor_plugins/ # Copy generated template rendering script COPY --from=rendering --chown=user:user /app/rendering/dist /app/rendering/dist/ @@ -210,8 +211,7 @@ FROM --platform=$BUILDPLATFORM api-test AS api-statics RUN python3 manage.py collectstatic --no-input --clear COPY --from=frontend /app/frontend/dist/index.html /app/frontend/dist/static/ /app/api/frontend/static/ RUN mv /app/api/frontend/static/index.html /app/api/frontend/index.html \ - && python3 manage.py collectstatic --no-input --no-post-process \ - && python3 -m whitenoise.compress /app/api/static/ map + && python3 manage.py collectstatic --no-input --no-post-process COPY --from=plugin-builder --chown=user:user /app/plugins/ /app/plugins/ diff --git a/api/src/reportcreator_api/utils/middleware.py b/api/src/reportcreator_api/utils/middleware.py index 27a5a02c..4c83f7cd 100644 --- a/api/src/reportcreator_api/utils/middleware.py +++ b/api/src/reportcreator_api/utils/middleware.py @@ -53,13 +53,12 @@ def process_response(self, request, response): # Cache static files if request.path.startswith(settings.STATIC_URL) and response.status_code == 200 and not settings.DEBUG: - if any(request.path.endswith(e) for e in ['.html', '.json']) or \ - (request.path.startswith(settings.STATIC_URL + 'plugins/') and '/_nuxt/' not in request.path): - # Do not cache for long - cache.patch_cache_control(response, public=True, max_age=2 * 60) - else: + if '/_nuxt/' not in request.path and not any(request.path.endswith(e) for e in ['.html', '.json']): # Chunk files with unique names. Can be cached for a long time - cache.patch_cache_control(response, public=True, max_age=24 * 3600) + cache.patch_cache_control(response, public=True, max_age=24 * 60 * 60) + else: + # Do not cache for long + cache.patch_cache_control(response, public=True, max_age=1 * 60) else: # Do not cache API responses and django views cache.add_never_cache_headers(response)