File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88(set! *warn-on-reflection* true )
99
10+ (def ^:private alphanumeric " abcdefghijklmnopqrstuvwxyz0123456789" )
11+
1012(defn generate-token
11- " Generates a cryptographically random 32-byte hex token (64 characters) ."
13+ " Generates a random 5-character alphanumeric password ."
1214 []
1315 (let [random (SecureRandom. )
14- bytes (byte-array 32 )]
15- (.nextBytes random bytes)
16- (apply str (map #(format " %02x" (bit-and % 0xff )) bytes))))
16+ len (count alphanumeric)]
17+ (apply str (repeatedly 5 #(nth alphanumeric (.nextInt random len))))))
1718
1819(def ^:private unauthorized-response
1920 {:status 401
Original file line number Diff line number Diff line change 8787 :trust (boolean (:trust db))
8888 :selectedVariant selected-variant}))
8989
90- (defn handle-root [_components _request {:keys [host token ]}]
90+ (defn handle-root [_components _request {:keys [host password ]}]
9191 {:status 302
92- :headers {" Location" (str " https://web.eca.dev?host=" host " &token =" token )}
92+ :headers {" Location" (str " https://web.eca.dev?host=" host " &pass =" password )}
9393 :body nil })
9494
9595(defn handle-health [_components _request]
Original file line number Diff line number Diff line change 2121 segments (path-segments (:uri request))]
2222 (case segments
2323 [] (when (= :get method)
24- [handlers/handle-root components request {:host @host* :token token}])
24+ [handlers/handle-root components request {:host @host* :password token}])
2525
2626 [" api" " v1" " health" ]
2727 (when (= :get method)
Original file line number Diff line number Diff line change 8181 heartbeat-ch (sse/start-heartbeat! sse-connections*)
8282 connect-url (str " https://web.eca.dev?host="
8383 host-with-port
84- " &token =" token)]
84+ " &pass =" token)]
8585 (logger/info logger-tag (str " 🌐 Remote server started on port " actual-port))
8686 (logger/info logger-tag (str " 🔗 " connect-url))
8787 {:server jetty-server
You can’t perform that action at this time.
0 commit comments