mirror of
https://github.com/penpot/penpot.git
synced 2025-07-31 11:48:32 +02:00
♻️ Move audit http handler to RPC
This commit is contained in:
parent
27c4cdb5f9
commit
7f589b09ca
8 changed files with 199 additions and 124 deletions
|
@ -38,7 +38,7 @@
|
|||
(defn- collect-context
|
||||
[]
|
||||
(let [uagent (UAParser.)]
|
||||
(d/merge
|
||||
(merge
|
||||
{:app-version (:full @cf/version)
|
||||
:locale @i18n/locale}
|
||||
(let [browser (.getBrowser uagent)]
|
||||
|
@ -215,12 +215,17 @@
|
|||
(defn- persist-events
|
||||
[events]
|
||||
(if (seq events)
|
||||
(let [uri (u/join @cf/public-uri "api/audit/events")
|
||||
(let [uri (u/join @cf/public-uri "api/rpc/command/push-audit-events")
|
||||
params {:uri uri
|
||||
:method :post
|
||||
:credentials "include"
|
||||
:body (http/transit-data {:events events})}]
|
||||
(->> (http/send! params)
|
||||
(rx/mapcat rp/handle-response)))
|
||||
(rx/mapcat rp/handle-response)
|
||||
(rx/catch (fn [cause]
|
||||
(l/error :hint "unexpected error on persisting audit events")
|
||||
(rx/of nil)))))
|
||||
|
||||
(rx/of nil)))
|
||||
|
||||
(defn initialize
|
||||
|
@ -274,7 +279,7 @@
|
|||
(rx/map (fn [event]
|
||||
(let [session* (or @session (dt/now))
|
||||
context (-> @context
|
||||
(d/merge (:context event))
|
||||
(merge (:context event))
|
||||
(assoc :session session*))]
|
||||
(reset! session session*)
|
||||
(-> event
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue