mirror of
https://github.com/penpot/penpot.git
synced 2025-08-01 15:18:21 +02:00
✨ Add more adaptations to make app run in a prefixed path.
This commit is contained in:
parent
2828ccda7f
commit
55ea84a056
14 changed files with 115 additions and 98 deletions
|
@ -7,13 +7,13 @@
|
|||
(ns app.util.websockets
|
||||
"A interface to webworkers exposed functionality."
|
||||
(:require
|
||||
[app.common.uri :as u]
|
||||
[app.config :as cfg]
|
||||
[app.util.transit :as t]
|
||||
[beicon.core :as rx]
|
||||
[goog.events :as ev]
|
||||
[potok.core :as ptk])
|
||||
(:import
|
||||
goog.Uri
|
||||
goog.net.WebSocket
|
||||
goog.net.WebSocket.EventType))
|
||||
|
||||
|
@ -22,19 +22,6 @@
|
|||
(-send [_ message] "send a message")
|
||||
(-close [_] "close websocket"))
|
||||
|
||||
(defn uri
|
||||
([path] (uri path {}))
|
||||
([path params]
|
||||
(let [uri (.parse ^js Uri cfg/public-uri)]
|
||||
(.setPath ^js uri path)
|
||||
(if (= (.getScheme ^js uri) "http")
|
||||
(.setScheme ^js uri "ws")
|
||||
(.setScheme ^js uri "wss"))
|
||||
(run! (fn [[k v]]
|
||||
(.setParameterValue ^js uri (name k) (str v)))
|
||||
params)
|
||||
(.toString uri))))
|
||||
|
||||
(defn open
|
||||
[uri]
|
||||
(let [sb (rx/subject)
|
||||
|
@ -45,7 +32,7 @@
|
|||
#(rx/push! sb {:type :error :payload %}))
|
||||
lk3 (ev/listen ws EventType.OPENED
|
||||
#(rx/push! sb {:type :opened :payload %}))]
|
||||
(.open ws uri)
|
||||
(.open ws (str uri))
|
||||
(reify
|
||||
cljs.core/IDeref
|
||||
(-deref [_] ws)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue