diff --git a/.github/workflows/build-desktop-release.yml b/.github/workflows/build-desktop-release.yml index 748569e38..277f474d9 100644 --- a/.github/workflows/build-desktop-release.yml +++ b/.github/workflows/build-desktop-release.yml @@ -24,6 +24,16 @@ on: type: boolean required: true default: true + enable-file-sync: + description: 'Build with file sync support' + type: boolean + required: true + default: false + enable-plugins: + description: 'Build with plugin system support' + 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' @@ -87,6 +97,12 @@ jobs: run: | sed -i 's/defonce version ".*"/defonce version "${{ steps.ref.outputs.version }}"/g' src/main/frontend/version.cljs + - name: Set Build Environment Variables (only when workflow_dispath) + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + echo "ENABLE_FILE_SYNC=${{ github.event.inputs.enable-file-sync }}" >> $GITHUB_ENV + echo "ENABLE_PLUGINS=${{ github.event.inputs.enable-plugins }}" >> $GITHUB_ENV + - name: Compile CLJS run: yarn install && gulp build && yarn cljs:release-electron diff --git a/shadow-cljs.edn b/shadow-cljs.edn index e8df8c271..3f425a3e6 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -31,7 +31,9 @@ "externs.js"] :warnings {:fn-deprecated false :redef false}} - :closure-defines {goog.debug.LOGGING_ENABLED true} + :closure-defines {goog.debug.LOGGING_ENABLED true + frontend.config/ENABLE-FILE-SYNC #shadow/env ["ENABLE_FILE_SYNC" :as :bool :default false] + frontend.config/ENABLE-PLUGINS #shadow/env ["ENABLE_PLUGINS" :as :bool :default true]} ;; NOTE: electron, browser/mobile-app use different asset-paths. ;; For browser/mobile-app devs, assets are located in /static/js(via HTTP root). diff --git a/src/main/frontend/components/settings.cljs b/src/main/frontend/components/settings.cljs index b7bbce779..4340059ae 100644 --- a/src/main/frontend/components/settings.cljs +++ b/src/main/frontend/components/settings.cljs @@ -619,7 +619,7 @@ (when (and util/mac? (util/electron?)) (app-auto-update-row t)) (usage-diagnostics-row t instrument-disabled?) (when-not (mobile-util/native-platform?) (developer-mode-row t developer-mode?)) - (when (util/electron?) (plugin-system-switcher-row)) + (when (and (util/electron?) config/enable-plugins?) (plugin-system-switcher-row)) (flashcards-switcher-row enable-flashcards?) (when (util/electron?) (https-user-agent-row https-agent-opts)) (clear-cache-row t) diff --git a/src/main/frontend/config.cljs b/src/main/frontend/config.cljs index af9fba065..9c2389af5 100644 --- a/src/main/frontend/config.cljs +++ b/src/main/frontend/config.cljs @@ -33,6 +33,15 @@ (goog-define API-DOMAIN "api.logseq.com") (goog-define WS-URL "wss://og96xf1si7.execute-api.us-east-2.amazonaws.com/production?graphuuid=%s") +;; feature flags +(goog-define ENABLE-FILE-SYNC false) +(defonce enable-file-sync? (or ENABLE-FILE-SYNC dev?)) ;; always enable file-sync when dev + +(goog-define ENABLE-PLUGINS true) +(defonce enable-plugins? ENABLE-PLUGINS) + +(swap! state/state assoc :plugin/enabled enable-plugins?) + ;; :TODO: How to do this? ;; (defonce desktop? ^boolean goog.DESKTOP) diff --git a/src/main/frontend/handler/file_sync.cljs b/src/main/frontend/handler/file_sync.cljs index e51654744..f500728ba 100644 --- a/src/main/frontend/handler/file_sync.cljs +++ b/src/main/frontend/handler/file_sync.cljs @@ -15,7 +15,7 @@ [frontend.handler.user :as user] [frontend.fs :as fs])) -(def hiding-login&file-sync (not config/dev?)) +(def hiding-login&file-sync (not config/enable-file-sync?)) (def refresh-file-sync-component (atom false)) (defn graph-txid-exists?