mirror of
https://github.com/penpot/penpot.git
synced 2025-08-03 21:38:23 +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
34
common/app/common/uri.cljc
Normal file
34
common/app/common/uri.cljc
Normal file
|
@ -0,0 +1,34 @@
|
|||
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; Copyright (c) UXBOX Labs SL
|
||||
|
||||
(ns app.common.uri
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[lambdaisland.uri :as u]
|
||||
[lambdaisland.uri.normalize :as un]))
|
||||
|
||||
(d/export u/uri)
|
||||
(d/export u/join)
|
||||
(d/export un/percent-encode)
|
||||
|
||||
(defn query-string->map
|
||||
[s]
|
||||
(u/query-string->map s))
|
||||
|
||||
(defn default-encode-value
|
||||
[v]
|
||||
(if (keyword? v) (name v) v))
|
||||
|
||||
(defn map->query-string
|
||||
([params] (map->query-string params nil))
|
||||
([params {:keys [value-fn key-fn]
|
||||
:or {value-fn default-encode-value
|
||||
key-fn identity}}]
|
||||
(->> params
|
||||
(into {} (comp
|
||||
(remove #(nil? (second %)))
|
||||
(map (fn [[k v]] [(key-fn k) (value-fn v)]))))
|
||||
(u/map->query-string))))
|
Loading…
Add table
Add a link
Reference in a new issue