Browse Source

Merge branch 'feat/db' into refactor/journal-title

Tienson Qin 1 year ago
parent
commit
c287a76313

+ 7 - 2
src/main/frontend/components/plugins.cljs

@@ -250,6 +250,7 @@
      [:ul.menu-list
       [:li {:on-click #(plugin-handler/open-plugin-settings! id false)} (t :plugin/open-settings)]
       [:li {:on-click #(js/apis.openPath url)} (t :plugin/open-package)]
+      [:li {:on-click #(plugin-handler/open-report-modal! id name)} (t :plugin/report-security)]
       [:li {:on-click
             #(-> (shui/dialog-confirm!
                    [:b (t :plugin/delete-alert name)])
@@ -607,9 +608,10 @@
                     [{:title [:span.flex.items-center.gap-1 (ui/icon "arrow-down-circle") (t :plugin.install-from-file/menu-title)]
                       :options {:on-click plugin-config-handler/open-replace-plugins-modal}}]
 
+                    [{:hr true}]
+
                     (when (state/developer-mode?)
-                      [{:hr true}
-                       {:title [:span.flex.items-center.gap-1 (ui/icon "file-code") (t :plugin/open-preferences)]
+                      [{:title [:span.flex.items-center.gap-1 (ui/icon "file-code") (t :plugin/open-preferences)]
                         :options {:on-click
                                   #(p/let [root (plugin-handler/get-ls-dotdir-root)]
                                      (js/apis.openPath (str root "/preferences.json")))}}
@@ -619,6 +621,9 @@
                                   #(p/let [root (plugin-handler/get-ls-dotdir-root)]
                                      (js/apis.openPath root))}}])
 
+                    [{:title [:span.flex.items-center.gap-1 (ui/icon "alert-triangle") (t :plugin/report-security)]
+                      :options {:on-click #(plugin-handler/open-report-modal!)}}]
+
                     [{:hr true :key "dropdown-more"}
                      {:title (auto-check-for-updates-control)}])]
 

+ 17 - 0
src/main/frontend/handler/plugin.cljs

@@ -477,6 +477,23 @@
        (state/pub-event! [:go/plugins-settings id nav? (or (:name plugin) (:title plugin))])
        (open-settings-file-in-default-app! plugin)))))
 
+(defn open-report-modal!
+  ([] (open-report-modal! nil nil))
+  ([pid name]
+   (shui/dialog-open!
+     [:div.p-1
+      (when pid
+        [:h1.opacity-90.font-bold.pb-1.flex.item-center.gap-1
+         [:span.text-red-rx-10.flex.items-center (shui/tabler-icon "alert-triangle-filled" {:size 20})]
+         [:span name "  " [:code "#" (str pid)]]])
+      [:p
+       "If any plugin is unavailable or you think it contains malicious code,
+        please email " [:a.hover:underline {:href (str "mailto://[email protected]?subject=Report plugin from Logseq Marketplace"
+                                                           (when pid (str " (#" pid ")")))} "[email protected]"]
+       " . Mention the name of the plugin and the URL of its GitHub repository.
+       The Logseq team usually responds within a business day."]
+      ])))
+
 (defn parse-user-md-content
   [content {:keys [url]}]
   (try

+ 1 - 0
src/resources/dicts/en.edn

@@ -531,6 +531,7 @@
  :plugin/delete-alert "Are you sure you want to uninstall the plugin [{1}]?"
  :plugin/open-settings "Open settings"
  :plugin/open-package "Open package"
+ :plugin/report-security "Report plugin"
  :plugin/load-unpacked "Load unpacked plugin"
  :plugin/restart "Restart App"
  :plugin/unpacked-tips "Select the plugin directory"