mirror of
https://github.com/penpot/penpot.git
synced 2025-07-31 11:48:32 +02:00
✨ Allow CORS backend option and fix frontend to allow it
This commit is contained in:
parent
f32f13069f
commit
007728819b
9 changed files with 80 additions and 18 deletions
|
@ -9,6 +9,8 @@
|
|||
(:require
|
||||
[app.common.transit :as t]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.util.globals :refer [global]]
|
||||
[app.util.object :as obj]
|
||||
[beicon.core :as rx]))
|
||||
|
||||
(declare handle-response)
|
||||
|
@ -28,11 +30,13 @@
|
|||
data (t/encode-str message)
|
||||
instance (:instance worker)]
|
||||
|
||||
(.postMessage instance data)
|
||||
(->> (:stream worker)
|
||||
(rx/filter #(= (:reply-to %) sender-id))
|
||||
(take-messages)
|
||||
(rx/map handle-response)))))
|
||||
(if (some? instance)
|
||||
(do (.postMessage instance data)
|
||||
(->> (:stream worker)
|
||||
(rx/filter #(= (:reply-to %) sender-id))
|
||||
(take-messages)
|
||||
(rx/map handle-response)))
|
||||
(rx/empty)))))
|
||||
|
||||
(defn ask!
|
||||
[worker message]
|
||||
|
@ -79,6 +83,11 @@
|
|||
(.addEventListener instance "message" handle-message)
|
||||
(.addEventListener instance "error" handle-error)
|
||||
|
||||
(ask! worker
|
||||
{:cmd :configure
|
||||
:params
|
||||
{"penpotPublicURI" (obj/get global "penpotPublicURI")}})
|
||||
|
||||
worker))
|
||||
|
||||
(defn- handle-response
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue