[FIX #3143] Cannot sign in to Cryptokitties (chrome webstore)
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
parent
13c448032c
commit
83876f7cf1
|
@ -1,6 +1,8 @@
|
||||||
(ns status-im.ui.screens.browser.views
|
(ns status-im.ui.screens.browser.views
|
||||||
(:require-macros [status-im.utils.views :as views])
|
(:require-macros [status-im.utils.slurp :refer [slurp]]
|
||||||
(:require [re-frame.core :as re-frame]
|
[status-im.utils.views :as views])
|
||||||
|
(:require [cljs.reader :as reader]
|
||||||
|
[re-frame.core :as re-frame]
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[status-im.ui.screens.browser.styles :as styles]
|
[status-im.ui.screens.browser.styles :as styles]
|
||||||
[status-im.ui.components.status-bar.view :as status-bar]
|
[status-im.ui.components.status-bar.view :as status-bar]
|
||||||
|
@ -27,6 +29,9 @@
|
||||||
[react/text {:style styles/dapp-text}
|
[react/text {:style styles/dapp-text}
|
||||||
(i18n/label :t/dapp)]]]]))
|
(i18n/label :t/dapp)]]]]))
|
||||||
|
|
||||||
|
(def browser-config
|
||||||
|
(reader/read-string (slurp "./src/status_im/utils/browser_config.edn")))
|
||||||
|
|
||||||
(defn toolbar-content [{:keys [url] :as browser}]
|
(defn toolbar-content [{:keys [url] :as browser}]
|
||||||
(let [url-text (atom nil)]
|
(let [url-text (atom nil)]
|
||||||
[react/view
|
[react/view
|
||||||
|
@ -60,6 +65,10 @@
|
||||||
(re-frame/dispatch [:update-browser (assoc browser :url url :name title)]))
|
(re-frame/dispatch [:update-browser (assoc browser :url url :name title)]))
|
||||||
(re-frame/dispatch [:update-browser-options {:can-go-back? canGoBack :can-go-forward? canGoForward}])))
|
(re-frame/dispatch [:update-browser-options {:can-go-back? canGoBack :can-go-forward? canGoForward}])))
|
||||||
|
|
||||||
|
(defn get-inject-js [url]
|
||||||
|
(let [domain-name (nth (re-find #"^\w+://(www\.)?([^/:]+)" url) 2)]
|
||||||
|
(get (:inject-js browser-config) domain-name)))
|
||||||
|
|
||||||
(views/defview browser []
|
(views/defview browser []
|
||||||
(views/letsubs [webview (atom nil)
|
(views/letsubs [webview (atom nil)
|
||||||
{:keys [dapp? contact url] :as browser} [:get-current-browser]
|
{:keys [dapp? contact url] :as browser} [:get-current-browser]
|
||||||
|
@ -87,6 +96,7 @@
|
||||||
:on-navigation-state-change #(on-navigation-change % browser)
|
:on-navigation-state-change #(on-navigation-change % browser)
|
||||||
:injected-on-start-loading-java-script (str js-res/web3
|
:injected-on-start-loading-java-script (str js-res/web3
|
||||||
js-res/jquery
|
js-res/jquery
|
||||||
|
(get-inject-js url)
|
||||||
(js-res/web3-init rpc-url))
|
(js-res/web3-init rpc-url))
|
||||||
:injected-java-script (str js-res/webview-js extra-js)}]
|
:injected-java-script (str js-res/webview-js extra-js)}]
|
||||||
[react/view styles/background
|
[react/view styles/background
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
;; Browser (webview) configuration
|
||||||
|
;; :inject-js is a map of {<domain> <js-code>}, JS code will be injected if the domain name matches (www. is stripped away)
|
||||||
|
|
||||||
|
{:inject-js {"cryptokitties.co" "; if (!window.chrome) { window.chrome = { webstore: true }; }"}}
|
Loading…
Reference in New Issue