mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 07:29:08 -05:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
496afb0f25
11 changed files with 40 additions and 63 deletions
|
@ -15,7 +15,7 @@ export PENPOT_FLAGS="\
|
|||
enable-fdata-storage-objets-map \
|
||||
disable-secure-session-cookies \
|
||||
enable-smtp \
|
||||
enable-webhooks";
|
||||
enable-access-tokens";
|
||||
|
||||
set -ex
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
(let [explain (ex/explain data)]
|
||||
{::yrs/status 400
|
||||
::yrs/body (-> data
|
||||
(dissoc ::s/problems ::s/value)
|
||||
(dissoc ::s/problems ::s/value ::s/spec)
|
||||
(cond-> explain (assoc :explain explain)))})
|
||||
|
||||
(= code :params-validation)
|
||||
|
|
|
@ -516,6 +516,9 @@
|
|||
:media (count media)
|
||||
::l/sync? true)
|
||||
|
||||
(doseq [item media]
|
||||
(l/debug :hint "write penpot file media object" :id (:id item) ::l/sync? true))
|
||||
|
||||
(doto output
|
||||
(write-obj! file)
|
||||
(write-obj! media))
|
||||
|
@ -770,7 +773,7 @@
|
|||
(defn- lookup-index
|
||||
[id]
|
||||
(let [val (get-in @*state* [:index id])]
|
||||
(l/trace :fn "lookup-index" :id id :val val ::l/sync? true)
|
||||
(l/debug :fn "lookup-index" :id id :val val ::l/sync? true)
|
||||
(when (and (not (::ignore-index-errors? *options*)) (not val))
|
||||
(ex/raise :type :validation
|
||||
:code :incomplete-index
|
||||
|
@ -783,7 +786,7 @@
|
|||
index index]
|
||||
(if-let [id (first items)]
|
||||
(let [new-id (if (::overwrite? *options*) id (uuid/next))]
|
||||
(l/trace :fn "update-index" :id id :new-id new-id ::l/sync? true)
|
||||
(l/debug :fn "update-index" :id id :new-id new-id ::l/sync? true)
|
||||
(recur (rest items)
|
||||
(assoc index id new-id)))
|
||||
index)))
|
||||
|
@ -801,8 +804,7 @@
|
|||
(update-in [:metadata :id] lookup-index)
|
||||
|
||||
;; Relink paths with fill image
|
||||
(and (map? (:fill-image form))
|
||||
(= :path (:type form)))
|
||||
(map? (:fill-image form))
|
||||
(update-in [:fill-image :id] lookup-index)
|
||||
|
||||
;; This covers old shapes and the new :fills.
|
||||
|
|
|
@ -378,21 +378,6 @@
|
|||
[{:keys [::rpc/profile-id]} {:keys [modified-at revn]}]
|
||||
(str profile-id (dt/format-instant modified-at :iso) revn))
|
||||
|
||||
|
||||
|
||||
(sv/defmethod ::hey
|
||||
{::doc/added "1.17"
|
||||
::rpc/auth false}
|
||||
[_ _]
|
||||
(str (rand-int 100)))
|
||||
|
||||
(sv/defmethod ::ho
|
||||
{::doc/added "1.17"
|
||||
::rpc/auth false}
|
||||
[_ _]
|
||||
(str (rand-int 1000)))
|
||||
|
||||
|
||||
(sv/defmethod ::get-file
|
||||
"Retrieve a file by its ID. Only authenticated users."
|
||||
{::doc/added "1.17"
|
||||
|
|
|
@ -114,7 +114,14 @@
|
|||
(keep (fn [{:keys [type] :as obj}]
|
||||
(case type
|
||||
:path (get-in obj [:fill-image :id])
|
||||
:bool (get-in obj [:fill-image :id])
|
||||
;; NOTE: because of some bug, we ended with
|
||||
;; many shape types having the ability to
|
||||
;; have fill-image attribute (which initially
|
||||
;; designed for :path shapes).
|
||||
:group (get-in obj [:fill-image :id])
|
||||
:image (get-in obj [:metadata :id])
|
||||
|
||||
nil))))
|
||||
pages (concat
|
||||
(vals (:pages-index data))
|
||||
|
|
|
@ -574,8 +574,11 @@
|
|||
(l/trace :hint "register cron task" :id id :cron (str cron))
|
||||
(db/exec-one! conn [sql:upsert-cron-task id (str cron) (str cron)]))))
|
||||
|
||||
(def sql:lock-cron-task
|
||||
"select id from scheduled_task where id=? for update skip locked")
|
||||
(defn- lock-scheduled-task!
|
||||
[conn id]
|
||||
(let [sql (str "SELECT id FROM scheduled_task "
|
||||
" WHERE id=? FOR UPDATE SKIP LOCKED")]
|
||||
(some? (db/exec-one! conn [sql (d/name id)]))))
|
||||
|
||||
(defn- execute-cron-task
|
||||
[{:keys [::db/pool] :as cfg} {:keys [id] :as task}]
|
||||
|
@ -583,11 +586,16 @@
|
|||
{:name (str "penpot/cront-task/" id)}
|
||||
(try
|
||||
(db/with-atomic [conn pool]
|
||||
(when (db/exec-one! conn [sql:lock-cron-task (d/name id)])
|
||||
(db/exec-one! conn ["SET statement_timeout=0;"])
|
||||
(db/exec-one! conn ["SET idle_in_transaction_session_timeout=0;"])
|
||||
(when (lock-scheduled-task! conn id)
|
||||
(l/trace :hint "cron: execute task" :task-id id)
|
||||
((:fn task) task)))
|
||||
((:fn task) task))
|
||||
(db/rollback! conn))
|
||||
|
||||
(catch InterruptedException _
|
||||
(l/debug :hint "cron: task interrupted" :task-id id))
|
||||
|
||||
(catch Throwable cause
|
||||
(binding [l/*context* (get-error-context cause task)]
|
||||
(l/error :hint "cron: unhandled exception on running task"
|
||||
|
|
|
@ -382,8 +382,10 @@
|
|||
keyword
|
||||
identity)}}))})
|
||||
|
||||
(def max-safe-int (int 1e6))
|
||||
(def min-safe-int (int -1e6))
|
||||
;; Integer/MAX_VALUE
|
||||
(def max-safe-int 2147483647)
|
||||
;; Integer/MIN_VALUE
|
||||
(def min-safe-int -2147483648)
|
||||
|
||||
(def! ::safe-int
|
||||
{:type ::safe-int
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
(log/setup! {:app :info})
|
||||
|
||||
(when (= :browser cf/target)
|
||||
(log/info :message "Hey!,Welcome to penpot"
|
||||
(log/info :message "Welcome to penpot"
|
||||
:version (:full cf/version)
|
||||
:asserts *assert*
|
||||
:build-date cf/build-date
|
||||
|
|
|
@ -518,29 +518,6 @@
|
|||
(->> (rp/cmd! :get-access-tokens)
|
||||
(rx/map access-tokens-fetched)))))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(defn heyhey-fetched
|
||||
[value]
|
||||
(ptk/reify ::heyhey-fetched
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(assoc state :hey-value value))))
|
||||
|
||||
|
||||
|
||||
(defn fetch-heyhey
|
||||
[]
|
||||
(ptk/reify ::fetch-heyhey
|
||||
ptk/WatchEvent
|
||||
(watch [_ _ _]
|
||||
(->> (rp/cmd! :hey)
|
||||
(rx/map heyhey-fetched)))))
|
||||
|
||||
|
||||
|
||||
;; --- EVENT: create-access-token
|
||||
|
||||
(defn access-token-created
|
||||
|
|
|
@ -260,21 +260,16 @@
|
|||
[:& access-token-actions
|
||||
{:on-delete on-delete}]]]))
|
||||
|
||||
(def hey-ref
|
||||
(l/derived :hey-value st/state))
|
||||
|
||||
(mf/defc access-tokens-page
|
||||
[]
|
||||
(mf/with-effect []
|
||||
(dom/set-html-title (tr "title.settings.access-tokens"))
|
||||
(st/emit! (du/fetch-access-tokens))
|
||||
(st/emit! (du/fetch-heyhey)))
|
||||
(st/emit! (du/fetch-access-tokens)))
|
||||
|
||||
(let [tokens (mf/deref tokens-ref)
|
||||
hey (mf/deref hey-ref)]
|
||||
[:div.dashboard-access-tokens {:style {:background "pink"}}
|
||||
(let [tokens (mf/deref tokens-ref)]
|
||||
[:div.dashboard-access-tokens
|
||||
[:div
|
||||
[:div {:on-click #(st/emit! (du/fetch-heyhey))} hey]
|
||||
[:& access-tokens-hero]
|
||||
(if (empty? tokens)
|
||||
[:div.access-tokens-empty
|
||||
[:div (tr "dashboard.access-tokens.empty.no-access-tokens")]
|
||||
|
|
|
@ -97,11 +97,12 @@
|
|||
(defn- svg-update-image!
|
||||
"Updates an image in an SVG to a Data URI."
|
||||
[image]
|
||||
(when-let [href (dom/get-attribute image "href")]
|
||||
(if-let [href (dom/get-attribute image "href")]
|
||||
(->> (fetch-as-data-uri href)
|
||||
(rx/map (fn [url]
|
||||
(dom/set-attribute! image "href" url)
|
||||
image)))))
|
||||
image)))
|
||||
(rx/empty)))
|
||||
|
||||
(defn- svg-resolve-images!
|
||||
"Resolves all images in an SVG to Data URIs."
|
||||
|
|
Loading…
Add table
Reference in a new issue