diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml index c2988c782..fae447d6b 100644 --- a/.github/workflows/flutter-nightly.yml +++ b/.github/workflows/flutter-nightly.yml @@ -93,7 +93,7 @@ jobs: rustdesk-*.exe build-for-linux: - name: ${{ matrix.job.target }} (${{ matrix.job.os }}) + name: ${{ matrix.job.target }} (${{ matrix.job.os }},${{ matrix.job.extra-build-args }}) runs-on: ${{ matrix.job.os }} strategy: fail-fast: false @@ -105,7 +105,8 @@ jobs: # - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } # - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } # - { target: x86_64-apple-darwin , os: macos-10.15 } - - { target: x86_64-unknown-linux-gnu , os: ubuntu-18.04} + - { target: x86_64-unknown-linux-gnu , os: ubuntu-18.04, extra-build-args: ""} + - { target: x86_64-unknown-linux-gnu , os: ubuntu-18.04, extra-build-args: "--flatpak"} # - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } steps: - name: Checkout source code @@ -160,7 +161,7 @@ jobs: - name: Install cargo bundle tools run: | - cargo install cargo-bundle --force + cargo install cargo-bundle - name: Show version information (Rust, cargo, GCC) shell: bash @@ -173,7 +174,7 @@ jobs: rustc -V - name: Build rustdesk - run: ./build.py --flutter --hwcodec + run: ./build.py --flutter --hwcodec ${{ matrix.job.extra-build-args }} - name: Rename rustdesk shell: bash @@ -188,15 +189,17 @@ jobs: prerelease: true tag_name: ${{ env.TAG_NAME }} files: | - rustdesk-${{ matrix.job.target }}-${{ matrix.job.os }}.deb + rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb - name: Upload Artifcat uses: actions/upload-artifact@master + if: ${{ contains(matrix.job.extra-build-args, 'flatpak') }} with: - name: rustdesk-${{ matrix.job.target }}-${{ matrix.job.os }}.deb - path: rustdesk-${{ matrix.job.target }}-${{ matrix.job.os }}.deb + name: rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb + path: rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb - name: Build archlinux package + if: ${{ matrix.job.extra-build-args == '' }} uses: vufa/arch-makepkg-action@master with: packages: > @@ -231,6 +234,7 @@ jobs: cd res && HBB=`pwd`/.. FLUTTER=1 makepkg -f - name: Publish archlinux package + if: ${{ matrix.job.extra-build-args == '' }} uses: softprops/action-gh-release@v1 with: prerelease: true @@ -238,6 +242,20 @@ jobs: files: | res/rustdesk*.zst + # - name: build RPM package + # id: rpm + # uses: Kingtous/rustdesk-rpmbuild@master + # with: + # spec_file: "res/rpm-flutter.spec" + + # - name: Publish fedora28/centos8 package + # uses: softprops/action-gh-release@v1 + # with: + # prerelease: true + # tag_name: ${{ env.TAG_NAME }} + # files: | + # ${{ steps.rpm.outputs.rpm_dir_path }}/* + build-flatpak: name: Build Flatpak needs: [build-for-linux] @@ -252,7 +270,7 @@ jobs: # - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } # - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } # - { target: x86_64-apple-darwin , os: macos-10.15 } - - { target: x86_64-unknown-linux-gnu , os: ubuntu-18.04, arch: "x86_64"} + - { target: x86_64-unknown-linux-gnu , os: ubuntu-18.04, arch: x86_64} # - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } steps: - name: Checkout source code @@ -266,12 +284,12 @@ jobs: - name: Download Binary uses: actions/download-artifact@master with: - name: rustdesk-${{ matrix.job.target }}-${{ matrix.job.os }}.deb + name: rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb path: . - name: Rename Binary run: | - mv rustdesk-${{ matrix.job.target }}-${{ matrix.job.os }}.deb rustdesk-${{ env.VERSION }}.deb + mv rustdesk-${{ env.VERSION }}-${{ matrix.job.target }}-${{ matrix.job.os }}.deb rustdesk-${{ env.VERSION }}.deb - name: Install Flatpak deps run: | diff --git a/build.py b/build.py index 3e7ce853e..7a02dfbcd 100755 --- a/build.py +++ b/build.py @@ -81,6 +81,11 @@ def make_parser(): action='store_true', help='Build windows portable' ) + parser.add_argument( + '--flatpak', + action='store_true', + help='Build rustdesk libs with the flatpak feature enabled' + ) return parser @@ -188,6 +193,8 @@ def get_features(args): features.append('hwcodec') if args.flutter: features.append('flutter') + if args.flatpak: + features.append('flatpak') print("features:", features) return features diff --git a/flatpak/rustdesk.json b/flatpak/rustdesk.json index 4cb5bccc4..d7f6e316e 100644 --- a/flatpak/rustdesk.json +++ b/flatpak/rustdesk.json @@ -6,6 +6,7 @@ "command": "rustdesk", "modules": [ "shared-modules/libappindicator/libappindicator-gtk3-12.10.json", + "xdotool.json", { "name": "rustdesk", "buildsystem": "simple", @@ -26,8 +27,12 @@ "finish-args": [ "--share=ipc", "--socket=x11", + "--socket=fallback-x11", "--socket=wayland", "--share=network", - "--filesystem=xdg-documents" + "--filesystem=home", + "--device=dri", + "--socket=pulseaudio", + "--talk-name=org.freedesktop.Flatpak" ] } \ No newline at end of file diff --git a/flatpak/xdotool.json b/flatpak/xdotool.json new file mode 100644 index 000000000..d7f41bf0e --- /dev/null +++ b/flatpak/xdotool.json @@ -0,0 +1,15 @@ +{ + "name": "xdotool", + "buildsystem": "simple", + "build-commands": [ + "make -j4 && PREFIX=./build make install", + "cp -r ./build/* /app/" + ], + "sources": [ + { + "type": "archive", + "url": "https://github.com/jordansissel/xdotool/releases/download/v3.20211022.1/xdotool-3.20211022.1.tar.gz", + "sha256": "96f0facfde6d78eacad35b91b0f46fecd0b35e474c03e00e30da3fdd345f9ada" + } + ] +} diff --git a/src/ui_interface.rs b/src/ui_interface.rs index 04ba90cb2..92c63e310 100644 --- a/src/ui_interface.rs +++ b/src/ui_interface.rs @@ -807,6 +807,8 @@ pub fn is_root() -> bool { #[inline] pub fn check_super_user_permission() -> bool { + #[cfg(feature = "flatpak")] + return true; #[cfg(any(windows, target_os = "linux"))] return crate::platform::check_super_user_permission().unwrap_or(false); #[cfg(not(any(windows, target_os = "linux")))]