diff --git a/.env.sample b/.env.sample
index 30c9381..9d27103 100644
--- a/.env.sample
+++ b/.env.sample
@@ -1,4 +1,5 @@
PRESENTATION_STORAGE=local
+MAX_FILE_SIZE_MB=15
AWS_ACCESS_KEY_ID=xxx
AWS_SECRET_ACCESS_KEY=xxx
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bd95162..22aa34d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,8 @@
- Migrate to Liveview 0.18
- Add multiple choice poll
- Add feature to import all interactions from another presentation
+- Add MAX_FILE_SIZE_MB environment variable to limit file upload size
+- Add feature to deactivate messages during a presentation
## v1.3.0
diff --git a/assets/js/app.js b/assets/js/app.js
index b1bcd54..7b638a7 100644
--- a/assets/js/app.js
+++ b/assets/js/app.js
@@ -148,8 +148,10 @@ Hooks.PostForm = {
mounted() {
const submitBtn = document.getElementById("submitBtn")
const TA = document.getElementById("postFormTA")
- submitBtn.addEventListener("click", (e) => this.onSubmit(e, TA))
- TA.addEventListener("keydown", (e) => this.onPress(e, submitBtn, TA))
+ if (submitBtn && TA) {
+ submitBtn.addEventListener("click", (e) => this.onSubmit(e, TA))
+ TA.addEventListener("keydown", (e) => this.onPress(e, submitBtn, TA))
+ }
},
updated() {
const submitBtn = document.getElementById("submitBtn")
@@ -165,8 +167,10 @@ Hooks.PostForm = {
destroyed() {
const submitBtn = document.getElementById("submitBtn")
const TA = document.getElementById("postFormTA")
- TA.removeEventListener("keydown", (e) => this.onPress(e, submitBtn, TA))
- submitBtn.removeEventListener("click", (e) => this.onSubmit(e, TA))
+ if (submitBtn && TA) {
+ TA.removeEventListener("keydown", (e) => this.onPress(e, submitBtn, TA))
+ submitBtn.removeEventListener("click", (e) => this.onSubmit(e, TA))
+ }
}
}
diff --git a/config/config.exs b/config/config.exs
index 317f58e..c9148e6 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -66,6 +66,9 @@ config :ex_aws,
region: {:system, "AWS_REGION"},
normalize_path: false
+config :claper, max_file_size: System.get_env("MAX_FILE_SIZE_MB") || 15
+
+
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{config_env()}.exs"
diff --git a/config/runtime.exs b/config/runtime.exs
index b187ab6..1606636 100644
--- a/config/runtime.exs
+++ b/config/runtime.exs
@@ -76,6 +76,8 @@ if config_env() == :prod do
# Swoosh supports Hackney and Finch out of the box:
#
+
+
if System.get_env("MAIL_TRANSPORT", "local") == "smtp" do
config :claper, Claper.Mailer,
adapter: Swoosh.Adapters.SMTP,
diff --git a/guides/introduction/configuration.md b/guides/introduction/configuration.md
index b35ba91..cca6573 100644
--- a/guides/introduction/configuration.md
+++ b/guides/introduction/configuration.md
@@ -37,6 +37,7 @@ MAILBOX_PASSWORD | - | - | - | Basic auth password for mailbox route
Variable | Values | Default | Required | Description
--- | --- | --- | --- | ---
ENABLE_ACCOUNT_CREATION | true, false | true | - | Enable/disable user registration
+MAX_FILE_SIZE_MB | - | 15 | - | Max file size to upload in MB
## Production / Docker
diff --git a/guides/usage/features.md b/guides/usage/features.md
index a512f12..f748a4d 100644
--- a/guides/usage/features.md
+++ b/guides/usage/features.md
@@ -18,6 +18,8 @@ When you create a new presentation, click on **Present/Customize**, select the s
During your presentation, enable **Active poll results** on the dashboard to see the poll results in real time.
+You can choose between single choice and multiple choice polls.
+
## Forms
diff --git a/lib/claper/presentations/presentation_state.ex b/lib/claper/presentations/presentation_state.ex
index 4e16779..a0d539c 100644
--- a/lib/claper/presentations/presentation_state.ex
+++ b/lib/claper/presentations/presentation_state.ex
@@ -7,6 +7,7 @@ defmodule Claper.Presentations.PresentationState do
field :chat_visible, :boolean
field :poll_visible, :boolean
field :join_screen_visible, :boolean
+ field :chat_enabled, :boolean
field :banned, {:array, :string}, default: []
belongs_to :presentation_file, Claper.Presentations.PresentationFile
@@ -23,7 +24,8 @@ defmodule Claper.Presentations.PresentationState do
:poll_visible,
:join_screen_visible,
:banned,
- :presentation_file_id
+ :presentation_file_id,
+ :chat_enabled
])
|> validate_required([])
end
diff --git a/lib/claper_web/live/event_live/event_form_component.ex b/lib/claper_web/live/event_live/event_form_component.ex
index 2442ab1..1d2f378 100644
--- a/lib/claper_web/live/event_live/event_form_component.ex
+++ b/lib/claper_web/live/event_live/event_form_component.ex
@@ -7,15 +7,18 @@ defmodule ClaperWeb.EventLive.EventFormComponent do
def update(%{event: event} = assigns, socket) do
changeset = Events.change_event(event)
+ {max_file_size, _} = Integer.parse("#{Application.fetch_env!(:claper, :max_file_size)}")
+
{:ok,
socket
|> assign(assigns)
|> assign(:changeset, changeset)
+ |> assign(:max_file_size, max_file_size)
|> allow_upload(:presentation_file,
accept: ~w(.pdf .ppt .pptx),
auto_upload: true,
max_entries: 1,
- max_file_size: 15_000_000
+ max_file_size: max_file_size * 1_000_000 # MB
)}
end
diff --git a/lib/claper_web/live/event_live/event_form_component.html.heex b/lib/claper_web/live/event_live/event_form_component.html.heex
index 26d3ea2..a20e622 100644
--- a/lib/claper_web/live/event_live/event_form_component.html.heex
+++ b/lib/claper_web/live/event_live/event_form_component.html.heex
@@ -75,7 +75,7 @@
<%= gettext("or drag and drop") %>
-<%= gettext("PDF, PPT, PPTX up to 15MB") %>
+<%= gettext("PDF, PPT, PPTX up to %{size} MB", size: @max_file_size) %>
<%= for entry <- @uploads.presentation_file.entries do %>