From d9ba107da2d3722de3134e67e2d7f9f05b47c175 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 29 Jan 2025 10:45:50 +0100 Subject: [PATCH 1/8] :wrench: Update default body size for docker images Set it to 350MiB, the same as we have on our saas --- docker/images/files/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/images/files/nginx.conf b/docker/images/files/nginx.conf index e03f7ef0b2..ee732a945c 100644 --- a/docker/images/files/nginx.conf +++ b/docker/images/files/nginx.conf @@ -64,7 +64,7 @@ http { listen 8080 default_server; server_name _; - client_max_body_size 100M; + client_max_body_size 350M; charset utf-8; proxy_http_version 1.1; From 0768ef1b8f6b39675eda18651f703b0ca8084c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marina=20L=C3=B3pez?= Date: Wed, 29 Jan 2025 11:42:08 +0100 Subject: [PATCH 2/8] :sparkles: Add A/B test switching '+' to 'Add file' on hover (#5705) --- .../src/app/main/ui/dashboard/placeholder.cljs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/main/ui/dashboard/placeholder.cljs b/frontend/src/app/main/ui/dashboard/placeholder.cljs index dc85232207..af826ebc90 100644 --- a/frontend/src/app/main/ui/dashboard/placeholder.cljs +++ b/frontend/src/app/main/ui/dashboard/placeholder.cljs @@ -20,7 +20,10 @@ (mf/use-fn (mf/deps create-fn) (fn [_] - (create-fn "dashboard:empty-folder-placeholder")))] + (create-fn "dashboard:empty-folder-placeholder"))) + show-text (mf/use-state nil) + on-mouse-enter (mf/use-fn #(reset! show-text true)) + on-mouse-leave (mf/use-fn #(reset! show-text nil))] (cond (true? dragging?) [:ul @@ -43,9 +46,15 @@ :else [:div {:class (stl/css :grid-empty-placeholder)} - [:button {:class (stl/css :create-new) - :on-click on-click} - (if (cf/external-feature-flag "add-file-01" "test") (tr "dashboard.add-file") i/add)]]))) + (if (cf/external-feature-flag "add-file-01" "test") + [:button {:class (stl/css :create-new) + :on-click on-click + :on-mouse-enter on-mouse-enter + :on-mouse-leave on-mouse-leave} + (if @show-text (tr "dashboard.add-file") i/add)] + [:button {:class (stl/css :create-new) + :on-click on-click} + i/add])]))) (mf/defc loading-placeholder [] From f252ffb201f1be7e95f74616a1105a0a94393618 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 29 Jan 2025 12:22:05 +0100 Subject: [PATCH 3/8] :sparkles: Add the ability to overwrite default http body size on docker images And provide a compose file with good defaults --- docker/images/docker-compose.yaml | 15 +++++++++++---- docker/images/files/nginx-entrypoint.sh | 4 +++- docker/images/files/nginx.conf | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/docker/images/docker-compose.yaml b/docker/images/docker-compose.yaml index c745f78be5..ee06c0933c 100644 --- a/docker/images/docker-compose.yaml +++ b/docker/images/docker-compose.yaml @@ -29,6 +29,15 @@ x-flags: &penpot-flags x-uri: &penpot-public-uri PENPOT_PUBLIC_URI: http://localhost:9001 +x-body-size: &penpot-http-body-size + # Max body size (30MiB); Used for plain requests, should never be + # greater than multi-part size + PENPOT_HTTP_SERVER_MAX_BODY_SIZE: 31457280 + + # Max multipart body size (350MiB) + PENPOT_HTTP_SERVER_MAX_MULTIPART_BODY_SIZE: 367001600 + + networks: penpot: @@ -103,7 +112,7 @@ services: # - "traefik.http.routers.penpot-https.tls.certresolver=letsencrypt" environment: - << : *penpot-flags + << : [*penpot-flags, *penpot-http-body-size] penpot-backend: image: "penpotapp/backend:latest" @@ -123,7 +132,7 @@ services: ## container. environment: - << : [*penpot-flags, *penpot-public-uri] + << : [*penpot-flags, *penpot-public-uri, *penpot-http-body-size] ## Penpot SECRET KEY. It serves as a master key from which other keys for subsystems ## (eg http sessions, or invitations) are derived. @@ -261,5 +270,3 @@ services: # ports: # - 9000:9000 # - 9001:9001 - - diff --git a/docker/images/files/nginx-entrypoint.sh b/docker/images/files/nginx-entrypoint.sh index c342452307..74c0042d63 100644 --- a/docker/images/files/nginx-entrypoint.sh +++ b/docker/images/files/nginx-entrypoint.sh @@ -22,7 +22,9 @@ update_flags /var/www/app/js/config.js export PENPOT_BACKEND_URI=${PENPOT_BACKEND_URI:-http://penpot-backend:6060}; export PENPOT_EXPORTER_URI=${PENPOT_EXPORTER_URI:-http://penpot-exporter:6061}; export PENPOT_INTERNAL_RESOLVER=${PENPOT_INTERNAL_RESOLVER:-127.0.0.11}; +export PENPOT_HTTP_SERVER_MAX_MULTIPART_BODY_SIZE=${PENPOT_HTTP_SERVER_MAX_MULTIPART_BODY_SIZE:-367001600}; # Default to 350MiB -envsubst "\$PENPOT_BACKEND_URI,\$PENPOT_EXPORTER_URI,\$PENPOT_INTERNAL_RESOLVER" < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf +envsubst "\$PENPOT_BACKEND_URI,\$PENPOT_EXPORTER_URI,\$PENPOT_INTERNAL_RESOLVER,\$PENPOT_HTTP_SERVER_MAX_MULTIPART_BODY_SIZE" \ + < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf exec "$@"; diff --git a/docker/images/files/nginx.conf b/docker/images/files/nginx.conf index ee732a945c..19f2e3a1ab 100644 --- a/docker/images/files/nginx.conf +++ b/docker/images/files/nginx.conf @@ -64,7 +64,7 @@ http { listen 8080 default_server; server_name _; - client_max_body_size 350M; + client_max_body_size $PENPOT_HTTP_SERVER_MAX_MULTIPART_BODY_SIZE; charset utf-8; proxy_http_version 1.1; From 47f1ca9627899c2c89c626121f4dab0c1aaa3b94 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 29 Jan 2025 12:26:30 +0100 Subject: [PATCH 4/8] :sparkles: Change backend defaults for http body --- backend/src/app/http.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/app/http.clj b/backend/src/app/http.clj index 4d85cdaeed..e04b0523df 100644 --- a/backend/src/app/http.clj +++ b/backend/src/app/http.clj @@ -42,8 +42,8 @@ (def default-params {::port 6060 ::host "0.0.0.0" - ::max-body-size (* 1024 1024 30) ; default 30 MiB - ::max-multipart-body-size (* 1024 1024 120)}) ; default 120 MiB + ::max-body-size 31457280 ; default 30 MiB + ::max-multipart-body-size 367001600}) ; default 350 MiB (defmethod ig/expand-key ::server [k v] From 8145eb89d74bbd5242342ec8c49400168e9cd20b Mon Sep 17 00:00:00 2001 From: Aitor Moreno Date: Wed, 29 Jan 2025 23:06:05 +0100 Subject: [PATCH 5/8] :bug: Fix styles not being inherited (#5717) --- .../src/editor/controllers/SelectionController.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/text-editor/src/editor/controllers/SelectionController.js b/frontend/text-editor/src/editor/controllers/SelectionController.js index 4f8e49ca9d..77cb109a9d 100644 --- a/frontend/text-editor/src/editor/controllers/SelectionController.js +++ b/frontend/text-editor/src/editor/controllers/SelectionController.js @@ -358,6 +358,16 @@ export class SelectionController extends EventTarget { detail: this.#currentStyle, }) ); + } else { + const firstInline = this.#textEditor.root?.firstElementChild?.firstElementChild; + if (firstInline) { + this.#updateCurrentStyle(firstInline); + this.dispatchEvent( + new CustomEvent("stylechange", { + detail: this.#currentStyle, + }), + ); + } } } From 15a896e05080f220609d14dd9ec3e648b0b40123 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 30 Jan 2025 09:17:02 +0100 Subject: [PATCH 6/8] :bug: Add migration for fix files with invalid token-data (#5712) Because of previous bug that is already fixed --- common/src/app/common/files/defaults.cljc | 2 +- common/src/app/common/files/migrations.cljc | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/common/src/app/common/files/defaults.cljc b/common/src/app/common/files/defaults.cljc index e7d64788aa..cd1fbbf9b0 100644 --- a/common/src/app/common/files/defaults.cljc +++ b/common/src/app/common/files/defaults.cljc @@ -6,4 +6,4 @@ (ns app.common.files.defaults) -(def version 62) +(def version 65) diff --git a/common/src/app/common/files/migrations.cljc b/common/src/app/common/files/migrations.cljc index c245302d6d..adce0aeee5 100644 --- a/common/src/app/common/files/migrations.cljc +++ b/common/src/app/common/files/migrations.cljc @@ -1179,6 +1179,24 @@ (update data :components update-vals update-component))) +(defn migrate-up-65 + [data] + (let [update-object + (fn [object] + (d/update-when object :plugin-data d/without-nils)) + + update-page + (fn [page] + (-> (update-object page) + (update :objects update-vals update-object)))] + + (-> data + (update-object) + (d/update-when :pages-index update-vals update-page) + (d/update-when :colors update-vals update-object) + (d/update-when :typographies update-vals update-object) + (d/update-when :components update-vals update-object)))) + (def migrations "A vector of all applicable migrations" [{:id 2 :migrate-up migrate-up-2} @@ -1229,4 +1247,5 @@ {:id 56 :migrate-up migrate-up-56} {:id 57 :migrate-up migrate-up-57} {:id 59 :migrate-up migrate-up-59} - {:id 62 :migrate-up migrate-up-62}]) + {:id 62 :migrate-up migrate-up-62} + {:id 65 :migrate-up migrate-up-65}]) From a2ce5efe694eda921aee29910deda4f571699174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marina=20L=C3=B3pez?= Date: Thu, 30 Jan 2025 11:31:45 +0100 Subject: [PATCH 7/8] :sparkles: Add has-files prop to create-file event --- frontend/src/app/main/data/dashboard.cljs | 1 + frontend/src/app/main/ui/dashboard/files.cljs | 2 +- frontend/src/app/main/ui/dashboard/projects.cljs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/data/dashboard.cljs b/frontend/src/app/main/data/dashboard.cljs index e66187bead..da5ccb8415 100644 --- a/frontend/src/app/main/data/dashboard.cljs +++ b/frontend/src/app/main/data/dashboard.cljs @@ -953,6 +953,7 @@ (defn create-file [{:keys [project-id name] :as params}] (dm/assert! (uuid? project-id)) + (ptk/reify ::create-file ev/Event (-data [_] {:project-id project-id}) diff --git a/frontend/src/app/main/ui/dashboard/files.cljs b/frontend/src/app/main/ui/dashboard/files.cljs index 019e7b5025..db3ac3d090 100644 --- a/frontend/src/app/main/ui/dashboard/files.cljs +++ b/frontend/src/app/main/ui/dashboard/files.cljs @@ -160,7 +160,7 @@ (let [mdata {:on-success on-file-created} params {:project-id (:id project)}] (st/emit! (-> (dd/create-file (with-meta params mdata)) - (with-meta {::ev/origin origin}))))))] + (with-meta {::ev/origin origin :has-files (> file-count 0)}))))))] (mf/with-effect [project] (when project diff --git a/frontend/src/app/main/ui/dashboard/projects.cljs b/frontend/src/app/main/ui/dashboard/projects.cljs index 611f205cf3..95a509f023 100644 --- a/frontend/src/app/main/ui/dashboard/projects.cljs +++ b/frontend/src/app/main/ui/dashboard/projects.cljs @@ -179,7 +179,7 @@ (let [mdata {:on-success on-file-created} params {:project-id project-id}] (st/emit! (-> (dd/create-file (with-meta params mdata)) - (with-meta {::ev/origin origin})))))) + (with-meta {::ev/origin origin :has-files (> file-count 0)})))))) on-create-click (mf/use-fn From 10ca2b20e44e0a94625afa7115d22f6b773c074d Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 30 Jan 2025 11:41:50 +0100 Subject: [PATCH 8/8] :paperclip: Update changelog --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 8d7b928bf8..724ef91fce 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # CHANGELOG -## 2.4.3 (Unreleased) +## 2.4.3 ### :bug: Bugs fixed