|
17 | 17 | [status-im.signing.core :as signing]
|
18 | 18 | [status-im.ui.components.list-selection :as list-selection]
|
19 | 19 | [utils.re-frame :as rf]
|
20 |
| - [status-im.utils.http :as http] |
| 20 | + [utils.url :as url] |
21 | 21 | [status-im.utils.platform :as platform]
|
22 | 22 | [status-im.utils.random :as random]
|
23 | 23 | [status-im.utils.types :as types]
|
|
75 | 75 |
|
76 | 76 | (defn check-if-phishing-url
|
77 | 77 | [{:keys [history history-index] :as browser}]
|
78 |
| - (let [history-host (http/url-host (try (nth history history-index) (catch js/Error _)))] |
| 78 | + (let [history-host (url/url-host (try (nth history history-index) (catch js/Error _)))] |
79 | 79 | (cond-> browser history-host (assoc :unsafe? (eth-phishing-detect history-host)))))
|
80 | 80 |
|
81 | 81 | (defn resolve-ens-contenthash-callback
|
|
88 | 88 | [{:keys [db]} {:keys [error? resolved-url]}]
|
89 | 89 | (when (not error?)
|
90 | 90 | (let [current-url (get-current-url (get-current-browser db))
|
91 |
| - host (http/url-host current-url)] |
| 91 | + host (url/url-host current-url)] |
92 | 92 | (if (and (not resolved-url) (ens/is-valid-eth-name? host))
|
93 | 93 | {:db (update db :browser/options assoc :resolving? true)
|
94 | 94 | :browser/resolve-ens-contenthash {:chain-id (ethereum/chain-id db)
|
|
162 | 162 | {:events [:browser/ignore-unsafe]}
|
163 | 163 | [cofx]
|
164 | 164 | (let [browser (get-current-browser (:db cofx))
|
165 |
| - host (http/url-host (get-current-url browser))] |
| 165 | + host (url/url-host (get-current-url browser))] |
166 | 166 | (update-browser cofx (assoc browser :ignore-unsafe host))))
|
167 | 167 |
|
168 | 168 | (defn can-go-forward?
|
|
194 | 194 | {:events [:browser.callback/resolve-ens-multihash-success]}
|
195 | 195 | [{:keys [db] :as cofx} url]
|
196 | 196 | (let [current-url (get-current-url (get-current-browser db))
|
197 |
| - host (http/url-host current-url) |
| 197 | + host (url/url-host current-url) |
198 | 198 | path (subs current-url (+ (.indexOf ^js current-url host) (count host)))
|
199 | 199 | gateway url]
|
200 | 200 | (rf/merge cofx
|
|
247 | 247 | (not= (.indexOf ^js url (second v)) -1))
|
248 | 248 | (:resolved-ens options)))
|
249 | 249 | resolved-url (if resolved-ens
|
250 |
| - (http/normalize-url (string/replace url |
251 |
| - (second resolved-ens) |
252 |
| - (first resolved-ens))) |
| 250 | + (url/normalize-url (string/replace url |
| 251 | + (second resolved-ens) |
| 252 | + (first resolved-ens))) |
253 | 253 | url)]
|
254 | 254 | (rf/merge cofx
|
255 | 255 | (update-browser-history browser resolved-url)
|
|
282 | 282 | {:events [:browser.ui/url-submitted]}
|
283 | 283 | [cofx url]
|
284 | 284 | (let [browser (get-current-browser (:db cofx))
|
285 |
| - normalized-url (http/normalize-and-decode-url url)] |
| 285 | + normalized-url (url/normalize-and-decode-url url)] |
286 | 286 | (if (links/universal-link? normalized-url)
|
287 | 287 | {:dispatch [:universal-links/handle-url normalized-url]}
|
288 | 288 | (rf/merge cofx
|
|
296 | 296 | If the browser is reused, the history is flushed"
|
297 | 297 | {:events [:browser.ui/open-url]}
|
298 | 298 | [{:keys [db] :as cofx} url]
|
299 |
| - (let [normalized-url (http/normalize-and-decode-url url) |
| 299 | + (let [normalized-url (url/normalize-and-decode-url url) |
300 | 300 | browser {:browser-id (random/id)
|
301 | 301 | :history-index 0
|
302 | 302 | :history [normalized-url]}]
|
|
503 | 503 | {:keys [dapp? name]} browser
|
504 | 504 | dapp-name (if dapp?
|
505 | 505 | name
|
506 |
| - (http/url-host |
| 506 | + (url/url-host |
507 | 507 | url-original))]
|
508 | 508 | (cond
|
509 | 509 | (and (= type constants/history-state-changed)
|
|
0 commit comments