;; ported-from: src/apps.ts @ v1.3.0
;;
;; The suite's game apps: per-app salts and wire protocol prefixes.
(ns ardegazu.peer.apps)
;; An AppDef is #js {:name catalog name (matches the hub)
;; :host
;; :salt namespaces rooms on the shared p2p app (v2 stack)
;; :protocolPrefix the ONE line that differs between games}
;;
;; Four keys, so the literal order is safe (#js/js-obj preserves it only up to
;; eight pairs — dev/docs/CLJS.md). These objects are read by key everywhere,
;; never serialized, but GAMES is handed to consumers (the bot iterates
;; Object.keys) so the ORDER of GAMES' own keys is part of the surface: it is
;; built with sequential unchecked-set below for exactly that reason.
(defn- app-def [name host salt protocol-prefix]
(js-obj "name" name "host" host "salt" salt "protocolPrefix" protocol-prefix))
(def GAMES
(let [g (js-obj)]
(unchecked-set g "neon-grid"
(app-def "neon-grid" "game1.ardegazu.ro" "game1.ardegazu.ro/v2" "/neon-grid/2/"))
(unchecked-set g "valley-blocks"
(app-def "valley-blocks" "game2.ardegazu.ro" "game2.ardegazu.ro/v2" "/game2/2/"))
(unchecked-set g "tessera"
(app-def "tessera" "game3.ardegazu.ro" "game3.ardegazu.ro/v2" "/tessera/2/"))
(unchecked-set g "seance"
(app-def "seance" "game4.ardegazu.ro" "game4.ardegazu.ro/v2" "/seance/2/"))
(unchecked-set g "lampion"
(app-def "lampion" "game5.ardegazu.ro" "game5.ardegazu.ro/v2" "/lampion/2/"))
(unchecked-set g "odeon"
(app-def "odeon" "game6.ardegazu.ro" "game6.ardegazu.ro/v2" "/odeon/2/"))
g))
(def ^:private RELAY-FALLBACK-PEER-ID
"12D3KooWQzZvygPwd2F4JAqqf6tfBSJ29YtjzzftUyJ37RLCG5WT")
;; Signaling endpoints shared by every app in the suite.
(def SIGNAL
(js-obj "descriptorUrl" "https://signal.ardegazu.ro/.well-known/ap2p"
"turnUrl" "https://signal.ardegazu.ro/turn-credentials"
"relayFallback"
(js-obj "peerId" RELAY-FALLBACK-PEER-ID
"multiaddrs"
#js [(str "/dns4/signal.ardegazu.ro/tcp/443/tls/ws/p2p/" RELAY-FALLBACK-PEER-ID)])))
;; A default allowlisted Origin for the shims (any suite app origin works).
(def DEFAULT-ORIGIN "https://chat.ardegazu.ro")