mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
enhance(plugin): WIP install plugin from web
This commit is contained in:
@@ -40,13 +40,13 @@
|
||||
[{:keys [version repo only-check _plugin-action] :as mft}]
|
||||
(js/console.log "debug:install-or-update" mft)
|
||||
(-> (fetch-web-plugin-entry-info repo version)
|
||||
(p/then (fn [{:keys [version]}]
|
||||
(p/then (fn [{:keys [_version] :as web-pkg}]
|
||||
(emit-lsp-updates!
|
||||
{:status :completed
|
||||
:only-check only-check
|
||||
:payload (if only-check
|
||||
(assoc mft :latest-version version :latest-notes "TODO: update notes")
|
||||
(assoc mft :dst repo :installed-version version :web true))})))
|
||||
(assoc mft :dst repo :installed-version version :web-pkg (merge web-pkg mft)))})))
|
||||
(p/catch (fn [^js e]
|
||||
(emit-lsp-updates!
|
||||
{:status :error
|
||||
|
||||
@@ -203,7 +203,7 @@
|
||||
(case (keyword status)
|
||||
|
||||
:completed
|
||||
(let [{:keys [id dst name title theme]} payload
|
||||
(let [{:keys [id dst name title theme web-pkg]} payload
|
||||
name (or title name "Untitled")]
|
||||
(if only-check
|
||||
(state/consume-updates-from-coming-plugin! payload false)
|
||||
@@ -218,7 +218,7 @@
|
||||
(t :plugin/update-plugin name (.-version (.-options pl))) :success)
|
||||
(state/consume-updates-from-coming-plugin! payload true))))
|
||||
;; register plugin
|
||||
(-> (js/LSPluginCore.register (bean/->js {:key id :url dst}))
|
||||
(-> (js/LSPluginCore.register (bean/->js {:key id :url dst :webPkg web-pkg}))
|
||||
(p/then (fn []
|
||||
(when theme (js/setTimeout #(select-a-plugin-theme id) 300))
|
||||
(notification/show!
|
||||
|
||||
@@ -206,7 +206,10 @@
|
||||
|
||||
(def ^:export load_plugin_config
|
||||
(fn [path]
|
||||
(fs/read-file nil (util/node-path.join path "package.json"))))
|
||||
(if (util/electron?)
|
||||
(fs/read-file nil (util/node-path.join path "package.json"))
|
||||
(do (js/console.log "==>>> TODO: load plugin package.json from local???")
|
||||
""))))
|
||||
|
||||
(def ^:export load_plugin_readme
|
||||
(fn [path]
|
||||
|
||||
Reference in New Issue
Block a user