Merge remote-tracking branch 'upstream/master' into whiteboards

This commit is contained in:
Peng Xiao
2022-08-15 15:46:33 +08:00
6 changed files with 119 additions and 78 deletions

View File

@@ -19,11 +19,19 @@ on:
description: "Build from Git Ref(master)"
required: true
default: "master"
enable-file-sync:
description: 'Build with file sync support'
type: boolean
required: true
default: false
workflow_call:
inputs:
build-target:
type: string
required: true
enable-file-sync:
description: 'Build with file sync support'
type: boolean
secrets:
ANDROID_KEYSTORE:
required: true
@@ -93,11 +101,15 @@ jobs:
sed -i 's/defonce version ".*"/defonce version "${{ steps.ref.outputs.version }}"/g' src/main/frontend/version.cljs
sed -i 's/versionName ".*"/versionName "${{ steps.ref.outputs.version }}"/g' android/app/build.gradle
- name: Set Build Environment Variables
run: |
echo "ENABLE_FILE_SYNC=${{ inputs.enable-file-sync == 'true' || github.event.inputs.enable-file-sync == 'true' }}" >> $GITHUB_ENV
- name: Compile CLJS - android variant, use es6 instead of es-next
run: yarn install && yarn release-android-app
- name: Upload Sentry Sourcemaps (beta only)
if: ${{ inputs.build-target == 'beta' || github.event.inputs.build-target == 'beta' }}
if: ${{ github.repository == 'logseq/logseq' && (inputs.build-target == 'beta' || github.event.inputs.build-target == 'beta') }}
run: |
curl -sL https://sentry.io/get-cli/ | bash
release_name="logseq-android@${{ steps.ref.outputs.version }}"

View File

@@ -38,6 +38,11 @@ on:
type: boolean
required: true
default: true
build-android:
description: 'Build Android App'
type: boolean
required: true
default: true
schedule: # Every workday at the 2 P.M. (UTC) we run a scheduled nightly build
- cron: '0 14 * * MON-FRI'
@@ -49,6 +54,12 @@ jobs:
compile-cljs:
runs-on: ubuntu-18.04
steps:
- name: Check build options
if: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.build-target == 'nightly' || github.event.inputs.build-target == 'beta') && github.event.inputs.git-ref != 'master' }}
run: |
echo "::error title=CheckFail::Nightly and Beta Release MUST be built from master"
exit 1
- name: Check out Git repository
uses: actions/checkout@v2
with:
@@ -96,6 +107,14 @@ jobs:
pkgver=$(node ./scripts/get-pkg-version.js "${{ github.event.inputs.build-target }}")
echo ::set-output name=version::$pkgver
- name: Do Not Overwrite Existing Release
if: ${{ github.event.inputs.build-target == 'beta' }}
run: |
if curl -f "https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ steps.ref.outputs.version }}" &>/dev/null; then
echo "::error title=CheckFail::Release already exists"
exit 1
fi
- name: Update Nightly APP Version
if: ${{ github.event.inputs.build-target == 'nightly' || github.event_name == 'schedule' }}
run: |
@@ -128,7 +147,7 @@ jobs:
working-directory: ./static
- name: Upload Sentry Sourcemaps (beta only)
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.build-target == 'beta' }}
if: ${{ github.repository == 'logseq/logseq' && github.event_name == 'workflow_dispatch' && github.event.inputs.build-target == 'beta' }}
run: |
curl -sL https://sentry.io/get-cli/ | bash
release_name="logseq@${{ steps.ref.outputs.version }}"
@@ -284,6 +303,7 @@ jobs:
${{ runner.os }}-yarn-
- name: Signing By Apple Developer ID
if: ${{ github.repository == 'logseq/logseq' }}
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATES_P12 }}
@@ -351,6 +371,7 @@ jobs:
${{ runner.os }}-arm64-yarn-
- name: Signing By Apple Developer ID
if: ${{ github.repository == 'logseq/logseq' }}
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATES_P12 }}
@@ -389,9 +410,11 @@ jobs:
# reuse workflow via workflow_call
build-android:
uses: logseq/logseq/.github/workflows/build-android.yml@master
uses: ./.github/workflows/build-android.yml
if: ${{ github.event_name == 'schedule' || github.event.inputs.build-android == 'true' }}
with:
build-target: "${{ github.event.inputs.build-target }}"
enable-file-sync: "${{ github.event.inputs.enable-file-sync == 'true' }}"
secrets:
ANDROID_KEYSTORE: "${{ secrets.ANDROID_KEYSTORE }}"
ANDROID_KEYSTORE_PASSWORD: "${{ secrets.ANDROID_KEYSTORE_PASSWORD }}"
@@ -466,8 +489,8 @@ jobs:
release:
# NOTE: For now, we only have beta channel to be released on Github
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.build-target == 'beta' }}
needs: [ build-macos-x64, build-macos-arm64, build-linux, build-windows, build-android ]
runs-on: ubuntu-18.04
needs: [ build-macos-x64, build-macos-arm64, build-linux, build-windows ]
runs-on: ubuntu-latest
steps:
- name: Download MacOS x64 Artifacts
uses: actions/download-artifact@v2
@@ -495,6 +518,7 @@ jobs:
- name: Download Android Artifacts
uses: actions/download-artifact@v2
if: ${{ github.event_name == 'schedule' || github.event.inputs.build-android == 'true' }}
with:
name: logseq-android-builds
path: ./

View File

@@ -35,7 +35,7 @@
[]
(let [lg-dir (str (.getPath app "home") "/.logseq")]
(if-not (fs/existsSync lg-dir)
(and (fs/mkdirSync lg-dir) lg-dir)
(do (fs/mkdirSync lg-dir) lg-dir)
lg-dir)))
(defn get-ls-default-plugins

View File

@@ -34,7 +34,7 @@
{:title "Development"
:children [[(t :help/roadmap) "https://trello.com/b/8txSM12G/roadmap"]
[(t :help/bug) "https://github.com/logseq/logseq/issues/new?labels=from:in-app&template=bug_report.yaml"]
[(t :help/feature) "https://github.com/logseq/logseq/issues/new?assignees=&labels=&template=feature_request.md&title="]
[(t :help/feature) "https://discuss.logseq.com/c/feature-requests/"]
[(t :help/changelog) "https://docs.logseq.com/#/page/changelog"]]}
{:title "About"

View File

@@ -23,10 +23,10 @@
(defn uuid->uid-map []
(let [db (db/get-db (state/get-current-repo))]
(->>
(d/q db '[:find (pull ?r [:block/uuid])
:in $
:where
[?b :block/refs ?r]])
(d/q '[:find (pull ?r [:block/uuid])
:in $
:where
[?b :block/refs ?r]] db)
(map (comp :block/uuid first))
(distinct)
(map (fn [uuid] [uuid (nano-id)]))

View File

@@ -591,89 +591,94 @@
(let [el (js/document.createElement "div")]
(.appendChild js/document.body el)
(rum/mount
(lsp-indicator) el))
(lsp-indicator) el))
(state/set-state! :plugin/indicator-text "LOADING")
(p/then
(p/let [root (get-ls-dotdir-root)
_ (.setupPluginCore js/LSPlugin (bean/->js {:localUserConfigRoot root :dotConfigRoot root}))
(-> (p/let [root (get-ls-dotdir-root)
_ (.setupPluginCore js/LSPlugin (bean/->js {:localUserConfigRoot root :dotConfigRoot root}))
clear-commands! (fn [pid]
;; commands
(unregister-plugin-slash-command pid)
(invoke-exported-api "unregister_plugin_simple_command" pid)
(invoke-exported-api "uninstall_plugin_hook" pid)
(unregister-plugin-ui-items pid)
(unregister-plugin-resources pid))
clear-commands! (fn [pid]
;; commands
(unregister-plugin-slash-command pid)
(invoke-exported-api "unregister_plugin_simple_command" pid)
(invoke-exported-api "uninstall_plugin_hook" pid)
(unregister-plugin-ui-items pid)
(unregister-plugin-resources pid))
_ (doto js/LSPluginCore
(.on "registered"
(fn [^js pl]
(register-plugin
(bean/->clj (.parse js/JSON (.stringify js/JSON pl))))))
_ (doto js/LSPluginCore
(.on "registered"
(fn [^js pl]
(register-plugin
(bean/->clj (.parse js/JSON (.stringify js/JSON pl))))))
(.on "reloaded"
(fn [^js pl]
(register-plugin
(bean/->clj (.parse js/JSON (.stringify js/JSON pl))))))
(.on "reloaded"
(fn [^js pl]
(register-plugin
(bean/->clj (.parse js/JSON (.stringify js/JSON pl))))))
(.on "unregistered" (fn [pid]
(let [pid (keyword pid)]
;; effects
(unregister-plugin-themes pid)
;; plugins
(swap! state/state medley/dissoc-in [:plugin/installed-plugins pid])
;; commands
(clear-commands! pid))))
(.on "unregistered" (fn [pid]
(let [pid (keyword pid)]
;; effects
(unregister-plugin-themes pid)
;; plugins
(swap! state/state medley/dissoc-in [:plugin/installed-plugins pid])
;; commands
(clear-commands! pid))))
(.on "unlink-plugin" (fn [pid]
(let [pid (keyword pid)]
(ipc/ipc "uninstallMarketPlugin" (name pid)))))
(.on "unlink-plugin" (fn [pid]
(let [pid (keyword pid)]
(ipc/ipc "uninstallMarketPlugin" (name pid)))))
(.on "beforereload" (fn [^js pl]
(let [pid (.-id pl)]
(clear-commands! pid)
(unregister-plugin-themes pid false))))
(.on "beforereload" (fn [^js pl]
(let [pid (.-id pl)]
(clear-commands! pid)
(unregister-plugin-themes pid false))))
(.on "disabled" (fn [pid]
(clear-commands! pid)
(unregister-plugin-themes pid)))
(.on "disabled" (fn [pid]
(clear-commands! pid)
(unregister-plugin-themes pid)))
(.on "themes-changed" (fn [^js themes]
(swap! state/state assoc :plugin/installed-themes
(vec (mapcat (fn [[pid vs]] (mapv #(assoc % :pid pid) (bean/->clj vs))) (bean/->clj themes))))))
(.on "themes-changed" (fn [^js themes]
(swap! state/state assoc :plugin/installed-themes
(vec (mapcat (fn [[pid vs]] (mapv #(assoc % :pid pid) (bean/->clj vs))) (bean/->clj themes))))))
(.on "theme-selected" (fn [^js theme]
(let [theme (bean/->clj theme)
url (:url theme)
mode (:mode theme)]
(when mode
(state/set-custom-theme! mode theme)
(state/set-theme-mode! mode))
(hook-plugin-app :theme-changed theme)
(state/set-state! :plugin/selected-theme url))))
(.on "theme-selected" (fn [^js theme]
(let [theme (bean/->clj theme)
url (:url theme)
mode (:mode theme)]
(when mode
(state/set-custom-theme! mode theme)
(state/set-theme-mode! mode))
(hook-plugin-app :theme-changed theme)
(state/set-state! :plugin/selected-theme url))))
(.on "reset-custom-theme" (fn [^js themes]
(let [themes (bean/->clj themes)
custom-theme (dissoc themes :mode)
mode (:mode themes)]
(state/set-custom-theme! {:light (if (nil? (:light custom-theme)) {:mode "light"} (:light custom-theme))
:dark (if (nil? (:dark custom-theme)) {:mode "dark"} (:dark custom-theme))})
(state/set-theme-mode! mode))))
(.on "reset-custom-theme" (fn [^js themes]
(let [themes (bean/->clj themes)
custom-theme (dissoc themes :mode)
mode (:mode themes)]
(state/set-custom-theme! {:light (if (nil? (:light custom-theme)) {:mode "light"} (:light custom-theme))
:dark (if (nil? (:dark custom-theme)) {:mode "dark"} (:dark custom-theme))})
(state/set-theme-mode! mode))))
(.on "settings-changed" (fn [id ^js settings]
(let [id (keyword id)]
(when (and settings
(contains? (:plugin/installed-plugins @state/state) id))
(update-plugin-settings-state id (bean/->clj settings)))))))
(.on "settings-changed" (fn [id ^js settings]
(let [id (keyword id)]
(when (and settings
(contains? (:plugin/installed-plugins @state/state) id))
(update-plugin-settings-state id (bean/->clj settings)))))))
default-plugins (get-user-default-plugins)
default-plugins (get-user-default-plugins)
_ (.register js/LSPluginCore (bean/->js (if (seq default-plugins) default-plugins [])) true)])
#(do
(state/set-state! :plugin/indicator-text "END")
(callback))))
_ (.register js/LSPluginCore (bean/->js (if (seq default-plugins) default-plugins [])) true)])
(p/then
(fn []
(state/set-state! :plugin/indicator-text "END")
(callback)))
(p/catch
(fn [^js e]
(log/error :setup-plugin-system-error e)
(state/set-state! :plugin/indicator-text (str "Fatal: " e))))))
(defn setup!
"setup plugin core handler"