Преглед изворни кода

search-remove-accents config should default to existing behavior

Also start a default-config to start a data-first approach
to config
Gabriel Horner пре 3 година
родитељ
комит
01c8f41b61
1 измењених фајлова са 10 додато и 6 уклоњено
  1. 10 6
      src/main/frontend/state.cljs

+ 10 - 6
src/main/frontend/state.cljs

@@ -297,17 +297,22 @@
       (when-not (mobile-util/native-platform?)
         "local")))
 
+(def default-config
+  "Default config for a repo-specific, user config"
+  {:feature/enable-search-remove-accents? true
+   :default-arweave-gateway "https://arweave.net"})
+
 (defn get-config
+  "User config for the given repo or current repo if none given"
   ([]
    (get-config (get-current-repo)))
   ([repo-url]
-   (get-in @state [:config repo-url])))
-
-(def default-arweave-gateway "https://arweave.net")
+   (merge default-config
+          (get-in @state [:config repo-url]))))
 
 (defn get-arweave-gateway
   []
-  (:arweave/gateway (get-config) default-arweave-gateway))
+  (:arweave/gateway (get-config)))
 
 (defonce built-in-macros
          {"img" "[:img.$4 {:src \"$1\" :style {:width $2 :height $3}}]"})
@@ -1702,5 +1707,4 @@
 
 (defn enable-search-remove-accents?
   []
-  (:feature/enable-search-remove-accents?
-    (get (sub-config) (get-current-repo))))
+  (:feature/enable-search-remove-accents? (get-config)))