Skip to content

Commit

Permalink
✨🐞 Improve/rethink/fix Live Preview (#358)
Browse files Browse the repository at this point in the history
Parent issue: sequentech/meta#752
  • Loading branch information
Findeton authored Jun 26, 2024
1 parent e9e81ff commit 1b08628
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ config:
# play.http.parser.maxDiskBuffer (in ballot-box config)
# play.http.parser.maxMemoryBuffer (in ballot-box config)
# parsers.text.maxLength (in ballot-box config)
# DATA_UPLOAD_MAX_MEMORY_SIZE (in iam config)
# client_max_body_size (in nginx)
max_body_size: 2m

Expand Down
4 changes: 4 additions & 0 deletions iam/templates/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def on_celery_setup_logging(**kwargs):
}

STATIC_ROOT = '/home/iam/webstatic'
STATIC_PREVIEW_PATH = '/home/iam/webstatic/preview'
MEDIA_ROOT = '/home/iam/webstatic/media'

ALLOWED_HOSTS = ['*']
Expand Down Expand Up @@ -222,4 +223,7 @@ def on_celery_setup_logging(**kwargs):
{{extra_option}}
{% endfor %}

{% set max_body_size_bytes = (config.http.max_body_size[:-1] | int) * 1024 * 1024 %}

DATA_UPLOAD_MAX_MEMORY_SIZE = {{ max_body_size_bytes }}

5 changes: 5 additions & 0 deletions iam/templates/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ class CeleryConfig:

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_PREVIEW_PATH = os.path.join(BASE_DIR, 'static', 'preview')

# cors
CORS_ORIGIN_ALLOW_ALL = False
Expand Down Expand Up @@ -248,6 +249,10 @@ class CeleryConfig:

ENABLE_MULTIPLE_TALLIES = False

{% set max_body_size_bytes = (config.http.max_body_size[:-1] | int) * 1024 * 1024 %}

DATA_UPLOAD_MAX_MEMORY_SIZE = {{ max_body_size_bytes }}

if not os.path.exists(IMAGE_STORE_PATH):
os.mkdir(IMAGE_STORE_PATH)

Expand Down
1 change: 1 addition & 0 deletions oneserver/templates/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ http {
default 1;
"~^GET:/elections/api/(authorities|election/(\d+)(|/results|/hash/))" 0;
"~^GET:/elections/public/\d+/\d+.tar" 0;
"~^GET:/iam/api/auth-event/([a-f0-9\-]+)/live-preview" 0;
"~^POST:/elections/api/election/(\d+)/voter/" 0;
"~^GET:/iam/api/(legal/|auth-event/(\d+)/?)" 0;
"~^POST:/iam/api/auth-event/(\d+)/(register|authenticate|resend_auth_code|ping)" 0;
Expand Down

0 comments on commit 1b08628

Please sign in to comment.