prevent loading bot's js using dapp-url/commands.js

This commit is contained in:
Roman Volosovskyi 2017-05-05 12:37:42 +03:00
parent 4265e73f33
commit 2780e24f04
1 changed files with 3 additions and 10 deletions

View File

@ -17,7 +17,6 @@
[status-im.chat.sign-up :as sign-up] [status-im.chat.sign-up :as sign-up]
[status-im.bots.constants :as bots-constants])) [status-im.bots.constants :as bots-constants]))
(def commands-js "commands.js")
(defn load-commands! (defn load-commands!
[{:keys [current-chat-id contacts]} [contact callback]] [{:keys [current-chat-id contacts]} [contact callback]]
@ -49,17 +48,11 @@
(defn fetch-commands! (defn fetch-commands!
[_ [{{:keys [dapp? dapp-url bot-url whisper-identity]} :contact [_ [{{:keys [dapp? dapp-url bot-url whisper-identity]} :contact
:as params}]] :as params}]]
(cond (if
bot-url bot-url
(if-let [url (js-res/get-resource bot-url)] (if-let [resource (js-res/get-resource bot-url)]
(dispatch [::validate-hash params url]) (dispatch [::validate-hash params resource])
(http-get-commands params bot-url)) (http-get-commands params bot-url))
dapp-url
(let [url (s/join "/" [dapp-url "commands.js"])]
(http-get-commands params url))
:else
(dispatch [::validate-hash params js-res/commands-js]))) (dispatch [::validate-hash params js-res/commands-js])))
(defn dispatch-loaded! (defn dispatch-loaded!