From 1b93ccdec9ac3d030a476c611742df8e94cabfb8 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 4 Jul 2024 12:07:54 +0200 Subject: [PATCH 1/2] :sparkles: Remove duplicate permissions in confirm dialog --- .../src/app/main/ui/workspace/plugins.cljs | 27 ++++++++++--------- frontend/src/app/plugins.cljs | 11 +++++++- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/plugins.cljs b/frontend/src/app/main/ui/workspace/plugins.cljs index d7db43950..53c41282a 100644 --- a/frontend/src/app/main/ui/workspace/plugins.cljs +++ b/frontend/src/app/main/ui/workspace/plugins.cljs @@ -205,35 +205,38 @@ [:div {:class (stl/css :modal-content)} [:div {:class (stl/css :permissions-list)} - (when (contains? permissions "content:read") + (cond + (contains? permissions "content:write") + [:div {:class (stl/css :permissions-list-entry)} + i/oauth-1 + [:p {:class (stl/css :permissions-list-text)} + (tr "workspace.plugins.permissions.content-write")]] + + (contains? permissions "content:read") [:div {:class (stl/css :permissions-list-entry)} i/oauth-1 [:p {:class (stl/css :permissions-list-text)} (tr "workspace.plugins.permissions.content-read")]]) - (when (contains? permissions "content:write") - [:div {:class (stl/css :permissions-list-entry)} - i/oauth-1 - [:p {:class (stl/css :permissions-list-text)} - (tr "workspace.plugins.permissions.content-write")]]) - - (when (contains? permissions "user:read") + (cond + (contains? permissions "user:read") [:div {:class (stl/css :permissions-list-entry)} i/oauth-2 [:p {:class (stl/css :permissions-list-text)} (tr "workspace.plugins.permissions.user-read")]]) - (when (contains? permissions "library:read") + (cond + (contains? permissions "library:write") [:div {:class (stl/css :permissions-list-entry)} i/oauth-3 [:p {:class (stl/css :permissions-list-text)} - (tr "workspace.plugins.permissions.library-read")]]) + (tr "workspace.plugins.permissions.library-write")]] - (when (contains? permissions "library:write") + (contains? permissions "library:read") [:div {:class (stl/css :permissions-list-entry)} i/oauth-3 [:p {:class (stl/css :permissions-list-text)} - (tr "workspace.plugins.permissions.library-write")]])] + (tr "workspace.plugins.permissions.library-read")]])] [:div {:class (stl/css :permissions-disclaimer)} (tr "workspace.plugins.permissions.disclaimer")]] diff --git a/frontend/src/app/plugins.cljs b/frontend/src/app/plugins.cljs index 21e16d3c2..c66260e52 100644 --- a/frontend/src/app/plugins.cljs +++ b/frontend/src/app/plugins.cljs @@ -47,7 +47,16 @@ desc (obj/get manifest "description") code (obj/get manifest "code") icon (obj/get manifest "icon") - permissions (obj/get manifest "permissions") + + permissions (into #{} (obj/get manifest "permissions" [])) + permissions + (cond-> permissions + (contains? permissions "content:write") + (conj "content:read") + + (contains? permissions "library:write") + (conj "content:write")) + origin (obj/get (js/URL. plugin-url) "origin") plugin-id (str (uuid/next))] {:plugin-id plugin-id From 0a83306015b59affb67e55f3fcdf3acc419f1e3c Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 4 Jul 2024 12:54:38 +0200 Subject: [PATCH 2/2] :arrow_up: Update plugins runtime --- frontend/resources/plugins-runtime/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/resources/plugins-runtime/index.js b/frontend/resources/plugins-runtime/index.js index 1d75c17b1..8b622aa53 100644 --- a/frontend/resources/plugins-runtime/index.js +++ b/frontend/resources/plugins-runtime/index.js @@ -7776,6 +7776,9 @@ function Ml(t, e) { get selection() { return o("content:read"), t.selection; }, + set selection(i) { + o("content:read"), t.selection = i; + }, get viewport() { return t.viewport; },