From 260694fdaae359d3738399b9c5985453a02cdd13 Mon Sep 17 00:00:00 2001 From: Kingtous Date: Mon, 27 Mar 2023 11:21:23 +0800 Subject: [PATCH] add: nearby dll check --- .github/workflows/flutter-ci.yml | 72 ++++++++++++++++++++++++++- .github/workflows/flutter-nightly.yml | 35 ++++++++++++- .github/workflows/sciter.yml | 53 -------------------- src/ui.rs | 12 +++++ 4 files changed, 115 insertions(+), 57 deletions(-) delete mode 100644 .github/workflows/sciter.yml diff --git a/.github/workflows/flutter-ci.yml b/.github/workflows/flutter-ci.yml index 5525586de..428d538bf 100644 --- a/.github/workflows/flutter-ci.yml +++ b/.github/workflows/flutter-ci.yml @@ -109,10 +109,78 @@ jobs: - name: Checkout source code uses: actions/checkout@v3 - - name: Build rustdesk sciter - uses: ./.github/workflows/sciter.yml + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 with: + toolchain: stable target: ${{ matrix.job.target }} + override: true + profile: minimal # minimal component installation (ie, no documentation) + + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: ${{ matrix.job.os }}-sciter + + - name: Restore from cache and install vcpkg + uses: lukka/run-vcpkg@v7 + with: + setupOnly: true + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + + - name: Install vcpkg dependencies + run: | + $VCPKG_ROOT/vcpkg install libvpx:x86-windows-static libyuv:x86-windows-static opus:x86-windows-static + shell: bash + + - name: Build rustdesk + id: build + shell: bash + run: | + python3 res/inline-sciter.py + # Replace the link for the ico. + rm res/icon.ico && cp flutter/windows/runner/resources/app_icon.ico res/icon.ico + cargo build --features inline --target=${{ matrix.job.target }} --release + mkdir -p ./Release + mv ./target/release/rustdesk.exe ./Release/rustdesk.exe + wget -O ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll + echo "output_folder=./Release" >> $GITHUB_OUTPUT + + - name: Sign rustdesk files + uses: GermanBluefox/code-sign-action@v7 + with: + certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' + password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' + certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}' + # certificatename: '${{ secrets.CERTNAME }}' + folder: './Release/' + recursive: true + + - name: Build self-extracted executable + shell: bash + run: | + pushd ./libs/portable + python3 ./generate.py -f ../../Release/ -o . -e ../../Release/rustdesk.exe + popd + mkdir -p ./SignOutput + mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}.exe + + - name: Sign rustdesk self-extracted file + uses: GermanBluefox/code-sign-action@v7 + with: + certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' + password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' + certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}' + # certificatename: '${{ secrets.WINDOWS_PFX_NAME }}' + folder: './SignOutput' + recursive: false + + - name: Publish Release + uses: softprops/action-gh-release@v1 + with: + prerelease: true + tag_name: ${{ env.TAG_NAME }} + files: | + ./SignOutput/rustdesk-*.exe build-for-macOS: name: ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-args }}] diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml index 183c39d68..e9fd70568 100644 --- a/.github/workflows/flutter-nightly.yml +++ b/.github/workflows/flutter-nightly.yml @@ -150,10 +150,41 @@ jobs: - name: Checkout source code uses: actions/checkout@v3 - - name: Build rustdesk sciter - uses: ./.github/workflows/sciter.yml + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 with: + toolchain: stable target: ${{ matrix.job.target }} + override: true + profile: minimal # minimal component installation (ie, no documentation) + + - uses: Swatinem/rust-cache@v2 + with: + prefix-key: ${{ matrix.job.os }}-sciter + + - name: Restore from cache and install vcpkg + uses: lukka/run-vcpkg@v7 + with: + setupOnly: true + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} + + - name: Install vcpkg dependencies + run: | + $VCPKG_ROOT/vcpkg install libvpx:x86-windows-static libyuv:x86-windows-static opus:x86-windows-static + shell: bash + + - name: Build rustdesk + id: build + shell: bash + run: | + python3 res/inline-sciter.py + # Replace the link for the ico. + rm res/icon.ico && cp flutter/windows/runner/resources/app_icon.ico res/icon.ico + cargo build --features inline --target=${{ matrix.job.target }} --release + mkdir -p ./Release + mv ./target/release/rustdesk.exe ./Release/rustdesk.exe + wget -O ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll + echo "output_folder=./Release" >> $GITHUB_OUTPUT - name: Sign rustdesk files uses: GermanBluefox/code-sign-action@v7 diff --git a/.github/workflows/sciter.yml b/.github/workflows/sciter.yml deleted file mode 100644 index cc0c801d2..000000000 --- a/.github/workflows/sciter.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Build Sciter - -on: - workflow_call: - inputs: - target: - required: true - type: string - outputs: - output_folder: - description: "The relative directory of the executable folder which contains all dependencies for RustDesk." - value: ${{ jobs.build-sciter.outputs.output_folder }} -jobs: - build-sciter: - runs-on: windows-2019 - outputs: - output_folder: ${{ steps.build.outputs.output_folder }} - steps: - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{ inputs.job.target }} - override: true - profile: minimal # minimal component installation (ie, no documentation) - - - uses: Swatinem/rust-cache@v2 - with: - prefix-key: ${{ matrix.job.os }}-sciter - - - name: Restore from cache and install vcpkg - uses: lukka/run-vcpkg@v7 - with: - setupOnly: true - vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} - - - name: Install vcpkg dependencies - run: | - $VCPKG_ROOT/vcpkg install libvpx:x86-windows-static libyuv:x86-windows-static opus:x86-windows-static - shell: bash - - - name: Build rustdesk - id: build - shell: bash - run: | - python3 res/inline-sciter.py - # Replace the link for the ico. - cp flutter/windows/runner/resources/app_icon.ico res/icon.ico - cargo build --features inline --target=${{ matrix.job.target }} --release - mkdir -p ./Release - mv ./target/release/rustdesk.exe ./Release/rustdesk.exe - wget -O ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll - echo "output_folder=./Release" >> $GITHUB_OUTPUT diff --git a/src/ui.rs b/src/ui.rs index f7419cd34..8f9d14c54 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -54,6 +54,18 @@ pub fn start(args: &mut [String]) { let dir = "/usr"; sciter::set_library(&(prefix + dir + "/lib/rustdesk/libsciter-gtk.so")).ok(); } + #[cfg(windows)] + // Check if there is a sciter.dll nearby. + if let Ok(exe) = std::env::current_exe() { + if let Some(parent) = exe.parent() { + let sciter_dll_path = parent.join("sciter.dll"); + if sciter_dll_path.exists() { + // Try to set the sciter dll. + let p = sciter_dll_path.to_string_lossy().to_string(); + println!("Found dll:{}, \n {:?}", p, sciter::set_library(&p)); + } + } + } // https://github.com/c-smile/sciter-sdk/blob/master/include/sciter-x-types.h // https://github.com/rustdesk/rustdesk/issues/132#issuecomment-886069737 #[cfg(windows)]