[#10811] There should be an option to continue opening suspicious urls
This commit is contained in:
parent
2110446d29
commit
96adbd6185
|
@ -139,6 +139,13 @@
|
||||||
(update-browser (assoc browser :history-index (dec history-index)))
|
(update-browser (assoc browser :history-index (dec history-index)))
|
||||||
(resolve-url nil)))))
|
(resolve-url nil)))))
|
||||||
|
|
||||||
|
(fx/defn ignore-unsafe
|
||||||
|
{:events [:browser/ignore-unsafe]}
|
||||||
|
[cofx]
|
||||||
|
(let [browser (get-current-browser (:db cofx))
|
||||||
|
host (http/url-host (get-current-url browser))]
|
||||||
|
(update-browser cofx (assoc browser :ignore-unsafe host))))
|
||||||
|
|
||||||
(defn can-go-forward? [{:keys [history-index history]}]
|
(defn can-go-forward? [{:keys [history-index history]}]
|
||||||
(< history-index (dec (count history))))
|
(< history-index (dec (count history))))
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
|
|
||||||
(def container
|
(def container
|
||||||
{:justify-content :center
|
{:justify-content :center
|
||||||
:flex 1
|
:flex 1})
|
||||||
:background-color colors/gray-lighter})
|
|
||||||
|
|
||||||
(def container-root-view
|
(def container-root-view
|
||||||
{:flex 1
|
{:flex 1
|
||||||
|
@ -26,6 +25,4 @@
|
||||||
{:color colors/blue})
|
{:color colors/blue})
|
||||||
|
|
||||||
(def buttons-container
|
(def buttons-container
|
||||||
{:flex-direction :row
|
{:margin 24})
|
||||||
:justify-content :center
|
|
||||||
:margin-top 24})
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[status-im.i18n :as i18n]
|
[status-im.i18n :as i18n]
|
||||||
[status-im.ui.components.colors :as colors]
|
[status-im.ui.components.colors :as colors]
|
||||||
[status-im.ui.components.common.common :as components.common]
|
|
||||||
[status-im.ui.components.icons.vector-icons :as vector-icons]
|
[status-im.ui.components.icons.vector-icons :as vector-icons]
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[status-im.ui.screens.browser.site-blocked.styles :as styles])
|
[status-im.ui.screens.browser.site-blocked.styles :as styles]
|
||||||
|
[quo.core :as quo])
|
||||||
(:require-macros [status-im.utils.views :as views]))
|
(:require-macros [status-im.utils.views :as views]))
|
||||||
|
|
||||||
(views/defview view [{:keys [can-go-back?]}]
|
(views/defview view [{:keys [can-go-back?]}]
|
||||||
|
@ -23,9 +23,12 @@
|
||||||
"#status"]
|
"#status"]
|
||||||
(i18n/label :t/browsing-site-blocked-description2)]
|
(i18n/label :t/browsing-site-blocked-description2)]
|
||||||
[react/view styles/buttons-container
|
[react/view styles/buttons-container
|
||||||
[components.common/button {:on-press (fn []
|
[quo/button {:on-press (fn []
|
||||||
(let [handler (if can-go-back?
|
(let [handler (if can-go-back?
|
||||||
:browser.ui/previous-page-button-pressed
|
:browser.ui/previous-page-button-pressed
|
||||||
:navigate-back)]
|
:navigate-back)]
|
||||||
(re-frame/dispatch [handler])))
|
(re-frame/dispatch [handler])))}
|
||||||
:label (i18n/label :t/browsing-site-blocked-go-back)}]]]])
|
(i18n/label :t/browsing-site-blocked-go-back)]]
|
||||||
|
[quo/button {:theme :negative
|
||||||
|
:on-press #(re-frame/dispatch [:browser/ignore-unsafe])}
|
||||||
|
(i18n/label :t/continue-anyway)]]])
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
;; should-component-update is called only when component's props are changed,
|
;; should-component-update is called only when component's props are changed,
|
||||||
;; that's why it can't be used in `browser`, because `url` comes from subs
|
;; that's why it can't be used in `browser`, because `url` comes from subs
|
||||||
(views/defview browser-component
|
(views/defview browser-component
|
||||||
[{:keys [error? url browser browser-id unsafe? can-go-back?
|
[{:keys [error? url browser browser-id unsafe? can-go-back? ignore-unsafe
|
||||||
can-go-forward? resolving? network-id url-original
|
can-go-forward? resolving? network-id url-original
|
||||||
show-permission show-tooltip dapp? name dapps-account]}]
|
show-permission show-tooltip dapp? name dapps-account]}]
|
||||||
{:should-component-update (fn [_ _ args]
|
{:should-component-update (fn [_ _ args]
|
||||||
|
@ -114,7 +114,7 @@
|
||||||
[react/view {:flex 1
|
[react/view {:flex 1
|
||||||
:elevation -10}
|
:elevation -10}
|
||||||
[react/view components.styles/flex
|
[react/view components.styles/flex
|
||||||
(if unsafe?
|
(if (and unsafe? (not= (http/url-host url) ignore-unsafe))
|
||||||
[site-blocked.views/view {:can-go-back? can-go-back?
|
[site-blocked.views/view {:can-go-back? can-go-back?
|
||||||
:site browser-id}]
|
:site browser-id}]
|
||||||
[components.webview/webview
|
[components.webview/webview
|
||||||
|
@ -148,7 +148,7 @@
|
||||||
|
|
||||||
(views/defview browser []
|
(views/defview browser []
|
||||||
(views/letsubs [window-width [:dimensions/window-width]
|
(views/letsubs [window-width [:dimensions/window-width]
|
||||||
{:keys [browser-id dapp? name unsafe?] :as browser} [:get-current-browser]
|
{:keys [browser-id dapp? name unsafe? ignore-unsafe] :as browser} [:get-current-browser]
|
||||||
{:keys [url error? loading? url-editing? show-tooltip show-permission resolving?]} [:browser/options]
|
{:keys [url error? loading? url-editing? show-tooltip show-permission resolving?]} [:browser/options]
|
||||||
dapps-account [:dapps-account]
|
dapps-account [:dapps-account]
|
||||||
network-id [:chain-id]]
|
network-id [:chain-id]]
|
||||||
|
@ -167,6 +167,7 @@
|
||||||
:browser browser
|
:browser browser
|
||||||
:browser-id browser-id
|
:browser-id browser-id
|
||||||
:unsafe? unsafe?
|
:unsafe? unsafe?
|
||||||
|
:ignore-unsafe ignore-unsafe
|
||||||
:can-go-back? can-go-back?
|
:can-go-back? can-go-back?
|
||||||
:can-go-forward? can-go-forward?
|
:can-go-forward? can-go-forward?
|
||||||
:resolving? resolving?
|
:resolving? resolving?
|
||||||
|
|
|
@ -1157,5 +1157,6 @@
|
||||||
"tx-fail-description2" : "This transaction is likely to fail. Set a custom network fee to sign at your own risk.",
|
"tx-fail-description2" : "This transaction is likely to fail. Set a custom network fee to sign at your own risk.",
|
||||||
"set-custom-fee" : "Set custom fee",
|
"set-custom-fee" : "Set custom fee",
|
||||||
"not-enough-snt": "Not enough SNT",
|
"not-enough-snt": "Not enough SNT",
|
||||||
"set-max": "Set max"
|
"set-max": "Set max",
|
||||||
|
"continue-anyway": "Continue anyway"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue