From 5ac6f0485763cacace119ced31f16bb471193aa2 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Wed, 31 Jul 2024 13:04:12 +0200 Subject: [PATCH 1/7] :sparkles: Add a/b testing for signup image --- frontend/src/app/main/ui/auth.cljs | 14 +++++++++----- frontend/src/app/main/ui/auth.scss | 31 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/main/ui/auth.cljs b/frontend/src/app/main/ui/auth.cljs index c22ec0902..4d24070cc 100644 --- a/frontend/src/app/main/ui/auth.cljs +++ b/frontend/src/app/main/ui/auth.cljs @@ -48,7 +48,8 @@ (not= section :auth-register-validate) (not= section :auth-register-success)) params (:query-params route) - error (:error params)] + error (:error params) + hide-image-auth? (cf/external-feature-flag "signup-01" "test")] (mf/with-effect [] (dom/set-html-title (tr "title.default"))) @@ -57,14 +58,17 @@ (when error (st/emit! (du/show-redirect-error error)))) - [:main {:class (stl/css :auth-section)} + [:main {:class (stl/css-case :auth-section (not hide-image-auth?) + :auth-section-hide-image hide-image-auth?)} (when show-login-icon [:h1 {:class (stl/css :logo-container)} [:a {:href "#/" :title "Penpot" :class (stl/css :logo-btn)} i/logo]]) - [:div {:class (stl/css :login-illustration)} - i/login-illustration] + (when (not hide-image-auth?) + [:div {:class (stl/css :login-illustration)} + i/login-illustration]) - [:section {:class (stl/css :auth-content)} + [:section {:class (stl/css-case :auth-content (not hide-image-auth?) + :auth-content-hide-image hide-image-auth?)} (case section :auth-register diff --git a/frontend/src/app/main/ui/auth.scss b/frontend/src/app/main/ui/auth.scss index 8f7e2087d..ff1a096a7 100644 --- a/frontend/src/app/main/ui/auth.scss +++ b/frontend/src/app/main/ui/auth.scss @@ -24,6 +24,24 @@ } } +// A-B text signup-01 +.auth-section-hide-image { + position: relative; + align-items: center; + background: var(--panel-background-color); + display: grid; + gap: $s-32; + height: 100%; + padding: $s-32; + width: 100%; + overflow: auto; + + @media (max-width: 992px) { + display: flex; + justify-content: center; + } +} + .logo-container { position: absolute; top: $s-20; @@ -65,6 +83,19 @@ width: 100%; } +// A-B text signup-01 +.auth-content-hide-image { + display: grid; + grid-template-rows: 1fr auto; + gap: $s-24; + height: fit-content; + margin: auto; + max-width: $s-412; + padding-block-end: $s-8; + position: relative; + width: 100%; +} + .logo-btn { svg { width: $s-120; From 8eddcd64f125776aef48d2566a14b8799a4de34e Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Mon, 5 Aug 2024 11:05:56 +0200 Subject: [PATCH 2/7] :bug: Fix user language validator --- CHANGES.md | 6 ++++++ backend/src/app/rpc/commands/profile.clj | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 5b1363679..5ebcda0d8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # CHANGELOG +## 2.1.2 + +### :bug: Bugs fixed + +- User switch language to "zh_hant" will get 400 [Github #4884](https://github.com/penpot/penpot/issues/4884) + ## 2.1.1 ### :sparkles: New features diff --git a/backend/src/app/rpc/commands/profile.clj b/backend/src/app/rpc/commands/profile.clj index 40b8b8a43..e3b453e26 100644 --- a/backend/src/app/rpc/commands/profile.clj +++ b/backend/src/app/rpc/commands/profile.clj @@ -102,7 +102,7 @@ (sm/define [:map {:title "update-profile"} [:fullname [::sm/word-string {:max 250}]] - [:lang {:optional true} [:string {:max 5}]] + [:lang {:optional true} [:string {:max 8}]] [:theme {:optional true} [:string {:max 250}]]])) (sv/defmethod ::update-profile From aa21430a5cba5f9f2ce2de723ffa55a129037294 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Mon, 5 Aug 2024 12:45:05 +0200 Subject: [PATCH 3/7] :bug: Fix custom smtp port with ssl enabled --- CHANGES.md | 1 + backend/src/app/email.clj | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 5ebcda0d8..09c8cb0b4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ ### :bug: Bugs fixed - User switch language to "zh_hant" will get 400 [Github #4884](https://github.com/penpot/penpot/issues/4884) +- Smtp config ignoring port if ssl is set [Github #4872](https://github.com/penpot/penpot/issues/4872) ## 2.1.1 diff --git a/backend/src/app/email.clj b/backend/src/app/email.clj index 2b1eb4c12..acb322805 100644 --- a/backend/src/app/email.clj +++ b/backend/src/app/email.clj @@ -306,6 +306,8 @@ (let [session (create-smtp-session cfg)] (with-open [transport (.getTransport session (if (::ssl cfg) "smtps" "smtp"))] (.connect ^Transport transport + ^String (::host cfg) + ^String (::port cfg) ^String (::username cfg) ^String (::password cfg)) From 016245120512e0cfb9051ff5009351e6b814957e Mon Sep 17 00:00:00 2001 From: Julian Schacher Date: Wed, 31 Jul 2024 00:32:48 +0200 Subject: [PATCH 4/7] Revert ":bug: Set proper default tenant on exporter" This reverts commit 86b2ce4dab9d70733c448e9b73c0905c6a66f949. --- exporter/src/app/config.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exporter/src/app/config.cljs b/exporter/src/app/config.cljs index ae590e53f..4c0088077 100644 --- a/exporter/src/app/config.cljs +++ b/exporter/src/app/config.cljs @@ -17,7 +17,7 @@ (def ^:private defaults {:public-uri "http://localhost:3449" - :tenant "dev" + :tenant "default" :host "localhost" :http-server-port 6061 :http-server-host "0.0.0.0" From ea7ad2aaa096f8d190d740f693f22f3ed1f05088 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 6 Aug 2024 10:38:19 +0200 Subject: [PATCH 5/7] :sparkles: Add flag `oidc-registration` for switch on/off registration with oidc --- CHANGES.md | 1 + backend/src/app/auth/oidc.clj | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 09c8cb0b4..5544b031e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ - User switch language to "zh_hant" will get 400 [Github #4884](https://github.com/penpot/penpot/issues/4884) - Smtp config ignoring port if ssl is set [Github #4872](https://github.com/penpot/penpot/issues/4872) +- Ability to let users to authenticate with a private oidc provider only [Github #4963](https://github.com/penpot/penpot/issues/4963) ## 2.1.1 diff --git a/backend/src/app/auth/oidc.clj b/backend/src/app/auth/oidc.clj index 18ecf718a..252f7e3cb 100644 --- a/backend/src/app/auth/oidc.clj +++ b/backend/src/app/auth/oidc.clj @@ -592,7 +592,8 @@ :else (let [info (assoc info :is-active (provider-has-email-verified? cfg info))] - (if (contains? cf/flags :registration) + (if (or (contains? cf/flags :registration) + (contains? cf/flags :oidc-registration)) (redirect-to-register cfg info request) (redirect-with-error "registration-disabled"))))) From a1c78683f5b982b457dd666883e2b86bd1c4715b Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 7 Aug 2024 10:57:51 +0200 Subject: [PATCH 6/7] :paperclip: Update version.txt file --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 7ec1d6db4..eca07e4c1 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.1.0 +2.1.2 From 2533d0ebc0f350a4f9b8facb872d1567ef6e0203 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 7 Aug 2024 16:18:17 +0200 Subject: [PATCH 7/7] :sparkles: Add naming consistency changes for file_data_fragment table --- backend/src/app/features/fdata.clj | 18 ++++++++---------- backend/src/app/migrations.clj | 5 ++++- .../sql/0121-mod-file-data-fragment-table.sql | 8 ++++++++ backend/src/app/rpc/commands/files.clj | 18 +++++++++--------- ...t-file-fragment-with-assets-components.json | 4 ++-- .../get-file-fragmnet-with-assets-page.json | 4 ++-- ...get-file-fragment-multiple-constraints.json | 4 ++-- .../viewer/get-file-fragment-empty-file.json | 4 ++-- .../viewer/get-file-fragment-single-board.json | 4 ++-- .../data/workspace/get-file-fragment-7760.json | 2 +- .../workspace/get-file-fragment-blank.json | 4 ++-- frontend/src/app/main/data/viewer.cljs | 2 +- .../src/app/main/features/pointer_map.cljs | 2 +- 13 files changed, 44 insertions(+), 35 deletions(-) create mode 100644 backend/src/app/migrations/sql/0121-mod-file-data-fragment-table.sql diff --git a/backend/src/app/features/fdata.clj b/backend/src/app/features/fdata.clj index baa63f693..5370df038 100644 --- a/backend/src/app/features/fdata.clj +++ b/backend/src/app/features/fdata.clj @@ -58,28 +58,26 @@ (defn load-pointer "A database loader pointer helper" [system file-id id] - (let [{:keys [content]} (db/get system :file-data-fragment - {:id id :file-id file-id} - {::sql/columns [:content] - ::db/check-deleted false})] + (let [fragment (db/get* system :file-data-fragment + {:id id :file-id file-id} + {::sql/columns [:data]})] (l/trc :hint "load pointer" :file-id (str file-id) :id (str id) - :found (some? content)) + :found (some? fragment)) - (when-not content + (when-not fragment (ex/raise :type :internal :code :fragment-not-found :hint "fragment not found" :file-id file-id :fragment-id id)) - (blob/decode content))) + (blob/decode (:data fragment)))) (defn persist-pointers! - "Given a database connection and the final file-id, persist all - pointers to the underlying storage (the database)." + "Persist all currently tracked pointer objects" [system file-id] (let [conn (db/get-connection system)] (doseq [[id item] @pmap/*tracked*] @@ -89,7 +87,7 @@ (db/insert! conn :file-data-fragment {:id id :file-id file-id - :content content})))))) + :data content})))))) (defn process-pointers "Apply a function to all pointers on the file. Usuly used for diff --git a/backend/src/app/migrations.clj b/backend/src/app/migrations.clj index 86f0fa6f5..32768abf9 100644 --- a/backend/src/app/migrations.clj +++ b/backend/src/app/migrations.clj @@ -379,7 +379,10 @@ :fn (mg/resource "app/migrations/sql/0119-mod-file-table.sql")} {:name "0120-mod-audit-log-table" - :fn (mg/resource "app/migrations/sql/0120-mod-audit-log-table.sql")}]) + :fn (mg/resource "app/migrations/sql/0120-mod-audit-log-table.sql")} + + {:name "0121-mod-file-data-fragment-table" + :fn (mg/resource "app/migrations/sql/0121-mod-file-data-fragment-table.sql")}]) (defn apply-migrations! [pool name migrations] diff --git a/backend/src/app/migrations/sql/0121-mod-file-data-fragment-table.sql b/backend/src/app/migrations/sql/0121-mod-file-data-fragment-table.sql new file mode 100644 index 000000000..bd30e8cb8 --- /dev/null +++ b/backend/src/app/migrations/sql/0121-mod-file-data-fragment-table.sql @@ -0,0 +1,8 @@ +ALTER TABLE file_data_fragment + ADD COLUMN data bytea NULL; + +UPDATE file_data_fragment + SET data = content; + +ALTER TABLE file_data_fragment + DROP COLUMN content; diff --git a/backend/src/app/rpc/commands/files.clj b/backend/src/app/rpc/commands/files.clj index 53cbf23c5..1ad42c22b 100644 --- a/backend/src/app/rpc/commands/files.clj +++ b/backend/src/app/rpc/commands/files.clj @@ -341,9 +341,9 @@ [:share-id {:optional true} ::sm/uuid]]) (defn- get-file-fragment - [conn file-id fragment-id] - (some-> (db/get conn :file-data-fragment {:file-id file-id :id fragment-id}) - (update :content blob/decode))) + [cfg file-id fragment-id] + (some-> (db/get cfg :file-data-fragment {:file-id file-id :id fragment-id}) + (update :data blob/decode))) (sv/defmethod ::get-file-fragment "Retrieve a file fragment by its ID. Only authenticated users." @@ -351,12 +351,12 @@ ::rpc/auth false ::sm/params schema:get-file-fragment ::sm/result schema:file-fragment} - [{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id file-id fragment-id share-id]}] - (dm/with-open [conn (db/open pool)] - (let [perms (get-permissions conn profile-id file-id share-id)] - (check-read-permissions! perms) - (-> (get-file-fragment conn file-id fragment-id) - (rph/with-http-cache long-cache-duration))))) + [cfg {:keys [::rpc/profile-id file-id fragment-id share-id]}] + (db/run! cfg (fn [cfg] + (let [perms (get-permissions cfg profile-id file-id share-id)] + (check-read-permissions! perms) + (-> (get-file-fragment cfg file-id fragment-id) + (rph/with-http-cache long-cache-duration)))))) ;; --- COMMAND QUERY: get-project-files diff --git a/frontend/playwright/data/assets/get-file-fragment-with-assets-components.json b/frontend/playwright/data/assets/get-file-fragment-with-assets-components.json index 4f8cfb630..053031eb5 100644 --- a/frontend/playwright/data/assets/get-file-fragment-with-assets-components.json +++ b/frontend/playwright/data/assets/get-file-fragment-with-assets-components.json @@ -2,7 +2,7 @@ "~:id": "~u015fda4f-caa6-8103-8004-862a9e4b4d4b", "~:file-id": "~u015fda4f-caa6-8103-8004-862a00dd4f31", "~:created-at": "~m1718718436639", - "~:content": { + "~:data": { "~ue117f7f6-433c-807e-8004-862a38e1823d": { "~:id": "~ue117f7f6-433c-807e-8004-862a38e1823d", "~:name": "Button", @@ -28,4 +28,4 @@ "~:main-instance-page": "~u015fda4f-caa6-8103-8004-862a00ddbe94" } } -} \ No newline at end of file +} diff --git a/frontend/playwright/data/assets/get-file-fragmnet-with-assets-page.json b/frontend/playwright/data/assets/get-file-fragmnet-with-assets-page.json index 99e01ce34..bae8fd54e 100644 --- a/frontend/playwright/data/assets/get-file-fragmnet-with-assets-page.json +++ b/frontend/playwright/data/assets/get-file-fragmnet-with-assets-page.json @@ -2,7 +2,7 @@ "~:id": "~u015fda4f-caa6-8103-8004-862a9e4ad279", "~:file-id": "~u015fda4f-caa6-8103-8004-862a00dd4f31", "~:created-at": "~m1718718436639", - "~:content": { + "~:data": { "~:options": {}, "~:objects": { "~u00000000-0000-0000-0000-000000000000": { @@ -627,4 +627,4 @@ "~:id": "~u015fda4f-caa6-8103-8004-862a00ddbe94", "~:name": "Page 1" } -} \ No newline at end of file +} diff --git a/frontend/playwright/data/design/get-file-fragment-multiple-constraints.json b/frontend/playwright/data/design/get-file-fragment-multiple-constraints.json index 1a055d7d1..0fe5f6a2c 100644 --- a/frontend/playwright/data/design/get-file-fragment-multiple-constraints.json +++ b/frontend/playwright/data/design/get-file-fragment-multiple-constraints.json @@ -2,7 +2,7 @@ "~:id": "~u03bff843-920f-81a1-8004-7563acdc8ca1", "~:file-id": "~u03bff843-920f-81a1-8004-756365e1eb6a", "~:created-at": "~m1717592543081", - "~:content": { + "~:data": { "~:options": {}, "~:objects": { "~u00000000-0000-0000-0000-000000000000": { @@ -360,4 +360,4 @@ "~:id": "~u03bff843-920f-81a1-8004-756365e1eb6b", "~:name": "Page 1" } -} \ No newline at end of file +} diff --git a/frontend/playwright/data/viewer/get-file-fragment-empty-file.json b/frontend/playwright/data/viewer/get-file-fragment-empty-file.json index 544c559f7..c4fc2086e 100644 --- a/frontend/playwright/data/viewer/get-file-fragment-empty-file.json +++ b/frontend/playwright/data/viewer/get-file-fragment-empty-file.json @@ -2,7 +2,7 @@ "~:id": "~u0515a066-e303-8169-8004-73eb58e899c2", "~:file-id": "~uc7ce0794-0992-8105-8004-38f280443849", "~:created-at": "~m1717493890966", - "~:content": { + "~:data": { "~:options": {}, "~:objects": { "~u00000000-0000-0000-0000-000000000000": { @@ -94,4 +94,4 @@ "~:id": "~uc7ce0794-0992-8105-8004-38f28044384a", "~:name": "Page 1" } -} \ No newline at end of file +} diff --git a/frontend/playwright/data/viewer/get-file-fragment-single-board.json b/frontend/playwright/data/viewer/get-file-fragment-single-board.json index 8c1e62a15..cf00a2900 100644 --- a/frontend/playwright/data/viewer/get-file-fragment-single-board.json +++ b/frontend/playwright/data/viewer/get-file-fragment-single-board.json @@ -2,7 +2,7 @@ "~:id": "~udd5cc0bb-91ff-81b9-8004-77dfae2d9e7c", "~:file-id": "~udd5cc0bb-91ff-81b9-8004-77df9cd3edb1", "~:created-at": "~m1717759268004", - "~:content": { + "~:data": { "~:options": {}, "~:objects": { "~u00000000-0000-0000-0000-000000000000": { @@ -183,4 +183,4 @@ "~:id": "~udd5cc0bb-91ff-81b9-8004-77df9cd3edb2", "~:name": "Page 1" } -} \ No newline at end of file +} diff --git a/frontend/playwright/data/workspace/get-file-fragment-7760.json b/frontend/playwright/data/workspace/get-file-fragment-7760.json index 0c8011553..c07d48702 100644 --- a/frontend/playwright/data/workspace/get-file-fragment-7760.json +++ b/frontend/playwright/data/workspace/get-file-fragment-7760.json @@ -2,7 +2,7 @@ "~:id": "~ucd90e028-326a-80b4-8004-7cdeefa23ece", "~:file-id": "~ucd90e028-326a-80b4-8004-7cdec16ffad5", "~:created-at": "~m1718094617214", - "~:content": { + "~:data": { "~:options": {}, "~:objects": { "~u00000000-0000-0000-0000-000000000000": { diff --git a/frontend/playwright/data/workspace/get-file-fragment-blank.json b/frontend/playwright/data/workspace/get-file-fragment-blank.json index fe357c500..7760aaa92 100644 --- a/frontend/playwright/data/workspace/get-file-fragment-blank.json +++ b/frontend/playwright/data/workspace/get-file-fragment-blank.json @@ -2,7 +2,7 @@ "~:id": "~ude58c8f6-c5c2-8196-8004-3df9e2e52d88", "~:file-id": "~uc7ce0794-0992-8105-8004-38f280443849", "~:created-at": "~m1713873823631", - "~:content": { + "~:data": { "~:options": {}, "~:objects": { "~u00000000-0000-0000-0000-000000000000": { @@ -94,4 +94,4 @@ "~:id": "~uc7ce0794-0992-8105-8004-38f28044384a", "~:name": "Page 1" } -} \ No newline at end of file +} diff --git a/frontend/src/app/main/data/viewer.cljs b/frontend/src/app/main/data/viewer.cljs index 456413018..68757d15d 100644 --- a/frontend/src/app/main/data/viewer.cljs +++ b/frontend/src/app/main/data/viewer.cljs @@ -134,7 +134,7 @@ (uuid? share-id) (assoc :share-id share-id))] (->> (rp/cmd! :get-file-fragment params) - (rx/map :content) + (rx/map :data) (rx/map #(vector key %)))))] (->> (rp/cmd! :get-view-only-bundle params') diff --git a/frontend/src/app/main/features/pointer_map.cljs b/frontend/src/app/main/features/pointer_map.cljs index 993427e55..7055c1188 100644 --- a/frontend/src/app/main/features/pointer_map.cljs +++ b/frontend/src/app/main/features/pointer_map.cljs @@ -16,7 +16,7 @@ (letfn [(resolve-pointer [[key val :as kv]] (if (t/pointer? val) (->> (rp/cmd! :get-file-fragment {:file-id id :fragment-id @val}) - (rx/map #(get % :content)) + (rx/map #(get % :data)) (rx/map #(vector key %))) (rx/of kv)))