fix: disable plugins system

pull/7348/head
charlie 2022-11-15 15:08:19 +08:00 committed by Tienson Qin
parent e882b7cabd
commit 3940db3107
3 changed files with 7 additions and 6 deletions

View File

@ -6,6 +6,7 @@
[frontend.config :as config] [frontend.config :as config]
[frontend.context.i18n :refer [t]] [frontend.context.i18n :refer [t]]
[frontend.storage :as storage] [frontend.storage :as storage]
[frontend.spec.storage :as storage-spec]
[frontend.date :as date] [frontend.date :as date]
[frontend.dicts :as dicts] [frontend.dicts :as dicts]
[frontend.handler :as handler] [frontend.handler :as handler]
@ -493,7 +494,7 @@
[on? set-on?] (rum/use-state value) [on? set-on?] (rum/use-state value)
on-toggle #(let [v (not on?)] on-toggle #(let [v (not on?)]
(set-on? v) (set-on? v)
(storage/set :lsp-core-enabled v))] (storage/set ::storage-spec/lsp-core-enabled v))]
[:div.flex.items-center [:div.flex.items-center
(ui/toggle on? on-toggle true) (ui/toggle on? on-toggle true)
(when (not= (boolean value) on?) (when (not= (boolean value) on?)
@ -679,7 +680,7 @@
:on-key-press (fn [e] :on-key-press (fn [e]
(when (= "Enter" (util/ekey e)) (when (= "Enter" (util/ekey e))
(update-home-page e)))}]]]]) (update-home-page e)))}]]]])
(when (and (util/electron?) config/enable-plugins?) (plugin-system-switcher-row)) (when (and (util/electron?) config/feature-plugin-system-on?) (plugin-system-switcher-row))
(flashcards-switcher-row enable-flashcards?) (flashcards-switcher-row enable-flashcards?)
(zotero-settings-row) (zotero-settings-row)
(when-not web-platform? (when-not web-platform?

View File

@ -39,9 +39,7 @@
;; ============= ;; =============
(goog-define ENABLE-PLUGINS true) (goog-define ENABLE-PLUGINS true)
(defonce enable-plugins? ENABLE-PLUGINS) (defonce feature-plugin-system-on? ENABLE-PLUGINS)
(swap! state/state assoc :plugin/enabled enable-plugins?)
;; Desktop only as other platforms requires better understanding of their ;; Desktop only as other platforms requires better understanding of their
;; multi-graph workflows and optimal place for a "global" dir ;; multi-graph workflows and optimal place for a "global" dir
@ -50,6 +48,7 @@
;; User level configuration for whether plugins are enabled ;; User level configuration for whether plugins are enabled
(defonce lsp-enabled? (defonce lsp-enabled?
(and (util/electron?) (and (util/electron?)
(not (false? feature-plugin-system-on?))
(state/lsp-enabled?-or-theme))) (state/lsp-enabled?-or-theme)))
(defn plugin-config-enabled? (defn plugin-config-enabled?

View File

@ -9,6 +9,7 @@
[electron.ipc :as ipc] [electron.ipc :as ipc]
[frontend.mobile.util :as mobile-util] [frontend.mobile.util :as mobile-util]
[frontend.storage :as storage] [frontend.storage :as storage]
[frontend.spec.storage :as storage-spec]
[frontend.util :as util] [frontend.util :as util]
[frontend.util.cursor :as cursor] [frontend.util.cursor :as cursor]
[goog.dom :as gdom] [goog.dom :as gdom]
@ -172,7 +173,7 @@
;; plugin ;; plugin
:plugin/enabled (and (util/electron?) :plugin/enabled (and (util/electron?)
;; true false :theme-only ;; true false :theme-only
((fnil identity true) (storage/get :lsp-core-enabled))) ((fnil identity true) (storage/get ::storage-spec/lsp-core-enabled)))
:plugin/preferences nil :plugin/preferences nil
:plugin/indicator-text nil :plugin/indicator-text nil
:plugin/installed-plugins {} :plugin/installed-plugins {}