0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-26 00:19:07 -05:00

Merge pull request #4842 from penpot/alotor-plugins-5

Alotor plugins 5
This commit is contained in:
Andrey Antukh 2024-07-04 13:59:48 +02:00 committed by GitHub
commit d1dd13fde9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 13 deletions

View file

@ -7776,6 +7776,9 @@ function Ml(t, e) {
get selection() { get selection() {
return o("content:read"), t.selection; return o("content:read"), t.selection;
}, },
set selection(i) {
o("content:read"), t.selection = i;
},
get viewport() { get viewport() {
return t.viewport; return t.viewport;
}, },

View file

@ -205,35 +205,38 @@
[:div {:class (stl/css :modal-content)} [:div {:class (stl/css :modal-content)}
[:div {:class (stl/css :permissions-list)} [: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)} [:div {:class (stl/css :permissions-list-entry)}
i/oauth-1 i/oauth-1
[:p {:class (stl/css :permissions-list-text)} [:p {:class (stl/css :permissions-list-text)}
(tr "workspace.plugins.permissions.content-read")]]) (tr "workspace.plugins.permissions.content-read")]])
(when (contains? permissions "content:write") (cond
[:div {:class (stl/css :permissions-list-entry)} (contains? permissions "user:read")
i/oauth-1
[:p {:class (stl/css :permissions-list-text)}
(tr "workspace.plugins.permissions.content-write")]])
(when (contains? permissions "user:read")
[:div {:class (stl/css :permissions-list-entry)} [:div {:class (stl/css :permissions-list-entry)}
i/oauth-2 i/oauth-2
[:p {:class (stl/css :permissions-list-text)} [:p {:class (stl/css :permissions-list-text)}
(tr "workspace.plugins.permissions.user-read")]]) (tr "workspace.plugins.permissions.user-read")]])
(when (contains? permissions "library:read") (cond
(contains? permissions "library:write")
[:div {:class (stl/css :permissions-list-entry)} [:div {:class (stl/css :permissions-list-entry)}
i/oauth-3 i/oauth-3
[:p {:class (stl/css :permissions-list-text)} [: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)} [:div {:class (stl/css :permissions-list-entry)}
i/oauth-3 i/oauth-3
[:p {:class (stl/css :permissions-list-text)} [: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)} [:div {:class (stl/css :permissions-disclaimer)}
(tr "workspace.plugins.permissions.disclaimer")]] (tr "workspace.plugins.permissions.disclaimer")]]

View file

@ -47,7 +47,16 @@
desc (obj/get manifest "description") desc (obj/get manifest "description")
code (obj/get manifest "code") code (obj/get manifest "code")
icon (obj/get manifest "icon") 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") origin (obj/get (js/URL. plugin-url) "origin")
plugin-id (str (uuid/next))] plugin-id (str (uuid/next))]
{:plugin-id plugin-id {:plugin-id plugin-id