mirror of
https://github.com/logseq/logseq.git
synced 2026-05-04 19:06:21 +00:00
enhance(ui): show network proxy hints on plugins page if it's settled
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
(ns frontend.components.settings
|
||||
(:require [clojure.string :as string]
|
||||
[frontend.components.svg :as svg]
|
||||
[frontend.components.plugins :as plugins]
|
||||
[frontend.config :as config]
|
||||
[frontend.context.i18n :refer [t]]
|
||||
[frontend.storage :as storage]
|
||||
@@ -134,7 +135,6 @@
|
||||
(mobile-util/is-native-platform?))
|
||||
[:div.text-sm desc])]])
|
||||
|
||||
|
||||
(defn edit-config-edn []
|
||||
(row-with-button-action
|
||||
{:left-label (t :settings-page/custom-configuration)
|
||||
@@ -485,40 +485,6 @@
|
||||
:on-click #(js/logseq.api.relaunch)
|
||||
:small? true :intent "logseq")]])]))
|
||||
|
||||
(rum/defc user-proxy-settings-panel
|
||||
[{:keys [protocol] :as agent-opts}]
|
||||
(let [[opts set-opts!] (rum/use-state agent-opts)
|
||||
disabled? (string/blank? (:protocol opts))]
|
||||
[:div.cp__settings-network-proxy-panel
|
||||
[:h1.mb-2.text-2xl.font-bold (t :settings-page/network-proxy)]
|
||||
[:div.p-2
|
||||
[:p [:label [:strong (t :type)]
|
||||
(ui/select [{:label "Disabled" :value "" :selected disabled?}
|
||||
{:label "http" :value "http" :selected (= protocol "http")}
|
||||
{:label "https" :value "https" :selected (= protocol "https")}
|
||||
{:label "socks5" :value "socks5" :selected (= protocol "socks5")}]
|
||||
#(set-opts!
|
||||
(assoc opts :protocol (if (= "disabled" (util/safe-lower-case %)) nil %))) nil)]]
|
||||
[:p.flex
|
||||
[:label.pr-4 [:strong (t :host)]
|
||||
[:input.form-input.is-small
|
||||
{:value (:host opts) :disabled disabled?
|
||||
:on-change #(set-opts!
|
||||
(assoc opts :host (util/trim-safe (util/evalue %))))}]]
|
||||
|
||||
[:label [:strong (t :port)]
|
||||
[:input.form-input.is-small
|
||||
{:value (:port opts) :type "number" :disabled disabled?
|
||||
:on-change #(set-opts!
|
||||
(assoc opts :port (util/trim-safe (util/evalue %))))}]]]
|
||||
|
||||
[:p.pt-2
|
||||
(ui/button (t :save)
|
||||
:on-click (fn []
|
||||
(p/let [_ (ipc/ipc :setHttpsAgent opts)]
|
||||
(state/set-state! [:electron/user-cfgs :settings/agent] opts)
|
||||
(state/close-sub-modal! :https-proxy-panel))))]]]))
|
||||
|
||||
(rum/defc user-proxy-settings
|
||||
[{:keys [protocol host port] :as agent-opts}]
|
||||
(ui/button [:span
|
||||
@@ -526,7 +492,7 @@
|
||||
[:strong.pr-1 e])
|
||||
(ui/icon "edit")]
|
||||
:on-click #(state/set-sub-modal!
|
||||
(fn [_] (user-proxy-settings-panel agent-opts))
|
||||
(fn [_] (plugins/user-proxy-settings-panel agent-opts))
|
||||
{:id :https-proxy-panel :center? true})))
|
||||
|
||||
(defn plugin-system-switcher-row []
|
||||
|
||||
Reference in New Issue
Block a user