diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index c1a5172a1d..0000000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -open_collective: logseq diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml deleted file mode 100644 index c32607d0a0..0000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ /dev/null @@ -1,90 +0,0 @@ -name: Bug Report -description: Report a bug encountered while using Logseq -body: - - type: markdown - attributes: - value: | - Thank you very much for opening a bug report with Logseq. - - If you have a feature idea or need help, please go to [our Forum](https://discuss.logseq.com/) or [our Discord](https://discord.com/invite/KpN4eHY). - - Please make sure to provide a descriptive, deterministic, and reproducible report. It saves time for both the developers and users who are looking for solutions. Providing as much information as possible, including screenshots and logs, is highly appreciated. This will help us to better understand the issue and respond more effectively. - - Please DO NOT use this template to ask questions. There are other appropriate channels to ask questions. This template is strictly for reporting bugs. - - type: checkboxes - id: confirm-search - attributes: - label: Search first - description: Please search [existing issues](https://github.com/logseq/og/issues) and the [Logseq Forum](https://discuss.logseq.com/) before reporting. - options: - - label: I searched and no similar issues were found - required: true - - type: textarea - id: problem - attributes: - label: What Happened? - description: | - Please provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. - validations: - required: true - - type: textarea - id: reproduce - attributes: - label: Reproduce the Bug - description: | - Please tell us the steps to reproduce the bug. - placeholder: | - 1. Go to '...' - 2. Click on '....' - 3. Scroll down to '....' - 4. See error - validations: - required: true - - type: textarea - id: expected - attributes: - label: Expected Behavior - description: | - Please tell us what's the behavior you expect. - validations: - required: false - - type: textarea - id: screenshots - attributes: - label: Screenshots - description: | - If applicable, add screenshots or screen recordings to help explain your problem. - validations: - required: false - - type: textarea - id: platform - attributes: - label: Desktop or Mobile Platform Information - description: | - Would you mind to tell us the system information about your desktop or mobile platform? - placeholder: | - OS version, Browser or App, Logseq App version - example: macOS 12.2, Desktop App v0.5.9 - example: iPhone 12, iOS8.1, v0.5.9 - example: Pixel XL, Android 12, v0.5.9 - validations: - required: false - - type: textarea - id: additional - attributes: - label: Additional Context - description: | - If applicable, add additional context to help explain your problem. - validations: - required: false - - - type: checkboxes - id: ask-pr - attributes: - label: Are you willing to submit a PR? If you know how to fix the bug. - description: | - If you are not familiar with programming, you can skip this step. - If you are a developer and know how to fix the bug, you can [submit a PR to fix it](https://github.com/logseq/og/blob/master/CONTRIBUTING.md#submit-pr). - Your contributions are greatly appreciated and play a vital role in helping to improve the project! - options: - - label: I'm willing to submit a PR (Thank you!) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 4b20698da1..0000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,11 +0,0 @@ -contact_links: - - name: Feature request - url: https://discuss.logseq.com/new-topic?category=feature-requests - about: Suggest an idea for Logseq - - name: Questions & Help - url: https://discuss.logseq.com/new-topic?category=questions-and-help - about: Ask a question about Logseq - - name: Feedback - url: https://discuss.logseq.com/new-topic?category=feedback - about: Discuss where Logseq can be improved - diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md deleted file mode 100644 index f3f7b9b67d..0000000000 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/.github/pr-labeler.yml b/.github/pr-labeler.yml deleted file mode 100644 index 5431e79a0a..0000000000 --- a/.github/pr-labeler.yml +++ /dev/null @@ -1,4 +0,0 @@ -:type/feature: ['feature/*', 'feat/*', '*:feat/*'] -:type/enhancement: ['enhancement/*', 'enh/*', 'enhance/*', 'improve/*', '*:enhance/*'] -:type/bug-fix: ['fix/*', 'fix*', 'bug/*', 'bug-fix/*', 'bugfix/*', 'bug-fixes/*', 'bugfixes/*', '*:fix/*'] -:type/dev: ['chore/*', 'test/*', 'docs/*', 'build/*', 'ci/*', 'misc/*', 'dev/*', '*:dev/*', '*:chore/*', '*:test/*'] diff --git a/.github/stale-issues.yml b/.github/stale-issues.yml deleted file mode 100644 index b8e198cb11..0000000000 --- a/.github/stale-issues.yml +++ /dev/null @@ -1,91 +0,0 @@ -# This workflow warns and then closes issues that have had no activity for a -# specified amount of time. You can adjust the behavior by modifying this file. -# For more information, see: -# https://github.com/marketplace/actions/close-stale-issues -# https://github.com/actions/stale/blob/master/action.yml -# https://github.com/actions/stale ---- -name: 'Stale Issues Policy' -on: # yamllint disable-line rule:truthy - schedule: - - cron: '0 0 * * *' # Run at 00:00 UTC every day - workflow_dispatch: - -permissions: - contents: read - issues: write # for actions/stale to close stale issues - -jobs: - stale: - runs-on: ubuntu-latest - steps: - - name: '🧹 Mark & close stale issues' - id: stale_issues - uses: actions/stale@6f05e4244c9a0b2ed3401882b05d701dd0a7289b # v7 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - days-before-issue-stale: 180 - days-before-close: 20 - operations-per-run: 100 # max num of ops per run - stale-issue-label: ':status/automatic-stale' - close-issue-label: ':status/automatic-closing' - # trunk-ignore(yamllint/line-length) - exempt-issue-labels: ':status/hold, :status/WIP, :type/enhancement, type/can-be-reproduced, priority-A' - remove-stale-when-updated: true - stale-issue-message: | - Hi There! 👋 - - We haven't seen any activity on this issue in a while :sleeping:, and we just wanted to make sure that it's still relevant. If you're still experiencing this issue, you might find it helpful to update to the latest version of Logseq. The latest version includes bug fixes and new features that may help to resolve this issue, and you can download it from [our website](https://logseq.com). If updating to the latest version doesn't help, please let us know by adding a comment 💬. We're here to help! - - If the issue has been resolved or is no longer relevant, that's great news! 🎉 - We'll go ahead and close this issue to keep our backlog organized. Please note that this issue will be closed automatically in 20 days if there is no further activity. If you need more time to resolve the issue or provide more information, please just let us know by adding a comment. - - - Access additional [Logseq](https://logseq.com) 🚀 resources: - - **Forum**: https://discuss.logseq.com - - **Blog**: https://blog.logseq.com - - **Docs**: https://docs.logseq.com - - Thanks for your contributions to Logseq! If you have any other [**issues**](https://github.com/logseq/og/issues/new/choose) or [**feature requests**](https://discuss.logseq.com/c/feedback/feature-requests/), please don't hesitate to [let us know](https://github.com/logseq/og/issues/new/choose). We always welcome pull requests too! - - - name: 'Print outputs' - run: | - for key in steps.stale_issues.outputs - do - printf '%s: %s\n' "${key}" "${steps.stale_issues.outputs[key]}" - done - - - name: '🧹 Close stale awaiting response issues' - id: awaiting_issues - uses: actions/stale@6f05e4244c9a0b2ed3401882b05d701dd0a7289b # v7 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - days-before-issue-stale: 40 - days-before-close: 20 - operations-per-run: 30 # max num of ops per run - stale-issue-label: ':status/automatic-stale' - close-issue-label: ':status/automatic-closing' - only-labels: 'awaiting response' - remove-stale-when-updated: true - stale-issue-message: | - Hi There! 👋 - - We haven't seen any activity on this issue in a while :sleeping:, and we just wanted to make sure that it's still relevant. If you're still experiencing this issue, you might find it helpful to update to the latest version of Logseq. The latest version includes bug fixes and new features that may help to resolve this issue, and you can download it from [our website](https://logseq.com). If updating to the latest version doesn't help, please let us know by adding a comment 💬. We're here to help! - - If the issue has been resolved or is no longer relevant, that's great news! 🎉 - We'll go ahead and close this issue to keep our backlog organized. Please note that this issue will be closed automatically in 20 days if there is no further activity. If you need more time to resolve the issue or provide more information, please just let us know by adding a comment. - - - Access additional [Logseq](https://logseq.com) 🚀 resources: - - **Forum**: https://discuss.logseq.com - - **Blog**: https://blog.logseq.com - - **Docs**: https://docs.logseq.com - - Thanks for your contributions to Logseq! If you have any other [**issues**](https://github.com/logseq/og/issues/new/choose) or [**feature requests**](https://discuss.logseq.com/c/feedback/feature-requests/), please don't hesitate to [let us know](https://github.com/logseq/og/issues/new/choose). We always welcome pull requests too! - - - name: 'Print outputs' - run: | - for key in steps.awaiting_issues.outputs - do - printf '%s: %s\n' "${key}" "${steps.awaiting_issues.outputs[key]}" - done diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index 1341be4be0..7d69d7bc9d 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -176,10 +176,10 @@ jobs: - name: Rename Apk run: | mkdir builds - mv android/app-signed.apk ./builds/Logseq-OG-android-${{ steps.ref.outputs.version }}.apk + mv android/app-signed.apk ./builds/Logseq-OG-SE-android-${{ steps.ref.outputs.version }}.apk - name: Upload Artifact uses: actions/upload-artifact@v4 with: - name: logseq-og-android-builds + name: logseq-og-se-android-builds path: builds diff --git a/.github/workflows/build-demo.yml b/.github/workflows/build-demo.yml deleted file mode 100644 index 0f2cb8c9d1..0000000000 --- a/.github/workflows/build-demo.yml +++ /dev/null @@ -1,68 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Build-Demo - -on: - workflow_dispatch: - inputs: - git-ref: - description: "Release Git Ref (Which branch or tag to build?)" - required: true - default: "master" - cloudflare-project-name: - description: "Cloudflare pages project name" - required: true - default: "logseq-demo" - - release: - types: [released] - -env: - CLOJURE_VERSION: '1.11.1.1413' - NODE_VERSION: '22' - JAVA_VERSION: '17' - -jobs: - build: - runs-on: ubuntu-latest - env: - asset-path: ${GITHUB_REF##*/}/static/js/ - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.inputs.git-ref }} - - - name: Setup Java JDK - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: ${{ env.JAVA_VERSION }} - - - name: Install Node.js, NPM and Yarn - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Setup clojure - uses: DeLaGuardo/setup-clojure@10.1 - with: - cli: ${{ env.CLOJURE_VERSION }} - - - name: Fetch yarn deps - run: yarn cache clean && yarn install --frozen-lockfile - - - name: Build Released-Web - run: | - yarn gulp:build && clojure -M:cljs release app --config-merge '{:asset-path "${{env.asset-path}}" :compiler-options {:source-map-include-sources-content false :source-map-detail-level :symbols}}' - ls -ah ./public - - - name: Publish to Cloudflare Pages - uses: cloudflare/pages-action@1 - with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: 2553ea8236c11ea0f88de28fce1cbfee - projectName: ${{ github.event.inputs.cloudflare-project-name || 'logseq-demo' }} - directory: 'static' - gitHubToken: ${{ secrets.GITHUB_TOKEN }} - branch: 'production' diff --git a/.github/workflows/build-desktop-release.yml b/.github/workflows/build-desktop-release.yml index 17c66a6842..f63c0fa0ac 100644 --- a/.github/workflows/build-desktop-release.yml +++ b/.github/workflows/build-desktop-release.yml @@ -1,4 +1,4 @@ -# This is the main desktop application release workflow for both nightly and beta/stable releases. +# Desktop application release workflow (Windows x64 only, manual trigger only) for beta/stable releases. name: Build-Desktop-Release @@ -11,7 +11,6 @@ on: required: true options: - beta - - nightly - non-release - release default: "non-release" @@ -20,7 +19,7 @@ on: required: true default: "master" is-draft: - description: 'Draft Release? (Beta/Release only, Nightly will always be a non-draft)' + description: 'Draft Release? (Beta/Release only)' type: boolean required: true default: true @@ -29,23 +28,16 @@ on: type: boolean required: true default: true - enable-file-sync-production: - description: 'File sync production mode' + override: + description: 'Override the existing release of the same version?' type: boolean required: true - default: true + default: false enable-plugins: description: 'Build with plugin system support' 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' env: CLOJURE_VERSION: '1.11.1.1413' @@ -55,6 +47,8 @@ env: jobs: compile-cljs: runs-on: ubuntu-22.04 + outputs: + sha: ${{ steps.ref.outputs.sha }} 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.build-target == 'release') && github.event.inputs.git-ref != 'master' }} @@ -63,12 +57,12 @@ jobs: # exit 1 - name: Check out Git repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: ref: ${{ github.event.inputs.git-ref }} - name: Install Node.js, NPM and Yarn - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version: ${{ env.NODE_VERSION }} @@ -77,7 +71,7 @@ jobs: run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Cache yarn cache directory - uses: actions/cache@v4 + uses: actions/cache@v6 id: yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -86,13 +80,13 @@ jobs: ${{ runner.os }}-yarn- - name: Setup Java JDK - uses: actions/setup-java@v4 + uses: actions/setup-java@v6 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} - name: Cache clojure deps - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: | ~/.m2/repository @@ -100,7 +94,7 @@ jobs: key: ${{ runner.os }}-clojure-lib-${{ hashFiles('**/deps.edn') }} - name: Setup clojure - uses: DeLaGuardo/setup-clojure@10.1 + uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: ${{ env.CLOJURE_VERSION }} @@ -109,26 +103,20 @@ jobs: run: | pkgver=$(node ./scripts/get-pkg-version.js "${{ github.event.inputs.build-target }}") echo "version=$pkgver" >> $GITHUB_OUTPUT + echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Do Not Overwrite Existing Release - if: ${{ github.event.inputs.build-target == 'beta' || github.event.inputs.build-target == 'release' }} + if: ${{ (github.event.inputs.build-target == 'beta' || github.event.inputs.build-target == 'release') && github.event.inputs.override != 'true' }} 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: | - 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_dispatch) if: ${{ github.event_name == 'workflow_dispatch' }} - # if scheduled, use default settings run: | - echo "ENABLE_PLUGINS=${{ github.event_name == 'schedule' || github.event.inputs.enable-plugins == 'true' }}" >> $GITHUB_ENV - echo "ENABLE_FILE_SYNC_PRODUCTION=${{ github.event_name == 'schedule' || github.event.inputs.enable-file-sync-production == 'true' }}" >> $GITHUB_ENV + echo "ENABLE_PLUGINS=${{ github.event.inputs.enable-plugins == 'true' }}" >> $GITHUB_ENV - name: Compile CLJS run: yarn install && gulp build && yarn cljs:release-electron @@ -153,21 +141,8 @@ jobs: run: ls -al working-directory: ./static - - name: Upload Sentry Sourcemaps (beta only) - if: ${{ github.repository == 'logseq/og' && github.event_name == 'workflow_dispatch' && github.event.inputs.build-target == 'beta' }} - run: | - curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION=2.58.4 bash - release_name="logseq@${{ steps.ref.outputs.version }}" - sentry-cli releases new "${release_name}" - sentry-cli releases files "${release_name}" upload-sourcemaps --ext map --ext js ./static/js --url-prefix '~/static/js' - sentry-cli releases finalize "${release_name}" - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: logseq - SENTRY_PROJECT: logseq - - name: Cache Static File - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: static path: static @@ -181,16 +156,16 @@ jobs: needs: [ compile-cljs ] steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Download The Static Asset - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: static path: static - name: Set up Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version: ${{ env.NODE_VERSION }} cache: 'yarn' @@ -228,112 +203,12 @@ jobs: DEBUG: "pw:api" RELEASE: true # skip dev only test - build-linux-x64: - runs-on: ubuntu-22.04 - needs: [ compile-cljs ] - steps: - - name: Download The Static Asset - uses: actions/download-artifact@v4 - with: - name: static - path: static - - - name: Retrieve tag version - id: ref - run: | - pkgver=$(cat ./static/VERSION) - echo "version=$pkgver" >> $GITHUB_OUTPUT - - - name: Install Node.js, NPM and Yarn - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - # - name: Cache Node Modules - # uses: actions/cache@v4 - # with: - # path: | - # **/node_modules - # key: ${{ runner.os }}-node-modules - - - name: Build/Release Electron App - run: yarn install && yarn electron:make - working-directory: ./static - - - name: Save artifacts - run: | - mkdir -p builds - # NOTE: save VERSION file to builds directory - cp static/VERSION ./builds/VERSION - mv static/out/make/*-*.AppImage ./builds/Logseq-OG-linux-x64-${{ steps.ref.outputs.version }}.AppImage - mv static/out/make/zip/linux/x64/*-linux-x64-*.zip ./builds/Logseq-OG-linux-x64-${{ steps.ref.outputs.version }}.zip - - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: logseq-og-linux-x64-builds - path: builds - - build-linux-arm64: - runs-on: ubuntu-22.04 - needs: [ compile-cljs ] - steps: - - name: Download The Static Asset - uses: actions/download-artifact@v4 - with: - name: static - path: static - - - name: Retrieve tag version - id: ref - run: | - pkgver=$(cat ./static/VERSION) - echo "version=$pkgver" >> $GITHUB_OUTPUT - - - name: Install Node.js, NPM and Yarn - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Fetch deps - env: - npm_config_arch: arm64 - run: | - yarn install --target_arch=arm64 --target_platform=linux - rsapi_version=`node -e 'console.log(require("@logseq/rsapi/package.json").optionalDependencies["@logseq/rsapi-linux-arm64-gnu"])'` - temp_dir=`mktemp -d` - cd "$temp_dir" - echo '{"dependencies": {"@logseq/rsapi-linux-arm64-gnu": "'"$rsapi_version"'"}}' > package.json - yarn install --ignore-platform - cd - - mv "$temp_dir/node_modules/@logseq/rsapi-linux-arm64-gnu" node_modules/@logseq/rsapi-linux-arm64-gnu - rm -rf "$temp_dir" "node_modules/@logseq/rsapi-linux-x64-gnu" - working-directory: ./static - - - name: Build/Release Electron App - run: yarn electron:make-linux-arm64 - working-directory: ./static - - - name: Save artifacts - run: | - mkdir -p builds - # NOTE: save VERSION file to builds directory - cp static/VERSION ./builds/VERSION - # mv static/out/make/*-*.AppImage ./builds/Logseq-OG-linux-arm64-${{ steps.ref.outputs.version }}.AppImage - mv static/out/make/zip/linux/arm64/*-linux-arm64-*.zip ./builds/Logseq-OG-linux-arm64-${{ steps.ref.outputs.version }}.zip - - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: logseq-og-linux-arm64-builds - path: builds - build-windows: runs-on: windows-latest needs: [ compile-cljs ] steps: - name: Download The Static Asset - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: static path: static @@ -343,12 +218,12 @@ jobs: run: echo "version=$(cat ./static/VERSION)" >> $env:GITHUB_OUTPUT - name: Install Node.js, NPM and Yarn - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version: ${{ env.NODE_VERSION }} - name: Install Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v7 with: python-version: '3.11' @@ -371,7 +246,7 @@ jobs: } # - name: Cache Node Modules - # uses: actions/cache@v4 + # uses: actions/cache@v6 # with: # path: | # **/node_modules @@ -381,331 +256,39 @@ jobs: run: yarn install working-directory: ./static - - name: Fix Deps Electron app - run: yarn run postinstall - working-directory: ./static/node_modules/dugite/ - + # Same targets as knowledge/packaging.md: Squirrel installer + zip, no WiX maker (no .msi) - name: Build/Release Electron app - run: yarn electron:make + run: npx electron-forge make --targets "@electron-forge/maker-squirrel,@electron-forge/maker-zip" working-directory: ./static env: DEBUG: electron-packager - - name: Save Artifact for Code Signing + - name: Save Artifacts run: | mkdir builds - mv static\out\make\squirrel.windows\x64\*.exe builds\Logseq-OG-win-x64-${{ steps.ref.outputs.version }}.exe - mv static\out\make\wix\x64\Logseq*.msi builds\Logseq-OG-win-x64-${{ steps.ref.outputs.version }}.msi - - - name: Sign - uses: azure/trusted-signing-action@v0.5.9 - with: - azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} - azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} - azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }} - endpoint: https://eus.codesigning.azure.net/ - trusted-signing-account-name: logseqwin - certificate-profile-name: Logseq - files-folder: builds - files-folder-filter: exe,msi - file-digest: SHA256 - timestamp-rfc3161: http://timestamp.acs.microsoft.com - timestamp-digest: SHA256 - - - name: Save Artifact - run: | - mv static\out\make\squirrel.windows\x64\*.nupkg builds\Logseq-OG-win-x64-${{ steps.ref.outputs.version }}-full.nupkg - mv static\out\make\zip\win32\x64\*.zip builds\Logseq-OG-win-x64-${{ steps.ref.outputs.version }}.zip + # NOTE: the release job reads VERSION from the downloaded artifact + cp static\VERSION builds\VERSION + mv static\out\make\squirrel.windows\x64\*.exe builds\Logseq-OG-SE-win-x64-${{ steps.ref.outputs.version }}.exe + mv static\out\make\squirrel.windows\x64\*.nupkg builds\Logseq-OG-SE-win-x64-${{ steps.ref.outputs.version }}-full.nupkg + mv static\out\make\zip\win32\x64\*.zip builds\Logseq-OG-SE-win-x64-${{ steps.ref.outputs.version }}.zip mv static\out\make\squirrel.windows\x64\RELEASES builds\RELEASES - name: Upload Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: - name: logseq-og-win64-builds + name: logseq-og-se-win64-builds path: builds - build-macos-x64: - needs: [ compile-cljs ] - runs-on: macos-15-intel - - steps: - - name: Download The Static Asset - uses: actions/download-artifact@v4 - with: - name: static - path: static - - - name: Retrieve tag version - id: ref - run: | - pkgver=$(cat ./static/VERSION) - echo "version=$pkgver" >> $GITHUB_OUTPUT - - - name: List Static Files - run: ls -al ./static - - - name: Install Node.js, NPM and Yarn - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Install Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - name: Cache yarn cache directory - uses: actions/cache@v4 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Signing By Apple Developer ID - if: ${{ github.repository == 'logseq/og' }} - uses: apple-actions/import-codesign-certs@v1 - with: - p12-file-base64: ${{ secrets.APPLE_CERTIFICATES_P12 }} - p12-password: ${{ secrets.APPLE_CERTIFICATES_P12_PASSWORD }} - - # - name: Cache Node Modules - # uses: actions/cache@v4 - # with: - # path: | - # **/node_modules - # key: ${{ runner.os }}-node-modules - - - name: Build/Release Electron App for x64 - run: yarn install && yarn rebuild:all && yarn electron:make - working-directory: ./static - env: - APPLE_ID: ${{ secrets.APPLE_ID_EMAIL }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - - - name: Save x64 artifacts - run: | - mkdir -p builds - mv static/out/make/*.dmg ./builds/Logseq-OG-darwin-x64-${{ steps.ref.outputs.version }}.dmg - mv static/out/make/zip/darwin/x64/*.zip ./builds/Logseq-OG-darwin-x64-${{ steps.ref.outputs.version }}.zip - - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: logseq-og-darwin-x64-builds - path: builds - - build-macos-arm64: - needs: [ compile-cljs ] - runs-on: macos-15 - - steps: - - name: Download The Static Asset - uses: actions/download-artifact@v4 - with: - name: static - path: static - - - name: Retrieve tag version - id: ref - run: | - pkgver=$(cat ./static/VERSION) - echo "version=$pkgver" >> $GITHUB_OUTPUT - - - name: Install Node.js, NPM and Yarn - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - - name: Cache yarn cache directory - uses: actions/cache@v4 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-arm64-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-arm64-yarn- - - - name: Install Python - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - - name: Signing By Apple Developer ID - if: ${{ github.repository == 'logseq/og' }} - uses: apple-actions/import-codesign-certs@v1 - with: - p12-file-base64: ${{ secrets.APPLE_CERTIFICATES_P12 }} - p12-password: ${{ secrets.APPLE_CERTIFICATES_P12_PASSWORD }} - - # - name: Cache Node Modules - # uses: actions/cache@v4 - # with: - # path: | - # **/node_modules - # key: ${{ runner.os }}-node-modules - - - name: Fetch deps and fix dugit arch for arm64 - run: yarn install --ignore-platform && yarn rebuild:all && cd node_modules/dugite && npm_config_arch=arm64 node script/download-git.js - working-directory: ./static - - - name: Build/Release Electron App for arm64 - run: yarn electron:make-macos-arm64 - working-directory: ./static - env: - APPLE_ID: ${{ secrets.APPLE_ID_EMAIL }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - - - name: Save arm64 artifacts - run: | - mkdir -p builds - mv static/out/make/*.dmg ./builds/Logseq-OG-darwin-arm64-${{ steps.ref.outputs.version }}.dmg - mv static/out/make/zip/darwin/arm64/*.zip ./builds/Logseq-OG-darwin-arm64-${{ steps.ref.outputs.version }}.zip - - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: logseq-og-darwin-arm64-builds - path: builds - - # reuse workflow via workflow_call - build-android: - 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 }}" - # if scheduled, use production mode - enable-file-sync-production: "${{ github.event_name == 'schedule' || github.event.inputs.enable-file-sync-production == 'true' }}" - secrets: - ANDROID_KEYSTORE: "${{ secrets.ANDROID_KEYSTORE }}" - ANDROID_KEYSTORE_PASSWORD: "${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" - SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}" - - nightly-release: - if: ${{ github.event_name == 'schedule' || github.event.inputs.build-target == 'nightly' }} - needs: [ build-macos-x64, build-macos-arm64, build-linux-x64, build-linux-arm64, build-android, e2e-test ] - runs-on: ubuntu-22.04 - steps: - - name: Download MacOS x64 Artifacts - uses: actions/download-artifact@v4 - with: - name: logseq-og-darwin-x64-builds - path: ./ - - - name: Download MacOS arm64 Artifacts - uses: actions/download-artifact@v4 - with: - name: logseq-og-darwin-arm64-builds - path: ./ - - - name: Download The Linux x64 Artifacts - uses: actions/download-artifact@v4 - with: - name: logseq-og-linux-x64-builds - path: ./ - - - name: Download The Linux arm64 Artifacts - uses: actions/download-artifact@v4 - with: - name: logseq-og-linux-arm64-builds - path: ./ - - - name: Download The Windows Artifact - uses: actions/download-artifact@v4 - with: - name: logseq-og-win64-builds - path: ./ - - - name: Download Android Artifacts - uses: actions/download-artifact@v4 - if: ${{ github.event_name == 'schedule' || github.event.inputs.build-android == 'true' }} - with: - name: logseq-og-android-builds - path: ./ - - - name: Generate SHA256 checksums - run: | - sha256sum *-darwin-* > SHA256SUMS.txt - sha256sum *-win-* >> SHA256SUMS.txt - sha256sum *-linux-* >> SHA256SUMS.txt - if ls *.apk 1>/dev/null 2>&1; then - sha256sum *.apk >> SHA256SUMS.txt - fi - cat SHA256SUMS.txt - - - name: List files - run: ls -rl - - - name: Update Nightly Release - uses: andelf/nightly-release@5834076edc55cc05975561c9722043f072ac5c26 # main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: nightly - name: 'Desktop/Android APP Nightly Release $$' - draft: false - prerelease: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.is-pre-release) || (github.event_name == 'schedule')}} - body: | - This is a nightly release of the Logseq OG desktop app. - It's unstable compared to the official releases, **use it with caution**! - files: | - ./SHA256SUMS.txt - ./*.zip - ./*.dmg - ./*.exe - ./*.msi - ./*.AppImage - ./*.apk release: if: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.build-target == 'beta' || github.event.inputs.build-target == 'release') }} - needs: [ build-macos-x64, build-macos-arm64, build-linux-x64, build-linux-arm64, build-android, e2e-test ] + needs: [ compile-cljs, build-windows, e2e-test ] runs-on: ubuntu-22.04 steps: - - name: Download MacOS x64 Artifacts - uses: actions/download-artifact@v4 - with: - name: logseq-og-darwin-x64-builds - path: ./ - - - name: Download MacOS arm64 Artifacts - uses: actions/download-artifact@v4 - with: - name: logseq-og-darwin-arm64-builds - path: ./ - - - name: Download The Linux x64 Artifacts - uses: actions/download-artifact@v4 - with: - name: logseq-og-linux-x64-builds - path: ./ - - - name: Download The Linux arm64 Artifacts - uses: actions/download-artifact@v4 - with: - name: logseq-og-linux-arm64-builds - path: ./ - - name: Download The Windows Artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: - name: logseq-og-win64-builds - path: ./ - - - name: Download Android Artifacts - uses: actions/download-artifact@v4 - if: ${{ github.event_name == 'schedule' || github.event.inputs.build-android == 'true' }} - with: - name: logseq-og-android-builds + name: logseq-og-se-win64-builds path: ./ - name: List files @@ -719,37 +302,42 @@ jobs: - name: Fix .nupkg name in RELEASES file run: | - sed -i "s/Logseq.*.nupkg/Logseq-OG-win-x64-${{ steps.ref.outputs.version }}-full.nupkg/g" RELEASES + sed -i "s/Logseq.*.nupkg/Logseq-OG-SE-win-x64-${{ steps.ref.outputs.version }}-full.nupkg/g" RELEASES - name: Generate SHA256 checksums run: | - sha256sum *-darwin-* > SHA256SUMS.txt - sha256sum *-win-* >> SHA256SUMS.txt - sha256sum *-linux-* >> SHA256SUMS.txt - if ls *.apk 1>/dev/null 2>&1; then - sha256sum *.apk >> SHA256SUMS.txt - fi + sha256sum *-win-* > SHA256SUMS.txt sha256sum RELEASES >> SHA256SUMS.txt cat SHA256SUMS.txt + # The release action never moves an existing tag, so do it before updating the release + - name: Move Existing Tag To The Built Commit (override only) + if: ${{ github.event.inputs.override == 'true' }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ steps.ref.outputs.version }} + SHA: ${{ needs.compile-cljs.outputs.sha }} + run: | + if gh api "repos/$GITHUB_REPOSITORY/git/ref/tags/$TAG" > /dev/null 2>&1; then + gh api --method PATCH "repos/$GITHUB_REPOSITORY/git/refs/tags/$TAG" -f sha="$SHA" -F force=true + fi + - name: Create Release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v3 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ steps.ref.outputs.version }} - name: ${{ github.event.inputs.build-target == 'beta' && format('Desktop/Android APP {0} (Beta Testing)', steps.ref.outputs.version) || format('Desktop/Android APP {0}', steps.ref.outputs.version) }} - body: "TODO: Fill this changelog. Sorry for the inconvenience!" + name: ${{ github.event.inputs.build-target == 'beta' && format('Desktop APP {0} (Beta Testing)', steps.ref.outputs.version) || format('Desktop APP {0}', steps.ref.outputs.version) }} + target_commitish: ${{ needs.compile-cljs.outputs.sha }} + # An empty body keeps the existing changelog when overriding + body: "${{ github.event.inputs.override != 'true' && 'TODO: Fill this changelog. Sorry for the inconvenience!' || '' }}" draft: ${{ github.event.inputs.is-draft }} prerelease: ${{ github.event.inputs.build-target == 'beta' && github.event.inputs.is-pre-release || false }} files: | ./VERSION ./SHA256SUMS.txt ./*.zip - ./*.dmg ./*.exe - ./*.msi ./*.nupkg ./RELEASES - ./*.AppImage - ./*.apk diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml deleted file mode 100644 index a4a2325252..0000000000 --- a/.github/workflows/build-docker.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Build-Docker - -on: - workflow_dispatch: - workflow_call: - release: - types: [released] - -env: - CLOJURE_VERSION: '1.11.1.1413' - -jobs: - - build-docker: - runs-on: ubuntu-22.04 - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 1 - submodules: 'true' - - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v1 - - - name: Docker Login - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v2 - with: - context: . - platforms: linux/amd64,linux/arm64 - push: ${{ github.event_name != 'pull_request' }} - tags: ghcr.io/${{ github.repository_owner }}/logseq-webapp:latest diff --git a/.github/workflows/build-stage.yml b/.github/workflows/build-stage.yml deleted file mode 100644 index 428b8c1573..0000000000 --- a/.github/workflows/build-stage.yml +++ /dev/null @@ -1,68 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Build-Stage - -on: - workflow_dispatch: - inputs: - git-ref: - description: "Release Git Ref (Which branch or tag to build?)" - required: true - default: "master" - cloudflare-project-name: - description: "Cloudflare pages project name" - required: true - default: "logseq-dev" - - release: - types: [released] - -env: - CLOJURE_VERSION: '1.11.1.1413' - NODE_VERSION: '22' - JAVA_VERSION: '17' - -jobs: - build: - runs-on: ubuntu-latest - env: - asset-path: ${GITHUB_REF##*/}/static/js/ - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.inputs.git-ref }} - - - name: Setup Java JDK - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-version: ${{ env.JAVA_VERSION }} - - - name: Install Node.js, NPM and Yarn - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Setup clojure - uses: DeLaGuardo/setup-clojure@10.1 - with: - cli: ${{ env.CLOJURE_VERSION }} - - - name: Fetch yarn deps - run: yarn cache clean && yarn install --frozen-lockfile - - - name: Build Released-Web - run: | - yarn gulp:build && clojure -M:cljs release app --config-merge '{:asset-path "${{env.asset-path}}" :compiler-options {:source-map-include-sources-content false :source-map-detail-level :symbols}}' - ls -ah ./public - - - name: Publish to Cloudflare Pages - uses: cloudflare/pages-action@1 - with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: 2553ea8236c11ea0f88de28fce1cbfee - projectName: ${{ github.event.inputs.cloudflare-project-name || 'logseq-dev' }} - directory: 'public' - gitHubToken: ${{ secrets.GITHUB_TOKEN }} - branch: 'production' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 07cd83deea..ee356c9532 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout Actions Repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Check spelling with custom config file uses: crate-ci/typos@v1.16.8 with: @@ -38,10 +38,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Set up Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version: ${{ env.NODE_VERSION }} cache: 'yarn' @@ -50,18 +50,18 @@ jobs: static/yarn.lock - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v6 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} - name: Set up Clojure - uses: DeLaGuardo/setup-clojure@10.1 + uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: ${{ env.CLOJURE_VERSION }} - name: Clojure cache - uses: actions/cache@v4 + uses: actions/cache@v6 id: clojure-deps with: path: | @@ -90,16 +90,16 @@ jobs: steps: - name: Checkout - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c #v3 + uses: actions/checkout@v7 - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v6 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} - name: Set up Clojure - uses: DeLaGuardo/setup-clojure@10.1 + uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: ${{ env.CLOJURE_VERSION }} bb: ${{ env.BABASHKA_VERSION }} @@ -124,10 +124,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Set up Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version: ${{ env.NODE_VERSION }} cache: 'yarn' @@ -136,18 +136,18 @@ jobs: static/yarn.lock - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v6 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} - name: Set up Clojure - uses: DeLaGuardo/setup-clojure@10.1 + uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: ${{ env.CLOJURE_VERSION }} - name: Clojure cache - uses: actions/cache@v4 + uses: actions/cache@v6 id: clojure-deps with: path: | @@ -161,7 +161,7 @@ jobs: run: clojure -A:cljs -P - name: Shadow-cljs cache - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: .shadow-cljs # ensure update cache every time @@ -219,7 +219,7 @@ jobs: - name: Save test artifacts if: ${{ failure() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: e2e-test-report path: e2e-dump/* diff --git a/.github/workflows/db.yml b/.github/workflows/db.yml index 561c334633..f39e367b12 100644 --- a/.github/workflows/db.yml +++ b/.github/workflows/db.yml @@ -32,23 +32,23 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Set up Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version: ${{ env.NODE_VERSION }} cache: 'yarn' cache-dependency-path: deps/db/yarn.lock - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v6 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} - name: Set up Clojure - uses: DeLaGuardo/setup-clojure@10.1 + uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: ${{ env.CLOJURE_VERSION }} bb: ${{ env.BABASHKA_VERSION }} @@ -65,16 +65,16 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v6 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} - name: Set up Clojure - uses: DeLaGuardo/setup-clojure@10.1 + uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: ${{ env.CLOJURE_VERSION }} bb: ${{ env.BABASHKA_VERSION }} diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index db297e8ed0..7081aa77e2 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -27,10 +27,10 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Set up Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version: ${{ env.NODE_VERSION }} cache: 'yarn' @@ -39,18 +39,18 @@ jobs: static/yarn.lock - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v6 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} - name: Set up Clojure - uses: DeLaGuardo/setup-clojure@10.1 + uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: ${{ env.CLOJURE_VERSION }} - name: Clojure cache - uses: actions/cache@v4 + uses: actions/cache@v6 id: clojure-deps with: path: | @@ -64,7 +64,7 @@ jobs: run: clojure -A:cljs -P - name: Shadow-cljs cache - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: .shadow-cljs # ensure update cache every time @@ -88,7 +88,7 @@ jobs: run: tar czf static.tar.gz static - name: Upload Artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: logseq-e2e-artifact path: static.tar.gz @@ -108,10 +108,10 @@ jobs: run: echo ::info title=StartUp::E2E testing shard ${{ matrix.shard}}/3 repeat ${{ matrix.repeat }} - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Download test build artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: logseq-e2e-artifact @@ -119,7 +119,7 @@ jobs: run: tar xzf static.tar.gz - name: Set up Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version: ${{ env.NODE_VERSION }} cache: 'yarn' @@ -162,7 +162,7 @@ jobs: - name: Save e2e artifacts if: ${{ failure() }} - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: e2e-repeat-report-${{ matrix.shard}}-${{ matrix.repeat }} path: e2e-dump/* diff --git a/.github/workflows/graph-parser.yml b/.github/workflows/graph-parser.yml index bab2ff50a6..f668699867 100644 --- a/.github/workflows/graph-parser.yml +++ b/.github/workflows/graph-parser.yml @@ -37,29 +37,29 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Set up Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version: ${{ env.NODE_VERSION }} cache: 'yarn' cache-dependency-path: deps/graph-parser/yarn.lock - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v6 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} - name: Set up Clojure - uses: DeLaGuardo/setup-clojure@10.1 + uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: ${{ env.CLOJURE_VERSION }} bb: ${{ env.BABASHKA_VERSION }} - name: Clojure cache - uses: actions/cache@v4 + uses: actions/cache@v6 id: clojure-deps with: path: | @@ -90,16 +90,16 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v6 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} - name: Set up Clojure - uses: DeLaGuardo/setup-clojure@10.1 + uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: ${{ env.CLOJURE_VERSION }} bb: ${{ env.BABASHKA_VERSION }} diff --git a/.github/workflows/logseq-common.yml b/.github/workflows/logseq-common.yml index 28c3d2da2a..802e6f7084 100644 --- a/.github/workflows/logseq-common.yml +++ b/.github/workflows/logseq-common.yml @@ -32,23 +32,23 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Set up Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version: ${{ env.NODE_VERSION }} cache: 'yarn' cache-dependency-path: deps/publishing/yarn.lock - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v6 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} - name: Set up Clojure - uses: DeLaGuardo/setup-clojure@10.1 + uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: ${{ env.CLOJURE_VERSION }} bb: ${{ env.BABASHKA_VERSION }} @@ -64,7 +64,7 @@ jobs: run: bb test:load-all-namespaces-with-nbb . - name: Clojure cache - uses: actions/cache@v4 + uses: actions/cache@v6 id: clojure-deps with: path: | @@ -85,16 +85,16 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v6 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} - name: Set up Clojure - uses: DeLaGuardo/setup-clojure@10.1 + uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: ${{ env.CLOJURE_VERSION }} bb: ${{ env.BABASHKA_VERSION }} diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml deleted file mode 100644 index 2d6add54c3..0000000000 --- a/.github/workflows/pr-labeler.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: PR Labeler -on: - pull_request_target: - types: [opened] - -jobs: - pr-labeler: - runs-on: ubuntu-latest - steps: - - uses: TimonVS/pr-labeler-action@v3.1.0 - with: - # optional, .github/pr-labeler.yml is the default value - configuration-path: .github/pr-labeler.yml - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index e788d4edb7..e283e07652 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -37,24 +37,24 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Set up Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v7 with: node-version: ${{ env.NODE_VERSION }} cache: 'yarn' cache-dependency-path: deps/publishing/yarn.lock - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v6 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} # Clojure needed for bb step - name: Set up Clojure - uses: DeLaGuardo/setup-clojure@10.1 + uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: ${{ env.CLOJURE_VERSION }} bb: ${{ env.BABASHKA_VERSION }} @@ -74,16 +74,16 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Set up Java - uses: actions/setup-java@v4 + uses: actions/setup-java@v6 with: distribution: 'zulu' java-version: ${{ env.JAVA_VERSION }} - name: Set up Clojure - uses: DeLaGuardo/setup-clojure@10.1 + uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: ${{ env.CLOJURE_VERSION }} bb: ${{ env.BABASHKA_VERSION }} diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml deleted file mode 100644 index cfd57a0737..0000000000 --- a/.github/workflows/stale-issues.yml +++ /dev/null @@ -1,77 +0,0 @@ -# This workflow warns and then closes issues that have had no activity for a -# specified amount of time. You can adjust the behavior by modifying this file. -# For more information, see: -# https://github.com/marketplace/actions/close-stale-issues -# https://github.com/actions/stale/blob/master/action.yml -# https://github.com/actions/stale ---- -name: 'Stale Issues Policy' -on: # yamllint disable-line rule:truthy - schedule: - - cron: '0 0 * * *' # Run at 00:00 UTC every day - workflow_dispatch: - -permissions: - contents: read - issues: write # for actions/stale to close stale issues - -jobs: - stale: - runs-on: ubuntu-latest - steps: - - name: '🧹 Mark & close stale issues' - id: stale_issues - uses: actions/stale@6f05e4244c9a0b2ed3401882b05d701dd0a7289b # v7 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - days-before-issue-stale: 180 - days-before-close: 20 - operations-per-run: 100 # max num of ops per run - stale-issue-label: ':status/automatic-stale' - close-issue-label: ':status/automatic-closing' - # trunk-ignore(yamllint/line-length) - exempt-issue-labels: 'hold, WIP, :type/enhancement, can-be-reproduced, priority-A, :type/bug, :type/feature-request' - remove-stale-when-updated: true - stale-issue-message: | - Hi There! 👋 - - We haven't seen any activity on this issue in a while :sleeping:, and we just wanted to make sure that it's still relevant. If you're still experiencing this issue, you might find it helpful to update to the latest version of Logseq. The latest version includes bug fixes and new features that may help to resolve this issue, and you can download it from [our website](https://logseq.com). If updating to the latest version doesn't help, please let us know by adding a comment 💬. We're here to help! - - If the issue has been resolved or is no longer relevant, that's great news! 🎉 - We'll go ahead and close this issue to keep our backlog organized. Please note that this issue will be closed automatically in 20 days if there is no further activity. If you need more time to resolve the issue or provide more information, please just let us know by adding a comment. - - - Access additional [Logseq](https://logseq.com) 🚀 resources: - - **Forum**: https://discuss.logseq.com - - **Blog**: https://blog.logseq.com - - **Docs**: https://docs.logseq.com - - Thanks for your contributions to Logseq! If you have any other [**issues**](https://github.com/logseq/og/issues/new/choose) or [**feature requests**](https://discuss.logseq.com/c/feedback/feature-requests/), please don't hesitate to [let us know](https://github.com/logseq/og/issues/new/choose). We always welcome pull requests too! - - - name: '🧹 Close stale awaiting response issues' - id: awaiting_issues - uses: actions/stale@6f05e4244c9a0b2ed3401882b05d701dd0a7289b # v7 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - days-before-issue-stale: 40 - days-before-close: 20 - operations-per-run: 30 # max num of ops per run - stale-issue-label: ':status/automatic-stale' - close-issue-label: ':status/automatic-closing' - only-labels: 'awaiting response' - remove-stale-when-updated: true - stale-issue-message: | - Hi There! 👋 - - We haven't seen any activity on this issue in a while :sleeping:, and we just wanted to make sure that it's still relevant. If you're still experiencing this issue, you might find it helpful to update to the latest version of Logseq. The latest version includes bug fixes and new features that may help to resolve this issue, and you can download it from [our website](https://logseq.com). If updating to the latest version doesn't help, please let us know by adding a comment 💬. We're here to help! - - If the issue has been resolved or is no longer relevant, that's great news! 🎉 - We'll go ahead and close this issue to keep our backlog organized. Please note that this issue will be closed automatically in 20 days if there is no further activity. If you need more time to resolve the issue or provide more information, please just let us know by adding a comment. - - - Access additional [Logseq](https://logseq.com) 🚀 resources: - - **Forum**: https://discuss.logseq.com - - **Blog**: https://blog.logseq.com - - **Docs**: https://docs.logseq.com - - Thanks for your contributions to Logseq! If you have any other [**issues**](https://github.com/logseq/og/issues/new/choose) or [**feature requests**](https://discuss.logseq.com/c/feedback/feature-requests/), please don't hesitate to [let us know](https://github.com/logseq/og/issues/new/choose). We always welcome pull requests too! diff --git a/.gitignore b/.gitignore index c04b1df5ae..fd8dc22a2b 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,6 @@ deps/shui/.lsp deps/shui/.lsp-cache deps/shui/.clj-kondo deps/shui/shui-graph/logseq/bak + +# Personal workspace instructions, kept out of version control +/CLAUDE.md diff --git a/DELTA_SPEC.md b/DELTA_SPEC.md new file mode 100644 index 0000000000..cb1f144170 --- /dev/null +++ b/DELTA_SPEC.md @@ -0,0 +1,65 @@ +# DELTA_SPEC:相對上游 Logseq OG 的客製化規格 + +登記本分支與上游 [logseq/og](https://github.com/logseq/og) 的差異。新增客製化時在此加一項:摘要少於 100 字,不列出改動的檔案路徑。 + +## 名稱 +- **產品名稱**:`Logseq-OG` 改為 `Logseq-OG-SE`,涵蓋安裝檔、zip、exe 檔名與 Windows 應用程式顯示名稱;打包設定內各處名稱須同步。 +- **顯示名稱**:執行期名稱與「關於」標題改為 `Logseq OG SE`;AppData 使用者資料夾隨之更名,舊設定不會自動遷移。 +- **圖示配色(2026-11-29)**:圖示、favicon、安裝動畫由藍綠改紫以區別官方版;OKLCH 色相 300、彩度 1.35 倍、亮度不變,主色 `#2b1d40`/`#c3adec`。 + +## 識別碼(凡字面含 `logseq-og` 者一律改為 `logseq-og-se`) +- **協定 scheme**:深層連結改為 `logseq-og-se://`,含行動端;主程序、前端、打包設定三處必須一致。 +- **設定資料夾**:`~/.logseq-og` 改為 `~/.logseq-og-se`,舊資料夾不會自動遷移,需要請自行複製。 +- **套件與應用 id**:套件名稱、macOS bundle id、Windows AppUserModelId 改為含 `logseq-og-se` 的值。 +- **登入回呼網址**:官方登入(Cognito)的 redirect_uri 改用新 scheme;伺服器端是否登記未知,登入可能失敗。 +- **CI 發佈檔名**:release 檔名前綴 `Logseq-OG-` 改為 `Logseq-OG-SE-`,artifact 名改為 `logseq-og-se-*-builds`。 + +## 更新 +- **更新來源**:手動檢查、啟動時自動更新、發佈設定與錯誤提示連結,全改指向本 repo 的 GitHub Releases,不再查詢上游。 +- **版本號**:由本分支自行維護、獨立於上游;更新檢查拿它與本 repo 最新 Release 比較。 + +## CI(GitHub Actions) +- **桌面版發佈**:只能手動觸發,只建置 Windows x64(Squirrel 安裝檔與 zip),不產 msi、不簽章;已移除 macOS、Linux、Android 的打包與 nightly。 +- **覆蓋發佈**:桌面版發佈新增 override 選項(預設關閉);開啟後更新同版本 Release 並保留說明,tag 移到本次建置的 commit,已公開者不會變回草稿。 +- **同步後端選項**:桌面版發佈表單移除「File sync production mode」,建置時沿用預設值(正式後端);Sync 本身已停用。 +- **已移除**:Docker 映像、Cloudflare Pages 部署、Sentry sourcemap 上傳,以及 issue/PR 的自動標籤、範本、過期清理與贊助連結設定。 +- **Docker 文件**:說明文件保留(README 有連結),內容描述上游映像,不適用本分支。 +- **沿用上游**:測試、lint、E2E 與各子套件的 CI 維持不變。 +- **行動端流程**:Android、iOS 腳本(含簽章步驟)原封保留,改以 GitHub 網頁停用而非改檔;停用狀態不在版控內,要用時再啟用。 + +## Git 整合(桌面端) +- **不自帶 git**:移除 dugite,改用 PATH 上的系統 git(需 2.31 以上),找不到時以錯誤通知提示。 +- **綁定取代 init**:不再自動 `git init` 或搬移 `.git`。圖表須在「設定 > 版本控制」綁定既有的 git 儲藏庫,未綁定時所有 git 功能不動作。 +- **綁定檔**:存在圖表內的 `logseq/.git-binding.edn`,只在本機有效,不會進入 ref。圖表在儲藏庫內時記相對路徑,否則記絕對路徑。 +- **獨立版本樹**:提交只寫入該儲藏庫的 `refs/logseq-og-se/<名稱>`,不動到分支、HEAD、索引與工作目錄;ref 樹根即圖表根目錄。 +- **ref 名稱**:預填清理過的資料夾名稱,只允許單層;不合法或已存在(不分大小寫)時表單擋下,須換名。 +- **exclude**:在儲藏庫的 `info/exclude` 加入綁定檔規則;圖表位於儲藏庫內時也排除圖表目錄。圖表若已被分支追蹤只提出警告,不代為取消追蹤。圖表不能是儲藏庫根目錄。 +- **指令範圍**:外掛 git API、shell 的 git 指令、版本歷史與提交視窗都作用在圖表的 ref;每次執行前把 HEAD 重設回該 ref,但不限制指令內容。 +- **作者身分**:缺少身分時的設定視窗改寫入綁定儲藏庫的 `--local` 設定,不再寫入全域設定。 +- **工具列選單**:桌面端頂部有 Git 圖示。未綁定時引導至設定綁定;已綁定時可用預設訊息立即提交,並選擇遠端 push 或 pull 圖表的 ref。 +- **push**:只推送圖表的 ref,遠端較新時拒絕並提示先 pull,不提供 force push。 +- **pull**:一律 rebase,拉取前先自動提交;文字衝突以 union 合併保留兩邊內容。無法合併的檔案(如二進位、刪改衝突)會中止 rebase 並列出檔案,圖表維持原狀。 +- **遠端記憶**:上次使用的遠端記在綁定檔,預設 `origin`。 + +## Logseq Sync(停用) +- **同步與登入**:官方 Logseq Sync 一律停用(開發版亦同),設定中的登入/登出與 Beta 同步開關隱藏;程式碼保留,未刪除。 +- **頁面歷史**:只從綁定儲藏庫的圖表 ref 讀取;版本控制頁的提示改為說明此來源,其他語言改用英文提示。 + +## 介面行為 +- **頁面預覽延遲**:滑鼠停在頁面連結或 hashtag 上,預覽浮窗的出現延遲由 1 秒縮短為 330 毫秒;區塊引用的預覽維持 1 秒。 +- **預覽觸發條件**:頁面與區塊引用的預覽只在指標實際移到連結上才計時,移開(含滾輪捲離)即取消;捲動掃過靜止指標、或被其他預覽蓋住的連結不會觸發。 +- **預覽關閉條件**:指標離開連結、浮窗與兩者間空隙滿 200 毫秒後關閉(含開在其中的子浮窗不算離開);捲動把連結帶離指標時立即關閉。 + +## MCP(桌面端) +- **端點**:HTTP API server 啟動時一併提供 `/mcp`,共用 port 與授權 token;主機名須與設定一致(預設 `127.0.0.1`)。 +- **讀取工具**:取得圖表路徑;依日期讀日誌;依頁面屬性 `tags::`(含別名)找頁面,內文標籤不算。 +- **展開**:日誌與標籤查詢可沿 `#` 連結展開最多 5 層,只收有內容的頁面;超過字數上限者僅列名稱。 +- **寫入工具**:向當天日誌末尾追加巢狀區塊;新增完整頁面,頁面、檔案或同名別名已存在時拒絕。 +- **限制**:當天日誌尚未建立時直接建立、不套用範本;只作用於主視窗開啟的圖表。 +- **API 方法**:相同功能以 `mcp_` 開頭的方法開放給 `/api` 與外掛。 + +## 開發環境 +- **開發伺服器只限本機**:shadow-cljs 的網頁伺服器與管理介面只監聽 `127.0.0.1`,其他裝置無法連入,行動端的區網熱重載因此不可用。 + +## 刻意維持上游原值 +- 行動端 `com.logseq.og` 系列 id(牽涉簽署)、WiX `upgradeCode`。 diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 9cacd34b43..0000000000 --- a/Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -# NOTE: please keep it in sync with .github pipelines -# NOTE: during testing make sure to change the branch below -# NOTE: before running the build-docker GH action edit -# build-docker.yml and change the release channel from :latest to :testing - -# Builder image -FROM clojure:temurin-11-tools-deps-1.11.1.1208-bullseye-slim as builder - -ARG DEBIAN_FRONTEND=noninteractive - -# Install reqs -RUN apt-get update && apt-get install -y --no-install-recommends \ - curl \ - ca-certificates \ - apt-transport-https \ - gpg \ - build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev - -# install NodeJS & yarn -RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - - -RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | \ - tee /etc/apt/trusted.gpg.d/yarn.gpg && \ - echo "deb https://dl.yarnpkg.com/debian/ stable main" | \ - tee /etc/apt/sources.list.d/yarn.list && \ - apt-get update && apt-get install -y nodejs yarn - -WORKDIR /data - -# build Logseq static resources -RUN git clone -b master https://github.com/logseq/og.git . - -RUN yarn config set network-timeout 240000 -g && yarn install - -RUN yarn release - -# Web App Runner image -FROM nginx:1.24.0-alpine3.17 - -COPY --from=builder /data/static /usr/share/nginx/html diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 2aa93e4220..e5305ebcda 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -46,7 +46,7 @@ - + diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 13c827aa2d..7e9b09d4e5 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -3,5 +3,5 @@ Logseq OG Logseq OG com.logseq.og - logseq-og + logseq-og-se diff --git a/deps/common/src/logseq/common/path.cljs b/deps/common/src/logseq/common/path.cljs index 3d3b238d76..26a6a49eb1 100644 --- a/deps/common/src/logseq/common/path.cljs +++ b/deps/common/src/logseq/common/path.cljs @@ -17,7 +17,7 @@ (or (string/starts-with? s "file://") ;; mobile platform (string/starts-with? s "content://") ;; android only (string/starts-with? s "assets://") ;; Electron asset, urlencoded - (string/starts-with? s "logseq-og://") ;; reserved for future fs protocol + (string/starts-with? s "logseq-og-se://") ;; reserved for future fs protocol (string/starts-with? s "memory://") ;; special memory fs (string/starts-with? s "s3://")))) diff --git a/ios/App/App/Info.plist b/ios/App/App/Info.plist index 4058a01f9f..8a02d836ef 100644 --- a/ios/App/App/Info.plist +++ b/ios/App/App/Info.plist @@ -38,7 +38,7 @@ com.logseq.og CFBundleURLSchemes - logseq-og + logseq-og-se diff --git a/ios/App/ShareViewController/ShareViewController.swift b/ios/App/ShareViewController/ShareViewController.swift index eee1207a61..dad83588e6 100644 --- a/ios/App/ShareViewController/ShareViewController.swift +++ b/ios/App/ShareViewController/ShareViewController.swift @@ -37,7 +37,7 @@ class ShareViewController: UIViewController { name: "payload", value: queryPayload.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) ?? ""), ] - var urlComps = URLComponents(string: "logseq-og://shared?")! + var urlComps = URLComponents(string: "logseq-og-se://shared?")! urlComps.queryItems = queryItems openURL(urlComps.url!) } diff --git a/knowledge/development.md b/knowledge/development.md new file mode 100644 index 0000000000..fd2d92a01d --- /dev/null +++ b/knowledge/development.md @@ -0,0 +1,19 @@ +# 開發 + +修改程式碼時使用熱重載的開發模式,不需要打包。 + +## 啟動 +兩個終端機: +1. `yarn electron-watch`:等 `:app` 與 `:electron` 都出現 `Build completed` +2. `yarn dev-electron-app`:開啟開發用 Electron 視窗 + +## 更新方式 +- renderer(`src/main/frontend/**`)存檔即熱重載。 +- 主程序(`src/electron/**`)改動後要關掉視窗重跑步驟 2,否則 `defonce` 的計時器/IPC 可能還是舊的。 + +## 檢查與測試 +- `yarn cljs:lint`(clj-kondo) +- `yarn test` + +## 已知陷阱 +- **一定用 `electron-watch`,不要用 `watch`**:`watch` 少了 `:asset-path "./js"`,Electron 視窗會白屏。 diff --git a/knowledge/packaging.md b/knowledge/packaging.md new file mode 100644 index 0000000000..79651620e2 --- /dev/null +++ b/knowledge/packaging.md @@ -0,0 +1,52 @@ +# 打包(Windows x64 桌面端) + +**不要直接跑 `yarn release-electron`**:它最後的 `electron-forge make` 會跑 WiX maker(本機沒裝),而且在 Node 24 下會失敗。改用下方的步驟。 + +## 切換到 Node 22(只限當前 shell) +`electron-forge make` 必須用 Node 22,其他步驟用全域的 24 即可。禁止 `nvm use`(nvm-windows 會改全域 symlink,影響其他專案)。 + +```powershell +$env:Path = "$env:NVM_HOME\v22.23.5;" + $env:Path; node -v +``` + +## 步驟(根目錄起算) +```powershell +yarn install # 首次或依賴變更時;約 12 分鐘 +yarn gulp:build +yarn cljs:release-electron # 約 7 分鐘 +cd static +yarn install # 首次或 resources/package.json 變更時 +# 以下要先切 Node 22(見上方) +npx electron-forge make --targets "@electron-forge/maker-squirrel,@electron-forge/maker-zip" +``` + +## 產出 +產出在 `static/out/make/`: +- `squirrel.windows/x64/Logseq-OG-SE- Setup.exe`(安裝檔) +- `zip/win32/x64/Logseq-OG-SE-win32-x64-.zip`(免安裝版,已驗證可執行) +- 解壓前的 App:`static/out/Logseq-OG-SE-win32-x64/` + +## 版本號(手動維護) +沒有任何機制會自動遞增版本號。基準值是 `src/main/frontend/version.cljs` 的 `(defonce version "x.y.z")`,**升版時手動改兩處,兩處必須一致**,然後重編 cljs(版本號是編進程式碼的): +- `src/main/frontend/version.cljs`:App 內顯示的版本,也是更新檢查拿去比較的本機版本 +- `resources/package.json` 的 `version`:決定安裝檔、nupkg、exe 的版本。`gulp build` 會把它複製成 `static/package.json`,直接改 `static/` 的那份會在下次 `gulp build` 被清掉 + +只改一處的後果:只改 `package.json` → 安裝檔是新版號、App 內顯示舊版;只改 `version.cljs` → 相反。 + +不用改:根目錄 `package.json`(打包不讀它)、Android/iOS 的版本欄位(只有行動端用)。 + +原版 `gulp electronMaker` 會自動把 `version.cljs` 寫進 `static/package.json`,但本流程拆開跑 `gulp:build` + `cljs:release-electron` + `forge make`,沒有經過它,所以要自己同步。 + +## 更新來源 +更新檢查指向本 repo(`k-s-studio/logseq-og-se`)的 GitHub Releases,**共四處須一致**:`src/electron/electron/core.cljs` 的 `:repo`(手動檢查與啟動時預檢)、`resources/package.json` 的 `repository`(`update-electron-app` 讀它)、`resources/forge.config.js` 的 `publisher-github`、`settings.cljs` 裡的 Releases 連結。 + +`update.electronjs.org` 官方文件載明:repo 必須公開;Windows 資產須為 `.zip` 或 `.exe`,檔名含 `-win32` 與架構(如 `-x64`)。**未載明、尚待實測**:是否忽略 pre-release(forge 的 `publisher-github` 設了 `prerelease: true`)、是否需要 `RELEASES`/`nupkg`、沒有 Release 時回傳什麼狀態碼。 + +## 不要碰的指令(其他平台) +`release-app`、`run-android-release`、`run-ios-release`、`ios:dev`、`android:dev`、`npx cap ...` + +## 已知陷阱 +- **`gulp build` 會清空 `static/`**:只保留 `static/node_modules` 和 `static/yarn.lock`,**連前一次的打包產出 `static/out/` 也會刪掉**,要保留的安裝檔請先移到別處。 +- **Node 24 下 forge make 會無聲結束**:解壓 Electron zip 時,extract-zip 2.0.1 的 Promise 永遠不會 resolve,程序 exit 0、沒有產出。看到「Finalizing package」後就結束、而且沒有 `static/out`,就是這個問題 → 改用 Node 22。排查用 `$env:DEBUG="electron-packager,electron-forge:*"` +- `static/` 執行 `yarn install` 時 `@bitdisaster/exe-icon-extractor` 編譯失敗(C2664):它是 `electron-wix-msi` 的選用依賴,只影響 msi,可以忽略。 +- App 不自帶 git,用的是 PATH 上的 `git`(需 2.31 以上);App 內 git 無法運作時,先確認在終端機執行 `git --version` 有結果。 diff --git a/libs/src/LSPlugin.ts b/libs/src/LSPlugin.ts index 12e62bb527..338d9e4a58 100644 --- a/libs/src/LSPlugin.ts +++ b/libs/src/LSPlugin.ts @@ -442,7 +442,8 @@ export interface IAppProxy { /** * @deprecated Using `logseq.Git.execCommand` - * @link https://github.com/desktop/dugite/blob/master/docs/api/exec.md + * Runs the system git against the current graph's ref (refs/logseq-og-se/) + * in the repo bound in Settings > Version control. * @param args */ execGitCommand: (args: string[]) => Promise @@ -861,7 +862,8 @@ export interface IDBProxy { export interface IGitProxy { /** * @added 0.0.2 - * @link https://github.com/desktop/dugite/blob/master/docs/api/exec.md + * Runs the system git against the current graph's ref (refs/logseq-og-se/) + * in the repo bound in Settings > Version control. * @param args */ execCommand: (args: string[]) => Promise diff --git a/package.json b/package.json index e2af130b18..153a086043 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "logseq-og", + "name": "logseq-og-se", "version": "1.0.0", "private": true, "main": "static/electron.js", diff --git a/resources/forge.config.js b/resources/forge.config.js index c602032d8d..afc24b9f0f 100644 --- a/resources/forge.config.js +++ b/resources/forge.config.js @@ -3,15 +3,15 @@ const fs = require('fs') module.exports = { packagerConfig: { - name: 'Logseq-OG', + name: 'Logseq-OG-SE', icon: './icons/logseq_big_sur.icns', buildVersion: "92", - appBundleId: "com.logseq.logseq-og", + appBundleId: "com.logseq.logseq-og-se", protocols: [ { - "protocol": "logseq-og", - "name": "logseq-og", - "schemes": "logseq-og" + "protocol": "logseq-og-se", + "name": "logseq-og-se", + "schemes": "logseq-og-se" } ], osxSign: { @@ -32,7 +32,7 @@ module.exports = { { 'name': '@electron-forge/maker-squirrel', 'config': { - 'name': 'Logseq-OG', + 'name': 'Logseq-OG-SE', 'setupIcon': './icons/logseq.ico', 'loadingGif': './icons/installing.gif', 'certificateFile': process.env.CODE_SIGN_CERTIFICATE_FILE, @@ -43,11 +43,11 @@ module.exports = { { 'name': '@electron-forge/maker-wix', 'config': { - name: 'Logseq-OG', + name: 'Logseq-OG-SE', icon: path.join(__dirname, './icons/logseq.ico'), language: 1033, manufacturer: 'Logseq', - appUserModelId: 'com.logseq.logseq-og', + appUserModelId: 'com.logseq.logseq-og-se', upgradeCode: "fefe66fc-d1dd-445e-aa76-12c593d13a4d", ui: { enabled: false, @@ -76,7 +76,7 @@ module.exports = { config: { format: 'ULFO', icon: './icons/logseq_big_sur.icns', - name: 'Logseq-OG' + name: 'Logseq-OG-SE' } }, { @@ -88,7 +88,7 @@ module.exports = { name: 'electron-forge-maker-appimage', platforms: ['linux'], config: { - mimeType: ["x-scheme-handler/logseq-og"] + mimeType: ["x-scheme-handler/logseq-og-se"] } } ], @@ -98,8 +98,8 @@ module.exports = { name: '@electron-forge/publisher-github', config: { repository: { - owner: 'logseq', - name: 'og' + owner: 'k-s-studio', + name: 'logseq-og-se' }, prerelease: true } diff --git a/resources/icons/installing.gif b/resources/icons/installing.gif index c6e545b13d..536db0d836 100644 Binary files a/resources/icons/installing.gif and b/resources/icons/installing.gif differ diff --git a/resources/icons/logseq.ico b/resources/icons/logseq.ico index c00cb0387b..6d620170e5 100644 Binary files a/resources/icons/logseq.ico and b/resources/icons/logseq.ico differ diff --git a/resources/icons/logseq.png b/resources/icons/logseq.png index 5c75fb722a..dd3b250d51 100644 Binary files a/resources/icons/logseq.png and b/resources/icons/logseq.png differ diff --git a/resources/icons/logseq_big_sur.ico b/resources/icons/logseq_big_sur.ico index fa854ccdcc..32079dbb0a 100644 Binary files a/resources/icons/logseq_big_sur.ico and b/resources/icons/logseq_big_sur.ico differ diff --git a/resources/icons/logseq_big_sur.png b/resources/icons/logseq_big_sur.png index 7b12837f3d..1f3fa1b4fc 100644 Binary files a/resources/icons/logseq_big_sur.png and b/resources/icons/logseq_big_sur.png differ diff --git a/resources/img/logo.png b/resources/img/logo.png index 169d7419de..18cdf8e7fc 100644 Binary files a/resources/img/logo.png and b/resources/img/logo.png differ diff --git a/resources/package.json b/resources/package.json index 9d3d384072..5d9a864454 100644 --- a/resources/package.json +++ b/resources/package.json @@ -1,12 +1,12 @@ { - "name": "logseq-og", - "productName": "Logseq OG", - "version": "1.0.0", + "name": "logseq-og-se", + "productName": "Logseq OG SE", + "version": "1.0.1", "main": "electron.js", "author": "Logseq", "license": "AGPL-3.0", "description": "A privacy-first, open-source platform for knowledge management and collaboration.", - "repository": "https://github.com/logseq/og", + "repository": "https://github.com/k-s-studio/logseq-og-se", "scripts": { "electron:dev": "electron-forge start", "electron:debug": "electron-forge start --inspect-electron", @@ -23,13 +23,13 @@ "dependencies": { "@fastify/cors": "11.0.1", "@logseq/rsapi": "0.0.92", + "@modelcontextprotocol/sdk": "^1.27.1", "@sentry/electron": "2.5.1", "abort-controller": "3.0.0", "better-sqlite3": "13.0.3", "chokidar": "^3.5.1", "command-exists": "1.2.9", "diff-match-patch": "1.0.5", - "dugite": "3.2.2", "electron-deeplink": "1.0.10", "electron-dl": "3.3.0", "electron-log": "4.3.1", @@ -44,7 +44,8 @@ "posthog-js": "1.10.2", "semver": "7.5.2", "socks-proxy-agent": "8.0.2", - "update-electron-app": "2.0.1" + "update-electron-app": "2.0.1", + "zod": "^4.3.6" }, "devDependencies": { "@electron-forge/cli": "^7.8.3", diff --git a/shadow-cljs.edn b/shadow-cljs.edn index fe5eb26b15..17cc0f7e30 100644 --- a/shadow-cljs.edn +++ b/shadow-cljs.edn @@ -2,8 +2,14 @@ {:deps true :nrepl {:port 8701} + ;; Local connections only. The default 0.0.0.0 exposes both dev servers to the + ;; network, and whoever reaches the shadow-cljs UI (9630) can evaluate code. + ;; `:http` covers the UI only, every `:dev-http` server needs its own `:host`. + :http {:host "127.0.0.1"} + ;; "." for /static - :dev-http {3001 ["static" "."]} + :dev-http {3001 {:roots ["static" "."] + :host "127.0.0.1"}} :js-options {:js-package-dirs ["node_modules" "tldraw/apps"]} diff --git a/src/electron/electron/configs.cljs b/src/electron/electron/configs.cljs index 6c42b25353..80819b5c27 100644 --- a/src/electron/electron/configs.cljs +++ b/src/electron/electron/configs.cljs @@ -6,7 +6,7 @@ [electron.logger :as logger])) ;; FIXME: move configs.edn to where it should be -(defonce dot-dir-name ".logseq-og") +(defonce dot-dir-name ".logseq-og-se") (defonce dot-root (.join node-path (.getPath app "home") dot-dir-name)) (defonce cfg-root (.getPath app "userData")) (defonce cfg-path (.join node-path cfg-root "configs.edn")) diff --git a/src/electron/electron/core.cljs b/src/electron/electron/core.cljs index 388a6f04ca..1f1b4036ff 100644 --- a/src/electron/electron/core.cljs +++ b/src/electron/electron/core.cljs @@ -24,7 +24,7 @@ [logseq.publishing.export :as publish-export])) ;; Keep same as main/frontend.util.url -(defonce LSP_SCHEME "logseq-og") +(defonce LSP_SCHEME "logseq-og-se") (defonce FILE_LSP_SCHEME "lsp") (defonce FILE_ASSETS_SCHEME "assets") (defonce LSP_PROTOCOL (str FILE_LSP_SCHEME "://")) @@ -45,7 +45,7 @@ (defn setup-updater! [^js win] ;; manual/auto updater (when-not linux? - (init-updater {:repo "logseq/og" + (init-updater {:repo "k-s-studio/logseq-og-se" :win win}))) (defn open-url-handler @@ -245,7 +245,7 @@ (defn- set-app-menu! [] (let [about-fn (fn [] - (.showMessageBox dialog (clj->js {:title "Logseq OG" + (.showMessageBox dialog (clj->js {:title "Logseq OG SE" :icon (node-path/join js/__dirname "icons/logseq.png") :message (str "Version " updater/electron-version)}))) template (if mac? diff --git a/src/electron/electron/git.cljs b/src/electron/electron/git.cljs index bc1e149913..c656ad85ac 100644 --- a/src/electron/electron/git.cljs +++ b/src/electron/electron/git.cljs @@ -1,122 +1,239 @@ (ns electron.git - (:require ["dugite" :refer [exec]] - [goog.object :as gobj] - [electron.configs :as cfgs] + "Git integration. A graph is bound to an existing git repo through a local + binding file inside the graph; its history lives on the single ref + refs/logseq-og-se/ of that repo and never touches the repo's HEAD, + index, branches or working tree. + + Every graph command runs against a private git dir (the shadow dir) whose + `commondir` points at the repo, so refs and objects are shared, and whose + HEAD is rewritten to the graph's ref before each command. Git is the one on + PATH." + (:require ["child_process" :as child-process] + ["crypto" :as crypto] + ["fs-extra" :as fs] + ["path" :as node-path] + [cljs.reader :as reader] + [clojure.string :as string] + [electron.logger :as logger] [electron.state :as state] [electron.utils :as utils] - [electron.logger :as logger] - [promesa.core :as p] - [clojure.string :as string] - ["fs-extra" :as fs] - ["path" :as node-path])) + [electron.window :as win] + [promesa.core :as p])) (def log-error (partial logger/error "[Git]")) -(defn get-graph-git-dir - [graph-path] - (when-let [graph-path (some-> graph-path - (string/replace "/" "_") - (string/replace ":" "comma"))] - (let [dir (.join node-path (utils/get-ls-dotdir-root) "git" graph-path ".git")] - (. fs ensureDirSync dir) - dir))) - -(defn run-git! - [graph-path commands] - (when (and graph-path (fs/existsSync graph-path)) - (p/let [result (exec commands graph-path)] - (if (zero? (gobj/get result "exitCode")) - (let [result (gobj/get result "stdout")] - (p/resolved result)) - (let [error (gobj/get result "stderr")] - (when-not (string/blank? error) - (log-error error)) - (p/rejected error)))))) +(def ref-namespace "refs/logseq-og-se/") -(defn run-git2! - [graph-path commands] - (when (and graph-path (fs/existsSync graph-path)) - (p/let [^js result (exec commands graph-path)] - result))) +(def binding-rpath + "Graph-relative path of the binding file. It starts with a dot so Logseq's + graph parser ignores it, and it is kept out of the ref." + "logseq/.git-binding.edn") + +(def ^:private not-bound-error + "This graph is not bound to a git repo. Bind one in Settings > Version control.") + +(def ^:private git-not-found-error + "Git was not found. Install Git and make sure `git` is on PATH.") -(defn git-dir-exists? +;; --------------------------------------------------------------------------- +;; Running git + +(defn- exec + "Runs the system git. Resolves a JS object {stdout, stderr, exitCode} for any + exit code (the same contract dugite had) and rejects only when git cannot be + started or its output cannot be collected." + [args cwd & [env]] + (p/create + (fn [resolve reject] + (child-process/execFile + "git" (clj->js args) + #js {:cwd cwd :maxBuffer js/Infinity :windowsHide true :encoding "utf8" + :env (js/Object.assign #js {} js/process.env (clj->js env))} + (fn [^js err stdout stderr] + (cond + (nil? err) + (resolve #js {:stdout stdout :stderr stderr :exitCode 0}) + + (number? (.-code err)) + (resolve #js {:stdout stdout :stderr stderr :exitCode (.-code err)}) + + (= "ENOENT" (.-code err)) + (reject git-not-found-error) + + :else + (reject (str err)))))))) + +(defn- exec! + "Like `exec` but resolves stdout and rejects stderr on a non-zero exit." + [args cwd] + (p/let [^js result (exec args cwd)] + (if (zero? (.-exitCode result)) + (.-stdout result) + (p/rejected (string/trim (.-stderr result)))))) + +;; --------------------------------------------------------------------------- +;; Binding file + +(defn- binding-file [graph-path] - (try - (let [p (.join node-path graph-path ".git")] - (.isDirectory (fs/statSync p))) - (catch :default _e - nil))) + (node-path/join graph-path binding-rpath)) -(defn remove-dot-git-file! +(defn read-binding + "Returns {:repo :ref :remote} from the graph's binding file, or nil. :repo is + relative to the graph when the graph sits inside the repo, absolute + otherwise. :remote is the last remote pushed to or pulled from." [graph-path] (try - (let [_ (when (string/blank? graph-path) - (utils/send-to-renderer :setCurrentGraph {}) - (throw (js/Error. "Empty graph path"))) - p (.join node-path graph-path ".git")] - (when (and (fs/existsSync p) - (.isFile (fs/statSync p))) - (let [content (string/trim (.toString (fs/readFileSync p))) - dir-path (string/replace content "gitdir: " "") - normalized-dir-path (string/replace dir-path "\\" "/")] - (when (and content - (string/starts-with? content "gitdir:") - (string/includes? normalized-dir-path (str "/" cfgs/dot-dir-name "/")) - (not (fs/existsSync dir-path))) - (fs/unlinkSync p))))) + (let [f (binding-file graph-path)] + (when (fs/existsSync f) + (let [m (reader/read-string (str (fs/readFileSync f)))] + (when (and (map? m) + (string? (:repo m)) (not (string/blank? (:repo m))) + (string? (:ref m)) (not (string/blank? (:ref m)))) + (select-keys m [:repo :ref :remote]))))) (catch :default e - (log-error e)))) + (log-error "Invalid binding file" e) + nil))) -(defn init! - [graph-path] - (let [_ (remove-dot-git-file! graph-path) - separate-git-dir (get-graph-git-dir graph-path) - args (cond - (git-dir-exists? graph-path) - ["init"] - separate-git-dir - ["init" (str "--separate-git-dir=" separate-git-dir)] - :else - ["init"])] - (p/let [_ (run-git! graph-path (clj->js args))] - (when utils/win32? - (run-git! graph-path #js ["config" "core.safecrlf" "false"]))))) - -(defn add-all! +(defn- write-binding! + [graph-path m] + (let [f (binding-file graph-path)] + (fs/ensureDirSync (node-path/dirname f)) + (fs/writeFileSync f (str ";; Local git binding of this graph. It is not committed to the ref.\n" + (pr-str m) "\n")))) + +;; --------------------------------------------------------------------------- +;; Context: shadow git dir per (repo, ref) + +(defn- common-dir + "Absolute git common dir of the repo at `path`." + [path] + (p/let [out (exec! ["rev-parse" "--path-format=absolute" "--git-common-dir"] path)] + (node-path/resolve (string/trim out)))) + +(defn- write-if-changed! + [f content] + (when-not (and (fs/existsSync f) (= content (str (fs/readFileSync f)))) + (fs/writeFileSync f content))) + +(defn- ensure-shadow-dir! + [common ref-name] + (let [key (-> (crypto/createHash "md5") + (.update (str (string/lower-case common) "\n" ref-name)) + (.digest "hex")) + dir (node-path/join (utils/get-ls-dotdir-root) "git-shadow" key)] + (fs/ensureDirSync dir) + ;; HEAD is reset on every call, so whatever a command did to it, the next + ;; one is back on the graph's ref. + (write-if-changed! (node-path/join dir "HEAD") (str "ref: " ref-namespace ref-name "\n")) + (write-if-changed! (node-path/join dir "commondir") (str common "\n")) + dir)) + +(defn- resolve-context + "Resolves the graph's git context, or nil when the graph is not bound." [graph-path] - (-> (run-git! graph-path #js ["add" "--ignore-errors" "./*"]) - (p/catch (fn [error] - (let [error (string/lower-case (str error))] - (if (or (string/includes? error "permission denied") - (string/includes? error "index.lock': File exists")) - (log-error error) - (p/rejected error))))))) + (when-let [{:keys [repo ref]} (and graph-path (fs/existsSync graph-path) (read-binding graph-path))] + (let [repo-path (node-path/resolve graph-path repo)] + (if-not (fs/existsSync repo-path) + (p/rejected (str "The bound git repo does not exist: " repo-path)) + (p/let [common (common-dir repo-path)] + {:graph graph-path + :ref ref + :git-dir (ensure-shadow-dir! common ref)}))))) -;; git log -100 --oneline -p ~/Desktop/org/pages/contents.org +(defn- context-args + [{:keys [git-dir graph]} args] + (concat [(str "--git-dir=" git-dir) (str "--work-tree=" graph) + "-c" "core.quotepath=false" "-c" "core.safecrlf=false"] + args)) -(defn commit! - [graph-path message] +(defn- run-in-context! + [ctx args] + (exec! (context-args ctx args) (:graph ctx))) + +;; --------------------------------------------------------------------------- +;; Public commands + +(defn run-git2! + "Runs `args` against the graph's ref. Resolves {stdout, stderr, exitCode} + for the plugin API; an unbound graph or a missing git is reported the same + way, with exitCode 128." + [graph-path args] + (let [failed (fn [msg] #js {:stdout "" :stderr (str msg) :exitCode 128})] + (if-let [ctx (resolve-context graph-path)] + (-> (p/let [ctx ctx] + (exec (context-args ctx (js->clj args)) graph-path)) + (p/catch failed)) + (p/resolved (failed not-bound-error))))) + +(defn- add-all! + [ctx] (p/do! - (run-git! graph-path #js ["config" "core.quotepath" "false"]) - (run-git! graph-path #js ["commit" "-m" message]))) + (-> (run-in-context! ctx ["add" "-A" "--ignore-errors" "."]) + (p/catch (fn [error] + (let [error (string/lower-case (str error))] + (if (or (string/includes? error "permission denied") + (string/includes? error "index.lock': file exists")) + (log-error error) + (p/rejected error)))))) + ;; In case the repo's exclude entry was removed by hand. + (run-in-context! ctx ["rm" "-q" "--cached" "--ignore-unmatch" "--" binding-rpath]))) + +(def default-commit-message "Auto saved by Logseq") + +(defonce ^:private *queues (atom {})) + +(defn- serialized! + "Runs `f` (returning a promise) after every earlier serialized call for the + same graph has settled, so an auto commit never races a pull or push for + the index lock." + [graph-path f] + (let [prev (get @*queues graph-path (p/resolved nil)) + run (-> prev + (p/catch (constantly nil)) + (p/then (fn [_] (f))))] + (swap! *queues assoc graph-path (p/catch run (constantly nil))) + run)) + +(defn- commit-in-context! + "Stages everything and commits when something changed. Resolves true when + a commit was made." + [ctx message] + (p/let [_ (add-all! ctx) + status (run-in-context! ctx ["status" "--porcelain"])] + (if (string/blank? status) + false + (p/let [_ (run-in-context! ctx ["commit" "-q" "-m" message])] + true)))) + +(defn- commit-graph! + [graph-path message] + (when-let [ctx (resolve-context graph-path)] + (serialized! graph-path + (fn [] (p/let [ctx ctx] (commit-in-context! ctx message)))))) + +(defn- notify-graph! + [graph-path kind payload] + (utils/send-to-renderer (or (first (win/get-graph-all-windows graph-path)) + (utils/get-focused-window)) + kind payload)) (defn add-all-and-commit-single-graph! [graph-path message] (let [message (if (string/blank? message) - "Auto saved by Logseq" + default-commit-message message)] - (-> - (p/let [_ (init! graph-path) - _ (add-all! graph-path)] - (commit! graph-path message)) - (p/catch (fn [error] - (when (and - (string? error) - (not (string/blank? error))) - (if (string/starts-with? error "Author identity unknown") - (utils/send-to-renderer "setGitUsernameAndEmail" {:type "git"}) - (utils/send-to-renderer "notification" {:type "error" - :payload (str error "\nIf you don't want to see those errors or don't need git, you can disable the \"Git auto commit\" feature on Settings > Version control.")})))))))) + (-> (commit-graph! graph-path message) + (p/catch (fn [error] + (let [error (str error)] + ;; Prefer a window showing this graph: background auto + ;; commits usually run with no window focused, and the + ;; identity form writes to the repo of its window's graph. + (when-not (string/blank? error) + (if (string/includes? error "Author identity unknown") + (notify-graph! graph-path "setGitUsernameAndEmail" {:type "git"}) + (notify-graph! graph-path "notification" {:type "error" + :payload (str error "\nIf you don't want to see those errors or don't need git, you can disable the \"Git auto commit\" feature on Settings > Version control.")}))))))))) (defn add-all-and-commit! ([] @@ -126,7 +243,11 @@ (defn short-status! [graph-path] - (run-git! graph-path #js ["status" "--porcelain"])) + (if-let [ctx (resolve-context graph-path)] + (p/let [ctx ctx + _ (add-all! ctx)] + (run-in-context! ctx ["status" "--porcelain"])) + (p/rejected not-bound-error))) (defonce quotes-regex #"\"[^\"]+\"") (defn wrapped-by-quotes? @@ -155,24 +276,324 @@ (defn raw! [graph-path args] - (init! graph-path) (let [args (if (string? args) (split-args args) args) error-handler (fn [error] - ;; TODO: why this happen? - (when-not (string/blank? error) + (when-not (string/blank? (str error)) (let [error (str (first args) " error: " error)] (utils/send-to-renderer "notification" {:type "error" :payload error})) (p/rejected error)))] (-> - (p/let [_ (when (= (first args) "commit") - (add-all! graph-path)) - result (run-git! graph-path (clj->js args))] - (p/resolved result)) + (if-let [ctx (resolve-context graph-path)] + (p/let [ctx ctx + _ (when (= (first args) "commit") + (add-all! ctx))] + (run-in-context! ctx args)) + (p/rejected not-bound-error)) (p/catch error-handler)))) +;; --------------------------------------------------------------------------- +;; Binding + +(defn sanitize-ref-name + "Turns a folder name into a single-level ref name component." + [s] + (let [s (-> (str s) + (string/replace #"[\x00-\x20\x7f~^:?*\[\\/]+" "-") + (string/replace "@{" "-") + (string/replace #"\.{2,}" "-") + (string/replace #"-{2,}" "-") + (string/replace #"^[.\-]+" "") + (string/replace #"(\.lock|\.|-)+$" ""))] + (if (or (string/blank? s) (= s "@")) "graph" s))) + +(defn get-binding + "Binding info for the settings page." + [graph-path] + (let [b (read-binding graph-path)] + (cond-> {:graph graph-path + :suggested-ref (sanitize-ref-name (node-path/basename graph-path))} + b (assoc :repo (:repo b) + :repo-path (node-path/resolve graph-path (:repo b)) + :ref (:ref b))))) + +(defn- path-key + [p] + (let [p (node-path/resolve p)] + (if utils/win32? (string/lower-case p) p))) + +(defn- inside? + "Graph-relative-to-root path when `child` is strictly inside `root`." + [root child] + (let [rel (node-path/relative root child)] + (when (and (not (string/blank? rel)) + (not (string/starts-with? rel "..")) + (not (node-path/isAbsolute rel))) + rel))) + +(defn- exclude-pattern + "An anchored gitignore pattern matching exactly the directory `rel`." + [rel] + (str "/" + (-> (string/replace rel "\\" "/") + (string/replace #"([*?\[\\!#])" "\\$1") + (string/replace #" $" "\\ ")) + "/")) + +(defn- add-excludes! + [common patterns] + (let [f (node-path/join common "info" "exclude") + existing (if (fs/existsSync f) (str (fs/readFileSync f)) "") + lines (set (map string/trim (string/split-lines existing))) + missing (remove lines patterns)] + (when (seq missing) + (fs/ensureDirSync (node-path/dirname f)) + (fs/appendFileSync f (str (when-not (or (string/blank? existing) + (string/ends-with? existing "\n")) + "\n") + "# Logseq-OG-SE graph\n" + (string/join "\n" missing) "\n"))))) + +(defn- validate-ref-name + [common ref-name] + (cond + (string/blank? ref-name) + (p/resolved "Ref name is required.") + + (string/includes? ref-name "/") + (p/resolved "Ref name must be a single level, without \"/\".") + + :else + (p/let [^js fmt (exec ["check-ref-format" (str ref-namespace ref-name)] common)] + (if-not (zero? (.-exitCode fmt)) + "Not a valid git ref name." + (p/let [out (exec! ["for-each-ref" "--format=%(refname)" ref-namespace] common) + wanted (string/lower-case (str ref-namespace ref-name)) + taken? (some (fn [r] + (let [r (string/lower-case r)] + (or (= r wanted) (string/starts-with? r (str wanted "/"))))) + (string/split-lines out))] + (when taken? + (str (str ref-namespace ref-name) " already exists in this repo. Choose another name."))))))) + +(defn bind! + "Binds the graph to the repo at `repo` (any path inside it) with the ref + name `ref`. Resolves {:ok true :warnings [...]} or {:errors {:repo :ref}}." + [graph-path {:keys [repo ref]}] + (let [repo (some-> repo string/trim) + ref-name (some-> ref string/trim)] + (cond + (or (string/blank? graph-path) (not (fs/existsSync graph-path))) + (p/resolved {:errors {:repo "The graph directory does not exist."}}) + + (string/blank? repo) + (p/resolved {:errors {:repo "Git repo path is required."}}) + + (not (fs/existsSync (node-path/resolve graph-path repo))) + (p/resolved {:errors {:repo "The path does not exist."}}) + + :else + (-> + (p/let [repo-input (node-path/resolve graph-path repo) + ^js common-r (exec ["rev-parse" "--path-format=absolute" "--git-common-dir"] repo-input)] + (if-not (zero? (.-exitCode common-r)) + {:errors {:repo "Not inside a git repo."}} + (p/let [common (node-path/resolve (string/trim (.-stdout common-r))) + ^js top-r (exec ["rev-parse" "--show-toplevel"] repo-input) + toplevel (when (zero? (.-exitCode top-r)) + (node-path/resolve (string/trim (.-stdout top-r)))) + root (or toplevel common) + graph-rel (when toplevel (inside? toplevel graph-path)) + repo-error (cond + (and toplevel (= (path-key toplevel) (path-key graph-path))) + "The graph directory cannot be the repo root." + + (or (inside? graph-path root) (inside? graph-path common)) + "The repo cannot be inside the graph directory.") + ref-error (validate-ref-name common ref-name)] + (if (or repo-error ref-error) + {:errors (cond-> {} + repo-error (assoc :repo repo-error) + ref-error (assoc :ref ref-error))} + (p/let [_ (add-excludes! common (cond-> [] + graph-rel (conj (exclude-pattern graph-rel)) + true (conj binding-rpath))) + tracked (when graph-rel + (-> (exec! ["ls-files" "--" (string/replace graph-rel "\\" "/")] toplevel) + (p/catch (constantly nil)))) + stored-repo (string/replace (if graph-rel + (node-path/relative graph-path toplevel) + root) + "\\" "/")] + (write-binding! graph-path {:repo stored-repo :ref ref-name}) + {:ok true + :warnings (cond-> [] + (not (string/blank? tracked)) + (conj (str "The graph directory is already tracked by this repo's branches, " + "so the exclude entry does not apply to those files. " + "To stop tracking them, run: git rm -r --cached \"" + (string/replace graph-rel "\\" "/") "\"")))}))))) + (p/catch (fn [e] {:errors {:repo (str e)}})))))) + +(defn unbind! + [graph-path] + (let [f (binding-file graph-path)] + (when (fs/existsSync f) + (fs/unlinkSync f)) + true)) + +;; --------------------------------------------------------------------------- +;; Toolbar: commit now, push, pull +;; +;; Results are {:ok bool :code keyword :detail string}; the renderer turns the +;; code into a localized message. + +(def ^:private network-env + ;; Never wait for a terminal prompt nobody can answer; credential helpers + ;; with their own UI still work. + {"GIT_TERMINAL_PROMPT" "0"}) + +(defn- list-remotes + [ctx] + (p/let [out (run-in-context! ctx ["remote"])] + (->> (string/split-lines out) (map string/trim) (remove string/blank?) vec))) + +(defn- error-result + [e] + (let [e (str e)] + (if (string/includes? e "Author identity unknown") + {:ok false :code :identity-unknown} + {:ok false :code :error :detail e}))) + +(defn- with-context + "Runs (f ctx) for a bound graph, or resolves the :not-bound result." + [graph-path f] + (if-let [ctx (resolve-context graph-path)] + (-> (p/let [ctx ctx] (f ctx)) + (p/catch error-result)) + (p/resolved {:ok false :code :not-bound}))) + +(defn sync-info + "What the toolbar menu needs: the ref, the repo's remotes and the remembered + one (falling back to origin, then the first remote)." + [graph-path] + (with-context graph-path + (fn [ctx] + (p/let [remotes (list-remotes ctx) + saved (:remote (read-binding graph-path)) + remote (or (some #{saved} remotes) + (some #{"origin"} remotes) + (first remotes))] + {:ok true :ref (:ref ctx) :remotes remotes :remote remote})))) + +(defn set-remote! + "Remembers `remote` in the graph's binding file." + [graph-path remote] + (when-let [b (read-binding graph-path)] + (when (and (string? remote) (not (string/blank? remote)) (not= remote (:remote b))) + (write-binding! graph-path (assoc b :remote remote)))) + true) + +(defn commit-now! + [graph-path] + (with-context graph-path + (fn [ctx] + (serialized! graph-path + (fn [] + (p/let [committed? (commit-in-context! ctx default-commit-message)] + {:ok true :code (if committed? :committed :no-changes)})))))) + +(defn- with-remote + "Checks that `remote` is one of the repo's remotes and remembers it." + [graph-path ctx remote f] + (p/let [remotes (list-remotes ctx)] + (if-not (some #{remote} remotes) + {:ok false :code :no-remote} + (do (set-remote! graph-path remote) + (f (str ref-namespace (:ref ctx))))))) + +(defn push! + [graph-path remote] + (with-context graph-path + (fn [ctx] + (serialized! graph-path + (fn [] + (with-remote graph-path ctx remote + (fn [full-ref] + (p/let [^js r (exec (context-args ctx ["push" "--porcelain" remote (str full-ref ":" full-ref)]) + graph-path network-env) + out (.-stdout r)] + (cond + (zero? (.-exitCode r)) + {:ok true :code (if (string/includes? out "[up to date]") :push-up-to-date :pushed)} + + ;; Porcelain flags a refused update with "!". + (some #(string/starts-with? % "!") (string/split-lines out)) + {:ok false :code :push-rejected} + + :else + {:ok false :code :error :detail (string/trim (str (.-stderr r) "\n" out))}))))))))) + +(defn- rebase-in-progress? + [{:keys [git-dir]}] + (or (fs/existsSync (node-path/join git-dir "rebase-merge")) + (fs/existsSync (node-path/join git-dir "rebase-apply")))) + +(defn- union-attributes-file + "An attributes file that makes every text merge keep both sides' lines. + Passed only to the pull, so the repo's own attributes are untouched." + [{:keys [git-dir]}] + (let [f (node-path/join git-dir "union-attributes")] + (write-if-changed! f "* merge=union\n") + f)) + +(defn pull! + "Commits pending changes, then rebases the graph's ref onto the remote's. + Text conflicts keep both sides; anything else (binary files, delete vs + modify) aborts the rebase and reports the files." + [graph-path remote] + (with-context graph-path + (fn [ctx] + (serialized! graph-path + (fn [] + (with-remote graph-path ctx remote + (fn [full-ref] + (p/let [^js ls (exec (context-args ctx ["ls-remote" "--exit-code" remote full-ref]) + graph-path network-env)] + (case (.-exitCode ls) + 0 + (p/let [_ (commit-in-context! ctx default-commit-message) + before (-> (run-in-context! ctx ["rev-parse" "-q" "--verify" "HEAD"]) + (p/catch (constantly nil))) + ^js r (exec (context-args ctx ["-c" (str "core.attributesFile=" (union-attributes-file ctx)) + "pull" "--rebase" "--no-autostash" remote full-ref]) + graph-path network-env)] + (cond + (zero? (.-exitCode r)) + (p/let [after (run-in-context! ctx ["rev-parse" "HEAD"])] + {:ok true :code (if (= (some-> before string/trim) (string/trim after)) + :pull-up-to-date + :pulled)}) + + (rebase-in-progress? ctx) + (p/let [files (-> (run-in-context! ctx ["diff" "--name-only" "--diff-filter=U"]) + (p/catch (constantly ""))) + _ (run-in-context! ctx ["rebase" "--abort"])] + {:ok false :code :pull-conflict :detail (string/trim files)}) + + :else + {:ok false :code :error :detail (string/trim (.-stderr r))})) + + 2 + {:ok false :code :remote-ref-missing} + + {:ok false :code :error :detail (string/trim (.-stderr ls))}))))))))) + +;; --------------------------------------------------------------------------- +;; Auto commit + (defonce auto-commit-interval (atom nil)) (defn- auto-commit-tick-fn [] diff --git a/src/electron/electron/handler.cljs b/src/electron/electron/handler.cljs index f4c3c622f0..ac5ce7bab7 100644 --- a/src/electron/electron/handler.cljs +++ b/src/electron/electron/handler.cljs @@ -516,9 +516,40 @@ (defmethod handle :runGitWithinCurrentGraph [_ [_ {:keys [repo command]}]] (when (seq command) - (git/init! (utils/get-graph-dir repo)) (git/run-git2! (utils/get-graph-dir repo) (clj->js command)))) +(defmethod handle :gitBinding [_ [_ repo]] + (when-let [graph-path (utils/get-graph-dir repo)] + (git/get-binding graph-path))) + +(defmethod handle :gitBind [_ [_ repo opts]] + (p/let [result (git/bind! (utils/get-graph-dir repo) opts)] + (bean/->js result))) + +(defn- git-result + [graph-name f] + (p/let [result (f (utils/get-graph-dir graph-name))] + (bean/->js result))) + +(defmethod handle :gitSyncInfo [_ [_ repo]] + (git-result repo git/sync-info)) + +(defmethod handle :gitCommitNow [_ [_ repo]] + (git-result repo git/commit-now!)) + +(defmethod handle :gitPush [_ [_ repo remote]] + (git-result repo #(git/push! % remote))) + +(defmethod handle :gitPull [_ [_ repo remote]] + (git-result repo #(git/pull! % remote))) + +(defmethod handle :gitSetRemote [_ [_ repo remote]] + (git/set-remote! (utils/get-graph-dir repo) remote)) + +(defmethod handle :gitUnbind [_ [_ repo]] + (when-let [graph-path (utils/get-graph-dir repo)] + (git/unbind! graph-path))) + (defmethod handle :runCli [window [_ {:keys [command args returnResult]}]] (try (let [on-data-handler (fn [message] diff --git a/src/electron/electron/mcp_server.cljs b/src/electron/electron/mcp_server.cljs new file mode 100644 index 0000000000..fd2dc0a677 --- /dev/null +++ b/src/electron/electron/mcp_server.cljs @@ -0,0 +1,166 @@ +(ns electron.mcp-server + "MCP routes of the local API server. Each tool forwards to one renderer API + method, implemented in logseq.api.mcp. Session handling follows upstream + logseq/logseq 2.0.2." + (:require ["@modelcontextprotocol/sdk/server/mcp.js" :refer [McpServer]] + ["@modelcontextprotocol/sdk/server/streamableHttp.js" :refer [StreamableHTTPServerTransport]] + ["@modelcontextprotocol/sdk/types.js" :refer [isInitializeRequest]] + ["zod/v3" :as z] ;; zod 4 schemas don't work with the MCP SDK + [electron.mcp-transport :as mcp-transport] + [promesa.core :as p])) + +;; Tools +;; ===== + +(defn- depth-schema [] + (-> (z/number) + (.int) + (.min 0) + (.max 5) + (.optional) + (.describe "How many levels of #links to follow from the starting pages. Defaults to 0, only the starting pages. [[Page]] links are not followed."))) + +(defn- max-chars-schema [] + (-> (z/number) + (.int) + (.positive) + (.optional) + (.describe "Budget for the total length of page contents, 30000 by default. Pages over it are listed under omitted, without content."))) + +(defn- block-schema + "Schema of one block with `levels` levels of children below it. Spelled out + instead of recursive so that the JSON schema needs no $ref. Strict, so that + children nested too deep are an error and not silently dropped." + [levels] + (-> (z/object + (cond-> #js {:content (-> (z/string) + (.describe "Text of one block in Logseq Markdown, without the leading bullet"))} + (pos? levels) + (doto (aset "children" (-> (z/array (block-schema (dec levels))) + (.optional) + (.describe "Blocks nested under this one")))))) + (.strict))) + +(defn- read-options + "The options argument shared by the reading renderer methods" + [args] + #js {:depth (aget args "depth") + :maxChars (aget args "maxChars")}) + +(def ^:private api-tools + [{:name "getGraphInfo" + :method "mcp_graph_info" + :args (fn [_] #js []) + :config #js {:title "Get Graph Info" + :description "Directory of the graph open in Logseq, its pages and journals folders, preferred format and today's journal title. Use it to edit page files directly."}} + {:name "searchTag" + :method "mcp_search_tag" + :args (fn [args] #js [(aget args "tag") (read-options args)]) + :config #js {:title "Search Tag" + :description "All pages whose page property tags:: contains a tag (or an alias of it), with their file content and path. Inline #mentions don't make a page match. With depth, also returns the non-blank pages they link to with #." + :inputSchema #js {:tag (-> (z/string) (.describe "Tag name, with or without #")) + :depth (depth-schema) + :maxChars (max-chars-schema)}}} + {:name "getJournal" + :method "mcp_journal" + :args (fn [args] #js [(aget args "date") (read-options args)]) + :config #js {:title "Get Journal" + :description "Content and path of the journal page of a date. With depth, also returns the non-blank pages it links to with #. pages is empty when there is no such journal." + :inputSchema #js {:date (-> (z/string) (.describe "YYYY-MM-DD")) + :depth (depth-schema) + :maxChars (max-chars-schema)}}} + {:name "appendToTodayJournal" + :method "mcp_append_to_today" + :args (fn [args] #js [(aget args "blocks")]) + :config #js {:title "Append To Today's Journal" + :description "Appends blocks, each optionally with nested children, to the end of today's journal, creating the journal if needed. Never repeat a successful call." + :inputSchema #js {:blocks (-> (z/array (block-schema 5)) + (.min 1))}}} + {:name "createPage" + :method "mcp_create_page" + :args (fn [args] #js [(aget args "title") (aget args "content")]) + :config #js {:title "Create Page" + :description "Creates a new page from a complete Markdown file. Fails if the page, its file or an alias of that name already exists, and for journal dates. To change an existing page, edit its file instead." + :inputSchema #js {:title (-> (z/string) (.describe "Page name, / separates namespaces")) + :content (-> (z/string) (.describe "Logseq Markdown, preferably an outline of '- ' bullets, children indented with a tab. Page properties such as tags:: go in the first lines. No title:: property."))}}}]) + +(defn- text-response + [text error?] + #js {:content #js [#js {:type "text" :text text}] + :isError error?}) + +(defn- call-tool + "Calls the renderer method of a tool and turns the result into an MCP response" + [api-fn {:keys [method args]} tool-args] + (-> (p/let [body (api-fn method (args tool-args))] + (if-let [error (and body (aget body "error"))] + (text-response (str "API Error: " error) true) + (text-response (js/JSON.stringify body) false))) + (p/catch (fn [^js e] + (text-response (str "Unexpected API error: " (.-message e)) true))))) + +(defn- create-mcp-server + [api-fn] + (let [^js mcp-server (McpServer. #js {:name "Logseq OG SE MCP Server" + :version "0.1.0"})] + (doseq [{:keys [config] :as tool} api-tools] + (.registerTool mcp-server (:name tool) config (partial call-tool api-fn tool))) + mcp-server)) + +;; Routes +;; ====== +;; See https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http + +;; transports by session id +(defonce ^:private *transports + (atom {})) + +(defn- session-id + [^js req] + (aget (.-headers req) "mcp-session-id")) + +(defn handle-post-request + [api-fn {:keys [host port]} ^js req ^js res] + (let [sid (session-id req) + existing (and sid (get @*transports sid))] + (cond + existing + (mcp-transport/handle-request! existing req res (.-body req)) + + (and (not sid) (isInitializeRequest (.-body req))) + (let [*transport (atom nil) + ^js transport (StreamableHTTPServerTransport. + #js {:sessionIdGenerator (comp str random-uuid) + :onsessioninitialized #(swap! *transports assoc % @*transport) + :enableDnsRebindingProtection true + :allowedHosts #js [(str host ":" port)]}) + ^js mcp-server (create-mcp-server api-fn)] + (reset! *transport transport) + (set! (.-onclose transport) + #(swap! *transports dissoc (.-sessionId transport))) + (p/do! + (.connect mcp-server transport) + (mcp-transport/handle-request! transport req res (.-body req)) + res)) + + :else + (-> res + (.code 400) + (.send #js {:jsonrpc "2.0" + :error #js {:code -32000 + :message "Bad Request: No valid session ID provided"} + :id nil}))))) + +(defn handle-get-request + [^js req ^js res] + (if-let [transport (get @*transports (session-id req))] + (mcp-transport/handle-request! transport req res) + (-> res (.code 400) (.send "Invalid or missing session ID")))) + +(defn handle-delete-request + [^js req ^js res] + (if-let [^js transport (get @*transports (session-id req))] + (do + (.close transport) + (-> res (.code 200) (.send #js {:ok true}))) + (-> res (.code 400) (.send "Invalid or missing session ID")))) diff --git a/src/electron/electron/mcp_transport.cljs b/src/electron/electron/mcp_transport.cljs new file mode 100644 index 0000000000..1a4281de97 --- /dev/null +++ b/src/electron/electron/mcp_transport.cljs @@ -0,0 +1,22 @@ +(ns electron.mcp-transport + "Hands a fastify request over to an MCP transport. Taken from upstream + logseq/logseq 2.0.2.") + +(defn- copy-reply-headers! + "Copies the headers fastify plugins queued on the reply onto the raw Node + response." + [^js res] + (doseq [[k v] (js/Object.entries (.getHeaders res))] + (.setHeader (.-raw res) k v))) + +(defn handle-request! + "Lets `transport` answer on the raw Node request and response. The transport + writes the raw response itself, so headers that fastify plugins queued on the + reply - notably the CORS headers from @fastify/cors - are copied onto it first; + otherwise they would never be sent." + ([^js transport ^js req ^js res] + (copy-reply-headers! res) + (.handleRequest transport (.-raw req) (.-raw res))) + ([^js transport ^js req ^js res body] + (copy-reply-headers! res) + (.handleRequest transport (.-raw req) (.-raw res) body))) diff --git a/src/electron/electron/server.cljs b/src/electron/electron/server.cljs index 9b927d79c5..a966835859 100644 --- a/src/electron/electron/server.cljs +++ b/src/electron/electron/server.cljs @@ -11,6 +11,7 @@ [camel-snake-kebab.core :as csk] [electron.logger :as logger] [electron.configs :as cfgs] + [electron.mcp-server :as mcp-server] [electron.window :as window])) (defonce ^:private *win (atom nil)) @@ -127,6 +128,14 @@ (p/catch (fn [^js e] (set-status! :running e)))))) +(defn- add-mcp-routes! + [^js server] + (.post server "/mcp" + #(mcp-server/handle-post-request invoke-logseq-api! {:host (get-host) + :port (get-port)} %1 %2)) + (.get server "/mcp" mcp-server/handle-get-request) + (.delete server "/mcp" mcp-server/handle-delete-request)) + (defn start! [] (-> (p/let [_ (close!) @@ -135,7 +144,9 @@ :requestTimeout (* 1000 42) :forceCloseConnections true}) ;; middlewares - _ (.register s FastifyCORS #js {:origin "*"}) + ;; browser MCP clients must be able to read the session id + _ (.register s FastifyCORS #js {:origin "*" + :exposedHeaders #js ["mcp-session-id"]}) ;; hooks & routes _ (doto s (.addHook "preHandler" api-pre-handler!) @@ -149,6 +160,7 @@ (string/replace-first "${PORT}" PORT))] (doto rep (.type "text/html") (.send html)))))) + _ (add-mcp-routes! s) ;; listen port _ (.listen s (bean/->js (select-keys @*state [:host :port])))] (reset! *server s) diff --git a/src/electron/electron/url.cljs b/src/electron/electron/url.cljs index dac318d5f0..56aaf4e727 100644 --- a/src/electron/electron/url.cljs +++ b/src/electron/electron/url.cljs @@ -27,7 +27,7 @@ (send-to-renderer "notification" {:type "error" :payload (str "Failed to open link. Cannot match graph identifier `" graph-identifier "` to any linked graph.")}) (send-to-renderer "notification" {:type "error" - :payload (str "Failed to open link. Missing graph identifier after `logseq-og://graph/`.")}))) + :payload (str "Failed to open link. Missing graph identifier after `logseq-og-se://graph/`.")}))) (defn local-url-handler "Given a URL with `graph identifier` as path, `page` (optional) and `block-id` diff --git a/src/main/frontend/components/block.cljs b/src/main/frontend/components/block.cljs index c98fc5e499..6345737ce7 100644 --- a/src/main/frontend/components/block.cljs +++ b/src/main/frontend/components/block.cljs @@ -664,7 +664,8 @@ :in-editor? true :html html-template :interactive true - :delay [1000, 100] + :delay [0, 100] + :hover-delay (when-not manual? 330) :fixed-position? fixed-position? :position (or tippy-position "top") :distance (or tippy-distance 10) @@ -937,7 +938,8 @@ (assoc config :id (str id) :preview? true))]]) :interactive true :in-editor? true - :delay [1000, 100]} inner) + :delay [0, 100] + :hover-delay 1000} inner) inner)]) [:span.warning.mr-1 {:title "Block ref invalid"} (block-ref/->block-ref id)])) diff --git a/src/main/frontend/components/commit.cljs b/src/main/frontend/components/commit.cljs index 1ddd1c4d29..e7f9b15ce8 100644 --- a/src/main/frontend/components/commit.cljs +++ b/src/main/frontend/components/commit.cljs @@ -38,10 +38,13 @@ (rum/defcs add-commit-message < rum/reactive (rum/local nil ::git-status) + (rum/local nil ::git-error) {:will-mount (fn [state] (-> (ipc/ipc "gitStatus" (state/get-current-repo)) (p/then (fn [status] - (reset! (get state ::git-status) status)))) + (reset! (get state ::git-status) status))) + (p/catch (fn [error] + (reset! (get state ::git-error) (str error))))) state) :did-update (fn [state] (when-let [input (gdom/getElement "commit-message")] @@ -55,9 +58,19 @@ :on-enter (fn [] (commit-all!))))) [state _close-fn] - (let [*git-status (get state ::git-status)] + (let [*git-status (get state ::git-status) + git-error @(get state ::git-error)] [:div.w-full.mx-auto - (if (empty? @*git-status) + (cond + git-error + [:<> + [:div.mb-2 git-error] + [:div.mt-5.sm:mt-4.flex + (ui/button + {:on-click state/close-modal!} + "Close")]] + + (empty? @*git-status) [:<> [:div.sm:flex.sm:items-start [:div.mt-3.text-center.sm:mt-0.sm:text-left.mb-2 @@ -68,6 +81,7 @@ {:on-click state/close-modal!} "Close")]] + :else [:<> [:div.sm:flex.sm:items-start [:div.mt-3.text-center.sm:mt-0.sm:text-left.mb-2 diff --git a/src/main/frontend/components/git_sync.cljs b/src/main/frontend/components/git_sync.cljs new file mode 100644 index 0000000000..a4a2594d80 --- /dev/null +++ b/src/main/frontend/components/git_sync.cljs @@ -0,0 +1,127 @@ +(ns frontend.components.git-sync + "Toolbar git menu: commit the graph now, and push or pull its ref + (refs/logseq-og-se/) against a remote of the bound repo." + (:require [clojure.string :as string] + [electron.ipc :as ipc] + [frontend.context.i18n :refer [t]] + [frontend.handler.notification :as notification] + [frontend.state :as state] + [frontend.ui :as ui] + [promesa.core :as p] + [rum.core :as rum])) + +(defn- message + ;; Keep each translation call literal: the translation lint greps for them. + [code] + (case code + :committed (t :git-sync/committed) + :no-changes (t :git-sync/no-changes) + :pushed (t :git-sync/pushed) + :push-up-to-date (t :git-sync/push-up-to-date) + :push-rejected (t :git-sync/push-rejected) + :pulled (t :git-sync/pulled) + :pull-up-to-date (t :git-sync/pull-up-to-date) + :pull-conflict (t :git-sync/pull-conflict) + :remote-ref-missing (t :git-sync/remote-ref-missing) + :no-remote (t :git-sync/no-remote) + :not-bound (t :git-sync/not-bound) + (t :git-sync/error))) + +(defn- ->clj + [result] + (some-> (js->clj result :keywordize-keys true) + (update :code keyword))) + +(defn- show-result! + [{:keys [ok code detail]}] + (if (= code :identity-unknown) + (state/pub-event! [:modal/set-git-username-and-email]) + (let [msg (message code)] + (notification/show! + (if (string/blank? detail) + msg + [:div + [:div msg] + [:pre.text-xs.mt-2.whitespace-pre-wrap detail]]) + (cond + ok :success + (contains? #{:push-rejected :remote-ref-missing :no-remote} code) :warning + :else :error) + ;; Errors carry details worth reading, so they stay until dismissed. + (boolean ok))))) + +(rum/defc git-sync-menu + [repo] + (let [[info set-info!] (rum/use-state nil) + [busy set-busy!] (rum/use-state nil) + load! (fn [] + (p/let [result (ipc/ipc :gitSyncInfo repo)] + (set-info! (->clj result)))) + run! (fn [kind f] + (when-not busy + (set-busy! kind) + (-> (p/let [result (f)] + (show-result! (->clj result))) + (p/catch #(show-result! {:ok false :code :error :detail (str %)})) + (p/finally #(set-busy! nil))))) + {:keys [ok code ref remotes remote]} info + bound? (and ok ref) + label (fn [text kind] (if (= busy kind) (str text " …") text))] + + (rum/use-effect! (fn [] (load!) nil) [repo]) + + (ui/dropdown-with-links + (fn [{:keys [toggle-fn]}] + [:button.button.icon + {:title "Git" + :on-click (fn [] (load!) (toggle-fn))} + (ui/icon "brand-git" {:size ui/icon-size})]) + + (cond + bound? + (cond-> [{:title (label (t :git-sync/commit) :commit) + :options {:on-click #(run! :commit (fn [] (ipc/ipc :gitCommitNow repo)))} + :icon (ui/icon "git-commit")}] + remote + (into [{:title (label (t :git-sync/push) :push) + :options {:on-click #(run! :push (fn [] (ipc/ipc :gitPush repo remote)))} + :icon (ui/icon "cloud-upload")} + {:title (label (t :git-sync/pull) :pull) + :options {:on-click #(run! :pull (fn [] (ipc/ipc :gitPull repo remote)))} + :icon (ui/icon "cloud-download")}])) + + (= code :not-bound) + [{:title (t :git-sync/go-bind) + :options {:on-click #(state/open-settings! :version-control)} + :icon (ui/icon "settings")}] + + :else + []) + + {:links-header + [:div.px-4.py-2.text-sm {:style {:max-width 320}} + (cond + (nil? info) + [:span.opacity-50 "…"] + + bound? + [:div.flex.flex-col.gap-2 + [:code.text-xs (str "refs/logseq-og-se/" ref)] + (if (seq remotes) + [:label.flex.items-center.gap-2 + [:span.opacity-70 (t :git-sync/remote)] + [:select.form-select.is-small + {:value (or remote "") + :on-change (fn [e] + (let [v (.. e -target -value)] + (set-info! (assoc info :remote v)) + (ipc/ipc :gitSetRemote repo v)))} + (for [r remotes] + [:option {:key r :value r} r])]] + [:span.opacity-70 (t :git-sync/no-remotes)])] + + (= code :not-bound) + [:span.opacity-70 (t :git-sync/not-bound)] + + :else + [:span.text-red-500 (or (:detail info) (t :git-sync/error))])]}))) diff --git a/src/main/frontend/components/header.cljs b/src/main/frontend/components/header.cljs index 52b0721518..722bb457b8 100644 --- a/src/main/frontend/components/header.cljs +++ b/src/main/frontend/components/header.cljs @@ -11,6 +11,7 @@ [frontend.handler :as handler] [frontend.handler.file-sync :as file-sync-handler] [frontend.components.file-sync :as fs-sync] + [frontend.components.git-sync :as git-sync] [frontend.handler.plugin :as plugin-handler] [frontend.handler.route :as route-handler] [frontend.handler.user :as user-handler] @@ -258,6 +259,12 @@ (plugins/hook-ui-items :toolbar) (plugins/updates-notifications)]) + (when (and (util/electron?) + current-repo + (config/local-db? current-repo) + (not (config/demo-graph? current-repo))) + (rum/with-key (git-sync/git-sync-menu current-repo) "git-sync-menu")) + (when (state/feature-http-server-enabled?) (server/server-indicator (state/sub :electron/server))) diff --git a/src/main/frontend/components/plugins.cljs b/src/main/frontend/components/plugins.cljs index b249c76006..015db84fc4 100644 --- a/src/main/frontend/components/plugins.cljs +++ b/src/main/frontend/components/plugins.cljs @@ -607,7 +607,7 @@ #(p/let [root (plugin-handler/get-ls-dotdir-root)] (js/apis.openPath (str root "/preferences.json")))}} {:title [:span.flex.items-center.whitespace-nowrap.gap-1 - (ui/icon "bug") (t :plugin/open-logseq-dir) [:code "~/.logseq-og"]] + (ui/icon "bug") (t :plugin/open-logseq-dir) [:code "~/.logseq-og-se"]] :options {:on-click #(p/let [root (plugin-handler/get-ls-dotdir-root)] (js/apis.openPath root))}}]) diff --git a/src/main/frontend/components/settings.cljs b/src/main/frontend/components/settings.cljs index f2c8e1e75c..782d59190c 100644 --- a/src/main/frontend/components/settings.cljs +++ b/src/main/frontend/components/settings.cljs @@ -62,7 +62,7 @@ (ui/button (t :settings-page/check-for-updates) :class "text-sm mr-1" - :href "https://github.com/logseq/og/releases") + :href "https://github.com/k-s-studio/logseq-og-se/releases") (mobile-util/native-ios?) (ui/button @@ -118,7 +118,7 @@ [:a.link {:on-click (fn [e] - (js/window.apis.openExternal "https://github.com/logseq/og/releases") + (js/window.apis.openExternal "https://github.com/k-s-studio/logseq-og-se/releases") (util/stop e))} svg/external-link " release channel"]])])])) @@ -763,9 +763,95 @@ (enable-all-pages-public-row t enable-all-pages-public?) (auto-push-row t current-repo enable-git-auto-push?)])) +(defn- load-git-binding! + [*binding *form repo] + (p/let [result (ipc/ipc :gitBinding repo) + result (js->clj result :keywordize-keys true)] + (reset! *binding result) + (reset! *form {:repo "" :ref (:suggested-ref result) :errors nil}))) + +(rum/defcs git-binding-row < rum/reactive + (rum/local nil ::binding) + (rum/local nil ::form) + {:will-mount (fn [state] + (load-git-binding! (::binding state) (::form state) (state/get-current-repo)) + state)} + [state t] + (let [repo (state/get-current-repo) + *binding (::binding state) + *form (::form state) + {:keys [ref repo-path] :as binding} @*binding + {:keys [errors] :as form} @*form + error-text (fn [k] (when-let [e (get errors k)] + [:div.text-sm.text-red-500.mt-1 e])) + bind! (fn [] + (p/let [result (ipc/ipc :gitBind repo (select-keys @*form [:repo :ref])) + result (js->clj result :keywordize-keys true)] + (if (:ok result) + (do + (doseq [w (:warnings result)] + (notification/show! w :warning false)) + (load-git-binding! *binding *form repo)) + (swap! *form assoc :errors (:errors result)))))] + ;; Block layout on purpose: the panel's `.it label + div` rule would turn + ;; this form into a single flex row. + [:div.it {:style {:display "block"}} + [:div.text-sm.font-medium.leading-5.opacity-70.mb-1 + (t :settings-page/git-binding)] + [:div + [:div.text-sm.opacity-50.mb-3 (t :settings-page/git-binding-desc)] + (cond + (nil? binding) + nil + + ref + [:div.flex.flex-col.gap-1.text-sm + [:div [:span.opacity-70 (t :settings-page/git-binding-repo) ": "] [:code repo-path]] + [:div [:span.opacity-70 (t :settings-page/git-binding-ref) ": "] [:code (str "refs/logseq-og-se/" ref)]] + [:div.mt-2 + (shui-ui/button + {:size :sm :variant :outline + :on-click (fn [] + (when (js/confirm (t :settings-page/git-binding-unbind-confirm)) + (p/do! + (ipc/ipc :gitUnbind repo) + (load-git-binding! *binding *form repo))))} + (t :settings-page/git-binding-unbind))]] + + :else + [:div.flex.flex-col.gap-2.max-w-lg + [:div + [:div.text-sm.opacity-70.mb-1 (t :settings-page/git-binding-repo)] + [:div.flex.gap-2.items-center + [:input.form-input.is-small.flex-1 + {:style {:max-width "none"} + :value (:repo form) + :on-change #(swap! *form assoc :repo (util/evalue %))}] + (shui-ui/button + {:size :sm :variant :outline + :on-click (fn [] + (p/let [dir (ipc/ipc :openDialog)] + (when (string? dir) + (swap! *form assoc :repo dir))))} + (t :settings-page/git-binding-browse))] + (error-text :repo)] + [:div + [:div.text-sm.opacity-70.mb-1 (t :settings-page/git-binding-ref)] + [:div.flex.gap-1.items-center + [:code.text-sm.whitespace-nowrap "refs/logseq-og-se/"] + [:input.form-input.is-small.flex-1 + {:style {:max-width "none"} + :value (:ref form) + :on-change #(swap! *form assoc :ref (util/evalue %))}]] + (error-text :ref)] + [:div + (shui-ui/button {:size :sm :on-click bind!} + (t :settings-page/git-binding-bind))]])]])) + (rum/defc settings-git [] [:div.panel-wrap + (git-binding-row t) [:div.text-sm.my-4 (ui/admonition :tip @@ -1036,6 +1122,11 @@ [:li "Early access to alpha/beta features"] [:li "Upcoming cloud-based features, including Logseq Publish"]]]]]])]])) +(def ^:private logseq-sync-ui? + "Logseq Sync and its account login are disabled in this fork. The UI is kept + behind this switch rather than deleted, so the upstream code stays intact." + false) + (rum/defc settings-features < rum/reactive [] (let [current-repo (state/get-current-repo) @@ -1067,7 +1158,7 @@ (http-server-switcher-row)) (flashcards-switcher-row enable-flashcards?) (zotero-settings-row) - (when-not web-platform? + (when (and logseq-sync-ui? (not web-platform?)) [:div.mt-1.sm:mt-0.sm:col-span-2 [:hr] (if logged-in? @@ -1084,7 +1175,7 @@ (state/pub-event! [:user/login]))}) [:p.text-sm.opacity-50 (t :settings-page/login-prompt)]])]) - (when-not web-platform? + (when (and logseq-sync-ui? (not web-platform?)) [:<> [:div.it.sm:grid.sm:grid-cols-3.sm:gap-4.sm:items-center [:label.flex.font-medium.leading-5.self-start.mt-1 diff --git a/src/main/frontend/config.cljs b/src/main/frontend/config.cljs index bf406c2162..07673985d4 100644 --- a/src/main/frontend/config.cljs +++ b/src/main/frontend/config.cljs @@ -36,7 +36,7 @@ (if ENABLE-FILE-SYNC-PRODUCTION (do (def FILE-SYNC-PROD? true) (def LOGIN-URL - "https://logseq-prod.auth.us-east-1.amazoncognito.com/login?client_id=3c7np6bjtb4r1k1bi9i049ops5&response_type=code&scope=email+openid+phone&redirect_uri=logseq-og%3A%2F%2Fauth-callback") + "https://logseq-prod.auth.us-east-1.amazoncognito.com/login?client_id=3c7np6bjtb4r1k1bi9i049ops5&response_type=code&scope=email+openid+phone&redirect_uri=logseq-og-se%3A%2F%2Fauth-callback") (def API-DOMAIN "api.logseq.com") (def WS-URL "wss://ws.logseq.com/file-sync?graphuuid=%s") (def COGNITO-IDP "https://cognito-idp.us-east-1.amazonaws.com/") @@ -50,7 +50,7 @@ (do (def FILE-SYNC-PROD? false) (def LOGIN-URL - "https://logseq-test2.auth.us-east-2.amazoncognito.com/login?client_id=3ji1a0059hspovjq5fhed3uil8&response_type=code&scope=email+openid+phone&redirect_uri=logseq-og%3A%2F%2Fauth-callback") + "https://logseq-test2.auth.us-east-2.amazoncognito.com/login?client_id=3ji1a0059hspovjq5fhed3uil8&response_type=code&scope=email+openid+phone&redirect_uri=logseq-og-se%3A%2F%2Fauth-callback") (def API-DOMAIN "api-dev.logseq.com") (def WS-URL "wss://ws-dev.logseq.com/file-sync?graphuuid=%s") (def COGNITO-IDP "https://cognito-idp.us-east-2.amazonaws.com/") diff --git a/src/main/frontend/extensions/handbooks/core.cljs b/src/main/frontend/extensions/handbooks/core.cljs index 2e5a38af88..34ad079189 100644 --- a/src/main/frontend/extensions/handbooks/core.cljs +++ b/src/main/frontend/extensions/handbooks/core.cljs @@ -606,7 +606,7 @@ [:a.flex.items-center {:aria-label "Copy topic link" :tabIndex "0" :on-click (fn [] - (let [s (str "logseq-og://handbook/" (:key (second active-pane-state)))] + (let [s (str "logseq-og-se://handbook/" (:key (second active-pane-state)))] (util/copy-to-clipboard! s) (notification/show! [:div [:strong.block "Handbook link copied!"] diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index f8f4f0bc1f..ca93a1fc9e 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -2019,8 +2019,10 @@ sibling? keep-uuid? revert-cut-txs - skip-empty-target?] - :or {exclude-properties []}}] + skip-empty-target? + edit-last-block?] + :or {exclude-properties [] + edit-last-block? true}}] (state/set-editor-op! :paste-blocks) (let [editing-block (when-let [editing-block (state/get-edit-block)] (some-> (db/pull [:block/uuid (:block/uuid editing-block)]) @@ -2074,7 +2076,8 @@ :replace-empty-target? replace-empty-target? :keep-uuid? keep-uuid?})] (state/set-block-op-type! nil) - (edit-last-block-after-inserted! result))))) + (when edit-last-block? + (edit-last-block-after-inserted! result)))))) (state/set-editor-op! nil)) (defn- block-tree->blocks diff --git a/src/main/frontend/handler/file_sync.cljs b/src/main/frontend/handler/file_sync.cljs index 903029562a..b2533503c9 100644 --- a/src/main/frontend/handler/file_sync.cljs +++ b/src/main/frontend/handler/file_sync.cljs @@ -28,9 +28,9 @@ (state/get-current-file-sync-graph-uuid)) (defn enable-sync? + "Logseq Sync is disabled in this fork, dev builds included." [] - (or (state/enable-sync?) - config/dev?)) + (state/enable-sync?)) (defn current-graph-sync-on? [] diff --git a/src/main/frontend/handler/shell.cljs b/src/main/frontend/handler/shell.cljs index 094d238fd8..c22fa423f0 100644 --- a/src/main/frontend/handler/shell.cljs +++ b/src/main/frontend/handler/shell.cljs @@ -74,8 +74,9 @@ (defn set-git-username-and-email [username email] - (p/let [_r1 (run-git-command! ["config" "--global" "user.name" username]) - _r2 (run-git-command! ["config" "--global" "user.email" email])] + ;; --local writes the bound repo's config, never the user's global one. + (p/let [_r1 (run-git-command! ["config" "--local" "user.name" username]) + _r2 (run-git-command! ["config" "--local" "user.email" email])] (state/close-modal!) (notification/show! [:div "git config successfully!"] diff --git a/src/main/frontend/state.cljs b/src/main/frontend/state.cljs index 6be20276a3..61c8d5d5b8 100644 --- a/src/main/frontend/state.cljs +++ b/src/main/frontend/state.cljs @@ -630,8 +630,9 @@ Similar to re-frame subscriptions" (not (false? (:feature/enable-flashcards? (sub-config repo)))))) (defn enable-sync? + "Logseq Sync is disabled in this fork; the stored switch is ignored." [] - (sub :feature/enable-sync?)) + false) (defn enable-sync-diff-merge? [] diff --git a/src/main/frontend/tippy-tooltip.css b/src/main/frontend/tippy-tooltip.css index dd1bf472e6..07ee9ecba4 100644 --- a/src/main/frontend/tippy-tooltip.css +++ b/src/main/frontend/tippy-tooltip.css @@ -74,6 +74,45 @@ text-align: left; } +/* Transparent strip over the gap between a hover tooltip and its trigger, so that + the pointer can cross it without leaving the tooltip. The popper's box touches + the trigger, and the `shift` animation moves the tooltip 10px away inside it, + so the strip is the popper's edge facing the trigger. It cannot belong to the + tooltip, which hides its overflow. */ +.tippy-popper:has(> .hover-bridge-theme)::after { + content: ""; + position: absolute; + pointer-events: auto; +} + +.tippy-popper[x-placement^=top]:has(> .hover-bridge-theme)::after { + bottom: 0; + left: 0; + right: 0; + height: 10px; +} + +.tippy-popper[x-placement^=bottom]:has(> .hover-bridge-theme)::after { + top: 0; + left: 0; + right: 0; + height: 10px; +} + +.tippy-popper[x-placement^=left]:has(> .hover-bridge-theme)::after { + right: 0; + top: 0; + bottom: 0; + width: 10px; +} + +.tippy-popper[x-placement^=right]:has(> .hover-bridge-theme)::after { + left: 0; + top: 0; + bottom: 0; + width: 10px; +} + .tippy-wrapper { border-radius: 8px; margin: 0 -6px; diff --git a/src/main/frontend/ui.cljs b/src/main/frontend/ui.cljs index ff02031788..b9f59a21da 100644 --- a/src/main/frontend/ui.cljs +++ b/src/main/frontend/ui.cljs @@ -944,9 +944,134 @@ :checked selected}] label])])) -(rum/defcs tippy < rum/reactive +(def ^:private hover-grace-ms + "How long the pointer may be off a hover tooltip and its trigger before it hides." + 200) + +(defn- in-hover-area? + "Whether `node` is part of `trigger`, of its tooltip, or of a tooltip opened from + within that one. Tooltips are appended to the body, so the way from a tooltip + back to its trigger is the latter's `aria-describedby`." + [^js trigger node] + (loop [^js node node] + (cond + (nil? node) false + (.contains trigger node) true + :else (recur (when-let [^js popper (.closest node ".tippy-popper")] + (js/document.querySelector + (str "[aria-describedby=\"" (.-id popper) "\"]"))))))) + +(rum/defc hover-intent + "Decides when a hover tooltip inside it shows and hides, in place of react-tippy: + the native `mouseenter` and `mouseleave` of the trigger are held back from it. + + react-tippy times the show delay from `mouseenter`, which also fires for whatever + scrolls under a resting pointer, and keeps that timer running until the next + `mousemove`. Here `mouseenter` is replayed only if the pointer was moved onto the + trigger and is still on it `delay-ms` later. + + It also only hides an interactive tooltip upon a `mousemove`, so one whose trigger + was scrolled away stays open. Here `hide!` is called once the pointer has been off + the hover area for `hover-grace-ms`, or at once when scrolling takes the trigger + from under the pointer." + [delay-ms hide! child] + (let [*el (rum/use-ref nil)] + (rum/use-effect! + (fn [] + (let [^js el (rum/deref *el) + *show-timer (atom nil) + *hide-timer (atom nil) + *pointer (atom nil) + *shown? (atom false) + clear! (fn [*timer] + (some-> @*timer js/clearTimeout) + (reset! *timer nil)) + track! (fn [^js e] + (reset! *pointer [(.-clientX e) (.-clientY e)])) + on-trigger? (fn [] + (let [[x y] @*pointer] + (some->> (js/document.elementFromPoint x y) (.contains el)))) + ;; `watch!` and `unwatch!` follow the pointer while the tooltip is open + *unwatch (atom nil) + unwatch! (fn [] + (clear! *hide-timer) + (when-let [f @*unwatch] + (reset! *unwatch nil) + (f))) + close! (fn [] + (unwatch!) + (reset! *shown? false) + (hide!)) + hide-later! (fn [] + (when-not @*hide-timer + (reset! *hide-timer (js/setTimeout close! hover-grace-ms)))) + ;; also fires for whatever scrolls or appears under a resting pointer + on-over (fn [^js e] + (if (in-hover-area? el (.-target e)) + (clear! *hide-timer) + (hide-later!))) + on-out (fn [^js e] + ;; the pointer left the window + (when-not (.-relatedTarget e) + (hide-later!))) + ;; The tooltip follows a scrolled trigger and may end up under the + ;; pointer, so `on-over` alone would keep it open + on-scroll (fn [^js e] + (when (and (.contains (.-target e) el) (not (on-trigger?))) + (close!))) + watch! (fn [] + (unwatch!) + (let [listeners [["mouseover" on-over] + ["mouseout" on-out] + ["mousemove" track!] + ["scroll" on-scroll]]] + (doseq [[event f] listeners] + (.addEventListener js/document event f true)) + (reset! *unwatch + #(doseq [[event f] listeners] + (.removeEventListener js/document event f true))))) + show! (fn [] + (reset! *show-timer nil) + ;; unless scrolled away, or covered by another tooltip + (when (on-trigger?) + (reset! *shown? true) + (watch!) + (some-> (.-firstElementChild el) + (.dispatchEvent (js/MouseEvent. "mouseenter"))))) + hold-back (fn [^js e] + (when (and (.-isTrusted e) + (identical? (.-target e) (.-firstElementChild el))) + (.stopPropagation e))) + on-move (fn [^js e] + (track! e) + (when-not (or @*show-timer @*shown?) + (reset! *show-timer (js/setTimeout show! delay-ms)))) + on-leave (fn [^js e] + (when (identical? (.-target e) el) + (clear! *show-timer) + (reset! *shown? false)))] + (.addEventListener el "mouseenter" hold-back true) + (.addEventListener el "mouseleave" hold-back true) + (.addEventListener el "mousemove" on-move) + (.addEventListener el "mouseleave" on-leave) + (fn [] + (clear! *show-timer) + (unwatch!) + (.removeEventListener el "mouseenter" hold-back true) + (.removeEventListener el "mouseleave" hold-back true) + (.removeEventListener el "mousemove" on-move) + (.removeEventListener el "mouseleave" on-leave)))) + [delay-ms]) + [:span {:ref *el :style {:display "contents"}} child])) + +(rum/defcs tippy + "Options besides react-tippy's own: + - `:hover-delay`: show only after the pointer has been moved onto the child and + rested there for this many milliseconds, and hide shortly after it is gone, + see `hover-intent`." + < rum/reactive (rum/local false ::mounted?) - [state {:keys [fixed-position? open? in-editor? html] :as opts} child] + [state {:keys [fixed-position? open? in-editor? html hover-delay] :as opts} child] (let [*mounted? (::mounted? state) manual (not= open? nil) edit-id (ffirst (state/sub :editor/editing?)) @@ -960,36 +1085,39 @@ ;; editing in non-preview containers or scrolling (not (util/rec-get-tippy-container editing-node)) (or editing? scrolling?)) - (not (state/enable-tooltip?))))] - (Tippy (-> - (merge {:arrow true - :sticky true - :delay 600 - :theme "customized" - :disabled disabled? - :unmountHTMLWhenHide true - :open (if disabled? false open?) - :trigger (if manual "manual" "mouseenter focus") - ;; See https://github.com/tvkhoa/react-tippy/issues/13 - :popperOptions {:modifiers {:flip {:enabled (not fixed-position?)} - :hide {:enabled false} - :preventOverflow {:enabled false}}} - :onShow #(reset! *mounted? true) - :onHide #(reset! *mounted? false)} - opts) - (assoc :html (or - (when open? - (try - (when html - (if (fn? html) - (html) - [:div.px-2.py-1 - html])) - (catch :default e - (log/error :exception e) - [:div]))) - [:div {:key "tippy"} ""]))) - (rum/fragment {:key "tippy-children"} child)))) + (not (state/enable-tooltip?)))) + tooltip (Tippy (-> + (merge {:arrow true + :sticky true + :delay 600 + :theme (if hover-delay "customized hover-bridge" "customized") + :disabled disabled? + :unmountHTMLWhenHide true + :open (if disabled? false open?) + :trigger (if manual "manual" "mouseenter focus") + ;; See https://github.com/tvkhoa/react-tippy/issues/13 + :popperOptions {:modifiers {:flip {:enabled (not fixed-position?)} + :hide {:enabled false} + :preventOverflow {:enabled false}}} + :onShow #(reset! *mounted? true) + :onHide #(reset! *mounted? false)} + (dissoc opts :hover-delay)) + (assoc :html (or + (when open? + (try + (when html + (if (fn? html) + (html) + [:div.px-2.py-1 + html])) + (catch :default e + (log/error :exception e) + [:div]))) + [:div {:key "tippy"} ""]))) + (rum/fragment {:key "tippy-children"} child))] + (if hover-delay + (hover-intent hover-delay #(reset! *mounted? false) tooltip) + tooltip))) (rum/defcs slider < rum/reactive {:init (fn [state] diff --git a/src/main/frontend/util/url.cljs b/src/main/frontend/util/url.cljs index 91ab24c384..c8c8d77c35 100644 --- a/src/main/frontend/util/url.cljs +++ b/src/main/frontend/util/url.cljs @@ -3,7 +3,7 @@ (:require [frontend.db.conn :as db-conn])) ;; Keep same as electron/electron.core -(def LSP_SCHEME "logseq-og") +(def LSP_SCHEME "logseq-og-se") ;; Keep same as electron/electron.url (def encode js/encodeURI) @@ -28,7 +28,7 @@ (defn get-logseq-graph-url "The URL represents an graph, for example: - logseq-og://graph/abc + logseq-og-se://graph/abc Ensure repo is valid before hand. host: set to `nil` for local graph protocol?: if true, returns URL with protocol prefix" @@ -42,7 +42,7 @@ (defn get-logseq-graph-uuid-url "The URL represents an entity in graph with uuid, for example: - logseq-og://graph/abc?block-id= + logseq-og-se://graph/abc?block-id= Ensure repo and uuid are valid before hand. host: set to `nil` for local graph protocol?: if true, returns URL with protocol prefix" @@ -54,7 +54,7 @@ (defn get-logseq-graph-page-url "The URL represents an page in graph with pagename, for example: - logseq-og://graph/abc?page= + logseq-og-se://graph/abc?page= Ensure repo and page-name are valid before hand. host: set to `nil` for local graph protocol?: if true, returns URL with protocol prefix" diff --git a/src/main/frontend/version.cljs b/src/main/frontend/version.cljs index 5e6eb805fa..3ba15dc952 100644 --- a/src/main/frontend/version.cljs +++ b/src/main/frontend/version.cljs @@ -1,3 +1,3 @@ (ns ^:no-doc frontend.version) -(defonce version "1.0.0") +(defonce version "1.0.1") diff --git a/src/main/logseq/api.cljs b/src/main/logseq/api.cljs index 46299e9948..50b06c57c9 100644 --- a/src/main/logseq/api.cljs +++ b/src/main/logseq/api.cljs @@ -46,7 +46,8 @@ [frontend.modules.layout.core] [frontend.handler.code :as code-handler] [frontend.handler.search :as search-handler] - [logseq.api.block :as api-block])) + [logseq.api.block :as api-block] + [logseq.api.mcp :as api-mcp])) ;; Alert: this namespace shouldn't invoke any reactive queries @@ -1008,6 +1009,13 @@ (-> (search-handler/search q) (p/then #(bean/->js %)))) +;; MCP, see electron.mcp-server +(def ^:export mcp_graph_info api-mcp/api-graph-info) +(def ^:export mcp_search_tag api-mcp/api-search-tag) +(def ^:export mcp_journal api-mcp/api-journal) +(def ^:export mcp_append_to_today api-mcp/api-append-to-today) +(def ^:export mcp_create_page api-mcp/api-create-page) + ;; helpers (defn ^:export set_focused_settings [pid] diff --git a/src/main/logseq/api/mcp.cljs b/src/main/logseq/api/mcp.cljs new file mode 100644 index 0000000000..5699a5d1c7 --- /dev/null +++ b/src/main/logseq/api/mcp.cljs @@ -0,0 +1,344 @@ +(ns logseq.api.mcp + "Renderer side of the MCP tools in electron.mcp-server: graph info, tag and + journal reads that follow # links, and writes that go through the editor and + file handlers." + (:require [cljs-bean.core :as bean] + [clojure.string :as string] + [datascript.core :as d] + [frontend.config :as config] + [frontend.date :as date] + [frontend.db :as db] + [frontend.db.conn :as conn] + [frontend.db.model :as db-model] + [frontend.fs :as fs] + [frontend.handler.editor :as editor-handler] + [frontend.handler.file :as file-handler] + [frontend.handler.page :as page-handler] + [frontend.state :as state] + [frontend.util :as util] + [frontend.util.fs :as fs-util] + [logseq.common.path :as path] + [logseq.graph-parser.block :as gp-block] + [logseq.graph-parser.mldoc :as gp-mldoc] + [logseq.graph-parser.text :as text] + [logseq.graph-parser.util :as gp-util] + [promesa.core :as p])) + +(def max-depth + "Deepest # link expansion a caller can ask for" + 5) + +(def default-max-chars + "Default budget for the page contents of one read" + 30000) + +(defn- fail! + [message] + (throw (js/Error. message))) + +(defn- current-repo! + [] + (let [repo (state/get-current-repo)] + (when (or (nil? repo) (= repo config/local-repo)) + (fail! "No graph is open. Open a local graph in Logseq first.")) + repo)) + +(defn- clean-page-name + "Accepts `name`, `#name`, `[[name]]` and `#[[name]]`" + [s] + (let [cleaned (when (string? s) + (-> (string/trim s) + (string/replace #"^#+" "") + (text/page-ref-un-brackets!) + (gp-util/remove-boundary-slashes) + (string/trim)))] + (when (string/blank? cleaned) + (fail! "A page name is required.")) + cleaned)) + +(defn graph-info + "Where the open graph lives, for callers that edit its files directly" + [] + (let [repo (current-repo!)] + {:path (config/get-repo-dir repo) + :pagesDirectory (config/get-pages-directory) + :journalsDirectory (config/get-journals-directory) + :preferredFormat (name (state/get-preferred-format)) + :todayJournal (date/today)})) + +;; Reads +;; ===== + +(defn- blank-content? + "True when a file holds nothing but empty bullets" + [content] + (string/blank? (string/replace (str content) #"(?m)^[ \t]*[-*]+[ \t]*\r?$" ""))) + +(defn- has-content? + [page] + (not (blank-content? (:file/content (:block/file page))))) + +(defn- page->result + [repo depth page-id] + (let [page (db/entity repo page-id) + file (:block/file page)] + {:name (or (:block/original-name page) (:block/name page)) + :depth depth + :path (some->> (:file/path file) (path/path-join (config/get-repo-dir repo))) + :content (or (:file/content file) "")})) + +(defn- hashtag-names + "Names of the pages that `content` links to with #. [[Page refs]] don't count." + [content format] + (->> (gp-mldoc/->edn content (gp-mldoc/default-config format)) + (tree-seq coll? seq) + ;; a property called Tag has the same head but a string as second item + (filter #(and (vector? %) (= "Tag" (first %)) (sequential? (second %)))) + (keep gp-block/get-tag) + (map text/page-ref-un-brackets!) + (distinct))) + +(defn- linked-page-id + "Id of the page that `#page-name` leads to, if it has a non-blank file" + [repo page-name] + (let [page-name' (util/page-name-sanity-lc (db-model/get-redirect-page-name page-name)) + page (db/entity repo [:block/name page-name'])] + (when (has-content? page) + (:db/id page)))) + +(defn- linked-page-ids + [repo {:keys [content path]}] + (when path + (->> (hashtag-names content (gp-util/get-format path)) + (keep #(linked-page-id repo %))))) + +(defn- expand + "Walks breadth first from `seed-ids`, following # links for `depth` levels. + A page appears once, at the shallowest level that reaches it." + [repo seed-ids depth] + (loop [level (vec (distinct seed-ids)) + current 0 + seen (set seed-ids) + pages []] + (if (empty? level) + pages + (let [found (mapv #(page->result repo current %) level) + next-level (if (< current depth) + (->> found + (mapcat #(linked-page-ids repo %)) + (remove seen) + (distinct) + (vec)) + [])] + (recur next-level (inc current) (into seen next-level) (into pages found)))))) + +(defn- within-budget + "Splits `pages` into those whose content fits in `max-chars` and the rest, + which are listed without content. The first page is always kept." + [pages max-chars] + (loop [[page & more :as remaining] pages + used 0 + kept [] + omitted []] + (if (empty? remaining) + {:pages kept :omitted omitted} + (let [used' (+ used (count (:content page)))] + (if (or (empty? kept) (<= used' max-chars)) + (recur more used' (conj kept page) omitted) + (recur more used kept (conj omitted (dissoc page :content)))))))) + +(defn- read-pages + [repo seed-ids {:keys [depth maxChars]}] + (within-budget (expand repo seed-ids (if (number? depth) + (-> depth (max 0) (min max-depth)) + 0)) + (if (and (number? maxChars) (pos? maxChars)) + maxChars + default-max-chars))) + +(defn search-tag + "Pages whose page property `tags::` names `tag` or one of its aliases" + [tag opts] + (let [repo (current-repo!) + tag-name (util/page-name-sanity-lc (clean-page-name tag)) + tag-ids (db-model/page-alias-set repo tag-name) + seed-ids (when (seq tag-ids) + (->> (d/q '[:find ?name ?page + :in $ [?tag ...] + :where + [?page :block/tags ?tag] + [?page :block/name ?name]] + (conn/get-db repo) + tag-ids) + (sort-by first) + (map second)))] + (assoc (read-pages repo seed-ids opts) :tag tag-name))) + +(defn- date->journal-day + [s] + (if-let [[_ y m d] (and (string? s) (re-matches #"(\d{4})-(\d{2})-(\d{2})" s))] + (js/parseInt (str y m d) 10) + (fail! "date must look like YYYY-MM-DD."))) + +(defn journal + "The journal page of `date-string` (YYYY-MM-DD)" + [date-string opts] + (let [repo (current-repo!) + day (date->journal-day date-string) + ;; blocks carry :block/journal-day too, only pages have :block/name + seed-ids (->> (d/q '[:find [?page ...] + :in $ ?day + :where + [?page :block/journal-day ?day] + [?page :block/name]] + (conn/get-db repo) + day) + (filter #(has-content? (db/entity repo %))))] + (assoc (read-pages repo seed-ids opts) :date date-string))) + +;; Writes +;; ====== + +(defn- single-block? + "False when `content` would be parsed into more than one block" + [content format] + (->> (gp-mldoc/->edn (str (config/get-block-pattern format) " " content) + (gp-mldoc/default-config format)) + (filter (fn [[node]] (= "Heading" (first node)))) + (count) + (= 1))) + +(defn- check-block + "Validates one {:content :children} node and its descendants" + [format {:keys [content children] :as block}] + (when-not (and (map? block) (string? content) (not (string/blank? content))) + (fail! "Every block needs a non-blank content string.")) + (when-not (single-block? content format) + (fail! (str "Block content must stay a single block, without bullet or heading lines inside. " + "Put nested items in children: " (pr-str content)))) + (when-not (or (nil? children) (sequential? children)) + (fail! "children must be an array of blocks.")) + {:content content + :children (mapv #(check-block format %) children)}) + +(defn- last-top-block + [page] + (some-> (:block/_parent page) + (db-model/sort-by-left page) + (last))) + +(defn append-to-today + "Appends the block trees in `blocks` to the end of today's journal" + [blocks] + (let [repo (current-repo!) + title (date/today) + page-name (util/page-name-sanity-lc title) + get-page #(db/entity repo [:block/name page-name]) + format (or (:block/format (get-page)) (state/get-preferred-format)) + _ (when-not (and (sequential? blocks) (seq blocks)) + (fail! "blocks must be a non-empty array.")) + ;; check everything before the first write + tree (mapv #(check-block format %) blocks)] + (when-not (get-page) + (page-handler/create! title {:redirect? false + :split-namespace? false + :create-first-block? false + :journal? true})) + (when-not (last-top-block (get-page)) + (editor-handler/api-insert-new-block! "" {:page page-name :edit-block? false})) + (let [target (last-top-block (get-page)) + ;; Replacing the empty last block would also overwrite whatever the + ;; editor holds, so only do it while nothing is being edited + replace? (and (string/blank? (:block/content target)) + (empty? (:block/_parent target)) + (not (state/editing?)))] + (editor-handler/insert-block-tree tree format + {:target-block (db/pull (:db/id target)) + :sibling? true + :skip-empty-target? (not replace?) + :edit-last-block? false}) + {:page title}))) + +(defn- sets-title? + [content] + (boolean + (or (re-find #"(?im)^(?:-[ \t]+)?title::" content) + (re-find #"(?i)^---\r?\n(?:(?!---)[^\n]*\n)*?title[ \t]*:" content)))) + +(defn check-new-page + "Validates a new page against the db and returns its cleaned up title" + [title content] + (let [repo (current-repo!) + title' (clean-page-name title) + page-name (util/page-name-sanity-lc title') + page (db/entity repo [:block/name page-name])] + (when-not (and (string? content) (not (string/blank? content))) + (fail! "content must be a non-blank Markdown string.")) + (when (sets-title? content) + (fail! "Remove the title property from content, the page is named by the title argument.")) + (when (date/valid-journal-title? title') + (fail! "That title is a journal date. Use appendToTodayJournal, or edit the journal file.")) + (when (or (:block/file page) + (and page (not (db-model/page-empty? repo (:db/id page))))) + (fail! (str "Page already exists: " title'))) + (when-let [source (db-model/get-alias-source-page repo page-name)] + (fail! (str title' " is an alias of the page " (:block/original-name source)))) + title')) + +(defn (js/Promise. (fn [resolve _reject] (resolve (f)))) + (p/then bean/->js) + (p/catch (fn [e] + (js/console.error e) + #js {:error (or (ex-message e) (str e))})))) + +(defn- ->clj + [x] + (js->clj x :keywordize-keys true)) + +(defn api-graph-info + [] + (respond graph-info)) + +(defn api-search-tag + [tag opts] + (respond #(search-tag tag (->clj opts)))) + +(defn api-journal + [date-string opts] + (respond #(journal date-string (->clj opts)))) + +(defn api-append-to-today + [blocks] + (respond #(append-to-today (->clj blocks)))) + +(defn api-create-page + [title content] + (respond #( (p/let [result (mcp/= 2.1.2 < 3.0.0" +iconv-lite@^0.7.3, iconv-lite@~0.7.0: + version "0.7.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.7.3.tgz#84ee12f963e7de50bc01a13e160a078b3b0f415f" + integrity sha512-IKXpvIzjnC9XTAUbVBcMfGS0EPaIXtW6v+zr+RRp+hqULEpo0owZax6wyRwPOJbWbzjYspQwusTsfVr0ifh4uQ== + dependencies: + safer-buffer ">= 2.1.2 < 3.0.0" + ieee754@^1.1.13: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" @@ -3278,7 +3457,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.3, inherits@^2.0.4: +inherits@2, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -3293,6 +3472,11 @@ interpret@^3.1.1: resolved "https://registry.yarnpkg.com/interpret/-/interpret-3.1.1.tgz#5be0ceed67ca79c6c4bc5cf0d7ee843dcea110c4" integrity sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ== +ip-address@^10.2.0: + version "10.7.7" + resolved "https://registry.yarnpkg.com/ip-address/-/ip-address-10.7.7.tgz#19be86d3be85c575049cf320df9dbd04841f7c72" + integrity sha512-He15rAs4jip5AEAz7XM9L+S6Y8LBMIDj6YewbYuJfmDnOCKWb+3TLOGnHFBTAIW7wpm5ohtZ+Xyo5PEaG+O2vQ== + ip-address@^9.0.5: version "9.0.5" resolved "https://registry.yarnpkg.com/ip-address/-/ip-address-9.0.5.tgz#117a960819b08780c3bd1f14ef3c1cc1d3f3ea5a" @@ -3301,6 +3485,11 @@ ip-address@^9.0.5: jsbn "1.1.0" sprintf-js "^1.1.3" +ipaddr.js@1.9.1: + version "1.9.1" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" + integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== + ipaddr.js@^2.1.0: version "2.2.0" resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-2.2.0.tgz#d33fa7bac284f4de7af949638c9d68157c6b92e8" @@ -3390,6 +3579,11 @@ is-plain-obj@^1.0.0: resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" integrity sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg== +is-promise@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-4.0.0.tgz#42ff9f84206c1991d26debf520dd5c01042dd2f3" + integrity sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ== + is-property@^1.0.0, is-property@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" @@ -3470,6 +3664,11 @@ jiti@^2.4.2: resolved "https://registry.yarnpkg.com/jiti/-/jiti-2.6.1.tgz#178ef2fc9a1a594248c20627cd820187a4d78d92" integrity sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ== +jose@^6.1.3: + version "6.2.18" + resolved "https://registry.yarnpkg.com/jose/-/jose-6.2.18.tgz#81428d8ed8f7fc9332025836b4ec2d4365a67afb" + integrity sha512-doV4thUwgkrycJH4yLeqwTGIIZphHl+pk7CPReuMIhYhncmgzdko85MaCG4YQFTxqMFr1/oEH32tZuKKovcDEg== + js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" @@ -3509,6 +3708,11 @@ json-schema-traverse@^1.0.0: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== +json-schema-typed@^8.0.2: + version "8.0.2" + resolved "https://registry.yarnpkg.com/json-schema-typed/-/json-schema-typed-8.0.2.tgz#e98ee7b1899ff4a184534d1f167c288c66bbeff4" + integrity sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA== + json-stringify-safe@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -3690,6 +3894,11 @@ math-intrinsics@^1.1.0: resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== +media-typer@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-1.1.1.tgz#6f035400dfe3ab9d5607bc77546ce30cc2f9c6b8" + integrity sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ== + mem@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178" @@ -3699,6 +3908,11 @@ mem@^4.3.0: mimic-fn "^2.0.0" p-is-promise "^2.0.0" +merge-descriptors@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-2.0.0.tgz#ea922f660635a2249ee565e0449f951e6b603808" + integrity sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g== + merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" @@ -3722,7 +3936,7 @@ mime-db@1.52.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-db@^1.28.0: +mime-db@^1.28.0, mime-db@^1.54.0: version "1.54.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.54.0.tgz#cddb3ee4f9c64530dff640236661d42cb6a314f5" integrity sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ== @@ -3734,6 +3948,13 @@ mime-types@^2.1.12, mime-types@^2.1.27: dependencies: mime-db "1.52.0" +mime-types@^3.0.0, mime-types@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-3.0.2.tgz#39002d4182575d5af036ffa118100f2524b2e2ab" + integrity sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A== + dependencies: + mime-db "^1.54.0" + mime@^2.5.2: version "2.6.0" resolved "https://registry.yarnpkg.com/mime/-/mime-2.6.0.tgz#a2a682a95cd4d0cb1d6257e28f83da7e35800367" @@ -3865,6 +4086,13 @@ nan@^2.4.0: resolved "https://registry.yarnpkg.com/nan/-/nan-2.22.2.tgz#6b504fd029fb8f38c0990e52ad5c26772fdacfbb" integrity sha512-DANghxFkS1plDdRsX0X9pm0Z6SJNN6gBdtXfanwoZ8hooC5gosGFSBGRYHUVPz1asKA/kMRqDRdHrluZ61SpBQ== +negotiator@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-1.1.0.tgz#16e003d0db4ac24fd9df168edf871625deeae3df" + integrity sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg== + dependencies: + content-type "^2.1.0" + neo-async@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" @@ -3973,6 +4201,16 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" +object-assign@^4: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== + +object-inspect@^1.13.3, object-inspect@^1.13.4: + version "1.14.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.14.0.tgz#8d373f7293f9d0ba656de41bdb7a55992255af46" + integrity sha512-IVgHNlp/jwQX271+Xzoq9LZNTWXxZK+cEOrGBOBxXNbn7fapnZ+Ts6TVMgNOuAezwG2wdtnMX97tTPK6VEnuOQ== + object-keys@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" @@ -3983,6 +4221,13 @@ on-exit-leak-free@^2.1.0: resolved "https://registry.yarnpkg.com/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz#fed195c9ebddb7d9e4c3842f93f281ac8dadd3b8" integrity sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA== +on-finished@^2.4.1: + version "2.4.2" + resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.2.tgz#6932b04b95bf6a4828201db10af75fe5c9c38b73" + integrity sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ== + dependencies: + ee-first "1.1.1" + once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -4104,6 +4349,11 @@ parse-json@^2.2.0: dependencies: error-ex "^1.2.0" +parseurl@^1.3.3: + version "1.3.3" + resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" + integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== + path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" @@ -4142,6 +4392,11 @@ path-scurry@^1.11.1: lru-cache "^10.2.0" minipass "^5.0.0 || ^6.0.2 || ^7.0.0" +path-to-regexp@^8.0.0: + version "8.4.2" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-8.4.2.tgz#795c420c4f7ca45c5b887366f622ee0c9852cccd" + integrity sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA== + path-type@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" @@ -4213,6 +4468,11 @@ pino@^9.0.0: sonic-boom "^4.0.1" thread-stream "^3.0.0" +pkce-challenge@^5.0.0: + version "5.0.2" + resolved "https://registry.yarnpkg.com/pkce-challenge/-/pkce-challenge-5.0.2.tgz#372dbfc2ecdfb51e8e582fccec1a79a9b95113c9" + integrity sha512-vCc54+qyIfKC5e2UN28AZKElwqjLINgiIV3RKI8pDu93TjaAJoB3QrgMzEBouy8yOKsXVXdAinO1QArJf9x5WA== + plist@3.1.0, plist@^3.0.0, plist@^3.0.4, plist@^3.0.5, plist@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/plist/-/plist-3.1.0.tgz#797a516a93e62f5bde55e0b9cc9c967f860893c9" @@ -4264,6 +4524,14 @@ promise-retry@^2.0.1: err-code "^2.0.2" retry "^0.12.0" +proxy-addr@^2.0.8: + version "2.0.8" + resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.8.tgz#624e760fd8ab06b1b8320c2f8506d4422cf8e932" + integrity sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ== + dependencies: + forwarded "0.2.0" + ipaddr.js "1.9.1" + pump@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.2.tgz#836f3edd6bc2ee599256c924ffe0d88573ddcbf8" @@ -4284,6 +4552,14 @@ pupa@^2.0.1: dependencies: escape-goat "^2.0.0" +qs@^6.16.0, qs@^6.16.1: + version "6.17.1" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.17.1.tgz#43ac71d29ca0e9d0eed16a218e35b6cde5628e81" + integrity sha512-jd3COkaKVgGUW+ZHyEHCG9bH7RoaaiWuMgzsIBjUMVjLAaWGWpoUAVwljVvBHxRu/2qEHnadLGZrkutYUBPQJA== + dependencies: + es-define-property "^1.0.1" + side-channel "^1.1.1" + queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" @@ -4314,6 +4590,21 @@ randombytes@^2.1.0: dependencies: safe-buffer "^5.1.0" +range-parser@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.3.0.tgz#d7f19be812bb62721472b45d3be219ef09572b47" + integrity sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw== + +raw-body@^3.0.0, raw-body@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-3.0.2.tgz#3e3ada5ae5568f9095d84376fd3a49b8fb000a51" + integrity sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA== + dependencies: + bytes "~3.1.2" + http-errors "~2.0.1" + iconv-lite "~0.7.0" + unpipe "~1.0.0" + rcedit@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/rcedit/-/rcedit-4.0.1.tgz#892ac47a19204a380f49e00ea38ce070443343c2" @@ -4495,6 +4786,17 @@ roarr@^2.15.3: semver-compare "^1.0.0" sprintf-js "^1.1.2" +router@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/router/-/router-2.3.0.tgz#b383eb82cc19b9b9ef20ac1a7081345540b31fc4" + integrity sha512-bpowRfGjEPe8t9R6fJIzhwmyCGAXwKvxBUsgJm+bJukwdcWmUXbMo7p22w7aYmQBPQTUMNqMV39YX0kMou3z8w== + dependencies: + debug "^4.4.0" + depd "^2.0.0" + is-promise "^4.0.0" + parseurl "^1.3.3" + path-to-regexp "^8.0.0" + run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -4583,6 +4885,23 @@ semver@^7.6.3: resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.3.tgz#4b5f4143d007633a8dc671cd0a6ef9147b8bb946" integrity sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q== +send@^1.1.0, send@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/send/-/send-1.2.1.tgz#9eab743b874f3550f40a26867bf286ad60d3f3ed" + integrity sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ== + dependencies: + debug "^4.4.3" + encodeurl "^2.0.0" + escape-html "^1.0.3" + etag "^1.8.1" + fresh "^2.0.0" + http-errors "^2.0.1" + mime-types "^3.0.2" + ms "^2.1.3" + on-finished "^2.4.1" + range-parser "^1.2.1" + statuses "^2.0.2" + serialize-error@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/serialize-error/-/serialize-error-7.0.1.tgz#f1360b0447f61ffb483ec4157c737fab7d778e18" @@ -4597,11 +4916,26 @@ serialize-javascript@^6.0.2: dependencies: randombytes "^2.1.0" +serve-static@^2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-2.2.1.tgz#7f186a4a4e5f5b663ad7a4294ff1bf37cf0e98a9" + integrity sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw== + dependencies: + encodeurl "^2.0.0" + escape-html "^1.0.3" + parseurl "^1.3.3" + send "^1.2.0" + set-cookie-parser@^2.6.0: version "2.7.1" resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz#3016f150072202dfbe90fadee053573cc89d2943" integrity sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ== +setprototypeof@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" + integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== + shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" @@ -4626,6 +4960,46 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +side-channel-list@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.1.tgz#c2e0b5a14a540aebee3bbc6c3f8666cc9b509127" + integrity sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w== + dependencies: + es-errors "^1.3.0" + object-inspect "^1.13.4" + +side-channel-map@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/side-channel-map/-/side-channel-map-1.0.1.tgz#d6bb6b37902c6fef5174e5f533fab4c732a26f42" + integrity sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA== + dependencies: + call-bound "^1.0.2" + es-errors "^1.3.0" + get-intrinsic "^1.2.5" + object-inspect "^1.13.3" + +side-channel-weakmap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz#11dda19d5368e40ce9ec2bdc1fb0ecbc0790ecea" + integrity sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A== + dependencies: + call-bound "^1.0.2" + es-errors "^1.3.0" + get-intrinsic "^1.2.5" + object-inspect "^1.13.3" + side-channel-map "^1.0.1" + +side-channel@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.1.tgz#ea02c62e05dc4bea67d4442f0fb71ee192f8e0ab" + integrity sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ== + dependencies: + es-errors "^1.3.0" + object-inspect "^1.13.4" + side-channel-list "^1.0.1" + side-channel-map "^1.0.1" + side-channel-weakmap "^1.0.2" + signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" @@ -4757,20 +5131,16 @@ stat-mode@^1.0.0: resolved "https://registry.yarnpkg.com/stat-mode/-/stat-mode-1.0.0.tgz#68b55cb61ea639ff57136f36b216a291800d1465" integrity sha512-jH9EhtKIjuXZ2cWxmXS8ZP80XyC3iasQxMDV8jzhNJpfDb7VbQLVW4Wvsxz9QZvzV+G4YoSfBUVKDOyxLzi/sg== +statuses@^2.0.1, statuses@^2.0.2, statuses@~2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.2.tgz#8f75eecef765b5e1cfcdc080da59409ed424e382" + integrity sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw== + stream-buffers@~2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/stream-buffers/-/stream-buffers-2.2.0.tgz#91d5f5130d1cef96dcfa7f726945188741d09ee4" integrity sha512-uyQK/mx5QjHun80FLJTfaWE7JtwfRMKBLkMne6udYOmvH0CawotVa7TfgYHzAnpphn4+TweIx1QKMnRIbipmUg== -streamx@^2.12.5, streamx@^2.15.0, streamx@^2.25.0: - version "2.25.0" - resolved "https://registry.yarnpkg.com/streamx/-/streamx-2.25.0.tgz#cc967e99390fda8b918b1eeaf3bc437637c8c7af" - integrity sha512-0nQuG6jf1w+wddNEEXCF4nTg3LtufWINB5eFEN+5TNZW7KWJp6x87+JFL43vaAUPyCfH1wID+mNVyW6OHtFamg== - dependencies: - events-universal "^1.0.0" - fast-fifo "^1.3.2" - text-decoder "^1.1.0" - "string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" @@ -4858,16 +5228,6 @@ tapable@^2.2.0, tapable@^2.3.0: resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.3.0.tgz#7e3ea6d5ca31ba8e078b560f0d83ce9a14aa8be6" integrity sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg== -tar-stream@^3.1.7: - version "3.2.0" - resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-3.2.0.tgz#0d0064d9b67ea3c9f5abde155e35faab0df37591" - integrity sha512-ojzvCvVaNp6aOTFmG7jaRD0meowIAuPc3cMMhSgKiVWws1GyHbGd/xvnyuRKcKlMpt3qvxx6r0hreCNITP9hIg== - dependencies: - b4a "^1.6.4" - bare-fs "^4.5.5" - fast-fifo "^1.2.0" - streamx "^2.15.0" - tar@^6.0.5, tar@^6.1.12: version "6.2.1" resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.1.tgz#717549c541bc3c2af15751bea94b1dd068d4b03a" @@ -4891,13 +5251,6 @@ tar@^7.5.4: minizlib "^3.1.0" yallist "^5.0.0" -teex@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/teex/-/teex-1.0.1.tgz#b8fa7245ef8e8effa8078281946c85ab780a0b12" - integrity sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg== - dependencies: - streamx "^2.12.5" - temp-file@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/temp-file/-/temp-file-3.4.0.tgz#766ea28911c683996c248ef1a20eea04d51652c7" @@ -4935,13 +5288,6 @@ terser@^5.31.1: commander "^2.20.0" source-map-support "~0.5.20" -text-decoder@^1.1.0: - version "1.2.7" - resolved "https://registry.yarnpkg.com/text-decoder/-/text-decoder-1.2.7.tgz#5d073a9a74b9c0a9d28dfadcab96b604af57d8ba" - integrity sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ== - dependencies: - b4a "^1.6.4" - thread-stream@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/thread-stream/-/thread-stream-3.1.0.tgz#4b2ef252a7c215064507d4ef70c05a5e2d34c4f1" @@ -5012,6 +5358,11 @@ toad-cache@^3.7.0: resolved "https://registry.yarnpkg.com/toad-cache/-/toad-cache-3.7.0.tgz#b9b63304ea7c45ec34d91f1d2fa513517025c441" integrity sha512-/m8M+2BJUpoJdgAHoG+baCwBT+tf2VraSfkBgl0Y00qIWt41DJ8R5B8nsEw0I58YwF5IZH6z24/2TobDKnqSWw== +toidentifier@~1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" + integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== + tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" @@ -5056,6 +5407,15 @@ type-fest@^1.0.2: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1" integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA== +type-is@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-2.1.0.tgz#71d1a7053293582e16ac9f3ebaf1ab9aa49e5570" + integrity sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA== + dependencies: + content-type "^2.0.0" + media-typer "^1.1.0" + mime-types "^3.0.0" + typescript@^5.3.3, typescript@^5.4.3: version "5.8.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.3.tgz#92f8a3e5e3cf497356f4178c34cd65a7f5e8440e" @@ -5101,6 +5461,11 @@ unorm@^1.4.1: resolved "https://registry.yarnpkg.com/unorm/-/unorm-1.6.0.tgz#029b289661fba714f1a9af439eb51d9b16c205af" integrity sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA== +unpipe@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" + integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== + unused-filename@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/unused-filename/-/unused-filename-2.1.0.tgz#33719c4e8d9644f32d2dec1bc8525c6aaeb4ba51" @@ -5160,6 +5525,11 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" +vary@^1, vary@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" + integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== + verror@^1.10.0: version "1.10.1" resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.1.tgz#4bf09eeccf4563b109ed4b3d458380c972b0cdeb" @@ -5360,3 +5730,13 @@ yoctocolors-cjs@^2.1.2: version "2.1.3" resolved "https://registry.yarnpkg.com/yoctocolors-cjs/-/yoctocolors-cjs-2.1.3.tgz#7e4964ea8ec422b7a40ac917d3a344cfd2304baa" integrity sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw== + +zod-to-json-schema@^3.25.1: + version "3.25.2" + resolved "https://registry.yarnpkg.com/zod-to-json-schema/-/zod-to-json-schema-3.25.2.tgz#3fa799a7badd554541472fb65843fdc460b2e5aa" + integrity sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA== + +"zod@^3.25 || ^4.0", zod@^4.3.6: + version "4.6.7" + resolved "https://registry.yarnpkg.com/zod/-/zod-4.6.7.tgz#e806cf64a7f4e37635ce9f2f52c04c3766f75e5b" + integrity sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg== diff --git a/test/electron-js/plugin-cors.test.mjs b/test/electron-js/plugin-cors.test.mjs index 180cf48d28..2575a705ba 100644 --- a/test/electron-js/plugin-cors.test.mjs +++ b/test/electron-js/plugin-cors.test.mjs @@ -188,7 +188,7 @@ describe('isRelaxablePluginRequest', () => { }) describe('pluginRootsFromPreferences', () => { - const DOT = path.resolve('/home/u/.logseq-og') + const DOT = path.resolve('/home/u/.logseq-og-se') test('always includes the dot-root tmp dir, where generated entries are written', () => { // A non-dot-root plugin whose package main is a .js file gets an entry