245 Commits

251 changed files with 12674 additions and 3490 deletions

61
.github/workflows/build-macos-arm64.yml vendored Normal file
View File

@@ -0,0 +1,61 @@
name: Flutter Nightly MacOS Arm64 Build
on:
#schedule:
# schedule build every night
# - cron: "0/6 * * * *"
workflow_dispatch:
env:
CARGO_NDK_VERSION: "3.1.2"
LLVM_VERSION: "15.0.6"
FLUTTER_VERSION: "3.16.9"
FLUTTER_RUST_BRIDGE_VERSION: "1.80.1"
# for arm64 linux because official Dart SDK does not work
FLUTTER_ELINUX_VERSION: "3.16.9"
FLUTTER_ELINUX_COMMIT_ID: "c02bd16e1630f5bd690b85c5c2456ac1920e25af"
TAG_NAME: "nightly"
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
# vcpkg version: 2023.10.19
# for multiarch gcc compatibility
VCPKG_COMMIT_ID: "8eb57355a4ffb410a2e94c07b4dca2dffbee8e50"
VERSION: "1.2.4"
NDK_VERSION: "r26b"
#signing keys env variable checks
ANDROID_SIGNING_KEY: '${{ secrets.ANDROID_SIGNING_KEY }}'
MACOS_P12_BASE64: '${{ secrets.MACOS_P12_BASE64 }}'
# To make a custom build with your own servers set the below secret values
RS_PUB_KEY: '${{ secrets.RS_PUB_KEY }}'
RENDEZVOUS_SERVER: '${{ secrets.RENDEZVOUS_SERVER }}'
API_SERVER: '${{ secrets.API_SERVER }}'
UPLOAD_ARTIFACT: true
SIGN_BASE_URL: "${{ secrets.SIGN_BASE_URL }}"
jobs:
build-for-macOS-arm64:
name: build-for-macOS-arm64
runs-on: [self-hosted, macOS, ARM64]
steps:
#- name: Import the codesign cert
# if: env.MACOS_P12_BASE64 != null
# uses: apple-actions/import-codesign-certs@v1
# continue-on-error: true
# with:
# p12-file-base64: ${{ secrets.MACOS_P12_BASE64 }}
# p12-password: ${{ secrets.MACOS_P12_PASSWORD }}
# keychain: rustdesk
#- name: Check sign and import sign key
# if: env.MACOS_P12_BASE64 != null
# run: |
# security default-keychain -s rustdesk.keychain
# security find-identity -v
- name: Run
shell: bash
run: |
cd /opt/build
#./update_mac_template.sh
#security default-keychain -s rustdesk.keychain
#security unlock-keychain -p ${{ secrets.MACOS_P12_PASSWORD }} rustdesk.keychain
./agent.sh

37
.github/workflows/clear-cache.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
name: Clear cache
on:
workflow_dispatch:
permissions:
actions: write
jobs:
clear-cache:
runs-on: ubuntu-latest
steps:
- name: Clear cache
uses: actions/github-script@v7
with:
script: |
console.log("About to clear")
const caches = await github.rest.actions.getActionsCacheList({
owner: context.repo.owner,
repo: context.repo.repo,
})
for (const cache of caches.data.actions_caches) {
console.log(cache)
github.rest.actions.deleteActionsCacheById({
owner: context.repo.owner,
repo: context.repo.repo,
cache_id: cache.id,
})
}
console.log("Clear completed")
- name: Purge cache # Above seems not clear thouroughly, so add this to double clear
uses: MyAlbum/purge-cache@v2
with:
accessed: true # Purge caches by their last accessed time (default)
created: false # Purge caches by their created time (default)
max-age: 1 # in seconds

View File

@@ -11,9 +11,10 @@ on:
default: "nightly" default: "nightly"
env: env:
RUST_VERSION: "1.75" # https://github.com/rustdesk/rustdesk/discussions/7503
CARGO_NDK_VERSION: "3.1.2" CARGO_NDK_VERSION: "3.1.2"
LLVM_VERSION: "15.0.6" LLVM_VERSION: "15.0.6"
FLUTTER_VERSION: "3.16.9" FLUTTER_VERSION: "3.19.5"
FLUTTER_RUST_BRIDGE_VERSION: "1.80.1" FLUTTER_RUST_BRIDGE_VERSION: "1.80.1"
# for arm64 linux because official Dart SDK does not work # for arm64 linux because official Dart SDK does not work
FLUTTER_ELINUX_VERSION: "3.16.9" FLUTTER_ELINUX_VERSION: "3.16.9"
@@ -26,17 +27,30 @@ env:
VERSION: "1.2.4" VERSION: "1.2.4"
NDK_VERSION: "r26b" NDK_VERSION: "r26b"
#signing keys env variable checks #signing keys env variable checks
ANDROID_SIGNING_KEY: '${{ secrets.ANDROID_SIGNING_KEY }}' ANDROID_SIGNING_KEY: "${{ secrets.ANDROID_SIGNING_KEY }}"
MACOS_P12_BASE64: '${{ secrets.MACOS_P12_BASE64 }}' MACOS_P12_BASE64: "${{ secrets.MACOS_P12_BASE64 }}"
# To make a custom build with your own servers set the below secret values # To make a custom build with your own servers set the below secret values
RS_PUB_KEY: '${{ secrets.RS_PUB_KEY }}' RS_PUB_KEY: "${{ secrets.RS_PUB_KEY }}"
RENDEZVOUS_SERVER: '${{ secrets.RENDEZVOUS_SERVER }}' RENDEZVOUS_SERVER: "${{ secrets.RENDEZVOUS_SERVER }}"
API_SERVER: '${{ secrets.API_SERVER }}' API_SERVER: "${{ secrets.API_SERVER }}"
UPLOAD_ARTIFACT: "${{ inputs.upload-artifact }}" UPLOAD_ARTIFACT: "${{ inputs.upload-artifact }}"
SIGN_BASE_URL: "${{ secrets.SIGN_BASE_URL }}"
jobs: jobs:
build-RustDeskTempTopMostWindow:
uses: ./.github/workflows/third-party-RustDeskTempTopMostWindow.yml
with:
upload-artifact: ${{ inputs.upload-artifact }}
target: windows-2019
configuration: Release
platform: x64
target_version: Windows10
strategy:
fail-fast: false
build-for-windows-flutter: build-for-windows-flutter:
name: ${{ matrix.job.target }} (${{ matrix.job.os }}) name: ${{ matrix.job.target }} (${{ matrix.job.os }})
needs: [build-RustDeskTempTopMostWindow]
runs-on: ${{ matrix.job.os }} runs-on: ${{ matrix.job.os }}
strategy: strategy:
fail-fast: false fail-fast: false
@@ -63,26 +77,18 @@ jobs:
version: ${{ env.LLVM_VERSION }} version: ${{ env.LLVM_VERSION }}
- name: Install flutter - name: Install flutter
uses: subosito/flutter-action@v2 uses: subosito/flutter-action@v2.12.0 #https://github.com/subosito/flutter-action/issues/277
with: with:
channel: "stable" channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }} flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true cache: true
- name: Replace engine with rustdesk custom flutter engine
run: |
flutter doctor -v
flutter precache --windows
Invoke-WebRequest -Uri https://github.com/fufesou/flutter-engine/releases/download/bugfix-subwindow-crash-3.16.9-apply-pull-47787/windows-x64-release.zip -OutFile windows-x64-flutter-release.zip
Expand-Archive windows-x64-flutter-release.zip -DestinationPath .
mv -Force windows-x64-release/* C:/hostedtoolcache/windows/flutter/stable-${{ env.FLUTTER_VERSION }}-x64/bin/cache/artifacts/engine/windows-x64-release/
- name: Install Rust toolchain - name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1 uses: dtolnay/rust-toolchain@v1
with: with:
toolchain: stable toolchain: ${{ env.RUST_VERSION }}
targets: ${{ matrix.job.target }} targets: ${{ matrix.job.target }}
components: '' components: "rustfmt"
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
@@ -107,7 +113,7 @@ jobs:
shell: bash shell: bash
- name: Build rustdesk - name: Build rustdesk
run: python3 .\build.py --portable --hwcodec --flutter --gpucodec --feature IddDriver run: python3 .\build.py --portable --hwcodec --flutter --gpucodec --skip-portable-pack
- name: find Runner.res - name: find Runner.res
# Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.res # Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.res
@@ -125,37 +131,42 @@ jobs:
ls -l ./libs/portable/Runner.res; ls -l ./libs/portable/Runner.res;
fi fi
- name: Sign rustdesk files - name: Download RustDeskTempTopMostWindow artifacts
uses: GermanBluefox/code-sign-action@v7 uses: actions/download-artifact@master
if: false # env.UPLOAD_ARTIFACT == 'true' if: ${{ inputs.upload-artifact }}
with: with:
certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' name: topmostwindow-artifacts
password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' path: "./flutter/build/windows/x64/runner/Release/"
certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}'
# certificatename: '${{ secrets.CERTNAME }}' - name: Compress unsigned
folder: './flutter/build/windows/runner/Release/' shell: bash
recursive: true run: |
mv ./flutter/build/windows/x64/runner/Release ./rustdesk
tar czf rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}-unsigned.tar.gz rustdesk
- name: Sign rustdesk files
if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != ''
shell: bash
run: |
pip3 install requests argparse
BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./rustdesk/
- name: Build self-extracted executable - name: Build self-extracted executable
shell: bash shell: bash
if: env.UPLOAD_ARTIFACT == 'true' if: env.UPLOAD_ARTIFACT == 'true'
run: | run: |
pushd ./libs/portable pushd ./libs/portable
python3 ./generate.py -f ../../flutter/build/windows/x64/runner/Release/ -o . -e ../../flutter/build/windows/x64/runner/Release/rustdesk.exe pip3 install -r requirements.txt
python3 ./generate.py -f ../../rustdesk/ -o . -e ../../rustdesk/rustdesk.exe
popd popd
mkdir -p ./SignOutput mkdir -p ./SignOutput
mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.exe mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.exe
- name: Sign rustdesk self-extracted file - name: Sign rustdesk self-extracted file
uses: GermanBluefox/code-sign-action@v7 if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != ''
if: false #env.UPLOAD_ARTIFACT == 'true' shell: bash
with: run: |
certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./SignOutput
password: '${{ secrets.WINDOWS_PFX_PASSWORD }}'
certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}'
# certificatename: '${{ secrets.WINDOWS_PFX_NAME }}'
folder: './SignOutput'
recursive: false
- name: Publish Release - name: Publish Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
@@ -165,13 +176,14 @@ jobs:
tag_name: ${{ env.TAG_NAME }} tag_name: ${{ env.TAG_NAME }}
files: | files: |
./SignOutput/rustdesk-*.exe ./SignOutput/rustdesk-*.exe
./rustdesk-*.tar.gz
# The fallback for the flutter version, we use Sciter for 32bit Windows. # The fallback for the flutter version, we use Sciter for 32bit Windows.
build-for-windows-sciter: build-for-windows-sciter:
name: ${{ matrix.job.target }} (${{ matrix.job.os }}) name: ${{ matrix.job.target }} (${{ matrix.job.os }})
runs-on: ${{ matrix.job.os }} runs-on: ${{ matrix.job.os }}
# Temporarily disable this action due to additional test is needed. # Temporarily disable this action due to additional test is needed.
# if: false # if: false
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@@ -199,9 +211,9 @@ jobs:
- name: Install Rust toolchain - name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1 uses: dtolnay/rust-toolchain@v1
with: with:
toolchain: nightly-${{ matrix.job.target }} toolchain: nightly-2023-10-13-${{ matrix.job.target }} # must use nightly here, because of abi_thiscall feature required
targets: ${{ matrix.job.target }} targets: ${{ matrix.job.target }}
components: '' components: "rustfmt"
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
@@ -248,15 +260,11 @@ jobs:
fi fi
- name: Sign rustdesk files - name: Sign rustdesk files
uses: GermanBluefox/code-sign-action@v7 if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != ''
if: false #env.UPLOAD_ARTIFACT == 'true' shell: bash
with: run: |
certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' pip3 install requests argparse
password: '${{ secrets.WINDOWS_PFX_PASSWORD }}' BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./Release/
certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}'
# certificatename: '${{ secrets.CERTNAME }}'
folder: './Release/'
recursive: true
- name: Build self-extracted executable - name: Build self-extracted executable
shell: bash shell: bash
@@ -267,17 +275,14 @@ jobs:
popd popd
mkdir -p ./SignOutput mkdir -p ./SignOutput
mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}-sciter.exe mv ./target/release/rustdesk-portable-packer.exe ./SignOutput/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}-sciter.exe
mv ./Release ./rustdesk
tar czf rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.tar.gz rustdesk
- name: Sign rustdesk self-extracted file - name: Sign rustdesk self-extracted file
uses: GermanBluefox/code-sign-action@v7 if: env.UPLOAD_ARTIFACT == 'true' && env.SIGN_BASE_URL != ''
if: false #env.UPLOAD_ARTIFACT == 'true' shell: bash
with: run: |
certificate: '${{ secrets.WINDOWS_PFX_BASE64 }}' BASE_URL=${{ secrets.SIGN_BASE_URL }} SECRET_KEY=${{ secrets.SIGN_SECRET_KEY }} python3 res/job.py sign_files ./SignOutput/
password: '${{ secrets.WINDOWS_PFX_PASSWORD }}'
certificatesha1: '${{ secrets.WINDOWS_PFX_SHA1_THUMBPRINT }}'
# certificatename: '${{ secrets.WINDOWS_PFX_NAME }}'
folder: './SignOutput'
recursive: false
- name: Publish Release - name: Publish Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
@@ -287,6 +292,79 @@ jobs:
tag_name: ${{ env.TAG_NAME }} tag_name: ${{ env.TAG_NAME }}
files: | files: |
./SignOutput/rustdesk-*.exe ./SignOutput/rustdesk-*.exe
./rustdesk-*.tar.gz
build-for-macOS-arm64:
name: build-for-macOS-arm64
runs-on: [self-hosted, macOS, ARM64]
steps:
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Checkout source code
uses: actions/checkout@v3
- name: Install flutter rust bridge deps
shell: bash
run: |
cargo install flutter_rust_bridge_codegen --version ${{ env.FLUTTER_RUST_BRIDGE_VERSION }} --features "uuid"
pushd flutter && flutter pub get && popd
~/.cargo/bin/flutter_rust_bridge_codegen --rust-input ./src/flutter_ffi.rs --dart-output ./flutter/lib/generated_bridge.dart --c-output ./flutter/macos/Runner/bridge_generated.h
- name: Build rustdesk
run: |
# --hwcodec not supported on macos yet
./build.py --flutter
- name: create unsigned dmg
if: env.UPLOAD_ARTIFACT == 'true'
run: |
CREATE_DMG="$(command -v create-dmg)"
CREATE_DMG="$(readlink -f "$CREATE_DMG")"
sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG"
create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}-arm64.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app
- name: Upload unsigned macOS app
if: env.UPLOAD_ARTIFACT == 'true'
uses: actions/upload-artifact@master
with:
name: rustdesk-unsigned-macos-arm64
path: rustdesk-${{ env.VERSION }}-arm64.dmg # can not upload the directory directly or tar.gz file, which destroy the link structure, causing the codesign failed
- name: Codesign app and create signed dmg
if: env.MACOS_P12_BASE64 != null && env.UPLOAD_ARTIFACT == 'true'
run: |
# Patch create-dmg to give more attempts to unmount image
CREATE_DMG="$(command -v create-dmg)"
CREATE_DMG="$(readlink -f "$CREATE_DMG")"
sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG"
# start sign the rustdesk.app and dmg
rm -rf *.dmg || true
codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict ./flutter/build/macos/Build/Products/Release/RustDesk.app -vvv
create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app
codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict rustdesk-${{ env.VERSION }}.dmg -vvv
# notarize the rustdesk-${{ env.VERSION }}.dmg
rcodesign notary-submit --api-key-path ~/.p12/api-key.json --staple rustdesk-${{ env.VERSION }}.dmg
- name: Rename rustdesk
if: env.UPLOAD_ARTIFACT == 'true'
run: |
for name in rustdesk*??.dmg; do
mv "$name" "${name%%.dmg}-aarch64.dmg"
done
- name: Publish DMG package
if: env.UPLOAD_ARTIFACT == 'true'
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: ${{ env.TAG_NAME }}
files: |
rustdesk*-aarch64.dmg
build-for-macOS: build-for-macOS:
name: ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-args }}] name: ${{ matrix.job.target }} (${{ matrix.job.os }}) [${{ matrix.job.extra-build-args }}]
@@ -299,7 +377,7 @@ jobs:
target: x86_64-apple-darwin, target: x86_64-apple-darwin,
os: macos-latest, os: macos-latest,
extra-build-args: "", extra-build-args: "",
arch: x86_64 arch: x86_64,
} }
steps: steps:
- name: Export GitHub Actions cache environment variables - name: Export GitHub Actions cache environment variables
@@ -358,9 +436,9 @@ jobs:
- name: Install Rust toolchain - name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1 uses: dtolnay/rust-toolchain@v1
with: with:
toolchain: stable toolchain: ${{ env.RUST_VERSION }}
targets: ${{ matrix.job.target }} targets: ${{ matrix.job.target }}
components: '' components: "rustfmt"
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
@@ -397,6 +475,21 @@ jobs:
# --hwcodec not supported on macos yet # --hwcodec not supported on macos yet
./build.py --flutter ${{ matrix.job.extra-build-args }} ./build.py --flutter ${{ matrix.job.extra-build-args }}
- name: create unsigned dmg
if: env.UPLOAD_ARTIFACT == 'true'
run: |
CREATE_DMG="$(command -v create-dmg)"
CREATE_DMG="$(readlink -f "$CREATE_DMG")"
sed -i -e 's/MAXIMUM_UNMOUNTING_ATTEMPTS=3/MAXIMUM_UNMOUNTING_ATTEMPTS=7/' "$CREATE_DMG"
create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}-x64.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app
- name: Upload unsigned macOS app
if: env.UPLOAD_ARTIFACT == 'true'
uses: actions/upload-artifact@master
with:
name: rustdesk-unsigned-macos-x64
path: rustdesk-${{ env.VERSION }}-x64.dmg # can not upload the directory directly or tar.gz, which destroy the link structure, causing the codesign failed
- name: Codesign app and create signed dmg - name: Codesign app and create signed dmg
if: env.MACOS_P12_BASE64 != null && env.UPLOAD_ARTIFACT == 'true' if: env.MACOS_P12_BASE64 != null && env.UPLOAD_ARTIFACT == 'true'
run: | run: |
@@ -408,7 +501,7 @@ jobs:
security default-keychain -s rustdesk.keychain security default-keychain -s rustdesk.keychain
security unlock-keychain -p ${{ secrets.MACOS_P12_PASSWORD }} rustdesk.keychain security unlock-keychain -p ${{ secrets.MACOS_P12_PASSWORD }} rustdesk.keychain
# start sign the rustdesk.app and dmg # start sign the rustdesk.app and dmg
rm rustdesk-${{ env.VERSION }}.dmg || true rm -rf *.dmg || true
codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict ./flutter/build/macos/Build/Products/Release/RustDesk.app -vvv codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict ./flutter/build/macos/Build/Products/Release/RustDesk.app -vvv
create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app create-dmg --icon "RustDesk.app" 200 190 --hide-extension "RustDesk.app" --window-size 800 400 --app-drop-link 600 185 rustdesk-${{ env.VERSION }}.dmg ./flutter/build/macos/Build/Products/Release/RustDesk.app
codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict rustdesk-${{ env.VERSION }}.dmg -vvv codesign --force --options runtime -s ${{ secrets.MACOS_CODESIGN_IDENTITY }} --deep --strict rustdesk-${{ env.VERSION }}.dmg -vvv
@@ -431,6 +524,36 @@ jobs:
files: | files: |
rustdesk*-${{ matrix.job.arch }}.dmg rustdesk*-${{ matrix.job.arch }}.dmg
publish_unsigned_mac:
needs:
- build-for-macOS
- build-for-macOS-arm64
runs-on: ubuntu-latest
if: ${{ inputs.upload-artifact }}
steps:
- name: Download artifacts
uses: actions/download-artifact@master
with:
name: rustdesk-unsigned-macos-x64
path: ./
- name: Download Artifacts
uses: actions/download-artifact@master
with:
name: rustdesk-unsigned-macos-arm64
path: ./
- name: Combine unsigned macos app
run: |
tar czf rustdesk-${{ env.VERSION }}-macos-unsigned.tar.gz *.dmg
- name: Publish unsigned macos app
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: ${{ env.TAG_NAME }}
files: rustdesk-${{ env.VERSION }}-macos-unsigned.tar.gz
generate-bridge-linux: generate-bridge-linux:
uses: ./.github/workflows/bridge.yml uses: ./.github/workflows/bridge.yml
@@ -480,9 +603,9 @@ jobs:
- name: Install Rust toolchain - name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1 uses: dtolnay/rust-toolchain@v1
with: with:
toolchain: stable toolchain: ${{ env.RUST_VERSION }}
targets: ${{ matrix.job.target }} targets: ${{ matrix.job.target }}
components: '' components: "rustfmt"
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
@@ -538,14 +661,14 @@ jobs:
target: aarch64-linux-android, target: aarch64-linux-android,
os: ubuntu-20.04, os: ubuntu-20.04,
extra-build-features: "", extra-build-features: "",
openssl-arch: android-arm64 openssl-arch: android-arm64,
} }
- { - {
arch: armv7, arch: armv7,
target: armv7-linux-androideabi, target: armv7-linux-androideabi,
os: ubuntu-20.04, os: ubuntu-20.04,
extra-build-features: "", extra-build-features: "",
openssl-arch: android-arm openssl-arch: android-arm,
} }
steps: steps:
- name: Export GitHub Actions cache environment variables - name: Export GitHub Actions cache environment variables
@@ -632,8 +755,8 @@ jobs:
- name: Install Rust toolchain - name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1 uses: dtolnay/rust-toolchain@v1
with: with:
toolchain: stable toolchain: ${{ env.RUST_VERSION }}
components: '' components: "rustfmt"
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
@@ -747,21 +870,21 @@ jobs:
target: x86_64-unknown-linux-gnu, target: x86_64-unknown-linux-gnu,
os: ubuntu-20.04, os: ubuntu-20.04,
extra-build-features: "", extra-build-features: "",
enable-headless: true enable-headless: true,
} }
- { - {
arch: x86_64, arch: x86_64,
target: x86_64-unknown-linux-gnu, target: x86_64-unknown-linux-gnu,
os: ubuntu-20.04, os: ubuntu-20.04,
extra-build-features: "flatpak", extra-build-features: "flatpak",
enable-headless: false enable-headless: false,
} }
- { - {
arch: x86_64, arch: x86_64,
target: x86_64-unknown-linux-gnu, target: x86_64-unknown-linux-gnu,
os: ubuntu-20.04, os: ubuntu-20.04,
extra-build-features: "appimage", extra-build-features: "appimage",
enable-headless: false enable-headless: false,
} }
# - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } # - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
steps: steps:
@@ -796,9 +919,9 @@ jobs:
- name: Install Rust toolchain - name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1 uses: dtolnay/rust-toolchain@v1
with: with:
toolchain: stable toolchain: ${{ env.RUST_VERSION }}
targets: ${{ matrix.job.target }} targets: ${{ matrix.job.target }}
components: '' components: "rustfmt"
- name: Save Rust toolchain version - name: Save Rust toolchain version
run: | run: |
@@ -935,7 +1058,7 @@ jobs:
os: ubuntu-20.04, # just for naming package, not running host os: ubuntu-20.04, # just for naming package, not running host
use-cross: true, use-cross: true,
extra-build-features: "", extra-build-features: "",
enable-headless: true enable-headless: true,
} }
- { - {
arch: aarch64, arch: aarch64,
@@ -943,7 +1066,7 @@ jobs:
os: ubuntu-20.04, # just for naming package, not running host os: ubuntu-20.04, # just for naming package, not running host
use-cross: true, use-cross: true,
extra-build-features: "appimage", extra-build-features: "appimage",
enable-headless: false enable-headless: false,
} }
# - { arch: aarch64, target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true, extra-build-features: "flatpak" } # - { arch: aarch64, target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true, extra-build-features: "flatpak" }
# - { # - {
@@ -1005,9 +1128,9 @@ jobs:
- name: Install Rust toolchain - name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1 uses: dtolnay/rust-toolchain@v1
with: with:
toolchain: stable toolchain: ${{ env.RUST_VERSION }}
targets: ${{ matrix.job.target }} targets: ${{ matrix.job.target }}
components: '' components: "rustfmt"
- name: Save Rust toolchain version - name: Save Rust toolchain version
run: | run: |
@@ -1144,7 +1267,7 @@ jobs:
os: ubuntu-latest, os: ubuntu-latest,
use-cross: true, use-cross: true,
extra-build-features: "", extra-build-features: "",
enable-headless: true enable-headless: true,
} }
# - { arch: armv7, target: armv7-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "appimage" } # - { arch: armv7, target: armv7-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "appimage" }
# - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true }
@@ -1197,9 +1320,9 @@ jobs:
- name: Install Rust toolchain - name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1 uses: dtolnay/rust-toolchain@v1
with: with:
toolchain: stable toolchain: ${{ env.RUST_VERSION }}
targets: ${{ matrix.job.target }} targets: ${{ matrix.job.target }}
components: '' components: "rustfmt"
- name: Save Rust toolchain version - name: Save Rust toolchain version
run: | run: |
@@ -1816,7 +1939,7 @@ jobs:
prerelease: true prerelease: true
tag_name: ${{ env.TAG_NAME }} tag_name: ${{ env.TAG_NAME }}
files: | files: |
res/rustdesk*.zst res/rustdesk-${{ env.VERSION }}*.zst
- name: Build appimage package - name: Build appimage package
if: matrix.job.extra-build-features == 'appimage' && env.UPLOAD_ARTIFACT == 'true' if: matrix.job.extra-build-features == 'appimage' && env.UPLOAD_ARTIFACT == 'true'
@@ -2001,3 +2124,69 @@ jobs:
tag_name: ${{ env.TAG_NAME }} tag_name: ${{ env.TAG_NAME }}
files: | files: |
flatpak/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.flatpak flatpak/rustdesk-${{ env.VERSION }}-${{ matrix.job.arch }}.flatpak
build-rustdesk-web:
name: build-rustdesk-web
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
job:
- { arch: x86_64, target: x86_64-unknown-linux-gnu, os: ubuntu-18.04 }
env:
RELEASE_NAME: web-basic
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Prepare env
run: |
sudo apt-get update -y
sudo apt-get install -y wget npm
- name: Install flutter
uses: subosito/flutter-action@v2.12.0 #https://github.com/subosito/flutter-action/issues/277
with:
channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
# https://rustdesk.com/docs/en/dev/build/web/
- name: Build web
shell: bash
run: |
pushd flutter/web/js
npm install yarn -g
npm install typescript -g
npm install protoc -g
# Install protoc first, see: https://google.github.io/proto-lens/installing-protoc.html
npm install ts-proto
# Only works with vite <= 2.8, see: https://github.com/vitejs/vite/blob/main/docs/guide/build.md#chunking-strategy
npm install vite@2.8
yarn install && yarn build
popd
pushd flutter/web
wget https://github.com/rustdesk/doc.rustdesk.com/releases/download/console/web_deps.tar.gz
tar xzf web_deps.tar.gz
popd
pushd flutter
flutter build web --release
cd build
cp ../web/README.md web
# TODO: Remove the following line when the web is almost complete.
echo -e "\n\nThis build is for preview and not full functionality." >> web/README.md
dir_name="rustdesk-${{ env.VERSION }}-${{ env.RELEASE_NAME }}"
mv web "${dir_name}" && tar czf "${dir_name}".tar.gz "${dir_name}"
sha256sum "${dir_name}".tar.gz
popd
- name: Publish web
if: env.UPLOAD_ARTIFACT == 'true'
uses: softprops/action-gh-release@v1
with:
prerelease: true
tag_name: ${{ env.TAG_NAME }}
files: |
flutter/build/rustdesk-${{ env.VERSION }}-${{ env.RELEASE_NAME }}.tar.gz

View File

@@ -31,7 +31,7 @@ jobs:
version: ${{ env.LLVM_VERSION }} version: ${{ env.LLVM_VERSION }}
- name: Install flutter - name: Install flutter
uses: subosito/flutter-action@v2 uses: subosito/flutter-action@v2.12.0 #https://github.com/subosito/flutter-action/issues/277
with: with:
channel: "stable" channel: "stable"
flutter-version: ${{ env.FLUTTER_VERSION }} flutter-version: ${{ env.FLUTTER_VERSION }}
@@ -64,7 +64,7 @@ jobs:
shell: bash shell: bash
- name: Build rustdesk - name: Build rustdesk
run: python3 .\build.py --portable --hwcodec --flutter --feature IddDriver run: python3 .\build.py --portable --hwcodec --flutter
- name: Build self-extracted executable - name: Build self-extracted executable
shell: bash shell: bash

View File

@@ -0,0 +1,60 @@
name: build RustDeskTempTopMostWindow
on:
workflow_call:
inputs:
upload-artifact:
type: boolean
default: true
target:
description: 'Target'
required: true
type: string
default: 'windows-2019'
configuration:
description: 'Configuration'
required: true
type: string
default: 'Release'
platform:
description: 'Platform'
required: true
type: string
default: 'x64'
target_version:
description: 'TargetVersion'
required: true
type: string
default: 'Windows10'
env:
project_path: WindowInjection/WindowInjection.vcxproj
jobs:
build-RustDeskTempTopMostWindow:
runs-on: ${{ inputs.target }}
strategy:
fail-fast: false
env:
build_output_dir: RustDeskTempTopMostWindow/WindowInjection/${{ inputs.platform }}/${{ inputs.configuration }}
steps:
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Download the source code
run: |
git clone https://github.com/rustdesk-org/RustDeskTempTopMostWindow RustDeskTempTopMostWindow
# Build. commit 53b548a5398624f7149a382000397993542ad796 is tag v0.3
- name: Build the project
run: |
cd RustDeskTempTopMostWindow && git checkout 53b548a5398624f7149a382000397993542ad796
msbuild ${{ env.project_path }} -p:Configuration=${{ inputs.configuration }} -p:Platform=${{ inputs.platform }} /p:TargetVersion=${{ inputs.target_version }}
- name: Archive build artifacts
uses: actions/upload-artifact@master
if: ${{ inputs.upload-artifact }}
with:
name: topmostwindow-artifacts
path: |
./${{ env.build_output_dir }}/WindowInjection.dll

453
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@ version = "1.2.4"
authors = ["rustdesk <info@rustdesk.com>"] authors = ["rustdesk <info@rustdesk.com>"]
edition = "2021" edition = "2021"
build= "build.rs" build= "build.rs"
description = "A remote control software." description = "RustDesk Remote Desktop"
default-run = "rustdesk" default-run = "rustdesk"
rust-version = "1.75" rust-version = "1.75"
@@ -45,7 +45,8 @@ unix-file-copy-paste = [
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
whoami = "1.4" async-trait = "0.1"
whoami = "1.5.0"
scrap = { path = "libs/scrap", features = ["wayland"] } scrap = { path = "libs/scrap", features = ["wayland"] }
hbb_common = { path = "libs/hbb_common" } hbb_common = { path = "libs/hbb_common" }
serde_derive = "1.0" serde_derive = "1.0"
@@ -57,7 +58,6 @@ lazy_static = "1.4"
sha2 = "0.10" sha2 = "0.10"
repng = "0.2" repng = "0.2"
parity-tokio-ipc = { git = "https://github.com/rustdesk-org/parity-tokio-ipc" } parity-tokio-ipc = { git = "https://github.com/rustdesk-org/parity-tokio-ipc" }
runas = "=1.0" # https://github.com/mitsuhiko/rust-runas/issues/13
magnum-opus = { git = "https://github.com/rustdesk-org/magnum-opus" } magnum-opus = { git = "https://github.com/rustdesk-org/magnum-opus" }
dasp = { version = "0.11", features = ["signal", "interpolate-linear", "interpolate"], optional = true } dasp = { version = "0.11", features = ["signal", "interpolate-linear", "interpolate"], optional = true }
rubato = { version = "0.12", optional = true } rubato = { version = "0.12", optional = true }
@@ -95,7 +95,7 @@ sys-locale = "0.3"
enigo = { path = "libs/enigo", features = [ "with_serde" ] } enigo = { path = "libs/enigo", features = [ "with_serde" ] }
clipboard = { path = "libs/clipboard" } clipboard = { path = "libs/clipboard" }
ctrlc = "3.2" ctrlc = "3.2"
arboard = { version = "3.2", features = ["wayland-data-control"] } arboard = { git = "https://github.com/fufesou/arboard", branch = "feat/x11_set_conn_timeout", features = ["wayland-data-control"] }
system_shutdown = "4.0" system_shutdown = "4.0"
qrcode-generator = "4.1" qrcode-generator = "4.1"
@@ -107,6 +107,7 @@ virtual_display = { path = "libs/virtual_display", optional = true }
impersonate_system = { git = "https://github.com/21pages/impersonate-system" } impersonate_system = { git = "https://github.com/21pages/impersonate-system" }
shared_memory = "0.12" shared_memory = "0.12"
tauri-winrt-notification = "0.1.2" tauri-winrt-notification = "0.1.2"
runas = "1.2"
[target.'cfg(target_os = "macos")'.dependencies] [target.'cfg(target_os = "macos")'.dependencies]
objc = "0.2" objc = "0.2"
@@ -162,9 +163,10 @@ members = ["libs/scrap", "libs/hbb_common", "libs/enigo", "libs/clipboard", "lib
exclude = ["vdi/host", "examples/custom_plugin"] exclude = ["vdi/host", "examples/custom_plugin"]
[package.metadata.winres] [package.metadata.winres]
LegalCopyright = "Copyright © 2023 Purslane, Inc." LegalCopyright = "Copyright © 2024 Purslane Ltd. All rights reserved."
# this FileDescription overrides package.description ProductName = "RustDesk"
FileDescription = "RustDesk" FileDescription = "RustDesk Remote Desktop"
OriginalFilename = "rustdesk.exe"
[target.'cfg(target_os="windows")'.build-dependencies] [target.'cfg(target_os="windows")'.build-dependencies]
winres = "0.1" winres = "0.1"

View File

@@ -13,8 +13,6 @@ Chat with us: [Discord](https://discord.gg/nDceKgxnkV) | [Twitter](https://twitt
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09)
[![Open Bounties](https://img.shields.io/endpoint?url=https%3A%2F%2Fconsole.algora.io%2Fapi%2Fshields%2Frustdesk%2Fbounties%3Fstatus%3Dopen)](https://console.algora.io/org/rustdesk/bounties?status=open)
Yet another remote desktop software, written in Rust. Works out of the box, no configuration required. You have full control of your data, with no concerns about security. You can use our rendezvous/relay server, [set up your own](https://rustdesk.com/server), or [write your own rendezvous/relay server](https://github.com/rustdesk/rustdesk-server-demo). Yet another remote desktop software, written in Rust. Works out of the box, no configuration required. You have full control of your data, with no concerns about security. You can use our rendezvous/relay server, [set up your own](https://rustdesk.com/server), or [write your own rendezvous/relay server](https://github.com/rustdesk/rustdesk-server-demo).
![image](https://user-images.githubusercontent.com/71636191/171661982-430285f0-2e12-4b1d-9957-4a58e375304d.png) ![image](https://user-images.githubusercontent.com/71636191/171661982-430285f0-2e12-4b1d-9957-4a58e375304d.png)
@@ -31,22 +29,6 @@ RustDesk welcomes contribution from everyone. See [CONTRIBUTING.md](docs/CONTRIB
alt="Get it on F-Droid" alt="Get it on F-Droid"
height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb) height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
## Free Public Servers
Below are the servers you are using for free, they may change over time. If you are not close to one of these, your network may be slow.
| Location | Vendor | Specification |
| --------- | ------------- | ------------------ |
| Germany | [Hetzner](https://www.hetzner.com) | 2 vCPU / 4 GB RAM |
| Ukraine (Kyiv) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4 GB RAM |
## Dev Container
[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Container&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/rustdesk/rustdesk)
If you already have VS Code and Docker installed, you can click the badge above to get started. Clicking will cause VS Code to automatically install the Dev Containers extension if needed, clone the source code into a container volume, and spin up a dev container for use.
Go through [DEVCONTAINER.md](docs/DEVCONTAINER.md) for more info.
## Dependencies ## Dependencies
Desktop versions use Flutter or Sciter (deprecated) for GUI, this tutorial is for Sciter only, since it is easier and more friendly to start. Check out our [CI](https://github.com/rustdesk/rustdesk/blob/master/.github/workflows/flutter-build.yml) for building Flutter version. Desktop versions use Flutter or Sciter (deprecated) for GUI, this tutorial is for Sciter only, since it is easier and more friendly to start. Check out our [CI](https://github.com/rustdesk/rustdesk/blob/master/.github/workflows/flutter-build.yml) for building Flutter version.
@@ -180,12 +162,12 @@ Please ensure that you are running these commands from the root of the RustDesk
- **[flutter](https://github.com/rustdesk/rustdesk/tree/master/flutter)**: Flutter code for desktop and mobile - **[flutter](https://github.com/rustdesk/rustdesk/tree/master/flutter)**: Flutter code for desktop and mobile
- **[flutter/web/js](https://github.com/rustdesk/rustdesk/tree/master/flutter/web/js)**: JavaScript for Flutter web client - **[flutter/web/js](https://github.com/rustdesk/rustdesk/tree/master/flutter/web/js)**: JavaScript for Flutter web client
## Snapshots ## Screenshots
![image](https://user-images.githubusercontent.com/71636191/113112362-ae4deb80-923b-11eb-957d-ff88daad4f06.png) ![Connection Manager](https://github.com/rustdesk/rustdesk/assets/28412477/db82d4e7-c4bc-4823-8e6f-6af7eadf7651)
![image](https://user-images.githubusercontent.com/71636191/113112619-f705a480-923b-11eb-911d-97e984ef52b6.png) ![Connected to a Windows PC](https://github.com/rustdesk/rustdesk/assets/28412477/9baa91e9-3362-4d06-aa1a-7518edcbd7ea)
![image](https://user-images.githubusercontent.com/71636191/113112857-3fbd5d80-923c-11eb-9836-768325faf906.png) ![File Transfer](https://github.com/rustdesk/rustdesk/assets/28412477/39511ad3-aa9a-4f8c-8947-1cce286a46ad)
![image](https://user-images.githubusercontent.com/71636191/135385039-38fdbd72-379a-422d-b97f-33df71fb1cec.png) ![TCP Tunneling](https://github.com/rustdesk/rustdesk/assets/28412477/78e8708f-e87e-4570-8373-1360033ea6c5)

View File

@@ -80,8 +80,10 @@ def parse_rc_features(feature):
return get_all_features() return get_all_features()
elif isinstance(feature, list): elif isinstance(feature, list):
if windows: if windows:
# download third party is deprecated, we use github ci instead.
# force add PrivacyMode # force add PrivacyMode
feature.append('PrivacyMode') # feature.append('PrivacyMode')
pass
for feat in feature: for feat in feature:
if isinstance(feat, str) and feat.upper() == 'ALL': if isinstance(feat, str) and feat.upper() == 'ALL':
return get_all_features() return get_all_features()
@@ -145,6 +147,12 @@ def make_parser():
action='store_true', action='store_true',
help='Skip cargo build process, only flutter version + Linux supported currently' help='Skip cargo build process, only flutter version + Linux supported currently'
) )
if windows:
parser.add_argument(
'--skip-portable-pack',
action='store_true',
help='Skip packing, only flutter version + Windows supported'
)
parser.add_argument( parser.add_argument(
"--package", "--package",
type=str type=str
@@ -188,6 +196,9 @@ def generate_build_script_for_docker():
system2("bash /tmp/build.sh") system2("bash /tmp/build.sh")
# Downloading third party resources is deprecated.
# We can use this function in an offline build environment.
# Even in an online environment, we recommend building third-party resources yourself.
def download_extract_features(features, res_dir): def download_extract_features(features, res_dir):
import re import re
@@ -410,9 +421,11 @@ def build_flutter_dmg(version, features):
"cp target/release/liblibrustdesk.dylib target/release/librustdesk.dylib") "cp target/release/liblibrustdesk.dylib target/release/librustdesk.dylib")
os.chdir('flutter') os.chdir('flutter')
system2('flutter build macos --release') system2('flutter build macos --release')
'''
system2( system2(
"create-dmg --volname \"RustDesk Installer\" --window-pos 200 120 --window-size 800 400 --icon-size 100 --app-drop-link 600 185 --icon RustDesk.app 200 190 --hide-extension RustDesk.app rustdesk.dmg ./build/macos/Build/Products/Release/RustDesk.app") "create-dmg --volname \"RustDesk Installer\" --window-pos 200 120 --window-size 800 400 --icon-size 100 --app-drop-link 600 185 --icon RustDesk.app 200 190 --hide-extension RustDesk.app rustdesk.dmg ./build/macos/Build/Products/Release/RustDesk.app")
os.rename("rustdesk.dmg", f"../rustdesk-{version}.dmg") os.rename("rustdesk.dmg", f"../rustdesk-{version}.dmg")
'''
os.chdir("..") os.chdir("..")
@@ -427,7 +440,7 @@ def build_flutter_arch_manjaro(version, features):
system2('HBB=`pwd`/.. FLUTTER=1 makepkg -f') system2('HBB=`pwd`/.. FLUTTER=1 makepkg -f')
def build_flutter_windows(version, features): def build_flutter_windows(version, features, skip_portable_pack):
if not skip_cargo: if not skip_cargo:
system2(f'cargo build --features {features} --lib --release') system2(f'cargo build --features {features} --lib --release')
if not os.path.exists("target/release/librustdesk.dll"): if not os.path.exists("target/release/librustdesk.dll"):
@@ -438,6 +451,8 @@ def build_flutter_windows(version, features):
os.chdir('..') os.chdir('..')
shutil.copy2('target/release/deps/dylib_virtual_display.dll', shutil.copy2('target/release/deps/dylib_virtual_display.dll',
flutter_build_dir_2) flutter_build_dir_2)
if skip_portable_pack:
return
os.chdir('libs/portable') os.chdir('libs/portable')
system2('pip3 install -r requirements.txt') system2('pip3 install -r requirements.txt')
system2( system2(
@@ -487,7 +502,7 @@ def main():
os.chdir('../../..') os.chdir('../../..')
if flutter: if flutter:
build_flutter_windows(version, features) build_flutter_windows(version, features, args.skip_portable_pack)
return return
system2('cargo build --release --features ' + features) system2('cargo build --release --features ' + features)
# system2('upx.exe target/release/rustdesk.exe') # system2('upx.exe target/release/rustdesk.exe')

View File

@@ -1,9 +1,11 @@
#[cfg(windows)] #[cfg(windows)]
fn build_windows() { fn build_windows() {
let file = "src/platform/windows.cc"; let file = "src/platform/windows.cc";
cc::Build::new().file(file).compile("windows"); let file2 = "src/platform/windows_delete_test_cert.cc";
cc::Build::new().file(file).file(file2).compile("windows");
println!("cargo:rustc-link-lib=WtsApi32"); println!("cargo:rustc-link-lib=WtsApi32");
println!("cargo:rerun-if-changed={}", file); println!("cargo:rerun-if-changed={}", file);
println!("cargo:rerun-if-changed={}", file2);
} }
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]

View File

@@ -27,14 +27,6 @@
[**BINARY تنزيل**](https://github.com/rustdesk/rustdesk/releases) [**BINARY تنزيل**](https://github.com/rustdesk/rustdesk/releases)
## خوادم مفتوحة ومجانية
فيما يلي الخوادم التي تستخدمها مجانًا، وقد تتغير طوال الوقت. إذا لم تكن قريبًا من أحد هؤلاء، فقد تكون شبكتك بطيئة.
| الموقع | المورد | المواصفات |
| --------- | ------------- | ------------------ |
| Germany | Hetzner | 2 vCPU / 4GB RAM |
| Ukraine (Kyiv) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4 GB RAM |
## التبعيات ## التبعيات
لواجهة المستخدم الرسومية [sciter](https://sciter.com/) نسخة سطح المكتب تستخدم لواجهة المستخدم الرسومية [sciter](https://sciter.com/) نسخة سطح المكتب تستخدم

View File

@@ -22,14 +22,6 @@ Projekt RustDesk vítá přiložení ruky k dílu od každého. Jak začít se d
[**STAHOVÁNÍ ZKOMPILOVANÝCH APLIKACÍ**](https://github.com/rustdesk/rustdesk/releases) [**STAHOVÁNÍ ZKOMPILOVANÝCH APLIKACÍ**](https://github.com/rustdesk/rustdesk/releases)
## Veřejné, zdarma službu nabízející servery
Níže jsou uvedeny servery zdarma k vašemu použití (údaje se mohou v čase měnit). Pokud se nenacházíte v oblastech světa poblíž nich, spojení může být pomalé.
| umístění | dodavatel | parametry |
| --------- | ------------- | ------------------ |
| Germany | Hetzner | 2 vCPU / 4GB RAM |
| Ukraine (Kyiv) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4 GB RAM |
## Softwarové součásti, na kterých závisí ## Softwarové součásti, na kterých závisí
Varianta pro počítač používá pro grafické uživatelské rozhraní [sciter](https://sciter.com/) stáhněte si potřebnou knihovnu. Varianta pro počítač používá pro grafické uživatelské rozhraní [sciter](https://sciter.com/) stáhněte si potřebnou knihovnu.

View File

@@ -19,14 +19,6 @@ RustDesk hilser bidrag fra alle velkommen. Se [`docs/CONTRIBUTING.md`](docs/CONT
[**PROGRAM DOWNLOAD**](https://github.com/rustdesk/rustdesk/releases) [**PROGRAM DOWNLOAD**](https://github.com/rustdesk/rustdesk/releases)
## Gratis offentlige servere
Nedenfor er de servere, du bruger gratis, det kan ændre sig med tiden. Hvis du ikke er tæt på en af disse, kan dit netværk være langsomt.
| Beliggenhed | Udbyder | Specifikation |
| ---------- | ------------- | ------------------ |
| Germany | Hetzner | 2 vCPU / 4GB RAM |
## Afhængigheder ## Afhængigheder
Desktopversioner bruger [sciter](https://sciter.com/) eller Flutter til GUI, denne vejledning er kun for Sciter. Desktopversioner bruger [sciter](https://sciter.com/) eller Flutter til GUI, denne vejledning er kun for Sciter.

View File

@@ -29,22 +29,6 @@ RustDesk heißt jegliche Mitarbeit willkommen. Schauen Sie sich [CONTRIBUTING-DE
alt="Get it on F-Droid" alt="Get it on F-Droid"
height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb) height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
## Freie öffentliche Server
Nachfolgend sind die Server gelistet, die Sie kostenlos nutzen können. Es kann sein, dass sich diese Liste immer mal wieder ändert. Falls Sie nicht in der Nähe einer dieser Server sind, kann es sein, dass Ihre Verbindung langsam sein wird.
| Standort | Anbieter | Spezifikation |
| --------- | ------------- | ------------------ |
| Deutschland | [Hetzner](https://www.hetzner.com/de/) | 2 vCPU / 4 GB RAM |
| Ukraine (Kiew) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4 GB RAM |
## Dev-Container
[![In Dev-Containern öffnen](https://img.shields.io/static/v1?label=Dev%20Container&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/rustdesk/rustdesk)
Wenn Sie VS Code und Docker bereits installiert haben, können Sie auf das Abzeichen oben klicken, um loszulegen. Wenn Sie darauf klicken, wird VS Code automatisch die Dev-Container-Erweiterung installieren, den Quellcode in ein Container-Volume klonen und einen Dev-Container für die Verwendung aufsetzen.
Weitere Informationen finden Sie in [DEVCONTAINER-DE.md](DEVCONTAINER-DE.md).
## Abhängigkeiten ## Abhängigkeiten
Desktop-Versionen verwenden [Sciter](https://sciter.com/) oder Flutter für die GUI, dieses Tutorial ist nur für Sciter. Desktop-Versionen verwenden [Sciter](https://sciter.com/) oder Flutter für die GUI, dieses Tutorial ist nur für Sciter.

View File

@@ -19,14 +19,6 @@ RustDesk bonvenigas kontribuon de ĉiuj. Vidu [`docs/CONTRIBUTING.md`](CONTRIBUT
[**BINARA ELŜUTO**](https://github.com/rustdesk/rustdesk/releases) [**BINARA ELŜUTO**](https://github.com/rustdesk/rustdesk/releases)
## Senpagaj publikaj serviloj
Malsupre estas la serviloj, kiuj vi uzas senpage, ĝi povas ŝanĝi laŭlonge de la tempo. Se vi ne estas proksima de unu de tiuj, via reto povas esti malrapida.
| Situo | Vendanto | Detaloj |
| --------- | ------------- | ------------------ |
| Germany | Hetzner | 2 vCPU / 4GB RAM |
| Ukraine (Kyiv) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4GB RAM |
## Dependantaĵoj ## Dependantaĵoj
La labortabla versio uzas [sciter](https://sciter.com/) por la interfaco, bonvolu elŝuti la bibliotekon dinamikan sciter. La labortabla versio uzas [sciter](https://sciter.com/) por la interfaco, bonvolu elŝuti la bibliotekon dinamikan sciter.

View File

@@ -25,15 +25,6 @@ RustDesk agradece la contribución de todo el mundo. Lee [`docs/CONTRIBUTING.md`
alt="Get it on F-Droid" alt="Get it on F-Droid"
height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb) height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
## Servidores gratis de uso público
A continuación se muestran los servidores gratuitos, pueden cambiar a medida que pasa el tiempo. Si no estás cerca de uno de ellos, tu conexión puede ser lenta.
| Ubicación | Compañía | Especificación |
| --------- | ------------- | ------------------ |
| Germany | Hetzner | 2 vCPU / 4GB RAM |
| Ukraine (Kyiv) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4GB RAM |
## Dependencias ## Dependencias
La versión Desktop usa [Sciter](https://sciter.com/) o Flutter para el GUI, este tutorial es solo para Sciter. La versión Desktop usa [Sciter](https://sciter.com/) o Flutter para el GUI, este tutorial es solo para Sciter.

View File

@@ -25,13 +25,6 @@
[دریافت نرم‌افزار](https://github.com/rustdesk/rustdesk/releases) [دریافت نرم‌افزار](https://github.com/rustdesk/rustdesk/releases)
## سرورهای عمومی رایگان
شما مي‌توانید از سرورهای زیر به رایگان استفاده کنید. این لیست ممکن است به مرور زمان تغییر می‌کند. اگر به این سرورها نزدیک نیستید، ممکن است اتصال شما کند باشد.
| موقعیت | سرویس دهنده | مشخصات |
| --------- | ------------- | ------------------ |
| آلمان | Hetzner | 2 vCPU / 4GB RAM |
## وابستگی ها ## وابستگی ها
نسخه‌های رومیزی از [sciter](https://sciter.com/) برای رابط کاربری گرافیکی استفاده می‌کنند. خواهشمندیم کتابخانه‌ی پویای sciter را خودتان دانلود کنید از این منابع دریافت کنید. نسخه‌های رومیزی از [sciter](https://sciter.com/) برای رابط کاربری گرافیکی استفاده می‌کنند. خواهشمندیم کتابخانه‌ی پویای sciter را خودتان دانلود کنید از این منابع دریافت کنید.

View File

@@ -19,14 +19,6 @@ RustDesk toivottaa avustukset tervetulleiksi kaikilta. Katso lisätietoja [`docs
[**BINAARILATAUS**](https://github.com/rustdesk/rustdesk/releases) [**BINAARILATAUS**](https://github.com/rustdesk/rustdesk/releases)
## Vapaita julkisia palvelimia
Alla on palvelimia, joita voit käyttää ilmaiseksi, ne saattavat muuttua ajan mittaan. Jos et ole lähellä yhtä näistä, verkkosi voi olla hidas.
| Sijainti | Myyjä | Määrittely |
| --------- | ------------- | ------------------ |
| Germany | Hetzner | 2 vCPU / 4GB RAM |
| Ukraine (Kyiv) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4GB RAM |
## Riippuvuudet ## Riippuvuudet
Desktop-versiot käyttävät [sciter](https://sciter.com/) graafisena käyttöliittymänä, lataa sciter-dynaaminen kirjasto itsellesi. Desktop-versiot käyttävät [sciter](https://sciter.com/) graafisena käyttöliittymänä, lataa sciter-dynaaminen kirjasto itsellesi.

View File

@@ -19,14 +19,6 @@ RustDesk accueille les contributions de tout le monde. Voir [`docs/CONTRIBUTING.
[**TÉLÉCHARGEMENT BINAIRE**](https://github.com/rustdesk/rustdesk/releases) [**TÉLÉCHARGEMENT BINAIRE**](https://github.com/rustdesk/rustdesk/releases)
## Serveurs publics libres
Ci-dessous se trouvent les serveurs que vous utilisez gratuitement, cela peut changer au fil du temps. Si vous n'êtes pas proche de l'un d'entre eux, votre réseau peut être lent.
| Location | Vendor | Specification |
| --------- | ------------- | ------------------ |
| Germany | Hetzner | 2 vCPU / 4GB RAM |
## Dépendances ## Dépendances
Les versions de bureau utilisent [sciter](https://sciter.com/) pour l'interface graphique, veuillez télécharger la bibliothèque dynamique sciter vous-même. Les versions de bureau utilisent [sciter](https://sciter.com/) pour l'interface graphique, veuillez télécharger la bibliothèque dynamique sciter vous-même.

View File

@@ -29,22 +29,6 @@
alt="Get it on F-Droid" alt="Get it on F-Droid"
height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb) height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
## Δωρεάν δημόσιοι διακομιστές
Παρακάτω είναι οι διακομιστές που χρησιμοποιούνται δωρεάν, ενδέχεται να αλλάξουν με την πάροδο του χρόνου. Εάν δεν είστε κοντά σε ένα από αυτούς, το δίκτυό σας ίσως να είναι αργό.
| Περιοχή | Πάροχος | Προδιαγραφές |
| --------- | ------------- | ------------------ |
| Γερμανία | Hetzner | 2 vCPU / 4GB RAM |
| Ουκρανία (Κίεβο) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4GB RAM |
## Dev Container
[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Container&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/rustdesk/rustdesk)
Αν έχετε εγκατεστημένα το VS Code και το Docker, μπορείτε να ξεκινήσετε κάνοντας κλικ στην παραπάνω εικόνα. Αυτό θα έχει ως αποτέλεσμα, το VS Code να εγκαταστήσει αυτόματα την επέκταση Dev Containers, εάν χρειάζεται, θα κλωνοποιήσει τον πηγαίο κώδικα σε έναν νέο container και θα εκκινήσει ένα Dev Container για χρήση προγραμματισμού.
Για περισσότερες πληροφορίες μεταβείτε στο [DEVCONTAINER.md](docs/DEVCONTAINER.md).
## Προαπαιτούμενα για build ## Προαπαιτούμενα για build
Στις παραθυρικές εκδόσεις χρησιμοποιείται είτε το [sciter](https://sciter.com/) είτε το Flutter, τα παρακάτω βήματα είναι μόνο για το Sciter. Στις παραθυρικές εκδόσεις χρησιμοποιείται είτε το [sciter](https://sciter.com/) είτε το Flutter, τα παρακάτω βήματα είναι μόνο για το Sciter.

View File

@@ -27,14 +27,6 @@ A RustDesk szívesen fogad minden contributiont, támogatást mindenkitől. Lás
alt="Get it on F-Droid" alt="Get it on F-Droid"
height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb) height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
## Ingyenes publikus szerverek
Ezalatt az üzenet alatt találhatóak azok a publikus szerverek, amelyeket ingyen használhatsz. Ezek a szerverek változhatnak a jövőben, illetve a hálózatuk lehet hogy lassú lehet.
| Hely | Host | Specifikáció |
| --------- | ------------- | ------------------ |
| Germany | Hetzner | 2 vCPU / 4GB RAM |
| Ukraine (Kyiv) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4GB RAM |
## Dependencies ## Dependencies
Az asztali verziók [sciter](https://sciter.com/)-t használnak a GUI-hoz, kérlek telepítsd a dynamikus könyvtárat magad. Az asztali verziók [sciter](https://sciter.com/)-t használnak a GUI-hoz, kérlek telepítsd a dynamikus könyvtárat magad.

View File

@@ -31,20 +31,6 @@ RustDesk mengajak semua orang untuk ikut berkontribusi. Lihat [`docs/CONTRIBUTIN
alt="Get it on F-Droid" alt="Get it on F-Droid"
height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb) height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
## Server Publik Gratis
Di bawah ini merupakan server gratis yang bisa kamu gunakan, seiring dengan waktu mungkin akan terjadi perubahan spesifikasi pada setiap server yang ada. Jika lokasi kamu berada jauh dengan salah satu server yang tersedia, kemungkinan koneksi akan terasa lambat ketika melakukan proses remote.
| Lokasi | Penyedia | Spesifikasi |
| --------- | ------------- | ------------------ |
| Jerman | [Hetzner](https://www.hetzner.com) | 2 vCPU / 4GB RAM |
| Ukraina (Kyiv) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4GB RAM |
## Dev Container
[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Container&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/rustdesk/rustdesk)
Apabila PC kamu sudah terinstal VS Code dan Docker, kamu bisa mengklik badge yang ada diatas untuk memulainya. Dengan mengklik badge tersebut secara otomatis akan menginstal ekstensi pada VS Code, lakukan kloning (clone) source code kedalam container volume, dan aktifkan dev container untuk menggunakannya.
## Dependensi ## Dependensi
Pada versi desktop, antarmuka pengguna (GUI) menggunakan [Sciter](https://sciter.com/) atau flutter Pada versi desktop, antarmuka pengguna (GUI) menggunakan [Sciter](https://sciter.com/) atau flutter

View File

@@ -4,8 +4,8 @@
<a href="#passaggi-per-la-compilazione">Compilazione</a> • <a href="#passaggi-per-la-compilazione">Compilazione</a> •
<a href="#come-compilare-con-docker">Docker</a> • <a href="#come-compilare-con-docker">Docker</a> •
<a href="#struttura-dei-file">Struttura</a> • <a href="#struttura-dei-file">Struttura</a> •
<a href="#screenshots">Schermate</a><br> <a href="#schermate">Schermate</a><br>
[<a href="../README.md">English</a>] | [<a href="README-UA.md">Українська</a>] | [<a href="README-CS.md">česky</a>] | [<a href="README-ZH.md">中文</a>] | [<a href="README-HU.md">Magyar</a>] | [<a href="README-ES.md">Español</a>] | [<a href="README-FA.md">فارسی</a>] | [<a href="README-FR.md">Français</a>] | [<a href="README-DE.md">Deutsch</a>] | [<a href="README-PL.md">Polski</a>] | [<a href="README-ID.md">Indonesian</a>] | [<a href="README-FI.md">Suomi</a>] | [<a href="README-ML.md">മലയാളം</a>] | [<a href="README-JP.md">日本語</a>] | [<a href="README-NL.md">Nederlands</a>] | [<a href="README-RU.md">Русский</a>] | [<a href="README-PTBR.md">Português (Brasil)</a>] | [<a href="README-EO.md">Esperanto</a>] | [<a href="README-KR.md">한국어</a>] | [<a href="README-AR.md">العربي</a>] | [<a href="README-VN.md">Tiếng Việt</a>] | [<a href="README-GR.md">Ελληνικά</a>]<br> [<a href="../README.md">English</a>] | [<a href="README-UA.md">Українська</a>] | [<a href="README-CS.md">česky</a>] | [<a href="README-ZH.md">中文</a>] | [<a href="README-HU.md">Magyar</a>] | [<a href="README-ES.md">Español</a>] | [<a href="README-FA.md">فارسی</a>] | [<a href="README-FR.md">Français</a>] | [<a href="README-DE.md">Deutsch</a>] | [<a href="README-PL.md">Polski</a>] | [<a href="README-ID.md">Indonesian</a>] | [<a href="README-FI.md">Suomi</a>] | [<a href="README-ML.md">മലയാളം</a>] | [<a href="README-JP.md">日本語</a>] | [<a href="README-NL.md">Nederlands</a>] | [<a href="README-RU.md">Русский</a>] | [<a href="README-PTBR.md">Português (Brasil)</a>] | [<a href="README-EO.md">Esperanto</a>] | [<a href="README-KR.md">한국어</a>] | [<a href="README-AR.md">العربي</a>] | [<a href="README-VN.md">Tiếng Việt</a>] | [<a href="README-DA.md">Dansk</a>] | [<a href="README-GR.md">Ελληνικά</a>] | [<a href="README-TR.md">Türkçe</a>]<br>
<b>Abbiamo bisogno del tuo aiuto per tradurre questo file README e la <a href="https://github.com/rustdesk/rustdesk/tree/master/src/lang">UI RustDesk</a> nella tua lingua nativa</b> <b>Abbiamo bisogno del tuo aiuto per tradurre questo file README e la <a href="https://github.com/rustdesk/rustdesk/tree/master/src/lang">UI RustDesk</a> nella tua lingua nativa</b>
</p> </p>
@@ -13,28 +13,29 @@ Chatta con noi su: [Discord](https://discord.gg/nDceKgxnkV) | [Twitter](https://
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09) [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I2I04VU09)
Ancora un altro software per il controllo remoto del desktop, scritto in Rust. [![Bounties aperti](https://img.shields.io/endpoint?url=https%3A%2F%2Fconsole.algora.io%2Fapi%2Fshields%2Frustdesk%2Fbounties%3Fstatus%3Dopen)](https://console.algora.io/org/rustdesk/bounties?status=open)
Funziona immediatamente, nessuna configurazione richiesta. Hai il pieno controllo dei tuoi dati, senza preoccupazioni per la sicurezza.
Puoi usare il nostro server rendezvous/relay, [configurare il tuo server](https://rustdesk.com/server) o [realizzare il tuo server rendezvous/relay](https://github.com/rustdesk/rustdesk-server-demo).
RustDesk accoglie il contributo di tutti. Ancora un altro software per il controllo remoto del desktop, scritto in Rust. Funziona immediatamente, nessuna configurazione richiesta. Hai il pieno controllo dei tuoi dati, senza preoccupazioni per la sicurezza. Puoi usare il nostro server rendezvous/relay, [configurare il tuo server](https://rustdesk.com/server) o [realizzare il tuo server rendezvous/relay](https://github.com/rustdesk/rustdesk-server-demo).
Per ulteriori informazioni su come iniziare a contribuire, vedi [`docs/CONTRIBUTING-IT.md`](CONTRIBUTING.md).
[**DOWNLOAD PROGRAMMA**](https://github.com/rustdesk/rustdesk/releases) ![image](https://user-images.githubusercontent.com/71636191/171661982-430285f0-2e12-4b1d-9957-4a58e375304d.png)
## Server pubblici gratuiti RustDesk accoglie il contributo di tutti. Per ulteriori informazioni su come iniziare a contribuire, vedi [CONTRIBUTING.md](CONTRIBUTING-IT.md).
Qui sotto trovi i server che possono essere usati gratuitamente, la lista potrebbe cambiare nel tempo. [**FAQ**](https://github.com/rustdesk/rustdesk/wiki/FAQ)
Se non sei vicino a uno di questi server, la connessione potrebbe essere lenta.
| Posizione | Venditore | Specifiche | [**SCARICA PROGRAMMA**](https://github.com/rustdesk/rustdesk/releases)
| --------- | ------------- | ------------------ |
| Germania | Hetzner | 2 vCPU / 4GB RAM | [**SCARICA NIGHTLY**](https://github.com/rustdesk/rustdesk/releases/tag/nightly)
| Ucraina (Kyev) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4GB RAM |
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
alt="Get it on F-Droid"
height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
## Dipendenze ## Dipendenze
La versione Desktop usa per la GUI [sciter](https://sciter.com/), per favore scarica la libreria dinamica sciter. Le versioni desktop utilizzano Flutter o Sciter (deprecato) per l'interfaccia utente, questo tutorial è solo per Sciter, poiché è più facile per iniziare. Controlla il nostro [CI](https://github.com/rustdesk/rustdesk/blob/master/.github/workflows/flutter-build.yml) per la compilazione della versione Flutter.
Scarica la libreria dinamica Sciter.
[Windows](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll) | [Windows](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.win/x64/sciter.dll) |
[Linux](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so) | [Linux](https://raw.githubusercontent.com/c-smile/sciter-sdk/master/bin.lnx/x64/libsciter-gtk.so) |
@@ -51,12 +52,22 @@ La versione Desktop usa per la GUI [sciter](https://sciter.com/), per favore sca
- Esegui `cargo run` - Esegui `cargo run`
## [Build](https://rustdesk.com/docs/en/dev/build/)
## Come compilare in Linux ## Come compilare in Linux
### Ubuntu 18 (Debian 10) ### Ubuntu 18 (Debian 10)
```sh ```sh
sudo apt install -y g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake sudo apt install -y zip g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev \
libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake make \
libclang-dev ninja-build libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
```
### openSUSE Tumbleweed
```sh
sudo zypper install gcc-c++ git curl wget nasm yasm gcc gtk3-devel clang libxcb-devel libXfixes-devel cmake alsa-lib-devel gstreamer-devel gstreamer-plugins-base-devel xdotool-devel
``` ```
### Fedora 28 (CentOS 8) ### Fedora 28 (CentOS 8)
@@ -125,10 +136,7 @@ Quindi, ogni volta che devi compilare l'applicazione, esegui il seguente comando
docker run --rm -it -v $PWD:/home/user/rustdesk -v rustdesk-git-cache:/home/user/.cargo/git -v rustdesk-registry-cache:/home/user/.cargo/registry -e PUID="$(id -u)" -e PGID="$(id -g)" rustdesk-builder docker run --rm -it -v $PWD:/home/user/rustdesk -v rustdesk-git-cache:/home/user/.cargo/git -v rustdesk-registry-cache:/home/user/.cargo/registry -e PUID="$(id -u)" -e PGID="$(id -g)" rustdesk-builder
``` ```
Tieni presente che la prima build potrebbe richiedere più tempo prima che le dipendenze vengano memorizzate nella cache, le build successive saranno più veloci. Tieni presente che la prima build potrebbe richiedere più tempo prima che le dipendenze vengano memorizzate nella cache, le build successive saranno più veloci. Inoltre, se hai bisogno di specificare argomenti diversi per il comando build, puoi farlo alla fine del comando nella posizione `<OPTIONAL-ARGS>`. Ad esempio, se vuoi creare una versione di rilascio ottimizzata, esegui il comando precedentemente indicato seguito da `--release`. L'eseguibile generato sarà creato nella cartella destinazione del sistema e può essere eseguito con:
Inoltre, se hai bisogno di specificare argomenti diversi per il comando build, puoi farlo alla fine del comando nella posizione `<OPTIONAL-ARGS>`.
Ad esempio, se vuoi creare una versione di rilascio ottimizzata, esegui il comando precedentemente indicato seguito da `--release`.
L'eseguibile generato sarà creato nella cartella destinazione del sistema e può essere eseguito con:
```sh ```sh
target/debug/rustdesk target/debug/rustdesk
@@ -140,19 +148,21 @@ Oppure, se stai avviando un eseguibile di rilascio:
target/release/rustdesk target/release/rustdesk
``` ```
Assicurati di eseguire questi comandi dalla radice del repository RustDesk, altrimenti l'applicazione potrebbe non essere in grado di trovare le risorse richieste. Assicurati di eseguire questi comandi dalla radice del repository RustDesk, altrimenti l'applicazione potrebbe non essere in grado di trovare le risorse richieste. Nota inoltre che altri sottocomandi cargo come `install` o `run` non sono attualmente supportati tramite questo metodo poiché installerebbero o eseguirebbero il programma all'interno del container anziché nell'host.
Nota inoltre che altri sottocomandi cargo come `install` o `run` non sono attualmente supportati tramite questo metodo poiché installerebbero o eseguirebbero il programma all'interno del container anziché nell'host.
## Struttura dei file ## Struttura dei file
- **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: codec video, config, wrapper tcp/udp, protobuf, funzioni per il trasferimento file, e altre funzioni utili. - **[libs/hbb_common](https://github.com/rustdesk/rustdesk/tree/master/libs/hbb_common)**: codec video, config, wrapper tcp/udp, protobuf, funzioni per il trasferimento file, e altre funzioni utili.
- **[libs/scrap](https://github.com/rustdesk/rustdesk/tree/master/libs/scrap)**: cattura dello schermo - **[libs/scrap](https://github.com/rustdesk/rustdesk/tree/master/libs/scrap)**: cattura dello schermo
- **[libs/enigo](https://github.com/rustdesk/rustdesk/tree/master/libs/enigo)**: controllo tastiera/mouse specifico della piattaforma - **[libs/enigo](https://github.com/rustdesk/rustdesk/tree/master/libs/enigo)**: controllo tastiera/mouse specifico della piattaforma
- **[src/ui](https://github.com/rustdesk/rustdesk/tree/master/src/ui)**: GUI - **[libs/clipboard](https://github.com/rustdesk/rustdesk/tree/master/libs/clipboard)**: implementazione del copia e incolla dei file per Windows, Linux, macOS.
- **[src/ui](https://github.com/rustdesk/rustdesk/tree/master/src/ui)**: Sciter UI obsoleto (deprecato)
- **[src/server](https://github.com/rustdesk/rustdesk/tree/master/src/server)**: servizi audio/appunti/input/video e connessioni di rete - **[src/server](https://github.com/rustdesk/rustdesk/tree/master/src/server)**: servizi audio/appunti/input/video e connessioni di rete
- **[src/client.rs](https://github.com/rustdesk/rustdesk/tree/master/src/client.rs)**: avvio di una connessione peer - **[src/client.rs](https://github.com/rustdesk/rustdesk/tree/master/src/client.rs)**: avvio di una connessione peer
- **[src/rendezvous_mediator.rs](https://github.com/rustdesk/rustdesk/tree/master/src/rendezvous_mediator.rs)**: Comunica con [rustdesk-server](https://github.com/rustdesk/rustdesk-server), attende la connessione remota diretta (TCP hole punching) oppure indiretta (relayed) - **[src/rendezvous_mediator.rs](https://github.com/rustdesk/rustdesk/tree/master/src/rendezvous_mediator.rs)**: comunica con [rustdesk-server](https://github.com/rustdesk/rustdesk-server), attende la connessione remota diretta (TCP hole punching) oppure indiretta (relayed)
- **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)**: codice specifico della piattaforma - **[src/platform](https://github.com/rustdesk/rustdesk/tree/master/src/platform)**: codice specifico della piattaforma
- **[flutter](https://github.com/rustdesk/rustdesk/tree/master/flutter)**: codice Flutter per desktop e mobile
- **[flutter/web/js](https://github.com/rustdesk/rustdesk/tree/master/flutter/web/js)**: JavaScript per client web Flutter
## Schermate ## Schermate

View File

@@ -24,13 +24,6 @@ RustDeskは誰からの貢献も歓迎します。 貢献するには [`docs/CON
[**BINARY DOWNLOAD**](https://github.com/rustdesk/rustdesk/releases) [**BINARY DOWNLOAD**](https://github.com/rustdesk/rustdesk/releases)
## 無料のパブリックサーバー
下記のサーバーは、無料で使用できますが、後々変更されることがあります。これらのサーバーから遠い場合、接続が遅い可能性があります。
| Location | Vendor | Specification |
| --------- | ------------- | ------------------ |
| Germany | Hetzner | 2 vCPU / 4GB RAM |
## 依存関係 ## 依存関係
デスクトップ版ではGUIに [sciter](https://sciter.com/) が使われています。 sciter dynamic library をダウンロードしてください。 デスクトップ版ではGUIに [sciter](https://sciter.com/) が使われています。 sciter dynamic library をダウンロードしてください。

View File

@@ -24,13 +24,6 @@ RustDesk는 모든 기여를 환영합니다. 기여하고자 한다면 [`docs/C
[**BINARY DOWNLOAD**](https://github.com/rustdesk/rustdesk/releases) [**BINARY DOWNLOAD**](https://github.com/rustdesk/rustdesk/releases)
## 무료 퍼블릭 서버
표에 있는 서버는 무료로 사용할 수 있지만 추후 변경될 수도 있습니다. 이 서버에서 멀다면, 네트워크가 느려질 가능성도 있습니다.
| Location | Vendor | Specification |
| --------- | ------------- | ------------------ |
| Germany | Hetzner | 2 vCPU / 4GB RAM |
## 의존관계 ## 의존관계
데스크탑판에는 GUI에 [sciter](https://sciter.com/)가 사용되었습니다. sciter dynamic library 를 다운로드해주세요. 데스크탑판에는 GUI에 [sciter](https://sciter.com/)가 사용되었습니다. sciter dynamic library 를 다운로드해주세요.

View File

@@ -19,13 +19,6 @@
[**BINARY DOWNLOAD**](https://github.com/rustdesk/rustdesk/releases) [**BINARY DOWNLOAD**](https://github.com/rustdesk/rustdesk/releases)
## സൗജന്യ പൊതു സെർവറുകൾ
നിങ്ങൾ സൗജന്യമായി ഉപയോഗിക്കുന്ന സെർവറുകൾ ചുവടെയുണ്ട്, അത് സമയത്തിനനുസരിച്ച് മാറിയേക്കാം. നിങ്ങൾ ഇവയിലൊന്നിനോട് അടുത്തല്ലെങ്കിൽ, നിങ്ങളുടെ നെറ്റ്‌വർക്ക് സ്ലോ ആയേക്കാം.
| സ്ഥാനം | കച്ചവടക്കാരൻ | വിവരണം |
| --------- | ------------- | ------------------ |
| Germany | Hetzner | 2 vCPU / 4GB RAM |
## ഡിപെൻഡൻസികൾ ## ഡിപെൻഡൻസികൾ
ഡെസ്‌ക്‌ടോപ്പ് പതിപ്പുകൾ GUI-യ്‌ക്കായി [sciter](https://sciter.com/) ഉപയോഗിക്കുന്നു, ദയവായി സ്‌സൈറ്റർ ഡൈനാമിക് ലൈബ്രറി സ്വയം ഡൗൺലോഡ് ചെയ്യുക. ഡെസ്‌ക്‌ടോപ്പ് പതിപ്പുകൾ GUI-യ്‌ക്കായി [sciter](https://sciter.com/) ഉപയോഗിക്കുന്നു, ദയവായി സ്‌സൈറ്റർ ഡൈനാമിക് ലൈബ്രറി സ്വയം ഡൗൺലോഡ് ചെയ്യുക.

View File

@@ -27,22 +27,6 @@ RustDesk verwelkomt bijdragen van iedereen. Zie [`docs/CONTRIBUTING.md`](CONTRIB
alt="Download het op F-Droid" alt="Download het op F-Droid"
height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb) height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
## Gratis openbare servers
Hieronder staan de servers die u gratis gebruikt, ze kunnen in de loop van de tijd veranderen. Als u niet in de buurt van een van deze servers bevindt, kan uw vervinding langzamer zijn.
| Locatie | Aanbieder | Specificaties |
| --------- | ------------- | ------------------ |
| Duitsland | Hetzner | 2 vCPU / 4GB RAM |
| Oekraine (Kyiv) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4GB RAM |
## Dev Container
[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Container&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/rustdesk/rustdesk)
Als u VS Code en Docker al hebt geinstalleerd, kunt u op de bovenstaande badge klikken om te beginnen. Door te klikken zal VS Code automatisch de Dev Containers-extensie installeren indien nodig, de broncode klonen naar een containervolume en een dev container opstarten voor gebruik.
Bekijk [DEVCONTAINER.md](docs/DEVCONTAINER.md) voor meer informatie.
## Afhankelijkheden ## Afhankelijkheden
Desktop versies gebruiken [sciter](https://sciter.com/) of Flutter voor GUI, deze handleiding is alleen voor Sciter. Desktop versies gebruiken [sciter](https://sciter.com/) of Flutter voor GUI, deze handleiding is alleen voor Sciter.

View File

@@ -29,22 +29,6 @@ RustDesk zaprasza do współpracy każdego. Zobacz [`docs/CONTRIBUTING-PL.md`](C
alt="Get it on F-Droid" alt="Get it on F-Droid"
height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb) height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
## Darmowe Serwery Publiczne
Poniżej znajdują się serwery, z których można korzystać za darmo, może się to zmienić z upływem czasu. Jeśli nie znajdujesz się w pobliżu jednego z nich, Twoja prędkość połączenia może być niska.
| Lokalizacja | Dostawca | Specyfikacja |
| --------- | ------------- | ------------------ |
| Niemcy | Hetzner | 2 vCPU / 4GB RAM |
| Ukraina (Kijów) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4GB RAM |
## Konterner Programisty (Dev Container)
[![Otwórz w Kontenerze programisty](https://img.shields.io/static/v1?label=Dev%20Container&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/rustdesk/rustdesk)
Jeżeli masz zainstalowany VS Code i Docker, możesz kliknąć w powyższy link, aby rozpocząć. Kliknięcie spowoduje automatyczną instalację rozszrzenia Kontenera Programisty w VS Code (jeżeli wymagany), sklonuje kod źródłowy do kontenera, i przygotuje kontener do użycia.
Więcej informacji w pliku [DEVCONTAINER-PL.md](docs/DEVCONTAINER-PL.md) for more info.
## Zależności ## Zależności
Wersje desktopowe używają [sciter](https://sciter.com/) dla GUI, proszę pobrać samodzielnie bibliotekę sciter. Wersje desktopowe używają [sciter](https://sciter.com/) dla GUI, proszę pobrać samodzielnie bibliotekę sciter.

View File

@@ -19,14 +19,6 @@ RustDesk acolhe contribuições de todos. Leia [`docs/CONTRIBUTING.md`](CONTRIBU
[**DOWNLOAD DE BINÁRIOS**](https://github.com/rustdesk/rustdesk/releases) [**DOWNLOAD DE BINÁRIOS**](https://github.com/rustdesk/rustdesk/releases)
## Servidores Públicos Grátis
Abaixo estão os servidores que você está utilizando de graça, ele pode mudar com o tempo. Se você não está próximo de algum deles, sua conexão pode ser lenta.
| Localização | Fornecedor | Especificações |
| ----------- | ------------- | ------------------ |
| Germany | Hetzner | 2 vCPU / 4GB RAM |
## Dependências ## Dependências
Versões de desktop utilizam [sciter](https://sciter.com/) para a GUI, por favor baixe a biblioteca dinâmica sciter por conta própria. Versões de desktop utilizam [sciter](https://sciter.com/) para a GUI, por favor baixe a biblioteca dinâmica sciter por conta própria.

View File

@@ -28,13 +28,6 @@ RustDesk приветствует вклад каждого. Ознакомьт
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" alt="Get it on F-Droid" height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb) [<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" alt="Get it on F-Droid" height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
## Бесплатные общедоступные серверы
Ниже приведены бесплатные публичные сервера, используемые по умолчанию. Имейте ввиду, они могут меняться со временем. Также стоит отметить, что скорость работы сети зависит от вашего местоположения и расстояния до серверов. Подключение происходит к ближайшему доступному.
| Расположение | Поставщик | Технические характеристики |
| --------- | ------------- | ------------------ |
| Германия | Hetzner | 2 vCPU / 4GB RAM |
## Зависимости ## Зависимости
Настольные версии используют [sciter](https://sciter.com/) для графического интерфейса, загрузите динамическую библиотеку sciter самостоятельно. Настольные версии используют [sciter](https://sciter.com/) для графического интерфейса, загрузите динамическую библиотеку sciter самостоятельно.

View File

@@ -30,23 +30,6 @@ RustDesk, herkesten katkıyı kabul eder. Başlamak için [CONTRIBUTING.md](docs
alt="F-Droid'de Alın" alt="F-Droid'de Alın"
height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb) height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
## Ücretsiz Genel Sunucular
Aşağıda ücretsiz olarak kullandığınız sunucular listelenmiştir, zaman içinde değişebilirler. Eğer bunlardan birine yakın değilseniz, ağınız yavaş olabilir.
| Konum | Sağlayıcı | Özellikler |
| --------- | ------------- | ------------------ |
| Almanya | [Hetzner](https://www.hetzner.com) | 2 vCPU / 4 GB RAM |
| Almanya | [Codext](https://codext.de) | 4 vCPU / 8 GB RAM |
| Ukrayna (Kiev) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4 GB RAM |
## Geliştirici Konteyneri
[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Container&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/rustdesk/rustdesk)
Eğer zaten VS Code ve Docker kurulu ise yukarıdaki rozete tıklayarak başlayabilirsiniz. Tıklamak, VS Code'un gerektiğinde Dev Konteyner eklentisini otomatik olarak yüklemesine, kaynak kodunu bir konteyner hacmine klonlamasına ve kullanım için bir geliştirici konteyneri başlatmasına neden olur.
Daha fazla bilgi için [DEVCONTAINER.md](docs/DEVCONTAINER-TR.md) belgesine bakabilirsiniz.
## Bağımlılıklar ## Bağımlılıklar
Masaüstü sürümleri GUI için Masaüstü sürümleri GUI için

View File

@@ -31,22 +31,6 @@ RustDesk вітає внесок кожного. Ознайомтеся з [CONT
alt="Get it on F-Droid" alt="Get it on F-Droid"
height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb) height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
## Безкоштовні загальнодоступні сервери
Нижче наведені сервери, для безкоштовного використання, вони можуть змінюватися з часом. Якщо ви не перебуваєте поруч з одним із них, ваша мережа може працювати повільно.
| Місцезнаходження | Постачальник | Технічні характеристики |
| --------- | ------------- | ------------------ |
| Німеччина | [Hetzner](https://www.hetzner.com) | 2 vCPU / 4GB RAM |
| Україна (Київ) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4GB RAM |
## Dev Container
[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Container&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/rustdesk/rustdesk)
Якщо у вас уже встановлено VS Code та Docker, ви можете натиснути значок вище, щоб розпочати. Клацання призведе до того, що VS Code автоматично встановить розширення Dev Containers, якщо це необхідно, клонує вихідний код у том контейнера та розгорне контейнер dev для використання.
Дивіться [DEVCONTAINER.md](docs/DEVCONTAINER.md) для додаткової інформації
## Залежності ## Залежності
Стільничні версії використовують Flutter чи Sciter (застаріле) для графічного інтерфейсу. Ця інструкція лише для Sciter, оскільки він є більш простим та дружнім для початківців. Перегляньте [CI](https://github.com/rustdesk/rustdesk/blob/master/.github/workflows/flutter-build.yml) для збірки версії на Flutter. Стільничні версії використовують Flutter чи Sciter (застаріле) для графічного інтерфейсу. Ця інструкція лише для Sciter, оскільки він є більш простим та дружнім для початківців. Перегляньте [CI](https://github.com/rustdesk/rustdesk/blob/master/.github/workflows/flutter-build.yml) для збірки версії на Flutter.

View File

@@ -27,14 +27,6 @@ Mọi người đều đuợc chào đón để đóng góp vào RustDesk. Để
alt="Get it on F-Droid" alt="Get it on F-Droid"
height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb) height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
## Các Máy Chủ Công Khai Miễn Phí
Dưới đây là những máy chủ mà bạn có thể sử dụng mà không mất phí, chú ý là máy chủ có thể thay đổi theo thời gian. Nếu địa điểm của bạn không gần một trong số những máy chủ này, thì kết nói có thể chậm.
| Địa điểm | Nhà cung cấp | Cấu hình |
| --------- | ------------- | ------------------ |
| Germany | Hetzner | 2 vCPU / 4GB RAM |
## Dependencies ## Dependencies
Phiên bản cho máy tính sử dụng [sciter](https://sciter.com/) cho giao diện của phần mềm, vậy nên bạn cần tự tải về thư viện sciter. Phiên bản cho máy tính sử dụng [sciter](https://sciter.com/) cho giao diện của phần mềm, vậy nên bạn cần tự tải về thư viện sciter.

View File

@@ -30,23 +30,6 @@ RustDesk 期待各位的贡献. 如何参与开发? 详情请看 [CONTRIBUTING.m
alt="Get it on F-Droid" alt="Get it on F-Droid"
height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb) height="80">](https://f-droid.org/en/packages/com.carriez.flutter_hbb)
## 免费的公共服务器
以下是您可以使用的、免费的、会随时更新的公共服务器列表,在国内也许网速会很慢或者无法访问。
| Location | Vendor | Specification |
| --------- | ------------- | ------------------ |
| Germany | [Hetzner](https://www.hetzner.com) | 2 vCPU / 4 GB RAM |
| Ukraine (Kyiv) | [dc.volia](https://dc.volia.com) | 2 vCPU / 4 GB RAM |
## Dev Container
[![在 Dev Containers 中打开](https://img.shields.io/static/v1?label=Dev%20Container&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/rustdesk/rustdesk)
如果你已经安装了 VS Code 和 Docker, 你可以点击上面的徽章开始使用. 点击后, VS Code 将自动安装 Dev Containers 扩展(如果需要),将源代码克隆到容器卷中, 并启动一个 Dev 容器供使用.
Go through [DEVCONTAINER.md](docs/DEVCONTAINER.md) for more info.
## 依赖 ## 依赖
桌面版本界面使用[sciter](https://sciter.com/), 请自行下载。 桌面版本界面使用[sciter](https://sciter.com/), 请自行下载。

View File

@@ -20,7 +20,7 @@
"sed -i '/^Icon=/ c\\Icon=com.rustdesk.RustDesk' /app/share/applications/com.rustdesk.RustDesk.desktop", "sed -i '/^Icon=/ c\\Icon=com.rustdesk.RustDesk' /app/share/applications/com.rustdesk.RustDesk.desktop",
"sed -i '/^Icon=/ c\\Icon=com.rustdesk.RustDesk' /app/share/applications/rustdesk-link.desktop", "sed -i '/^Icon=/ c\\Icon=com.rustdesk.RustDesk' /app/share/applications/rustdesk-link.desktop",
"mv /app/share/icons/hicolor/scalable/apps/rustdesk.svg /app/share/icons/hicolor/scalable/apps/com.rustdesk.RustDesk.svg", "mv /app/share/icons/hicolor/scalable/apps/rustdesk.svg /app/share/icons/hicolor/scalable/apps/com.rustdesk.RustDesk.svg",
"for size in 16 24 32 48 64 128 256 512; do\n rsvg-convert -w $size -h $size -f png -o $size.png logo.svg\n install -Dm644 $size.png /app/share/icons/hicolor/${size}x${size}/apps/com.rustdesk.RustDesk.png\n done" "for size in 16 24 32 48 64 128 256 512; do\n rsvg-convert -w $size -h $size -f png -o $size.png scalable.svg\n install -Dm644 $size.png /app/share/icons/hicolor/${size}x${size}/apps/com.rustdesk.RustDesk.png\n done"
], ],
"cleanup": ["/include", "/lib/pkgconfig", "/share/gtk-doc"], "cleanup": ["/include", "/lib/pkgconfig", "/share/gtk-doc"],
"sources": [ "sources": [
@@ -30,7 +30,7 @@
}, },
{ {
"type": "file", "type": "file",
"path": "../res/logo.svg" "path": "../res/scalable.svg"
} }
] ]
} }

1
flutter/.gitignore vendored
View File

@@ -32,7 +32,6 @@
/build/ /build/
# Web related # Web related
lib/generated_plugin_registrant.dart
# Symbolication related # Symbolication related
app.*.symbols app.*.symbols

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,12 +1,9 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:ffi' hide Size;
import 'dart:io';
import 'dart:math'; import 'dart:math';
import 'package:back_button_interceptor/back_button_interceptor.dart'; import 'package:back_button_interceptor/back_button_interceptor.dart';
import 'package:desktop_multi_window/desktop_multi_window.dart'; import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:ffi/ffi.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -25,7 +22,6 @@ import 'package:get/get.dart';
import 'package:uni_links/uni_links.dart'; import 'package:uni_links/uni_links.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import 'package:win32/win32.dart' as win32;
import 'package:window_manager/window_manager.dart'; import 'package:window_manager/window_manager.dart';
import 'package:window_size/window_size.dart' as window_size; import 'package:window_size/window_size.dart' as window_size;
@@ -33,20 +29,30 @@ import '../consts.dart';
import 'common/widgets/overlay.dart'; import 'common/widgets/overlay.dart';
import 'mobile/pages/file_manager_page.dart'; import 'mobile/pages/file_manager_page.dart';
import 'mobile/pages/remote_page.dart'; import 'mobile/pages/remote_page.dart';
import 'desktop/pages/remote_page.dart' as desktop_remote;
import 'package:flutter_hbb/desktop/widgets/remote_toolbar.dart';
import 'models/input_model.dart'; import 'models/input_model.dart';
import 'models/model.dart'; import 'models/model.dart';
import 'models/platform_model.dart'; import 'models/platform_model.dart';
import 'package:flutter_hbb/native/win32.dart'
if (dart.library.html) 'package:flutter_hbb/web/win32.dart';
import 'package:flutter_hbb/native/common.dart'
if (dart.library.html) 'package:flutter_hbb/web/common.dart';
final globalKey = GlobalKey<NavigatorState>(); final globalKey = GlobalKey<NavigatorState>();
final navigationBarKey = GlobalKey(); final navigationBarKey = GlobalKey();
final isAndroid = Platform.isAndroid; final isAndroid = isAndroid_;
final isIOS = Platform.isIOS; final isIOS = isIOS_;
final isDesktop = Platform.isWindows || Platform.isMacOS || Platform.isLinux; final isWindows = isWindows_;
var isWeb = false; final isMacOS = isMacOS_;
var isWebDesktop = false; final isLinux = isLinux_;
final isDesktop = isDesktop_;
final isWeb = isWeb_;
final isWebDesktop = isWebDesktop_;
var isMobile = isAndroid || isIOS; var isMobile = isAndroid || isIOS;
var version = ""; var version = '';
int androidVersion = 0; int androidVersion = 0;
/// only available for Windows target /// only available for Windows target
@@ -56,6 +62,8 @@ DesktopType? desktopType;
bool get isMainDesktopWindow => bool get isMainDesktopWindow =>
desktopType == DesktopType.main || desktopType == DesktopType.cm; desktopType == DesktopType.main || desktopType == DesktopType.cm;
String get screenInfo => screenInfo_;
/// Check if the app is running with single view mode. /// Check if the app is running with single view mode.
bool isSingleViewApp() { bool isSingleViewApp() {
return desktopType == DesktopType.cm; return desktopType == DesktopType.cm;
@@ -229,11 +237,13 @@ class MyTheme {
); );
static SwitchThemeData switchTheme() { static SwitchThemeData switchTheme() {
return SwitchThemeData(splashRadius: isDesktop ? 0 : kRadialReactionRadius); return SwitchThemeData(
splashRadius: (isDesktop || isWebDesktop) ? 0 : kRadialReactionRadius);
} }
static RadioThemeData radioTheme() { static RadioThemeData radioTheme() {
return RadioThemeData(splashRadius: isDesktop ? 0 : kRadialReactionRadius); return RadioThemeData(
splashRadius: (isDesktop || isWebDesktop) ? 0 : kRadialReactionRadius);
} }
// Checkbox // Checkbox
@@ -282,7 +292,7 @@ class MyTheme {
static EdgeInsets dialogContentPadding({bool actions = true}) { static EdgeInsets dialogContentPadding({bool actions = true}) {
final double p = dialogPadding; final double p = dialogPadding;
return isDesktop return (isDesktop || isWebDesktop)
? EdgeInsets.fromLTRB(p, p, p, actions ? (p - 4) : p) ? EdgeInsets.fromLTRB(p, p, p, actions ? (p - 4) : p)
: EdgeInsets.fromLTRB(p, p, p, actions ? (p / 2) : p); : EdgeInsets.fromLTRB(p, p, p, actions ? (p / 2) : p);
} }
@@ -290,12 +300,12 @@ class MyTheme {
static EdgeInsets dialogActionsPadding() { static EdgeInsets dialogActionsPadding() {
final double p = dialogPadding; final double p = dialogPadding;
return isDesktop return (isDesktop || isWebDesktop)
? EdgeInsets.fromLTRB(p, 0, p, (p - 4)) ? EdgeInsets.fromLTRB(p, 0, p, (p - 4))
: EdgeInsets.fromLTRB(p, 0, (p - mobileTextButtonPaddingLR), (p / 2)); : EdgeInsets.fromLTRB(p, 0, (p - mobileTextButtonPaddingLR), (p / 2));
} }
static EdgeInsets dialogButtonPadding = isDesktop static EdgeInsets dialogButtonPadding = (isDesktop || isWebDesktop)
? EdgeInsets.only(left: dialogPadding) ? EdgeInsets.only(left: dialogPadding)
: EdgeInsets.only(left: dialogPadding / 3); : EdgeInsets.only(left: dialogPadding / 3);
@@ -367,10 +377,10 @@ class MyTheme {
labelColor: Colors.black87, labelColor: Colors.black87,
), ),
tooltipTheme: tooltipTheme(), tooltipTheme: tooltipTheme(),
splashColor: isDesktop ? Colors.transparent : null, splashColor: (isDesktop || isWebDesktop) ? Colors.transparent : null,
highlightColor: isDesktop ? Colors.transparent : null, highlightColor: (isDesktop || isWebDesktop) ? Colors.transparent : null,
splashFactory: isDesktop ? NoSplash.splashFactory : null, splashFactory: (isDesktop || isWebDesktop) ? NoSplash.splashFactory : null,
textButtonTheme: isDesktop textButtonTheme: (isDesktop || isWebDesktop)
? TextButtonThemeData( ? TextButtonThemeData(
style: TextButton.styleFrom( style: TextButton.styleFrom(
splashFactory: NoSplash.splashFactory, splashFactory: NoSplash.splashFactory,
@@ -410,7 +420,9 @@ class MyTheme {
color: Colors.white, color: Colors.white,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
side: BorderSide( side: BorderSide(
color: isDesktop ? Color(0xFFECECEC) : Colors.transparent), color: (isDesktop || isWebDesktop)
? Color(0xFFECECEC)
: Colors.transparent),
borderRadius: BorderRadius.all(Radius.circular(8.0)), borderRadius: BorderRadius.all(Radius.circular(8.0)),
)), )),
).copyWith( ).copyWith(
@@ -436,7 +448,7 @@ class MyTheme {
), ),
), ),
scrollbarTheme: scrollbarThemeDark, scrollbarTheme: scrollbarThemeDark,
inputDecorationTheme: isDesktop inputDecorationTheme: (isDesktop || isWebDesktop)
? InputDecorationTheme( ? InputDecorationTheme(
fillColor: Color(0xFF24252B), fillColor: Color(0xFF24252B),
filled: true, filled: true,
@@ -463,10 +475,10 @@ class MyTheme {
labelColor: Colors.white70, labelColor: Colors.white70,
), ),
tooltipTheme: tooltipTheme(), tooltipTheme: tooltipTheme(),
splashColor: isDesktop ? Colors.transparent : null, splashColor: (isDesktop || isWebDesktop) ? Colors.transparent : null,
highlightColor: isDesktop ? Colors.transparent : null, highlightColor: (isDesktop || isWebDesktop) ? Colors.transparent : null,
splashFactory: isDesktop ? NoSplash.splashFactory : null, splashFactory: (isDesktop || isWebDesktop) ? NoSplash.splashFactory : null,
textButtonTheme: isDesktop textButtonTheme: (isDesktop || isWebDesktop)
? TextButtonThemeData( ? TextButtonThemeData(
style: TextButton.styleFrom( style: TextButton.styleFrom(
splashFactory: NoSplash.splashFactory, splashFactory: NoSplash.splashFactory,
@@ -631,8 +643,12 @@ closeConnection({String? id}) {
gFFI.chatModel.hideChatOverlay(); gFFI.chatModel.hideChatOverlay();
Navigator.popUntil(globalKey.currentContext!, ModalRoute.withName("/")); Navigator.popUntil(globalKey.currentContext!, ModalRoute.withName("/"));
} else { } else {
final controller = Get.find<DesktopTabController>(); if (isWeb) {
controller.closeBy(id); Navigator.popUntil(globalKey.currentContext!, ModalRoute.withName("/"));
} else {
final controller = Get.find<DesktopTabController>();
controller.closeBy(id);
}
} }
} }
@@ -810,7 +826,7 @@ class OverlayDialogManager {
Offstage( Offstage(
offstage: !showCancel, offstage: !showCancel,
child: Center( child: Center(
child: isDesktop child: (isDesktop || isWebDesktop)
? dialogButton('Cancel', onPressed: cancel) ? dialogButton('Cancel', onPressed: cancel)
: TextButton( : TextButton(
style: flatButtonStyle, style: flatButtonStyle,
@@ -1285,7 +1301,7 @@ class AndroidPermissionManager {
} }
static Future<bool> check(String type) { static Future<bool> check(String type) {
if (isDesktop) { if (isDesktop || isWeb) {
return Future.value(true); return Future.value(true);
} }
return gFFI.invokeMethod("check_permission", type); return gFFI.invokeMethod("check_permission", type);
@@ -1299,7 +1315,7 @@ class AndroidPermissionManager {
/// We use XXPermissions to request permissions, /// We use XXPermissions to request permissions,
/// for supported types, see https://github.com/getActivity/XXPermissions/blob/e46caea32a64ad7819df62d448fb1c825481cd28/library/src/main/java/com/hjq/permissions/Permission.java /// for supported types, see https://github.com/getActivity/XXPermissions/blob/e46caea32a64ad7819df62d448fb1c825481cd28/library/src/main/java/com/hjq/permissions/Permission.java
static Future<bool> request(String type) { static Future<bool> request(String type) {
if (isDesktop) { if (isDesktop || isWeb) {
return Future.value(true); return Future.value(true);
} }
@@ -1521,6 +1537,12 @@ class LastWindowPosition {
} }
} }
String get windowFramePrefix =>
kWindowPrefix +
(bind.isIncomingOnly()
? "incoming_"
: (bind.isOutgoingOnly() ? "outgoing_" : ""));
/// Save window position and size on exit /// Save window position and size on exit
/// Note that windowId must be provided if it's subwindow /// Note that windowId must be provided if it's subwindow
Future<void> saveWindowPosition(WindowType type, {int? windowId}) async { Future<void> saveWindowPosition(WindowType type, {int? windowId}) async {
@@ -1533,10 +1555,10 @@ Future<void> saveWindowPosition(WindowType type, {int? windowId}) async {
late Size sz; late Size sz;
late bool isMaximized; late bool isMaximized;
bool isFullscreen = stateGlobal.fullscreen.isTrue || bool isFullscreen = stateGlobal.fullscreen.isTrue ||
(Platform.isMacOS && stateGlobal.closeOnFullscreen == true); (isMacOS && stateGlobal.closeOnFullscreen == true);
setFrameIfMaximized() { setFrameIfMaximized() {
if (isMaximized) { if (isMaximized) {
final pos = bind.getLocalFlutterOption(k: kWindowPrefix + type.name); final pos = bind.getLocalFlutterOption(k: windowFramePrefix + type.name);
var lpos = LastWindowPosition.loadFromString(pos); var lpos = LastWindowPosition.loadFromString(pos);
position = Offset( position = Offset(
lpos?.offsetWidth ?? position.dx, lpos?.offsetHeight ?? position.dy); lpos?.offsetWidth ?? position.dx, lpos?.offsetHeight ?? position.dy);
@@ -1546,7 +1568,13 @@ Future<void> saveWindowPosition(WindowType type, {int? windowId}) async {
switch (type) { switch (type) {
case WindowType.Main: case WindowType.Main:
isMaximized = await windowManager.isMaximized(); // Checking `bind.isIncomingOnly()` is a simple workaround for MacOS.
// `await windowManager.isMaximized()` will always return true
// if is not resizable. The reason is unknown.
//
// `windowManager.setResizable(!bind.isIncomingOnly());` in main.dart
isMaximized =
bind.isIncomingOnly() ? false : await windowManager.isMaximized();
position = await windowManager.getPosition(); position = await windowManager.getPosition();
sz = await windowManager.getSize(); sz = await windowManager.getSize();
setFrameIfMaximized(); setFrameIfMaximized();
@@ -1566,7 +1594,7 @@ Future<void> saveWindowPosition(WindowType type, {int? windowId}) async {
setFrameIfMaximized(); setFrameIfMaximized();
break; break;
} }
if (Platform.isWindows) { if (isWindows) {
const kMinOffset = -10000; const kMinOffset = -10000;
const kMaxOffset = 10000; const kMaxOffset = 10000;
if (position.dx < kMinOffset || if (position.dx < kMinOffset ||
@@ -1584,7 +1612,7 @@ Future<void> saveWindowPosition(WindowType type, {int? windowId}) async {
"Saving frame: $windowId: ${pos.width}/${pos.height}, offset:${pos.offsetWidth}/${pos.offsetHeight}, isMaximized:${pos.isMaximized}, isFullscreen:${pos.isFullscreen}"); "Saving frame: $windowId: ${pos.width}/${pos.height}, offset:${pos.offsetWidth}/${pos.offsetHeight}, isMaximized:${pos.isMaximized}, isFullscreen:${pos.isFullscreen}");
await bind.setLocalFlutterOption( await bind.setLocalFlutterOption(
k: kWindowPrefix + type.name, v: pos.toString()); k: windowFramePrefix + type.name, v: pos.toString());
if (type == WindowType.RemoteDesktop && windowId != null) { if (type == WindowType.RemoteDesktop && windowId != null) {
await _saveSessionWindowPosition( await _saveSessionWindowPosition(
@@ -1599,7 +1627,7 @@ Future _saveSessionWindowPosition(WindowType windowType, int windowId,
getPeerPos(String peerId) { getPeerPos(String peerId) {
if (isMaximized) { if (isMaximized) {
final peerPos = bind.mainGetPeerFlutterOptionSync( final peerPos = bind.mainGetPeerFlutterOptionSync(
id: peerId, k: kWindowPrefix + windowType.name); id: peerId, k: windowFramePrefix + windowType.name);
var lpos = LastWindowPosition.loadFromString(peerPos); var lpos = LastWindowPosition.loadFromString(peerPos);
return LastWindowPosition( return LastWindowPosition(
lpos?.width ?? pos.offsetWidth, lpos?.width ?? pos.offsetWidth,
@@ -1618,7 +1646,7 @@ Future _saveSessionWindowPosition(WindowType windowType, int windowId,
for (final peerId in remoteList.split(',')) { for (final peerId in remoteList.split(',')) {
bind.mainSetPeerFlutterOptionSync( bind.mainSetPeerFlutterOptionSync(
id: peerId, id: peerId,
k: kWindowPrefix + windowType.name, k: windowFramePrefix + windowType.name,
v: getPeerPos(peerId)); v: getPeerPos(peerId));
} }
} }
@@ -1736,14 +1764,14 @@ Future<bool> restoreWindowPosition(WindowType type,
// Because the session may not be read at this time. // Because the session may not be read at this time.
if (desktopType == DesktopType.main) { if (desktopType == DesktopType.main) {
pos = bind.mainGetPeerFlutterOptionSync( pos = bind.mainGetPeerFlutterOptionSync(
id: peerId, k: kWindowPrefix + type.name); id: peerId, k: windowFramePrefix + type.name);
} else { } else {
pos = await bind.sessionGetFlutterOptionByPeerId( pos = await bind.sessionGetFlutterOptionByPeerId(
id: peerId, k: kWindowPrefix + type.name); id: peerId, k: windowFramePrefix + type.name);
} }
isRemotePeerPos = pos != null; isRemotePeerPos = pos != null;
} }
pos ??= bind.getLocalFlutterOption(k: kWindowPrefix + type.name); pos ??= bind.getLocalFlutterOption(k: windowFramePrefix + type.name);
var lpos = LastWindowPosition.loadFromString(pos); var lpos = LastWindowPosition.loadFromString(pos);
if (lpos == null) { if (lpos == null) {
@@ -1790,9 +1818,13 @@ Future<bool> restoreWindowPosition(WindowType type,
} }
if (lpos.isMaximized == true) { if (lpos.isMaximized == true) {
await restorePos(); await restorePos();
await windowManager.maximize(); if (!(bind.isIncomingOnly() || bind.isOutgoingOnly())) {
await windowManager.maximize();
}
} else { } else {
await windowManager.setSize(size); if (!bind.isIncomingOnly() || bind.isOutgoingOnly()) {
await windowManager.setSize(size);
}
await restorePos(); await restorePos();
} }
return true; return true;
@@ -1833,13 +1865,14 @@ Future<bool> restoreWindowPosition(WindowType type,
/// initUniLinks should only be used on macos/windows. /// initUniLinks should only be used on macos/windows.
/// we use dbus for linux currently. /// we use dbus for linux currently.
Future<bool> initUniLinks() async { Future<bool> initUniLinks() async {
if (Platform.isLinux) { if (isLinux) {
return false; return false;
} }
// check cold boot // check cold boot
try { try {
final initialLink = await getInitialLink(); final initialLink = await getInitialLink();
if (initialLink == null) { print("initialLink: $initialLink");
if (initialLink == null || initialLink.isEmpty) {
return false; return false;
} }
return handleUriLink(uriString: initialLink); return handleUriLink(uriString: initialLink);
@@ -1855,7 +1888,7 @@ Future<bool> initUniLinks() async {
/// ///
/// Returns a [StreamSubscription] which can listen the uni links. /// Returns a [StreamSubscription] which can listen the uni links.
StreamSubscription? listenUniLinks({handleByFlutter = true}) { StreamSubscription? listenUniLinks({handleByFlutter = true}) {
if (Platform.isLinux) { if (isLinux) {
return null; return null;
} }
@@ -1889,7 +1922,7 @@ bool handleUriLink({List<String>? cmdArgs, Uri? uri, String? uriString}) {
if (cmdArgs != null && cmdArgs.isNotEmpty) { if (cmdArgs != null && cmdArgs.isNotEmpty) {
args = cmdArgs; args = cmdArgs;
// rustdesk <uri link> // rustdesk <uri link>
if (args[0].startsWith(kUniLinksPrefix)) { if (args[0].startsWith(bind.mainUriPrefixSync())) {
final uri = Uri.tryParse(args[0]); final uri = Uri.tryParse(args[0]);
if (uri != null) { if (uri != null) {
args = urlLinkToCmdArgs(uri); args = urlLinkToCmdArgs(uri);
@@ -2003,7 +2036,7 @@ List<String>? urlLinkToCmdArgs(Uri uri) {
command = '--connect'; command = '--connect';
id = uri.path.substring("/new/".length); id = uri.path.substring("/new/".length);
} else if (uri.authority == "config") { } else if (uri.authority == "config") {
if (Platform.isAndroid || Platform.isIOS) { if (isAndroid || isIOS) {
final config = uri.path.substring("/".length); final config = uri.path.substring("/".length);
// add a timer to make showToast work // add a timer to make showToast work
Timer(Duration(seconds: 1), () { Timer(Duration(seconds: 1), () {
@@ -2012,7 +2045,7 @@ List<String>? urlLinkToCmdArgs(Uri uri) {
} }
return null; return null;
} else if (uri.authority == "password") { } else if (uri.authority == "password") {
if (Platform.isAndroid || Platform.isIOS) { if (isAndroid || isIOS) {
final password = uri.path.substring("/".length); final password = uri.path.substring("/".length);
if (password.isNotEmpty) { if (password.isNotEmpty) {
Timer(Duration(seconds: 1), () async { Timer(Duration(seconds: 1), () async {
@@ -2079,19 +2112,28 @@ List<String>? urlLinkToCmdArgs(Uri uri) {
return null; return null;
} }
connectMainDesktop( connectMainDesktop(String id,
String id, { {required bool isFileTransfer,
required bool isFileTransfer, required bool isTcpTunneling,
required bool isTcpTunneling, required bool isRDP,
required bool isRDP, bool? forceRelay,
bool? forceRelay, String? password,
}) async { bool? isSharedPassword}) async {
if (isFileTransfer) { if (isFileTransfer) {
await rustDeskWinManager.newFileTransfer(id, forceRelay: forceRelay); await rustDeskWinManager.newFileTransfer(id,
password: password,
isSharedPassword: isSharedPassword,
forceRelay: forceRelay);
} else if (isTcpTunneling || isRDP) { } else if (isTcpTunneling || isRDP) {
await rustDeskWinManager.newPortForward(id, isRDP, forceRelay: forceRelay); await rustDeskWinManager.newPortForward(id, isRDP,
password: password,
isSharedPassword: isSharedPassword,
forceRelay: forceRelay);
} else { } else {
await rustDeskWinManager.newRemoteDesktop(id, forceRelay: forceRelay); await rustDeskWinManager.newRemoteDesktop(id,
password: password,
isSharedPassword: isSharedPassword,
forceRelay: forceRelay);
} }
} }
@@ -2099,14 +2141,13 @@ connectMainDesktop(
/// If [isFileTransfer], starts a session only for file transfer. /// If [isFileTransfer], starts a session only for file transfer.
/// If [isTcpTunneling], starts a session only for tcp tunneling. /// If [isTcpTunneling], starts a session only for tcp tunneling.
/// If [isRDP], starts a session only for rdp. /// If [isRDP], starts a session only for rdp.
connect( connect(BuildContext context, String id,
BuildContext context, {bool isFileTransfer = false,
String id, { bool isTcpTunneling = false,
bool isFileTransfer = false, bool isRDP = false,
bool isTcpTunneling = false, bool forceRelay = false,
bool isRDP = false, String? password,
bool forceRelay = false, bool? isSharedPassword}) async {
}) async {
if (id == '') return; if (id == '') return;
if (!isDesktop || desktopType == DesktopType.main) { if (!isDesktop || desktopType == DesktopType.main) {
try { try {
@@ -2134,6 +2175,8 @@ connect(
isFileTransfer: isFileTransfer, isFileTransfer: isFileTransfer,
isTcpTunneling: isTcpTunneling, isTcpTunneling: isTcpTunneling,
isRDP: isRDP, isRDP: isRDP,
password: password,
isSharedPassword: isSharedPassword,
forceRelay: forceRelay2, forceRelay: forceRelay2,
); );
} else { } else {
@@ -2142,6 +2185,8 @@ connect(
'isFileTransfer': isFileTransfer, 'isFileTransfer': isFileTransfer,
'isTcpTunneling': isTcpTunneling, 'isTcpTunneling': isTcpTunneling,
'isRDP': isRDP, 'isRDP': isRDP,
'password': password,
'isSharedPassword': isSharedPassword,
'forceRelay': forceRelay, 'forceRelay': forceRelay,
}); });
} }
@@ -2155,16 +2200,34 @@ connect(
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) => FileManagerPage(id: id), builder: (BuildContext context) => FileManagerPage(
id: id, password: password, isSharedPassword: isSharedPassword),
), ),
); );
} else { } else {
Navigator.push( if (isWebDesktop) {
context, Navigator.push(
MaterialPageRoute( context,
builder: (BuildContext context) => RemotePage(id: id), MaterialPageRoute(
), builder: (BuildContext context) => desktop_remote.RemotePage(
); key: ValueKey(id),
id: id,
toolbarState: ToolbarState(),
password: password,
forceRelay: forceRelay,
isSharedPassword: isSharedPassword,
),
),
);
} else {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => RemotePage(
id: id, password: password, isSharedPassword: isSharedPassword),
),
);
}
} }
} }
@@ -2218,7 +2281,7 @@ Future<void> reloadAllWindows() async {
/// [Note] /// [Note]
/// Portable build is only available on Windows. /// Portable build is only available on Windows.
bool isRunningInPortableMode() { bool isRunningInPortableMode() {
if (!Platform.isWindows) { if (!isWindows) {
return false; return false;
} }
return bool.hasEnvironment(kEnvPortableExecutable); return bool.hasEnvironment(kEnvPortableExecutable);
@@ -2231,7 +2294,7 @@ Future<void> onActiveWindowChanged() async {
if (rustDeskWinManager.getActiveWindows().isEmpty) { if (rustDeskWinManager.getActiveWindows().isEmpty) {
// close all sub windows // close all sub windows
try { try {
if (Platform.isLinux) { if (isLinux) {
await Future.wait([ await Future.wait([
saveWindowPosition(WindowType.Main), saveWindowPosition(WindowType.Main),
rustDeskWinManager.closeAllSubWindows() rustDeskWinManager.closeAllSubWindows()
@@ -2245,7 +2308,7 @@ Future<void> onActiveWindowChanged() async {
debugPrint("Start closing RustDesk..."); debugPrint("Start closing RustDesk...");
await windowManager.setPreventClose(false); await windowManager.setPreventClose(false);
await windowManager.close(); await windowManager.close();
if (Platform.isMacOS) { if (isMacOS) {
RdPlatformChannel.instance.terminate(); RdPlatformChannel.instance.terminate();
} }
} }
@@ -2261,7 +2324,7 @@ Timer periodic_immediate(Duration duration, Future<void> Function() callback) {
/// return a human readable windows version /// return a human readable windows version
WindowsTarget getWindowsTarget(int buildNumber) { WindowsTarget getWindowsTarget(int buildNumber) {
if (!Platform.isWindows) { if (!isWindows) {
return WindowsTarget.naw; return WindowsTarget.naw;
} }
if (buildNumber >= 22000) { if (buildNumber >= 22000) {
@@ -2287,35 +2350,7 @@ WindowsTarget getWindowsTarget(int buildNumber) {
/// [Note] /// [Note]
/// Please use this function wrapped with `Platform.isWindows`. /// Please use this function wrapped with `Platform.isWindows`.
int getWindowsTargetBuildNumber() { int getWindowsTargetBuildNumber() {
final rtlGetVersion = DynamicLibrary.open('ntdll.dll').lookupFunction< return getWindowsTargetBuildNumber_();
Void Function(Pointer<win32.OSVERSIONINFOEX>),
void Function(Pointer<win32.OSVERSIONINFOEX>)>('RtlGetVersion');
final osVersionInfo = getOSVERSIONINFOEXPointer();
rtlGetVersion(osVersionInfo);
int buildNumber = osVersionInfo.ref.dwBuildNumber;
calloc.free(osVersionInfo);
return buildNumber;
}
/// Get Windows OS version pointer
///
/// [Note]
/// Please use this function wrapped with `Platform.isWindows`.
Pointer<win32.OSVERSIONINFOEX> getOSVERSIONINFOEXPointer() {
final pointer = calloc<win32.OSVERSIONINFOEX>();
pointer.ref
..dwOSVersionInfoSize = sizeOf<win32.OSVERSIONINFOEX>()
..dwBuildNumber = 0
..dwMajorVersion = 0
..dwMinorVersion = 0
..dwPlatformId = 0
..szCSDVersion = ''
..wServicePackMajor = 0
..wServicePackMinor = 0
..wSuiteMask = 0
..wProductType = 0
..wReserved = 0;
return pointer;
} }
/// Indicating we need to use compatible ui mode. /// Indicating we need to use compatible ui mode.
@@ -2323,7 +2358,7 @@ Pointer<win32.OSVERSIONINFOEX> getOSVERSIONINFOEXPointer() {
/// [Conditions] /// [Conditions]
/// - Windows 7, window will overflow when we use frameless ui. /// - Windows 7, window will overflow when we use frameless ui.
bool get kUseCompatibleUiMode => bool get kUseCompatibleUiMode =>
Platform.isWindows && isWindows &&
const [WindowsTarget.w7].contains(windowsBuildNumber.windowsVersion); const [WindowsTarget.w7].contains(windowsBuildNumber.windowsVersion);
class ServerConfig { class ServerConfig {
@@ -2387,7 +2422,7 @@ Widget dialogButton(String text,
Widget? icon, Widget? icon,
TextStyle? style, TextStyle? style,
ButtonStyle? buttonStyle}) { ButtonStyle? buttonStyle}) {
if (isDesktop) { if (isDesktop || isWebDesktop) {
if (isOutline) { if (isOutline) {
return icon == null return icon == null
? OutlinedButton( ? OutlinedButton(
@@ -2429,19 +2464,20 @@ int versionCmp(String v1, String v2) {
} }
String getWindowName({WindowType? overrideType}) { String getWindowName({WindowType? overrideType}) {
final name = bind.mainGetAppNameSync();
switch (overrideType ?? kWindowType) { switch (overrideType ?? kWindowType) {
case WindowType.Main: case WindowType.Main:
return "RustDesk"; return name;
case WindowType.FileTransfer: case WindowType.FileTransfer:
return "File Transfer - RustDesk"; return "File Transfer - $name";
case WindowType.PortForward: case WindowType.PortForward:
return "Port Forward - RustDesk"; return "Port Forward - $name";
case WindowType.RemoteDesktop: case WindowType.RemoteDesktop:
return "Remote Desktop - RustDesk"; return "Remote Desktop - $name";
default: default:
break; break;
} }
return "RustDesk"; return name;
} }
String getWindowNameWithId(String id, {WindowType? overrideType}) { String getWindowNameWithId(String id, {WindowType? overrideType}) {
@@ -2452,7 +2488,7 @@ Future<void> updateSystemWindowTheme() async {
// Set system window theme for macOS. // Set system window theme for macOS.
final userPreference = MyTheme.getThemeModePreference(); final userPreference = MyTheme.getThemeModePreference();
if (userPreference != ThemeMode.system) { if (userPreference != ThemeMode.system) {
if (Platform.isMacOS) { if (isMacOS) {
await RdPlatformChannel.instance.changeSystemWindowTheme( await RdPlatformChannel.instance.changeSystemWindowTheme(
userPreference == ThemeMode.light userPreference == ThemeMode.light
? SystemWindowTheme.light ? SystemWindowTheme.light
@@ -2540,7 +2576,7 @@ void onCopyFingerprint(String value) {
Future<bool> callMainCheckSuperUserPermission() async { Future<bool> callMainCheckSuperUserPermission() async {
bool checked = await bind.mainCheckSuperUserPermission(); bool checked = await bind.mainCheckSuperUserPermission();
if (Platform.isMacOS) { if (isMacOS) {
await windowManager.show(); await windowManager.show();
} }
return checked; return checked;
@@ -2548,7 +2584,7 @@ Future<bool> callMainCheckSuperUserPermission() async {
Future<void> start_service(bool is_start) async { Future<void> start_service(bool is_start) async {
bool checked = !bind.mainIsInstalled() || bool checked = !bind.mainIsInstalled() ||
!Platform.isMacOS || !isMacOS ||
await callMainCheckSuperUserPermission(); await callMainCheckSuperUserPermission();
if (checked) { if (checked) {
bind.mainSetOption(key: "stop-service", value: is_start ? "" : "Y"); bind.mainSetOption(key: "stop-service", value: is_start ? "" : "Y");
@@ -2973,7 +3009,6 @@ Future<bool> setServerConfig(
await bind.mainSetOption(key: 'relay-server', value: config.relayServer); await bind.mainSetOption(key: 'relay-server', value: config.relayServer);
await bind.mainSetOption(key: 'api-server', value: config.apiServer); await bind.mainSetOption(key: 'api-server', value: config.apiServer);
await bind.mainSetOption(key: 'key', value: config.key); await bind.mainSetOption(key: 'key', value: config.key);
final newApiServer = await bind.mainGetApiServer(); final newApiServer = await bind.mainGetApiServer();
if (oldApiServer.isNotEmpty && if (oldApiServer.isNotEmpty &&
oldApiServer != newApiServer && oldApiServer != newApiServer &&
@@ -3070,3 +3105,53 @@ Color? disabledTextColor(BuildContext context, bool enabled) {
? null ? null
: Theme.of(context).textTheme.titleLarge?.color?.withOpacity(0.6); : Theme.of(context).textTheme.titleLarge?.color?.withOpacity(0.6);
} }
// max 300 x 60
Widget loadLogo() {
return FutureBuilder<ByteData>(
future: rootBundle.load('assets/logo.png'),
builder: (BuildContext context, AsyncSnapshot<ByteData> snapshot) {
if (snapshot.hasData) {
final image = Image.asset(
'assets/logo.png',
fit: BoxFit.contain,
errorBuilder: (ctx, error, stackTrace) {
return Container();
},
);
return Container(
constraints: BoxConstraints(maxWidth: 300, maxHeight: 60),
child: image,
).marginOnly(left: 12, right: 12, top: 12);
}
return const Offstage();
});
}
Widget loadIcon(double size) {
return Image.asset('assets/icon.png',
width: size,
height: size,
errorBuilder: (ctx, error, stackTrace) => SvgPicture.asset(
'assets/icon.svg',
width: size,
height: size,
));
}
var imcomingOnlyHomeSize = Size(280, 300);
Size getIncomingOnlyHomeSize() {
final magicWidth = isWindows ? 11.0 : 2.0;
final magicHeight = 10.0;
return imcomingOnlyHomeSize +
Offset(magicWidth, kDesktopRemoteTabBarHeight + magicHeight);
}
Size getIncomingOnlySettingsSize() {
return Size(768, 600);
}
bool isInHomePage() {
final controller = Get.find<DesktopTabController>();
return controller.state.value.selected == 0;
}

View File

@@ -1,5 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hbb/common.dart';
import 'package:flutter_hbb/consts.dart'; import 'package:flutter_hbb/consts.dart';
import 'package:flutter_hbb/models/peer_model.dart'; import 'package:flutter_hbb/models/peer_model.dart';
@@ -188,3 +189,79 @@ class RequestException implements Exception {
return "RequestException, statusCode: $statusCode, error: $cause"; return "RequestException, statusCode: $statusCode, error: $cause";
} }
} }
enum ShareRule {
read(1),
readWrite(2),
fullControl(3);
const ShareRule(this.value);
final int value;
static String desc(int v) {
if (v == ShareRule.read.value) {
return translate('Read-only');
}
if (v == ShareRule.readWrite.value) {
return translate('Read/Write');
}
if (v == ShareRule.fullControl.value) {
return translate('Full Control');
}
return v.toString();
}
static String shortDesc(int v) {
if (v == ShareRule.read.value) {
return 'R';
}
if (v == ShareRule.readWrite.value) {
return 'RW';
}
if (v == ShareRule.fullControl.value) {
return 'F';
}
return v.toString();
}
static ShareRule? fromValue(int v) {
if (v == ShareRule.read.value) {
return ShareRule.read;
}
if (v == ShareRule.readWrite.value) {
return ShareRule.readWrite;
}
if (v == ShareRule.fullControl.value) {
return ShareRule.fullControl;
}
return null;
}
}
class AbProfile {
String guid;
String name;
String owner;
String? note;
int rule;
AbProfile(this.guid, this.name, this.owner, this.note, this.rule);
AbProfile.fromJson(Map<String, dynamic> json)
: guid = json['guid'] ?? '',
name = json['name'] ?? '',
owner = json['owner'] ?? '',
note = json['note'] ?? '',
rule = json['rule'] ?? 0;
}
class AbTag {
String name;
int color;
AbTag(this.name, this.color);
AbTag.fromJson(Map<String, dynamic> json)
: name = json['name'] ?? '',
color = json['color'] ?? '';
}

View File

@@ -1,13 +1,16 @@
import 'dart:math'; import 'dart:math';
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:dynamic_layouts/dynamic_layouts.dart'; import 'package:dynamic_layouts/dynamic_layouts.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hbb/common/formatter/id_formatter.dart'; import 'package:flutter_hbb/common/formatter/id_formatter.dart';
import 'package:flutter_hbb/common/hbbs/hbbs.dart';
import 'package:flutter_hbb/common/widgets/peer_card.dart'; import 'package:flutter_hbb/common/widgets/peer_card.dart';
import 'package:flutter_hbb/common/widgets/peers_view.dart'; import 'package:flutter_hbb/common/widgets/peers_view.dart';
import 'package:flutter_hbb/desktop/widgets/popup_menu.dart'; import 'package:flutter_hbb/desktop/widgets/popup_menu.dart';
import 'package:flutter_hbb/models/ab_model.dart'; import 'package:flutter_hbb/models/ab_model.dart';
import 'package:flutter_hbb/models/platform_model.dart'; import 'package:flutter_hbb/models/platform_model.dart';
import 'package:url_launcher/url_launcher_string.dart';
import '../../desktop/widgets/material_mod_popup_menu.dart' as mod_menu; import '../../desktop/widgets/material_mod_popup_menu.dart' as mod_menu;
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:flex_color_picker/flex_color_picker.dart'; import 'package:flex_color_picker/flex_color_picker.dart';
@@ -43,27 +46,24 @@ class _AddressBookState extends State<AddressBook> {
child: ElevatedButton( child: ElevatedButton(
onPressed: loginDialog, child: Text(translate("Login")))); onPressed: loginDialog, child: Text(translate("Login"))));
} else { } else {
if (gFFI.abModel.abLoading.value && gFFI.abModel.emtpy) {
return const Center(
child: CircularProgressIndicator(),
);
}
return Column( return Column(
children: [ children: [
// NOT use Offstage to wrap LinearProgressIndicator // NOT use Offstage to wrap LinearProgressIndicator
if (gFFI.abModel.retrying.value) LinearProgressIndicator(), if (gFFI.abModel.currentAbLoading.value &&
gFFI.abModel.currentAbEmpty)
const LinearProgressIndicator(),
buildErrorBanner(context, buildErrorBanner(context,
loading: gFFI.abModel.abLoading, loading: gFFI.abModel.currentAbLoading,
err: gFFI.abModel.pullError, err: gFFI.abModel.currentAbPullError,
retry: null, retry: null,
close: () => gFFI.abModel.pullError.value = ''), close: () => gFFI.abModel.currentAbPullError.value = ''),
buildErrorBanner(context, buildErrorBanner(context,
loading: gFFI.abModel.abLoading, loading: gFFI.abModel.currentAbLoading,
err: gFFI.abModel.pushError, err: gFFI.abModel.currentAbPushError,
retry: () => gFFI.abModel.pushAb(isRetry: true), retry: null, // remove retry
close: () => gFFI.abModel.pushError.value = ''), close: () => gFFI.abModel.currentAbPushError.value = ''),
Expanded( Expanded(
child: isDesktop child: (isDesktop || isWebDesktop)
? _buildAddressBookDesktop() ? _buildAddressBookDesktop()
: _buildAddressBookMobile()) : _buildAddressBookMobile())
], ],
@@ -82,19 +82,23 @@ class _AddressBookState extends State<AddressBook> {
border: Border.all( border: Border.all(
color: Theme.of(context).colorScheme.background)), color: Theme.of(context).colorScheme.background)),
child: Container( child: Container(
width: 150, width: 200,
height: double.infinity, height: double.infinity,
padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
children: [ children: [
_buildTagHeader().marginOnly(left: 8.0, right: 0), _buildAbDropdown(),
_buildTagHeader().marginOnly(
left: 8.0,
right: gFFI.abModel.legacyMode.value ? 8.0 : 0,
top: gFFI.abModel.legacyMode.value ? 8.0 : 0),
Expanded( Expanded(
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
child: _buildTags(), child: _buildTags(),
), ),
) ),
_buildAbPermission(),
], ],
), ),
), ),
@@ -119,11 +123,13 @@ class _AddressBookState extends State<AddressBook> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
_buildAbDropdown(),
_buildTagHeader().marginOnly(left: 8.0, right: 0), _buildTagHeader().marginOnly(left: 8.0, right: 0),
Container( Container(
width: double.infinity, width: double.infinity,
child: _buildTags(), child: _buildTags(),
), ),
_buildAbPermission(),
], ],
), ),
), ),
@@ -133,6 +139,131 @@ class _AddressBookState extends State<AddressBook> {
); );
} }
Widget _buildAbPermission() {
icon(IconData data, String tooltip) {
return Tooltip(
message: translate(tooltip),
waitDuration: Duration.zero,
child: Icon(data, size: 12.0).marginSymmetric(horizontal: 2.0));
}
return Obx(() {
if (gFFI.abModel.legacyMode.value) return Offstage();
if (gFFI.abModel.current.isPersonal()) {
return Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
icon(Icons.cloud_off, "Personal"),
],
);
} else {
List<Widget> children = [];
final rule = gFFI.abModel.current.sharedProfile()?.rule;
if (rule == ShareRule.read.value) {
children.add(
icon(Icons.visibility, ShareRule.desc(ShareRule.read.value)));
} else if (rule == ShareRule.readWrite.value) {
children
.add(icon(Icons.edit, ShareRule.desc(ShareRule.readWrite.value)));
} else if (rule == ShareRule.fullControl.value) {
children.add(icon(
Icons.security, ShareRule.desc(ShareRule.fullControl.value)));
}
final owner = gFFI.abModel.current.sharedProfile()?.owner;
if (owner != null) {
children.add(icon(Icons.person, "${translate("Owner")}: $owner"));
}
return Row(
mainAxisAlignment: MainAxisAlignment.end,
children: children,
);
}
});
}
Widget _buildAbDropdown() {
if (gFFI.abModel.legacyMode.value) {
return Offstage();
}
final names = gFFI.abModel.addressBookNames();
if (!names.contains(gFFI.abModel.currentName.value)) {
return Offstage();
}
final TextEditingController textEditingController = TextEditingController();
return DropdownButton2<String>(
value: gFFI.abModel.currentName.value,
onChanged: (value) {
if (value != null) {
gFFI.abModel.setCurrentName(value);
bind.setLocalFlutterOption(k: 'current-ab-name', v: value);
}
},
underline: Container(
height: 0.7,
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
buttonStyleData: ButtonStyleData(height: 48),
menuItemStyleData: MenuItemStyleData(height: 36),
items: names
.map((e) => DropdownMenuItem(
value: e,
child: Row(
children: [
Expanded(
child: Tooltip(
waitDuration: Duration(milliseconds: 500),
message: gFFI.abModel.translatedName(e),
child: Text(
gFFI.abModel.translatedName(e),
style: TextStyle(fontSize: 14.0),
maxLines: 1,
overflow: TextOverflow.ellipsis,
)),
),
],
)))
.toList(),
isExpanded: true,
dropdownSearchData: DropdownSearchData(
searchController: textEditingController,
searchInnerWidgetHeight: 50,
searchInnerWidget: Container(
height: 50,
padding: const EdgeInsets.only(
top: 8,
bottom: 4,
right: 8,
left: 8,
),
child: TextFormField(
expands: true,
maxLines: null,
controller: textEditingController,
decoration: InputDecoration(
isDense: true,
contentPadding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 8,
),
hintText: translate('Search'),
hintStyle: const TextStyle(fontSize: 12),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
),
),
),
searchMatchFn: (item, searchValue) {
return item.value
.toString()
.toLowerCase()
.contains(searchValue.toLowerCase());
},
),
);
}
Widget _buildTagHeader() { Widget _buildTagHeader() {
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -154,11 +285,12 @@ class _AddressBookState extends State<AddressBook> {
return Obx(() { return Obx(() {
final List tags; final List tags;
if (gFFI.abModel.sortTags.value) { if (gFFI.abModel.sortTags.value) {
tags = gFFI.abModel.tags.toList(); tags = gFFI.abModel.currentAbTags.toList();
tags.sort(); tags.sort();
} else { } else {
tags = gFFI.abModel.tags; tags = gFFI.abModel.currentAbTags;
} }
final editPermission = gFFI.abModel.current.canWrite();
tagBuilder(String e) { tagBuilder(String e) {
return AddressBookTag( return AddressBookTag(
name: e, name: e,
@@ -169,7 +301,8 @@ class _AddressBookState extends State<AddressBook> {
} else { } else {
gFFI.abModel.selectedTags.add(e); gFFI.abModel.selectedTags.add(e);
} }
}); },
showActionMenu: editPermission);
} }
final gridView = DynamicGridView.builder( final gridView = DynamicGridView.builder(
@@ -181,7 +314,7 @@ class _AddressBookState extends State<AddressBook> {
return tagBuilder(e); return tagBuilder(e);
}); });
final maxHeight = max(MediaQuery.of(context).size.height / 6, 100.0); final maxHeight = max(MediaQuery.of(context).size.height / 6, 100.0);
return isDesktop return (isDesktop || isWebDesktop)
? gridView ? gridView
: LimitedBox(maxHeight: maxHeight, child: gridView); : LimitedBox(maxHeight: maxHeight, child: gridView);
}); });
@@ -193,7 +326,7 @@ class _AddressBookState extends State<AddressBook> {
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: AddressBookPeersView( child: AddressBookPeersView(
menuPadding: widget.menuPadding, menuPadding: widget.menuPadding,
initPeers: gFFI.abModel.peers, getInitPeers: () => gFFI.abModel.currentAbPeers,
)), )),
); );
} }
@@ -207,7 +340,7 @@ class _AddressBookState extends State<AddressBook> {
return shouldSyncAb(); return shouldSyncAb();
}, },
setter: (bool v) async { setter: (bool v) async {
bind.mainSetLocalOption(key: syncAbOption, value: v ? 'Y' : ''); gFFI.abModel.setShouldAsync(v);
}, },
dismissOnClicked: true, dismissOnClicked: true,
); );
@@ -246,13 +379,22 @@ class _AddressBookState extends State<AddressBook> {
} }
void _showMenu(RelativeRect pos) { void _showMenu(RelativeRect pos) {
final canWrite = gFFI.abModel.current.canWrite();
final items = [ final items = [
getEntry(translate("Add ID"), abAddId), if (canWrite) getEntry(translate("Add ID"), addIdToCurrentAb),
getEntry(translate("Add Tag"), abAddTag), if (canWrite) getEntry(translate("Add Tag"), abAddTag),
getEntry(translate("Unselect all tags"), gFFI.abModel.unsetSelectedTags), getEntry(translate("Unselect all tags"), gFFI.abModel.unsetSelectedTags),
sortMenuItem(), sortMenuItem(),
syncMenuItem(), syncMenuItem(),
filterMenuItem(), filterMenuItem(),
if (!gFFI.abModel.legacyMode.value) MenuEntryDivider<String>(),
if (!gFFI.abModel.legacyMode.value)
getEntry(translate("ab_web_console_tip"), () async {
final url = await bind.mainGetApiServer();
if (await canLaunchUrlString(url)) {
launchUrlString(url);
}
}),
]; ];
mod_menu.showMenu( mod_menu.showMenu(
@@ -271,17 +413,20 @@ class _AddressBookState extends State<AddressBook> {
); );
} }
void abAddId() async { void addIdToCurrentAb() async {
if (gFFI.abModel.isFull(true)) { if (gFFI.abModel.isCurrentAbFull(true)) {
return; return;
} }
var isInProgress = false; var isInProgress = false;
var passwordVisible = false;
IDTextEditingController idController = IDTextEditingController(text: ''); IDTextEditingController idController = IDTextEditingController(text: '');
TextEditingController aliasController = TextEditingController(text: ''); TextEditingController aliasController = TextEditingController(text: '');
final tags = List.of(gFFI.abModel.tags); TextEditingController passwordController = TextEditingController(text: '');
final tags = List.of(gFFI.abModel.currentAbTags);
var selectedTag = List<dynamic>.empty(growable: true).obs; var selectedTag = List<dynamic>.empty(growable: true).obs;
final style = TextStyle(fontSize: 14.0); final style = TextStyle(fontSize: 14.0);
String? errorMsg; String? errorMsg;
final isCurrentAbShared = !gFFI.abModel.current.isPersonal();
gFFI.dialogManager.show((setState, close, context) { gFFI.dialogManager.show((setState, close, context) {
submit() async { submit() async {
@@ -293,22 +438,50 @@ class _AddressBookState extends State<AddressBook> {
if (id.isEmpty) { if (id.isEmpty) {
// pass // pass
} else { } else {
if (gFFI.abModel.idContainBy(id)) { if (gFFI.abModel.idContainByCurrent(id)) {
setState(() { setState(() {
isInProgress = false; isInProgress = false;
errorMsg = translate('ID already exists'); errorMsg = translate('ID already exists');
}); });
return; return;
} }
gFFI.abModel.addId(id, aliasController.text.trim(), selectedTag); var password = '';
gFFI.abModel.pushAb(); if (isCurrentAbShared) {
this.setState(() {}); password = passwordController.text;
}
String? errMsg2 = await gFFI.abModel.addIdToCurrent(
id, aliasController.text.trim(), password, selectedTag);
if (errMsg2 != null) {
setState(() {
isInProgress = false;
errorMsg = errMsg2;
});
return;
}
// final currentPeers // final currentPeers
} }
close(); close();
} }
double marginBottom = 4; double marginBottom = 4;
row({required Widget lable, required Widget input}) {
return Row(
children: [
!isMobile
? ConstrainedBox(
constraints: const BoxConstraints(minWidth: 100),
child: lable.marginOnly(right: 10))
: SizedBox.shrink(),
Expanded(
child: ConstrainedBox(
constraints: const BoxConstraints(minWidth: 200),
child: input),
),
],
).marginOnly(bottom: !isMobile ? 8 : 0);
}
return CustomAlertDialog( return CustomAlertDialog(
title: Text(translate("Add ID")), title: Text(translate("Add ID")),
content: Column( content: Column(
@@ -316,66 +489,103 @@ class _AddressBookState extends State<AddressBook> {
children: [ children: [
Column( Column(
children: [ children: [
Align( row(
alignment: Alignment.centerLeft, lable: Row(
child: Row( children: [
children: [ Text(
Text( '*',
'*', style: TextStyle(color: Colors.red, fontSize: 14),
style: TextStyle(color: Colors.red, fontSize: 14), ),
), Text(
Text( 'ID',
'ID', style: style,
style: style, ),
), ],
], ),
), input: TextField(
).marginOnly(bottom: marginBottom), controller: idController,
TextField( inputFormatters: [IDTextInputFormatter()],
controller: idController, decoration: InputDecoration(
inputFormatters: [IDTextInputFormatter()], labelText: !isMobile ? null : translate('ID'),
decoration: InputDecoration(errorText: errorMsg), errorText: errorMsg,
), errorMaxLines: 5),
Align( )),
alignment: Alignment.centerLeft, row(
child: Text( lable: Text(
translate('Alias'), translate('Alias'),
style: style, style: style,
), ),
).marginOnly(top: 8, bottom: marginBottom), input: TextField(
TextField( controller: aliasController,
controller: aliasController, decoration: InputDecoration(
labelText: !isMobile ? null : translate('Alias'),
)),
), ),
Align( if (isCurrentAbShared)
alignment: Alignment.centerLeft, row(
child: Text( lable: Text(
translate('Tags'), translate('Password'),
style: style, style: style,
), ),
).marginOnly(top: 8, bottom: marginBottom), input: TextField(
Align( controller: passwordController,
alignment: Alignment.centerLeft, obscureText: !passwordVisible,
child: Wrap( decoration: InputDecoration(
children: tags labelText: !isMobile ? null : translate('Password'),
.map((e) => AddressBookTag( suffixIcon: IconButton(
name: e, icon: Icon(
tags: selectedTag, passwordVisible
onTap: () { ? Icons.visibility
if (selectedTag.contains(e)) { : Icons.visibility_off,
selectedTag.remove(e); color: MyTheme.lightTheme.primaryColor),
} else { onPressed: () {
selectedTag.add(e); setState(() {
} passwordVisible = !passwordVisible;
});
}, },
showActionMenu: false)) ),
.toList(growable: false), ),
)),
if (gFFI.abModel.currentAbTags.isNotEmpty)
Align(
alignment: Alignment.centerLeft,
child: Text(
translate('Tags'),
style: style,
),
).marginOnly(top: 8, bottom: marginBottom),
if (gFFI.abModel.currentAbTags.isNotEmpty)
Align(
alignment: Alignment.centerLeft,
child: Wrap(
children: tags
.map((e) => AddressBookTag(
name: e,
tags: selectedTag,
onTap: () {
if (selectedTag.contains(e)) {
selectedTag.remove(e);
} else {
selectedTag.add(e);
}
},
showActionMenu: false))
.toList(growable: false),
),
), ),
),
], ],
), ),
const SizedBox( const SizedBox(
height: 4.0, height: 4.0,
), ),
if (!gFFI.abModel.current.isPersonal())
Row(children: [
Icon(Icons.info, color: Colors.amber).marginOnly(right: 4),
Text(
translate('share_warning_tip'),
style: TextStyle(fontSize: 12),
)
]).marginSymmetric(vertical: 10),
// NOT use Offstage to wrap LinearProgressIndicator // NOT use Offstage to wrap LinearProgressIndicator
if (isInProgress) const LinearProgressIndicator(), if (isInProgress) const LinearProgressIndicator(),
], ],
@@ -407,10 +617,7 @@ class _AddressBookState extends State<AddressBook> {
} else { } else {
final tags = field.trim().split(RegExp(r"[\s,;\n]+")); final tags = field.trim().split(RegExp(r"[\s,;\n]+"));
field = tags.join(','); field = tags.join(',');
for (final tag in tags) { gFFI.abModel.addTags(tags);
gFFI.abModel.addTag(tag);
}
gFFI.abModel.pushAb();
// final currentPeers // final currentPeers
} }
close(); close();
@@ -491,7 +698,7 @@ class AddressBookTag extends StatelessWidget {
child: Obx(() => Container( child: Obx(() => Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: tags.contains(name) color: tags.contains(name)
? gFFI.abModel.getTagColor(name) ? gFFI.abModel.getCurrentAbTagColor(name)
: Theme.of(context).colorScheme.background, : Theme.of(context).colorScheme.background,
borderRadius: BorderRadius.circular(4)), borderRadius: BorderRadius.circular(4)),
margin: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0), margin: const EdgeInsets.symmetric(horizontal: 4.0, vertical: 4.0),
@@ -506,7 +713,7 @@ class AddressBookTag extends StatelessWidget {
shape: BoxShape.circle, shape: BoxShape.circle,
color: tags.contains(name) color: tags.contains(name)
? Colors.white ? Colors.white
: gFFI.abModel.getTagColor(name)), : gFFI.abModel.getCurrentAbTagColor(name)),
).marginOnly(right: radius / 2), ).marginOnly(right: radius / 2),
Expanded( Expanded(
child: Text(name, child: Text(name,
@@ -530,7 +737,8 @@ class AddressBookTag extends StatelessWidget {
if (newName == null || newName.isEmpty) { if (newName == null || newName.isEmpty) {
return translate('Can not be empty'); return translate('Can not be empty');
} }
if (newName != name && gFFI.abModel.tags.contains(newName)) { if (newName != name &&
gFFI.abModel.currentAbTags.contains(newName)) {
return translate('Already exists'); return translate('Already exists');
} }
return null; return null;
@@ -538,7 +746,6 @@ class AddressBookTag extends StatelessWidget {
onSubmit: (String newName) { onSubmit: (String newName) {
if (name != newName) { if (name != newName) {
gFFI.abModel.renameTag(name, newName); gFFI.abModel.renameTag(name, newName);
gFFI.abModel.pushAb();
} }
Future.delayed(Duration.zero, () => Get.back()); Future.delayed(Duration.zero, () => Get.back());
}, },
@@ -548,7 +755,7 @@ class AddressBookTag extends StatelessWidget {
}), }),
getEntry(translate(translate('Change Color')), () async { getEntry(translate(translate('Change Color')), () async {
final model = gFFI.abModel; final model = gFFI.abModel;
Color oldColor = model.getTagColor(name); Color oldColor = model.getCurrentAbTagColor(name);
Color newColor = await showColorPickerDialog( Color newColor = await showColorPickerDialog(
context, context,
oldColor, oldColor,
@@ -567,12 +774,10 @@ class AddressBookTag extends StatelessWidget {
); );
if (oldColor != newColor) { if (oldColor != newColor) {
model.setTagColor(name, newColor); model.setTagColor(name, newColor);
model.pushAb();
} }
}), }),
getEntry(translate("Delete"), () { getEntry(translate("Delete"), () {
gFFI.abModel.deleteTag(name); gFFI.abModel.deleteTag(name);
gFFI.abModel.pushAb();
Future.delayed(Duration.zero, () => Get.back()); Future.delayed(Duration.zero, () => Get.back());
}), }),
]; ];

View File

@@ -9,9 +9,6 @@ import 'package:flutter_hbb/common/widgets/peer_card.dart';
Future<List<Peer>> getAllPeers() async { Future<List<Peer>> getAllPeers() async {
Map<String, dynamic> recentPeers = jsonDecode(bind.mainLoadRecentPeersSync()); Map<String, dynamic> recentPeers = jsonDecode(bind.mainLoadRecentPeersSync());
Map<String, dynamic> lanPeers = jsonDecode(bind.mainLoadLanPeersSync()); Map<String, dynamic> lanPeers = jsonDecode(bind.mainLoadLanPeersSync());
Map<String, dynamic> abPeers = jsonDecode(bind.mainLoadAbSync());
Map<String, dynamic> groupPeers = jsonDecode(bind.mainLoadGroupSync());
Map<String, dynamic> combinedPeers = {}; Map<String, dynamic> combinedPeers = {};
void mergePeers(Map<String, dynamic> peers) { void mergePeers(Map<String, dynamic> peers) {
@@ -42,8 +39,16 @@ Future<List<Peer>> getAllPeers() async {
mergePeers(recentPeers); mergePeers(recentPeers);
mergePeers(lanPeers); mergePeers(lanPeers);
mergePeers(abPeers); for (var p in gFFI.abModel.allPeers()) {
mergePeers(groupPeers); if (!combinedPeers.containsKey(p.id)) {
combinedPeers[p.id] = p.toJson();
}
}
for (var p in gFFI.groupModel.peers.map((e) => Peer.copy(e)).toList()) {
if (!combinedPeers.containsKey(p.id)) {
combinedPeers[p.id] = p.toJson();
}
}
List<Peer> parsedPeers = []; List<Peer> parsedPeers = [];
@@ -181,7 +186,7 @@ class AutocompletePeerTileState extends State<AutocompletePeerTile> {
], ],
)))); ))));
final colors = _frontN(widget.peer.tags, 25) final colors = _frontN(widget.peer.tags, 25)
.map((e) => gFFI.abModel.getTagColor(e)) .map((e) => gFFI.abModel.getCurrentAbTagColor(e))
.toList(); .toList();
return Tooltip( return Tooltip(
message: isMobile message: isMobile

View File

@@ -1,12 +1,14 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_hbb/common/shared_state.dart'; import 'package:flutter_hbb/common/shared_state.dart';
import 'package:flutter_hbb/common/widgets/setting_widgets.dart'; import 'package:flutter_hbb/common/widgets/setting_widgets.dart';
import 'package:flutter_hbb/consts.dart'; import 'package:flutter_hbb/consts.dart';
import 'package:flutter_hbb/models/peer_model.dart';
import 'package:flutter_hbb/models/peer_tab_model.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart';
@@ -78,7 +80,7 @@ void changeIdDialog() {
final Iterable violations = rules.where((r) => !r.validate(newId)); final Iterable violations = rules.where((r) => !r.validate(newId));
if (violations.isNotEmpty) { if (violations.isNotEmpty) {
setState(() { setState(() {
msg = isDesktop msg = (isDesktop || isWebDesktop)
? '${translate('Prompt')}: ${violations.map((r) => r.name).join(', ')}' ? '${translate('Prompt')}: ${violations.map((r) => r.name).join(', ')}'
: violations.map((r) => r.name).join(', '); : violations.map((r) => r.name).join(', ');
}); });
@@ -103,7 +105,7 @@ void changeIdDialog() {
} }
setState(() { setState(() {
isInProgress = false; isInProgress = false;
msg = isDesktop msg = (isDesktop || isWebDesktop)
? '${translate('Prompt')}: ${translate(status)}' ? '${translate('Prompt')}: ${translate(status)}'
: translate(status); : translate(status);
}); });
@@ -140,7 +142,7 @@ void changeIdDialog() {
const SizedBox( const SizedBox(
height: 8.0, height: 8.0,
), ),
isDesktop (isDesktop || isWebDesktop)
? Obx(() => Wrap( ? Obx(() => Wrap(
runSpacing: 8, runSpacing: 8,
spacing: 4, spacing: 4,
@@ -622,7 +624,7 @@ class _DialogVerificationCodeField extends State<DialogVerificationCodeField> {
// software secure keyboard will take the focus since flutter 3.13 // software secure keyboard will take the focus since flutter 3.13
// request focus again when android account password obtain focus // request focus again when android account password obtain focus
if (Platform.isAndroid && widget.reRequestFocus) { if (isAndroid && widget.reRequestFocus) {
_focusNode.addListener(() { _focusNode.addListener(() {
if (_focusNode.hasFocus) { if (_focusNode.hasFocus) {
_timerReRequestFocus?.cancel(); _timerReRequestFocus?.cancel();
@@ -691,7 +693,7 @@ class _PasswordWidgetState extends State<PasswordWidget> {
} }
// software secure keyboard will take the focus since flutter 3.13 // software secure keyboard will take the focus since flutter 3.13
// request focus again when android account password obtain focus // request focus again when android account password obtain focus
if (Platform.isAndroid && widget.reRequestFocus) { if (isAndroid && widget.reRequestFocus) {
_focusNode.addListener(() { _focusNode.addListener(() {
if (_focusNode.hasFocus) { if (_focusNode.hasFocus) {
_timerReRequestFocus?.cancel(); _timerReRequestFocus?.cancel();
@@ -1106,7 +1108,7 @@ void showRequestElevationDialog(
errorText: errPwd.isEmpty ? null : errPwd.value, errorText: errPwd.isEmpty ? null : errPwd.value,
), ),
], ],
).marginOnly(left: isDesktop ? 35 : 0), ).marginOnly(left: (isDesktop || isWebDesktop) ? 35 : 0),
).marginOnly(top: 10), ).marginOnly(top: 10),
], ],
), ),
@@ -1583,7 +1585,7 @@ customImageQualityDialog(SessionID sessionId, String id, FFI ffi) async {
msgBoxCommon(ffi.dialogManager, 'Custom Image Quality', content, [btnClose]); msgBoxCommon(ffi.dialogManager, 'Custom Image Quality', content, [btnClose]);
} }
void deletePeerConfirmDialog(Function onSubmit, String title) async { void deleteConfirmDialog(Function onSubmit, String title) async {
gFFI.dialogManager.show( gFFI.dialogManager.show(
(setState, close, context) { (setState, close, context) {
submit() async { submit() async {
@@ -1631,7 +1633,7 @@ void editAbTagDialog(
List<dynamic> currentTags, Function(List<dynamic>) onSubmit) { List<dynamic> currentTags, Function(List<dynamic>) onSubmit) {
var isInProgress = false; var isInProgress = false;
final tags = List.of(gFFI.abModel.tags); final tags = List.of(gFFI.abModel.currentAbTags);
var selectedTag = currentTags.obs; var selectedTag = currentTags.obs;
gFFI.dialogManager.show((setState, close, context) { gFFI.dialogManager.show((setState, close, context) {
@@ -1909,3 +1911,207 @@ void showWindowsSessionsDialog(
); );
}); });
} }
void addPeersToAbDialog(
List<Peer> peers,
) async {
Future<bool> addTo(String abname) async {
final mapList = peers.map((e) {
var json = e.toJson();
// remove password when add to another address book to avoid re-share
json.remove('password');
json.remove('hash');
return json;
}).toList();
final errMsg = await gFFI.abModel.addPeersTo(mapList, abname);
if (errMsg == null) {
showToast(translate('Successful'));
return true;
} else {
BotToast.showText(text: errMsg, contentColor: Colors.red);
return false;
}
}
// if only one address book and it is personal, add to it directly
if (gFFI.abModel.addressbooks.length == 1 &&
gFFI.abModel.current.isPersonal()) {
await addTo(gFFI.abModel.currentName.value);
return;
}
RxBool isInProgress = false.obs;
final names = gFFI.abModel.addressBooksCanWrite();
RxString currentName = gFFI.abModel.currentName.value.obs;
TextEditingController controller = TextEditingController();
if (gFFI.peerTabModel.currentTab == PeerTabIndex.ab.index) {
names.remove(currentName.value);
}
if (names.isEmpty) {
debugPrint('no address book to add peers to, should not happen');
return;
}
if (!names.contains(currentName.value)) {
currentName.value = names[0];
}
gFFI.dialogManager.show((setState, close, context) {
submit() async {
if (controller.text != gFFI.abModel.translatedName(currentName.value)) {
BotToast.showText(
text: 'illegal address book name: ${controller.text}',
contentColor: Colors.red);
return;
}
isInProgress.value = true;
if (await addTo(currentName.value)) {
close();
}
isInProgress.value = false;
}
cancel() {
close();
}
return CustomAlertDialog(
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(IconFont.addressBook, color: MyTheme.accent),
Text(translate('Add to address book')).paddingOnly(left: 10),
],
),
content: Obx(() => Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// https://github.com/flutter/flutter/issues/145081
DropdownMenu(
initialSelection: currentName.value,
onSelected: (value) {
if (value != null) {
currentName.value = value;
}
},
dropdownMenuEntries: names
.map((e) => DropdownMenuEntry(
value: e, label: gFFI.abModel.translatedName(e)))
.toList(),
inputDecorationTheme: InputDecorationTheme(
isDense: true, border: UnderlineInputBorder()),
enableFilter: true,
controller: controller,
),
// NOT use Offstage to wrap LinearProgressIndicator
isInProgress.value ? const LinearProgressIndicator() : Offstage()
],
)),
actions: [
dialogButton(
"Cancel",
icon: Icon(Icons.close_rounded),
onPressed: cancel,
isOutline: true,
),
dialogButton(
"OK",
icon: Icon(Icons.done_rounded),
onPressed: submit,
),
],
onSubmit: submit,
onCancel: cancel,
);
});
}
void setSharedAbPasswordDialog(String abName, Peer peer) {
TextEditingController controller = TextEditingController(text: '');
RxBool isInProgress = false.obs;
RxBool isInputEmpty = true.obs;
bool passwordVisible = false;
controller.addListener(() {
isInputEmpty.value = controller.text.isEmpty;
});
gFFI.dialogManager.show((setState, close, context) {
change(String password) async {
isInProgress.value = true;
bool res =
await gFFI.abModel.changeSharedPassword(abName, peer.id, password);
isInProgress.value = false;
if (res) {
showToast(translate('Successful'));
}
close();
}
cancel() {
close();
}
return CustomAlertDialog(
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.key, color: MyTheme.accent),
Text(translate(peer.password.isEmpty
? 'Set shared password'
: 'Change Password'))
.paddingOnly(left: 10),
],
),
content: Obx(() => Column(children: [
TextField(
controller: controller,
autofocus: true,
obscureText: !passwordVisible,
decoration: InputDecoration(
suffixIcon: IconButton(
icon: Icon(
passwordVisible ? Icons.visibility : Icons.visibility_off,
color: MyTheme.lightTheme.primaryColor),
onPressed: () {
setState(() {
passwordVisible = !passwordVisible;
});
},
),
),
),
if (!gFFI.abModel.current.isPersonal())
Row(children: [
Icon(Icons.info, color: Colors.amber).marginOnly(right: 4),
Text(
translate('share_warning_tip'),
style: TextStyle(fontSize: 12),
)
]).marginSymmetric(vertical: 10),
// NOT use Offstage to wrap LinearProgressIndicator
isInProgress.value ? const LinearProgressIndicator() : Offstage()
])),
actions: [
dialogButton(
"Cancel",
icon: Icon(Icons.close_rounded),
onPressed: cancel,
isOutline: true,
),
if (peer.password.isNotEmpty)
dialogButton(
"Remove",
icon: Icon(Icons.delete_outline_rounded),
onPressed: () => change(''),
buttonStyle: ButtonStyle(
backgroundColor: MaterialStatePropertyAll(Colors.red)),
),
Obx(() => dialogButton(
"OK",
icon: Icon(Icons.done_rounded),
onPressed:
isInputEmpty.value ? null : () => change(controller.text),
)),
],
onSubmit: isInputEmpty.value ? null : () => change(controller.text),
onCancel: cancel,
);
});
}

View File

@@ -47,7 +47,10 @@ class _MyGroupState extends State<MyGroup> {
err: gFFI.groupModel.groupLoadError, err: gFFI.groupModel.groupLoadError,
retry: null, retry: null,
close: () => gFFI.groupModel.groupLoadError.value = ''), close: () => gFFI.groupModel.groupLoadError.value = ''),
Expanded(child: isDesktop ? _buildDesktop() : _buildMobile()) Expanded(
child: (isDesktop || isWebDesktop)
? _buildDesktop()
: _buildMobile())
], ],
); );
}); });
@@ -83,7 +86,7 @@ class _MyGroupState extends State<MyGroup> {
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: MyGroupPeerView( child: MyGroupPeerView(
menuPadding: widget.menuPadding, menuPadding: widget.menuPadding,
initPeers: gFFI.groupModel.peers)), getInitPeers: () => gFFI.groupModel.peers)),
) )
], ],
); );
@@ -115,7 +118,7 @@ class _MyGroupState extends State<MyGroup> {
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: MyGroupPeerView( child: MyGroupPeerView(
menuPadding: widget.menuPadding, menuPadding: widget.menuPadding,
initPeers: gFFI.groupModel.peers)), getInitPeers: () => gFFI.groupModel.peers)),
) )
], ],
); );
@@ -164,7 +167,7 @@ class _MyGroupState extends State<MyGroup> {
itemCount: items.length, itemCount: items.length,
itemBuilder: (context, index) => _buildUserItem(items[index])); itemBuilder: (context, index) => _buildUserItem(items[index]));
var maxHeight = max(MediaQuery.of(context).size.height / 6, 100.0); var maxHeight = max(MediaQuery.of(context).size.height / 6, 100.0);
return isDesktop return (isDesktop || isWebDesktop)
? listView ? listView
: LimitedBox(maxHeight: maxHeight, child: listView); : LimitedBox(maxHeight: maxHeight, child: listView);
}); });

View File

@@ -54,7 +54,7 @@ class DraggableChatWindow extends StatelessWidget {
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: CustomAppBar( appBar: CustomAppBar(
onPanUpdate: onPanUpdate, onPanUpdate: onPanUpdate,
appBar: isDesktop appBar: (isDesktop || isWebDesktop)
? _buildDesktopAppBar(context) ? _buildDesktopAppBar(context)
: _buildMobileAppBar(context), : _buildMobileAppBar(context),
), ),

View File

@@ -1,5 +1,4 @@
import 'dart:io'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_hbb/common/widgets/dialog.dart'; import 'package:flutter_hbb/common/widgets/dialog.dart';
@@ -52,7 +51,7 @@ class _PeerCardState extends State<_PeerCard>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
if (isDesktop) { if (isDesktop || isWebDesktop) {
return _buildDesktop(); return _buildDesktop();
} else { } else {
return _buildMobile(); return _buildMobile();
@@ -70,12 +69,12 @@ class _PeerCardState extends State<_PeerCard>
peerTabModel.select(peer); peerTabModel.select(peer);
} else { } else {
if (!isWebDesktop) { if (!isWebDesktop) {
connectInPeerTab(context, peer.id, widget.tab); connectInPeerTab(context, peer, widget.tab);
} }
} }
}, },
onDoubleTap: isWebDesktop onDoubleTap: isWebDesktop
? () => connectInPeerTab(context, peer.id, widget.tab) ? () => connectInPeerTab(context, peer, widget.tab)
: null, : null,
onLongPress: () { onLongPress: () {
peerTabModel.select(peer); peerTabModel.select(peer);
@@ -140,21 +139,30 @@ class _PeerCardState extends State<_PeerCard>
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
children: [ children: [
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: str2color('${peer.id}${peer.platform}', 0x7f), color: str2color('${peer.id}${peer.platform}', 0x7f),
borderRadius: isMobile borderRadius: isMobile
? BorderRadius.circular(_tileRadius) ? BorderRadius.circular(_tileRadius)
: BorderRadius.only( : BorderRadius.only(
topLeft: Radius.circular(_tileRadius), topLeft: Radius.circular(_tileRadius),
bottomLeft: Radius.circular(_tileRadius), bottomLeft: Radius.circular(_tileRadius),
),
),
alignment: Alignment.center,
width: isMobile ? 50 : 42,
height: isMobile ? 50 : null,
child: Stack(
children: [
getPlatformImage(peer.platform, size: isMobile ? 38 : 30)
.paddingAll(6),
if (_shouldBuildPasswordIcon(peer))
Positioned(
top: 1,
left: 1,
child: Icon(Icons.key, size: 6, color: Colors.white),
), ),
), ],
alignment: Alignment.center, )),
width: isMobile ? 50 : 42,
height: isMobile ? 50 : null,
child: getPlatformImage(peer.platform, size: isMobile ? 38 : 30)
.paddingAll(6),
),
Expanded( Expanded(
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -199,8 +207,9 @@ class _PeerCardState extends State<_PeerCard>
) )
], ],
); );
final colors = final colors = _frontN(peer.tags, 25)
_frontN(peer.tags, 25).map((e) => gFFI.abModel.getTagColor(e)).toList(); .map((e) => gFFI.abModel.getCurrentAbTagColor(e))
.toList();
return Tooltip( return Tooltip(
message: isMobile message: isMobile
? '' ? ''
@@ -310,14 +319,21 @@ class _PeerCardState extends State<_PeerCard>
), ),
); );
final colors = final colors = _frontN(peer.tags, 25)
_frontN(peer.tags, 25).map((e) => gFFI.abModel.getTagColor(e)).toList(); .map((e) => gFFI.abModel.getCurrentAbTagColor(e))
.toList();
return Tooltip( return Tooltip(
message: peer.tags.isNotEmpty message: peer.tags.isNotEmpty
? '${translate('Tags')}: ${peer.tags.join(', ')}' ? '${translate('Tags')}: ${peer.tags.join(', ')}'
: '', : '',
child: Stack(children: [ child: Stack(children: [
child, child,
if (_shouldBuildPasswordIcon(peer))
Positioned(
top: 4,
left: 12,
child: Icon(Icons.key, size: 12, color: Colors.white),
),
if (colors.isNotEmpty) if (colors.isNotEmpty)
Positioned( Positioned(
top: 4, top: 4,
@@ -401,6 +417,12 @@ class _PeerCardState extends State<_PeerCard>
onPointerUp: (_) => _showPeerMenu(peer.id), onPointerUp: (_) => _showPeerMenu(peer.id),
child: build_more(context)); child: build_more(context));
bool _shouldBuildPasswordIcon(Peer peer) {
if (gFFI.peerTabModel.currentTab != PeerTabIndex.ab.index) return false;
if (gFFI.abModel.current.isPersonal()) return false;
return peer.password.isNotEmpty;
}
/// Show the peer menu and handle user's choice. /// Show the peer menu and handle user's choice.
/// User might remove the peer or send a file to the peer. /// User might remove the peer or send a file to the peer.
void _showPeerMenu(String id) async { void _showPeerMenu(String id) async {
@@ -431,7 +453,7 @@ abstract class BasePeerCard extends StatelessWidget {
peer: peer, peer: peer,
tab: tab, tab: tab,
connect: (BuildContext context, String id) => connect: (BuildContext context, String id) =>
connectInPeerTab(context, id, tab), connectInPeerTab(context, peer, tab),
popupMenuEntryBuilder: _buildPopupMenuEntry, popupMenuEntryBuilder: _buildPopupMenuEntry,
); );
} }
@@ -453,7 +475,6 @@ abstract class BasePeerCard extends StatelessWidget {
MenuEntryBase<String> _connectCommonAction( MenuEntryBase<String> _connectCommonAction(
BuildContext context, BuildContext context,
String id,
String title, { String title, {
bool isFileTransfer = false, bool isFileTransfer = false,
bool isTcpTunneling = false, bool isTcpTunneling = false,
@@ -467,7 +488,7 @@ abstract class BasePeerCard extends StatelessWidget {
proc: () { proc: () {
connectInPeerTab( connectInPeerTab(
context, context,
peer.id, peer,
tab, tab,
isFileTransfer: isFileTransfer, isFileTransfer: isFileTransfer,
isTcpTunneling: isTcpTunneling, isTcpTunneling: isTcpTunneling,
@@ -480,10 +501,9 @@ abstract class BasePeerCard extends StatelessWidget {
} }
@protected @protected
MenuEntryBase<String> _connectAction(BuildContext context, Peer peer) { MenuEntryBase<String> _connectAction(BuildContext context) {
return _connectCommonAction( return _connectCommonAction(
context, context,
peer.id,
(peer.alias.isEmpty (peer.alias.isEmpty
? translate('Connect') ? translate('Connect')
: '${translate('Connect')} ${peer.id}'), : '${translate('Connect')} ${peer.id}'),
@@ -491,20 +511,18 @@ abstract class BasePeerCard extends StatelessWidget {
} }
@protected @protected
MenuEntryBase<String> _transferFileAction(BuildContext context, String id) { MenuEntryBase<String> _transferFileAction(BuildContext context) {
return _connectCommonAction( return _connectCommonAction(
context, context,
id,
translate('Transfer file'), translate('Transfer file'),
isFileTransfer: true, isFileTransfer: true,
); );
} }
@protected @protected
MenuEntryBase<String> _tcpTunnelingAction(BuildContext context, String id) { MenuEntryBase<String> _tcpTunnelingAction(BuildContext context) {
return _connectCommonAction( return _connectCommonAction(
context, context,
id,
translate('TCP tunneling'), translate('TCP tunneling'),
isTcpTunneling: true, isTcpTunneling: true,
); );
@@ -541,7 +559,7 @@ abstract class BasePeerCard extends StatelessWidget {
], ],
)), )),
proc: () { proc: () {
connectInPeerTab(context, id, tab, isRDP: true); connectInPeerTab(context, peer, tab, isRDP: true);
}, },
padding: menuPadding, padding: menuPadding,
dismissOnClicked: true, dismissOnClicked: true,
@@ -648,9 +666,8 @@ abstract class BasePeerCard extends StatelessWidget {
onSubmit: (String newName) async { onSubmit: (String newName) async {
if (newName != oldName) { if (newName != oldName) {
if (tab == PeerTabIndex.ab) { if (tab == PeerTabIndex.ab) {
gFFI.abModel.changeAlias(id: id, alias: newName); await gFFI.abModel.changeAlias(id: id, alias: newName);
await bind.mainSetPeerAlias(id: id, alias: newName); await bind.mainSetPeerAlias(id: id, alias: newName);
gFFI.abModel.pushAb();
} else { } else {
await bind.mainSetPeerAlias(id: id, alias: newName); await bind.mainSetPeerAlias(id: id, alias: newName);
showToast(translate('Successful')); showToast(translate('Successful'));
@@ -702,11 +719,7 @@ abstract class BasePeerCard extends StatelessWidget {
await bind.mainLoadLanPeers(); await bind.mainLoadLanPeers();
break; break;
case PeerTabIndex.ab: case PeerTabIndex.ab:
gFFI.abModel.deletePeer(id); await gFFI.abModel.deletePeers([id]);
final future = gFFI.abModel.pushAb();
if (await bind.mainPeerExists(id: peer.id)) {
gFFI.abModel.reSyncToast(future);
}
break; break;
case PeerTabIndex.group: case PeerTabIndex.group:
break; break;
@@ -716,7 +729,7 @@ abstract class BasePeerCard extends StatelessWidget {
} }
} }
deletePeerConfirmDialog(onSubmit, deleteConfirmDialog(onSubmit,
'${translate('Delete')} "${peer.alias.isEmpty ? formatID(peer.id) : peer.alias}"?'); '${translate('Delete')} "${peer.alias.isEmpty ? formatID(peer.id) : peer.alias}"?');
}, },
padding: menuPadding, padding: menuPadding,
@@ -732,14 +745,16 @@ abstract class BasePeerCard extends StatelessWidget {
style: style, style: style,
), ),
proc: () async { proc: () async {
bool result = gFFI.abModel.changePassword(id, ''); bool succ = await gFFI.abModel.changePersonalHashPassword(id, '');
await bind.mainForgetPassword(id: id); await bind.mainForgetPassword(id: id);
bool toast = false; if (succ) {
if (result) { showToast(translate('Successful'));
toast = tab == PeerTabIndex.ab; } else {
gFFI.abModel.pushAb(toastIfFail: toast, toastIfSucc: toast); if (tab.index == PeerTabIndex.ab.index) {
BotToast.showText(
contentColor: Colors.red, text: translate("Failed"));
}
} }
if (!toast) showToast(translate('Successful'));
}, },
padding: menuPadding, padding: menuPadding,
dismissOnClicked: true, dismissOnClicked: true,
@@ -824,13 +839,7 @@ abstract class BasePeerCard extends StatelessWidget {
), ),
proc: () { proc: () {
() async { () async {
if (gFFI.abModel.isFull(true)) { addPeersToAbDialog([Peer.copy(peer)]);
return;
}
if (!gFFI.abModel.idContainBy(peer.id)) {
gFFI.abModel.addPeer(peer);
gFFI.abModel.pushAb();
}
}(); }();
}, },
padding: menuPadding, padding: menuPadding,
@@ -858,25 +867,29 @@ class RecentPeerCard extends BasePeerCard {
Future<List<MenuEntryBase<String>>> _buildMenuItems( Future<List<MenuEntryBase<String>>> _buildMenuItems(
BuildContext context) async { BuildContext context) async {
final List<MenuEntryBase<String>> menuItems = [ final List<MenuEntryBase<String>> menuItems = [
_connectAction(context, peer), _connectAction(context),
_transferFileAction(context, peer.id), if (!isWeb) _transferFileAction(context),
]; ];
final List favs = (await bind.mainGetFav()).toList(); final List favs = (await bind.mainGetFav()).toList();
if (isDesktop && peer.platform != kPeerPlatformAndroid) { if (isDesktop && peer.platform != kPeerPlatformAndroid) {
menuItems.add(_tcpTunnelingAction(context, peer.id)); menuItems.add(_tcpTunnelingAction(context));
} }
// menuItems.add(await _openNewConnInOptAction(peer.id)); // menuItems.add(await _openNewConnInOptAction(peer.id));
menuItems.add(await _forceAlwaysRelayAction(peer.id)); if (!isWeb) {
if (Platform.isWindows && peer.platform == kPeerPlatformWindows) { menuItems.add(await _forceAlwaysRelayAction(peer.id));
}
if (isWindows && peer.platform == kPeerPlatformWindows) {
menuItems.add(_rdpAction(context, peer.id)); menuItems.add(_rdpAction(context, peer.id));
} }
if (Platform.isWindows) { if (isWindows) {
menuItems.add(_createShortCutAction(peer.id)); menuItems.add(_createShortCutAction(peer.id));
} }
menuItems.add(MenuEntryDivider()); menuItems.add(MenuEntryDivider());
menuItems.add(_renameAction(peer.id)); if (isDesktop || isWebDesktop) {
menuItems.add(_renameAction(peer.id));
}
if (await bind.mainPeerHasPassword(id: peer.id)) { if (await bind.mainPeerHasPassword(id: peer.id)) {
menuItems.add(_unrememberPasswordAction(peer.id)); menuItems.add(_unrememberPasswordAction(peer.id));
} }
@@ -888,9 +901,7 @@ class RecentPeerCard extends BasePeerCard {
} }
if (gFFI.userModel.userName.isNotEmpty) { if (gFFI.userModel.userName.isNotEmpty) {
if (!gFFI.abModel.idContainBy(peer.id)) { menuItems.add(_addToAb(peer));
menuItems.add(_addToAb(peer));
}
} }
menuItems.add(MenuEntryDivider()); menuItems.add(MenuEntryDivider());
@@ -915,22 +926,26 @@ class FavoritePeerCard extends BasePeerCard {
Future<List<MenuEntryBase<String>>> _buildMenuItems( Future<List<MenuEntryBase<String>>> _buildMenuItems(
BuildContext context) async { BuildContext context) async {
final List<MenuEntryBase<String>> menuItems = [ final List<MenuEntryBase<String>> menuItems = [
_connectAction(context, peer), _connectAction(context),
_transferFileAction(context, peer.id), if (!isWeb) _transferFileAction(context),
]; ];
if (isDesktop && peer.platform != kPeerPlatformAndroid) { if (isDesktop && peer.platform != kPeerPlatformAndroid) {
menuItems.add(_tcpTunnelingAction(context, peer.id)); menuItems.add(_tcpTunnelingAction(context));
} }
// menuItems.add(await _openNewConnInOptAction(peer.id)); // menuItems.add(await _openNewConnInOptAction(peer.id));
menuItems.add(await _forceAlwaysRelayAction(peer.id)); if (!isWeb) {
if (Platform.isWindows && peer.platform == kPeerPlatformWindows) { menuItems.add(await _forceAlwaysRelayAction(peer.id));
}
if (isWindows && peer.platform == kPeerPlatformWindows) {
menuItems.add(_rdpAction(context, peer.id)); menuItems.add(_rdpAction(context, peer.id));
} }
if (Platform.isWindows) { if (isWindows) {
menuItems.add(_createShortCutAction(peer.id)); menuItems.add(_createShortCutAction(peer.id));
} }
menuItems.add(MenuEntryDivider()); menuItems.add(MenuEntryDivider());
menuItems.add(_renameAction(peer.id)); if (isDesktop || isWebDesktop) {
menuItems.add(_renameAction(peer.id));
}
if (await bind.mainPeerHasPassword(id: peer.id)) { if (await bind.mainPeerHasPassword(id: peer.id)) {
menuItems.add(_unrememberPasswordAction(peer.id)); menuItems.add(_unrememberPasswordAction(peer.id));
} }
@@ -939,9 +954,7 @@ class FavoritePeerCard extends BasePeerCard {
})); }));
if (gFFI.userModel.userName.isNotEmpty) { if (gFFI.userModel.userName.isNotEmpty) {
if (!gFFI.abModel.idContainBy(peer.id)) { menuItems.add(_addToAb(peer));
menuItems.add(_addToAb(peer));
}
} }
menuItems.add(MenuEntryDivider()); menuItems.add(MenuEntryDivider());
@@ -966,22 +979,24 @@ class DiscoveredPeerCard extends BasePeerCard {
Future<List<MenuEntryBase<String>>> _buildMenuItems( Future<List<MenuEntryBase<String>>> _buildMenuItems(
BuildContext context) async { BuildContext context) async {
final List<MenuEntryBase<String>> menuItems = [ final List<MenuEntryBase<String>> menuItems = [
_connectAction(context, peer), _connectAction(context),
_transferFileAction(context, peer.id), if (!isWeb) _transferFileAction(context),
]; ];
final List favs = (await bind.mainGetFav()).toList(); final List favs = (await bind.mainGetFav()).toList();
if (isDesktop && peer.platform != kPeerPlatformAndroid) { if (isDesktop && peer.platform != kPeerPlatformAndroid) {
menuItems.add(_tcpTunnelingAction(context, peer.id)); menuItems.add(_tcpTunnelingAction(context));
} }
// menuItems.add(await _openNewConnInOptAction(peer.id)); // menuItems.add(await _openNewConnInOptAction(peer.id));
menuItems.add(await _forceAlwaysRelayAction(peer.id)); if (!isWeb) {
if (Platform.isWindows && peer.platform == kPeerPlatformWindows) { menuItems.add(await _forceAlwaysRelayAction(peer.id));
}
if (isWindows && peer.platform == kPeerPlatformWindows) {
menuItems.add(_rdpAction(context, peer.id)); menuItems.add(_rdpAction(context, peer.id));
} }
menuItems.add(_wolAction(peer.id)); menuItems.add(_wolAction(peer.id));
if (Platform.isWindows) { if (isWindows) {
menuItems.add(_createShortCutAction(peer.id)); menuItems.add(_createShortCutAction(peer.id));
} }
@@ -992,9 +1007,7 @@ class DiscoveredPeerCard extends BasePeerCard {
} }
if (gFFI.userModel.userName.isNotEmpty) { if (gFFI.userModel.userName.isNotEmpty) {
if (!gFFI.abModel.idContainBy(peer.id)) { menuItems.add(_addToAb(peer));
menuItems.add(_addToAb(peer));
}
} }
menuItems.add(MenuEntryDivider()); menuItems.add(MenuEntryDivider());
@@ -1019,37 +1032,55 @@ class AddressBookPeerCard extends BasePeerCard {
Future<List<MenuEntryBase<String>>> _buildMenuItems( Future<List<MenuEntryBase<String>>> _buildMenuItems(
BuildContext context) async { BuildContext context) async {
final List<MenuEntryBase<String>> menuItems = [ final List<MenuEntryBase<String>> menuItems = [
_connectAction(context, peer), _connectAction(context),
_transferFileAction(context, peer.id), if (!isWeb) _transferFileAction(context),
]; ];
if (isDesktop && peer.platform != kPeerPlatformAndroid) { if (isDesktop && peer.platform != kPeerPlatformAndroid) {
menuItems.add(_tcpTunnelingAction(context, peer.id)); menuItems.add(_tcpTunnelingAction(context));
} }
// menuItems.add(await _openNewConnInOptAction(peer.id)); // menuItems.add(await _openNewConnInOptAction(peer.id));
menuItems.add(await _forceAlwaysRelayAction(peer.id)); // menuItems.add(await _forceAlwaysRelayAction(peer.id));
if (Platform.isWindows && peer.platform == kPeerPlatformWindows) { if (isWindows && peer.platform == kPeerPlatformWindows) {
menuItems.add(_rdpAction(context, peer.id)); menuItems.add(_rdpAction(context, peer.id));
} }
if (Platform.isWindows) { if (isWindows) {
menuItems.add(_createShortCutAction(peer.id)); menuItems.add(_createShortCutAction(peer.id));
} }
menuItems.add(MenuEntryDivider()); if (gFFI.abModel.current.canWrite()) {
menuItems.add(_renameAction(peer.id)); menuItems.add(MenuEntryDivider());
if (peer.hash.isNotEmpty) { if (isDesktop || isWebDesktop) {
menuItems.add(_unrememberPasswordAction(peer.id)); menuItems.add(_renameAction(peer.id));
}
if (gFFI.abModel.current.isPersonal() && peer.hash.isNotEmpty) {
menuItems.add(_unrememberPasswordAction(peer.id));
}
if (!gFFI.abModel.current.isPersonal()) {
menuItems.add(_changeSharedAbPassword());
}
if (gFFI.abModel.currentAbTags.isNotEmpty) {
menuItems.add(_editTagAction(peer.id));
}
} }
if (gFFI.abModel.tags.isNotEmpty) { final addressbooks = gFFI.abModel.addressBooksCanWrite();
menuItems.add(_editTagAction(peer.id)); if (gFFI.peerTabModel.currentTab == PeerTabIndex.ab.index) {
addressbooks.remove(gFFI.abModel.currentName.value);
}
if (addressbooks.isNotEmpty) {
menuItems.add(_addToAb(peer));
}
menuItems.add(_existIn());
if (gFFI.abModel.current.canWrite()) {
menuItems.add(MenuEntryDivider());
menuItems.add(_removeAction(peer.id));
} }
menuItems.add(MenuEntryDivider());
menuItems.add(_removeAction(peer.id));
return menuItems; return menuItems;
} }
// address book does not need to update
@protected @protected
@override @override
void _update() => gFFI.abModel.pullAb(quiet: true); void _update() =>
{}; //gFFI.abModel.pullAb(force: ForcePullAb.current, quiet: true);
@protected @protected
MenuEntryBase<String> _editTagAction(String id) { MenuEntryBase<String> _editTagAction(String id) {
@@ -1060,8 +1091,7 @@ class AddressBookPeerCard extends BasePeerCard {
), ),
proc: () { proc: () {
editAbTagDialog(gFFI.abModel.getPeerTags(id), (selectedTag) async { editAbTagDialog(gFFI.abModel.getPeerTags(id), (selectedTag) async {
gFFI.abModel.changeTagForPeer(id, selectedTag); await gFFI.abModel.changeTagForPeers([id], selectedTag);
gFFI.abModel.pushAb();
}); });
}, },
padding: super.menuPadding, padding: super.menuPadding,
@@ -1073,6 +1103,53 @@ class AddressBookPeerCard extends BasePeerCard {
@override @override
Future<String> _getAlias(String id) async => Future<String> _getAlias(String id) async =>
gFFI.abModel.find(id)?.alias ?? ''; gFFI.abModel.find(id)?.alias ?? '';
MenuEntryBase<String> _changeSharedAbPassword() {
return MenuEntryButton<String>(
childBuilder: (TextStyle? style) => Text(
translate(
peer.password.isEmpty ? 'Set shared password' : 'Change Password'),
style: style,
),
proc: () {
setSharedAbPasswordDialog(gFFI.abModel.currentName.value, peer);
},
padding: super.menuPadding,
dismissOnClicked: true,
);
}
MenuEntryBase<String> _existIn() {
final names = gFFI.abModel.idExistIn(peer.id);
final text = names.join(', ');
return MenuEntryButton<String>(
childBuilder: (TextStyle? style) => Text(
translate('Exist in'),
style: style,
),
proc: () {
gFFI.dialogManager.show((setState, close, context) {
return CustomAlertDialog(
title: Text(translate('Exist in')),
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [Text(text)]),
actions: [
dialogButton(
"OK",
icon: Icon(Icons.done_rounded),
onPressed: close,
),
],
onSubmit: close,
onCancel: close,
);
});
},
padding: super.menuPadding,
dismissOnClicked: true,
);
}
} }
class MyGroupPeerCard extends BasePeerCard { class MyGroupPeerCard extends BasePeerCard {
@@ -1087,18 +1164,18 @@ class MyGroupPeerCard extends BasePeerCard {
Future<List<MenuEntryBase<String>>> _buildMenuItems( Future<List<MenuEntryBase<String>>> _buildMenuItems(
BuildContext context) async { BuildContext context) async {
final List<MenuEntryBase<String>> menuItems = [ final List<MenuEntryBase<String>> menuItems = [
_connectAction(context, peer), _connectAction(context),
_transferFileAction(context, peer.id), if (!isWeb) _transferFileAction(context),
]; ];
if (isDesktop && peer.platform != kPeerPlatformAndroid) { if (isDesktop && peer.platform != kPeerPlatformAndroid) {
menuItems.add(_tcpTunnelingAction(context, peer.id)); menuItems.add(_tcpTunnelingAction(context));
} }
// menuItems.add(await _openNewConnInOptAction(peer.id)); // menuItems.add(await _openNewConnInOptAction(peer.id));
// menuItems.add(await _forceAlwaysRelayAction(peer.id)); // menuItems.add(await _forceAlwaysRelayAction(peer.id));
if (Platform.isWindows && peer.platform == kPeerPlatformWindows) { if (isWindows && peer.platform == kPeerPlatformWindows) {
menuItems.add(_rdpAction(context, peer.id)); menuItems.add(_rdpAction(context, peer.id));
} }
if (Platform.isWindows) { if (isWindows) {
menuItems.add(_createShortCutAction(peer.id)); menuItems.add(_createShortCutAction(peer.id));
} }
// menuItems.add(MenuEntryDivider()); // menuItems.add(MenuEntryDivider());
@@ -1107,9 +1184,7 @@ class MyGroupPeerCard extends BasePeerCard {
// menuItems.add(_unrememberPasswordAction(peer.id)); // menuItems.add(_unrememberPasswordAction(peer.id));
// } // }
if (gFFI.userModel.userName.isNotEmpty) { if (gFFI.userModel.userName.isNotEmpty) {
if (!gFFI.abModel.idContainBy(peer.id)) { menuItems.add(_addToAb(peer));
menuItems.add(_addToAb(peer));
}
} }
return menuItems; return menuItems;
} }
@@ -1176,7 +1251,7 @@ void _rdpDialog(String id) async {
).marginOnly(bottom: isDesktop ? 8 : 0), ).marginOnly(bottom: isDesktop ? 8 : 0),
Row( Row(
children: [ children: [
isDesktop (isDesktop || isWebDesktop)
? ConstrainedBox( ? ConstrainedBox(
constraints: const BoxConstraints(minWidth: 140), constraints: const BoxConstraints(minWidth: 140),
child: Text( child: Text(
@@ -1187,15 +1262,17 @@ void _rdpDialog(String id) async {
Expanded( Expanded(
child: TextField( child: TextField(
decoration: InputDecoration( decoration: InputDecoration(
labelText: isDesktop ? null : translate('Username')), labelText: (isDesktop || isWebDesktop)
? null
: translate('Username')),
controller: userController, controller: userController,
), ),
), ),
], ],
).marginOnly(bottom: isDesktop ? 8 : 0), ).marginOnly(bottom: (isDesktop || isWebDesktop) ? 8 : 0),
Row( Row(
children: [ children: [
isDesktop (isDesktop || isWebDesktop)
? ConstrainedBox( ? ConstrainedBox(
constraints: const BoxConstraints(minWidth: 140), constraints: const BoxConstraints(minWidth: 140),
child: Text( child: Text(
@@ -1207,7 +1284,9 @@ void _rdpDialog(String id) async {
child: Obx(() => TextField( child: Obx(() => TextField(
obscureText: secure.value, obscureText: secure.value,
decoration: InputDecoration( decoration: InputDecoration(
labelText: isDesktop ? null : translate('Password'), labelText: (isDesktop || isWebDesktop)
? null
: translate('Password'),
suffixIcon: IconButton( suffixIcon: IconButton(
onPressed: () => secure.value = !secure.value, onPressed: () => secure.value = !secure.value,
icon: Icon(secure.value icon: Icon(secure.value
@@ -1305,24 +1384,32 @@ class TagPainter extends CustomPainter {
} }
} }
void connectInPeerTab(BuildContext context, String id, PeerTabIndex tab, void connectInPeerTab(BuildContext context, Peer peer, PeerTabIndex tab,
{bool isFileTransfer = false, {bool isFileTransfer = false,
bool isTcpTunneling = false, bool isTcpTunneling = false,
bool isRDP = false}) async { bool isRDP = false}) async {
var password = '';
bool isSharedPassword = false;
if (tab == PeerTabIndex.ab) { if (tab == PeerTabIndex.ab) {
// If recent peer's alias is empty, set it to ab's alias // If recent peer's alias is empty, set it to ab's alias
// Because the platform is not set, it may not take effect, but it is more important not to display if the connection is not successful // Because the platform is not set, it may not take effect, but it is more important not to display if the connection is not successful
Peer? p = gFFI.abModel.find(id); if (peer.alias.isNotEmpty &&
if (p != null && (await bind.mainGetPeerOption(id: peer.id, key: "alias")).isEmpty) {
p.alias.isNotEmpty &&
(await bind.mainGetPeerOption(id: id, key: "alias")).isEmpty) {
await bind.mainSetPeerAlias( await bind.mainSetPeerAlias(
id: id, id: peer.id,
alias: p.alias, alias: peer.alias,
); );
} }
if (!gFFI.abModel.current.isPersonal()) {
if (peer.password.isNotEmpty) {
password = peer.password;
isSharedPassword = true;
}
}
} }
connect(context, id, connect(context, peer.id,
password: password,
isSharedPassword: isSharedPassword,
isFileTransfer: isFileTransfer, isFileTransfer: isFileTransfer,
isTcpTunneling: isTcpTunneling, isTcpTunneling: isTcpTunneling,
isRDP: isRDP); isRDP: isRDP);

View File

@@ -13,6 +13,7 @@ import 'package:flutter_hbb/desktop/widgets/material_mod_popup_menu.dart'
as mod_menu; as mod_menu;
import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart'; import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
import 'package:flutter_hbb/models/ab_model.dart'; import 'package:flutter_hbb/models/ab_model.dart';
import 'package:flutter_hbb/models/peer_model.dart';
import 'package:flutter_hbb/models/peer_tab_model.dart'; import 'package:flutter_hbb/models/peer_tab_model.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
@@ -36,7 +37,7 @@ class _TabEntry {
} }
EdgeInsets? _menuPadding() { EdgeInsets? _menuPadding() {
return isDesktop ? kDesktopMenuPadding : null; return (isDesktop || isWebDesktop) ? kDesktopMenuPadding : null;
} }
class _PeerTabPageState extends State<PeerTabPage> class _PeerTabPageState extends State<PeerTabPage>
@@ -61,7 +62,9 @@ class _PeerTabPageState extends State<PeerTabPage>
AddressBook( AddressBook(
menuPadding: _menuPadding(), menuPadding: _menuPadding(),
), ),
({dynamic hint}) => gFFI.abModel.pullAb(force: hint == null)), ({dynamic hint}) => gFFI.abModel.pullAb(
force: hint == null ? ForcePullAb.listAndCurrent : null,
quiet: false)),
_TabEntry( _TabEntry(
MyGroup( MyGroup(
menuPadding: _menuPadding(), menuPadding: _menuPadding(),
@@ -110,7 +113,9 @@ class _PeerTabPageState extends State<PeerTabPage>
SizedBox( SizedBox(
height: 32, height: 32,
child: Container( child: Container(
padding: isDesktop ? null : EdgeInsets.symmetric(horizontal: 2), padding: (isDesktop || isWebDesktop)
? null
: EdgeInsets.symmetric(horizontal: 2),
child: selectionWrap(Row( child: selectionWrap(Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@@ -124,7 +129,7 @@ class _PeerTabPageState extends State<PeerTabPage>
], ],
)), )),
), ),
).paddingOnly(right: isDesktop ? 12 : 0), ).paddingOnly(right: (isDesktop || isWebDesktop) ? 12 : 0),
_createPeersView(), _createPeersView(),
], ],
); );
@@ -132,11 +137,13 @@ class _PeerTabPageState extends State<PeerTabPage>
Widget _createSwitchBar(BuildContext context) { Widget _createSwitchBar(BuildContext context) {
final model = Provider.of<PeerTabModel>(context); final model = Provider.of<PeerTabModel>(context);
var counter = -1;
return ListView( return ReorderableListView(
buildDefaultDragHandles: false,
onReorder: model.reorder,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
children: model.visibleIndexs.map((t) { children: model.visibleEnabledOrderedIndexs.map((t) {
final selected = model.currentTab == t; final selected = model.currentTab == t;
final color = selected final color = selected
? MyTheme.tabbar(context).selectedTextColor ? MyTheme.tabbar(context).selectedTextColor
@@ -150,48 +157,54 @@ class _PeerTabPageState extends State<PeerTabPage>
border: Border( border: Border(
bottom: BorderSide(width: 2, color: color!), bottom: BorderSide(width: 2, color: color!),
)); ));
return Obx(() => InkWell( counter += 1;
child: Container( return ReorderableDragStartListener(
decoration: (hover.value key: ValueKey(t),
? (selected ? decoBorder : deco) index: counter,
: (selected ? decoBorder : null)), child: Obx(() => Tooltip(
child: Tooltip(
preferBelow: false, preferBelow: false,
message: model.tabTooltip(t), message: model.tabTooltip(t),
onTriggered: isMobile ? mobileShowTabVisibilityMenu : null, onTriggered: isMobile ? mobileShowTabVisibilityMenu : null,
child: Icon(model.tabIcon(t), color: color), child: InkWell(
).paddingSymmetric(horizontal: 4), child: Container(
).paddingSymmetric(horizontal: 4), decoration: (hover.value
onTap: () async { ? (selected ? decoBorder : deco)
await handleTabSelection(t); : (selected ? decoBorder : null)),
await bind.setLocalFlutterOption( child: Icon(model.tabIcon(t), color: color)
k: 'peer-tab-index', v: t.toString()); .paddingSymmetric(horizontal: 4),
}, ).paddingSymmetric(horizontal: 4),
onHover: (value) => hover.value = value, onTap: () async {
)); await handleTabSelection(t);
await bind.setLocalFlutterOption(
k: PeerTabModel.kPeerTabIndex, v: t.toString());
},
onHover: (value) => hover.value = value,
),
)));
}).toList()); }).toList());
} }
Widget _createPeersView() { Widget _createPeersView() {
final model = Provider.of<PeerTabModel>(context); final model = Provider.of<PeerTabModel>(context);
Widget child; Widget child;
if (model.visibleIndexs.isEmpty) { if (model.visibleEnabledOrderedIndexs.isEmpty) {
child = visibleContextMenuListener(Row( child = visibleContextMenuListener(Row(
children: [Expanded(child: InkWell())], children: [Expanded(child: InkWell())],
)); ));
} else { } else {
if (model.visibleIndexs.contains(model.currentTab)) { if (model.visibleEnabledOrderedIndexs.contains(model.currentTab)) {
child = entries[model.currentTab].widget; child = entries[model.currentTab].widget;
} else { } else {
debugPrint("should not happen! currentTab not in visibleIndexs"); debugPrint("should not happen! currentTab not in visibleIndexs");
Future.delayed(Duration.zero, () { Future.delayed(Duration.zero, () {
model.setCurrentTab(model.indexs[0]); model.setCurrentTab(model.visibleEnabledOrderedIndexs[0]);
}); });
child = entries[0].widget; child = entries[0].widget;
} }
} }
return Expanded( return Expanded(
child: child.marginSymmetric(vertical: isDesktop ? 12.0 : 6.0)); child: child.marginSymmetric(
vertical: (isDesktop || isWebDesktop) ? 12.0 : 6.0));
} }
Widget _createRefresh( Widget _createRefresh(
@@ -200,22 +213,23 @@ class _PeerTabPageState extends State<PeerTabPage>
final textColor = Theme.of(context).textTheme.titleLarge?.color; final textColor = Theme.of(context).textTheme.titleLarge?.color;
return Offstage( return Offstage(
offstage: model.currentTab != index.index, offstage: model.currentTab != index.index,
child: RefreshWidget( child: Tooltip(
onPressed: () { message: translate('Refresh'),
if (gFFI.peerTabModel.currentTab < entries.length) { child: RefreshWidget(
entries[gFFI.peerTabModel.currentTab].load(); onPressed: () {
} if (gFFI.peerTabModel.currentTab < entries.length) {
}, entries[gFFI.peerTabModel.currentTab].load();
spinning: loading, }
child: RotatedBox( },
quarterTurns: 2, spinning: loading,
child: Tooltip( child: RotatedBox(
message: translate('Refresh'), quarterTurns: 2,
child: Icon( child: Icon(
Icons.refresh, Icons.refresh,
size: 18, size: 18,
color: textColor, color: textColor,
)))), ))),
),
); );
} }
@@ -227,6 +241,7 @@ class _PeerTabPageState extends State<PeerTabPage>
final textColor = Theme.of(context).textTheme.titleLarge?.color; final textColor = Theme.of(context).textTheme.titleLarge?.color;
final model = Provider.of<PeerTabModel>(context); final model = Provider.of<PeerTabModel>(context);
return _hoverAction( return _hoverAction(
toolTip: translate('Select'),
context: context, context: context,
onTap: () { onTap: () {
model.setMultiSelectionMode(true); model.setMultiSelectionMode(true);
@@ -234,30 +249,29 @@ class _PeerTabPageState extends State<PeerTabPage>
Navigator.pop(context); Navigator.pop(context);
} }
}, },
child: Tooltip( child: SvgPicture.asset(
message: translate('Select'), "assets/checkbox-outline.svg",
child: SvgPicture.asset( width: 18,
"assets/checkbox-outline.svg", height: 18,
width: 18, colorFilter: svgColor(textColor),
height: 18, ),
colorFilter: svgColor(textColor),
)),
); );
} }
void mobileShowTabVisibilityMenu() { void mobileShowTabVisibilityMenu() {
final model = gFFI.peerTabModel; final model = gFFI.peerTabModel;
final items = List<PopupMenuItem>.empty(growable: true); final items = List<PopupMenuItem>.empty(growable: true);
for (int i = 0; i < model.tabNames.length; i++) { for (int i = 0; i < PeerTabModel.maxTabCount; i++) {
if (!model.isEnabled[i]) continue;
items.add(PopupMenuItem( items.add(PopupMenuItem(
height: kMinInteractiveDimension * 0.8, height: kMinInteractiveDimension * 0.8,
onTap: () => model.setTabVisible(i, !model.isVisible[i]), onTap: () => model.setTabVisible(i, !model.isVisibleEnabled[i]),
child: Row( child: Row(
children: [ children: [
Checkbox( Checkbox(
value: model.isVisible[i], value: model.isVisibleEnabled[i],
onChanged: (_) { onChanged: (_) {
model.setTabVisible(i, !model.isVisible[i]); model.setTabVisible(i, !model.isVisibleEnabled[i]);
if (Navigator.canPop(context)) { if (Navigator.canPop(context)) {
Navigator.pop(context); Navigator.pop(context);
} }
@@ -307,16 +321,17 @@ class _PeerTabPageState extends State<PeerTabPage>
Widget visibleContextMenu(CancelFunc cancelFunc) { Widget visibleContextMenu(CancelFunc cancelFunc) {
final model = Provider.of<PeerTabModel>(context); final model = Provider.of<PeerTabModel>(context);
final menu = List<MenuEntrySwitch>.empty(growable: true); final menu = List<MenuEntrySwitchSync>.empty(growable: true);
for (int i = 0; i < model.tabNames.length; i++) { for (int i = 0; i < model.orders.length; i++) {
menu.add(MenuEntrySwitch( int tabIndex = model.orders[i];
if (tabIndex < 0 || tabIndex >= PeerTabModel.maxTabCount) continue;
if (!model.isEnabled[tabIndex]) continue;
menu.add(MenuEntrySwitchSync(
switchType: SwitchType.scheckbox, switchType: SwitchType.scheckbox,
text: model.tabTooltip(i), text: model.tabTooltip(tabIndex),
getter: () async { currentValue: model.isVisibleEnabled[tabIndex],
return model.isVisible[i];
},
setter: (show) async { setter: (show) async {
model.setTabVisible(i, show); model.setTabVisible(tabIndex, show);
cancelFunc(); cancelFunc();
})); }));
} }
@@ -367,6 +382,7 @@ class _PeerTabPageState extends State<PeerTabPage>
} }
return _hoverAction( return _hoverAction(
context: context, context: context,
toolTip: translate('Delete'),
onTap: () { onTap: () {
onSubmit() async { onSubmit() async {
final peers = model.selectedPeers; final peers = model.selectedPeers;
@@ -392,21 +408,7 @@ class _PeerTabPageState extends State<PeerTabPage>
await bind.mainLoadLanPeers(); await bind.mainLoadLanPeers();
break; break;
case 3: case 3:
{ await gFFI.abModel.deletePeers(peers.map((p) => p.id).toList());
bool hasSynced = false;
if (shouldSyncAb()) {
for (var p in peers) {
if (await bind.mainPeerExists(id: p.id)) {
hasSynced = true;
}
}
}
gFFI.abModel.deletePeers(peers.map((p) => p.id).toList());
final future = gFFI.abModel.pushAb();
if (hasSynced) {
gFFI.abModel.reSyncToast(future);
}
}
break; break;
default: default:
break; break;
@@ -415,11 +417,9 @@ class _PeerTabPageState extends State<PeerTabPage>
if (model.currentTab != 3) showToast(translate('Successful')); if (model.currentTab != 3) showToast(translate('Successful'));
} }
deletePeerConfirmDialog(onSubmit, translate('Delete')); deleteConfirmDialog(onSubmit, translate('Delete'));
}, },
child: Tooltip( child: Icon(Icons.delete, color: Colors.red));
message: translate('Delete'),
child: Icon(Icons.delete, color: Colors.red)));
} }
Widget addSelectionToFav() { Widget addSelectionToFav() {
@@ -429,6 +429,7 @@ class _PeerTabPageState extends State<PeerTabPage>
model.currentTab != PeerTabIndex.recent.index, // show based on recent model.currentTab != PeerTabIndex.recent.index, // show based on recent
child: _hoverAction( child: _hoverAction(
context: context, context: context,
toolTip: translate('Add to Favorites'),
onTap: () async { onTap: () async {
final peers = model.selectedPeers; final peers = model.selectedPeers;
final favs = (await bind.mainGetFav()).toList(); final favs = (await bind.mainGetFav()).toList();
@@ -441,37 +442,28 @@ class _PeerTabPageState extends State<PeerTabPage>
model.setMultiSelectionMode(false); model.setMultiSelectionMode(false);
showToast(translate('Successful')); showToast(translate('Successful'));
}, },
child: Tooltip( child: Icon(PeerTabModel.icons[PeerTabIndex.fav.index]),
message: translate('Add to Favorites'),
child: Icon(model.icons[PeerTabIndex.fav.index])),
).marginOnly(left: isMobile ? 11 : 6), ).marginOnly(left: isMobile ? 11 : 6),
); );
} }
Widget addSelectionToAb() { Widget addSelectionToAb() {
final model = Provider.of<PeerTabModel>(context); final model = Provider.of<PeerTabModel>(context);
final addressbooks = gFFI.abModel.addressBooksCanWrite();
if (model.currentTab == PeerTabIndex.ab.index) {
addressbooks.remove(gFFI.abModel.currentName.value);
}
return Offstage( return Offstage(
offstage: offstage: !gFFI.userModel.isLogin || addressbooks.isEmpty,
!gFFI.userModel.isLogin || model.currentTab == PeerTabIndex.ab.index,
child: _hoverAction( child: _hoverAction(
context: context, context: context,
toolTip: translate('Add to address book'),
onTap: () { onTap: () {
if (gFFI.abModel.isFull(true)) { final peers = model.selectedPeers.map((e) => Peer.copy(e)).toList();
return; addPeersToAbDialog(peers);
}
final peers = model.selectedPeers;
gFFI.abModel.addPeers(peers);
final future = gFFI.abModel.pushAb();
model.setMultiSelectionMode(false); model.setMultiSelectionMode(false);
Future.delayed(Duration.zero, () async {
await future;
await Future.delayed(Duration(seconds: 2)); // toast
gFFI.abModel.isFull(true);
});
}, },
child: Tooltip( child: Icon(PeerTabModel.icons[PeerTabIndex.ab.index]),
message: translate('Add to address book'),
child: Icon(model.icons[PeerTabIndex.ab.index])),
).marginOnly(left: isMobile ? 11 : 6), ).marginOnly(left: isMobile ? 11 : 6),
); );
} }
@@ -481,21 +473,20 @@ class _PeerTabPageState extends State<PeerTabPage>
return Offstage( return Offstage(
offstage: !gFFI.userModel.isLogin || offstage: !gFFI.userModel.isLogin ||
model.currentTab != PeerTabIndex.ab.index || model.currentTab != PeerTabIndex.ab.index ||
gFFI.abModel.tags.isEmpty, gFFI.abModel.currentAbTags.isEmpty,
child: _hoverAction( child: _hoverAction(
context: context, context: context,
toolTip: translate('Edit Tag'),
onTap: () { onTap: () {
editAbTagDialog(List.empty(), (selectedTags) async { editAbTagDialog(List.empty(), (selectedTags) async {
final peers = model.selectedPeers; final peers = model.selectedPeers;
gFFI.abModel.changeTagForPeers( await gFFI.abModel.changeTagForPeers(
peers.map((p) => p.id).toList(), selectedTags); peers.map((p) => p.id).toList(), selectedTags);
gFFI.abModel.pushAb();
model.setMultiSelectionMode(false); model.setMultiSelectionMode(false);
showToast(translate('Successful')); showToast(translate('Successful'));
}); });
}, },
child: Tooltip( child: Icon(Icons.tag))
message: translate('Edit Tag'), child: Icon(Icons.tag)))
.marginOnly(left: isMobile ? 11 : 6), .marginOnly(left: isMobile ? 11 : 6),
); );
} }
@@ -514,11 +505,11 @@ class _PeerTabPageState extends State<PeerTabPage>
model.selectedPeers.length >= model.currentTabCachedPeers.length, model.selectedPeers.length >= model.currentTabCachedPeers.length,
child: _hoverAction( child: _hoverAction(
context: context, context: context,
toolTip: translate('Select All'),
onTap: () { onTap: () {
model.selectAll(); model.selectAll();
}, },
child: Tooltip( child: Icon(Icons.select_all),
message: translate('Select All'), child: Icon(Icons.select_all)),
).marginOnly(left: 6), ).marginOnly(left: 6),
); );
} }
@@ -527,24 +518,23 @@ class _PeerTabPageState extends State<PeerTabPage>
final model = Provider.of<PeerTabModel>(context); final model = Provider.of<PeerTabModel>(context);
return _hoverAction( return _hoverAction(
context: context, context: context,
toolTip: translate('Close'),
onTap: () { onTap: () {
model.setMultiSelectionMode(false); model.setMultiSelectionMode(false);
}, },
child: child: Icon(Icons.clear))
Tooltip(message: translate('Close'), child: Icon(Icons.clear)))
.marginOnly(left: 6); .marginOnly(left: 6);
} }
Widget _toggleTags() { Widget _toggleTags() {
return _hoverAction( return _hoverAction(
context: context, context: context,
toolTip: translate('Toggle tags'),
hoverableWhenfalse: hideAbTagsPanel, hoverableWhenfalse: hideAbTagsPanel,
child: Tooltip( child: Icon(
message: translate('Toggle Tags'), Icons.tag_rounded,
child: Icon( size: 18,
Icons.tag_rounded, ),
size: 18,
)),
onTap: () async { onTap: () async {
await bind.mainSetLocalOption( await bind.mainSetLocalOption(
key: "hideAbTagsPanel", value: hideAbTagsPanel.value ? "" : "Y"); key: "hideAbTagsPanel", value: hideAbTagsPanel.value ? "" : "Y");
@@ -556,7 +546,8 @@ class _PeerTabPageState extends State<PeerTabPage>
final model = Provider.of<PeerTabModel>(context); final model = Provider.of<PeerTabModel>(context);
return [ return [
const PeerSearchBar().marginOnly(right: isMobile ? 0 : 13), const PeerSearchBar().marginOnly(right: isMobile ? 0 : 13),
_createRefresh(index: PeerTabIndex.ab, loading: gFFI.abModel.abLoading), _createRefresh(
index: PeerTabIndex.ab, loading: gFFI.abModel.currentAbLoading),
_createRefresh( _createRefresh(
index: PeerTabIndex.group, loading: gFFI.groupModel.groupLoading), index: PeerTabIndex.group, loading: gFFI.groupModel.groupLoading),
Offstage( Offstage(
@@ -580,7 +571,7 @@ class _PeerTabPageState extends State<PeerTabPage>
final screenWidth = MediaQuery.of(context).size.width; final screenWidth = MediaQuery.of(context).size.width;
final leftIconSize = Theme.of(context).iconTheme.size ?? 24; final leftIconSize = Theme.of(context).iconTheme.size ?? 24;
final leftActionsSize = final leftActionsSize =
(leftIconSize + (4 + 4) * 2) * model.visibleIndexs.length; (leftIconSize + (4 + 4) * 2) * model.visibleEnabledOrderedIndexs.length;
final availableWidth = screenWidth - 10 * 2 - leftActionsSize - 2 * 2; final availableWidth = screenWidth - 10 * 2 - leftActionsSize - 2 * 2;
final searchWidth = 120; final searchWidth = 120;
final otherActionWidth = 18 + 10; final otherActionWidth = 18 + 10;
@@ -593,14 +584,13 @@ class _PeerTabPageState extends State<PeerTabPage>
(BuildContext context, Future<void> Function() showMenu) { (BuildContext context, Future<void> Function() showMenu) {
return _hoverAction( return _hoverAction(
context: context, context: context,
child: Tooltip( toolTip: translate('More'),
message: translate('More'), child: SvgPicture.asset(
child: SvgPicture.asset( "assets/chevron_up_chevron_down.svg",
"assets/chevron_up_chevron_down.svg", width: 18,
width: 18, height: 18,
height: 18, colorFilter: svgColor(textColor),
colorFilter: svgColor(textColor), ),
)),
onTap: showMenu, onTap: showMenu,
); );
}, },
@@ -624,7 +614,8 @@ class _PeerTabPageState extends State<PeerTabPage>
List<Widget> actions = [ List<Widget> actions = [
const PeerSearchBar(), const PeerSearchBar(),
if (model.currentTab == PeerTabIndex.ab.index) if (model.currentTab == PeerTabIndex.ab.index)
_createRefresh(index: PeerTabIndex.ab, loading: gFFI.abModel.abLoading), _createRefresh(
index: PeerTabIndex.ab, loading: gFFI.abModel.currentAbLoading),
if (model.currentTab == PeerTabIndex.group.index) if (model.currentTab == PeerTabIndex.group.index)
_createRefresh( _createRefresh(
index: PeerTabIndex.group, loading: gFFI.groupModel.groupLoading), index: PeerTabIndex.group, loading: gFFI.groupModel.groupLoading),
@@ -674,18 +665,17 @@ class _PeerSearchBarState extends State<PeerSearchBar> {
? _buildSearchBar() ? _buildSearchBar()
: _hoverAction( : _hoverAction(
context: context, context: context,
toolTip: translate('Search'),
padding: const EdgeInsets.only(right: 2), padding: const EdgeInsets.only(right: 2),
onTap: () { onTap: () {
setState(() { setState(() {
drawer = true; drawer = true;
}); });
}, },
child: Tooltip( child: Icon(
message: translate('Search'), Icons.search_rounded,
child: Icon( color: Theme.of(context).hintColor,
Icons.search_rounded, ));
color: Theme.of(context).hintColor,
)));
} }
Widget _buildSearchBar() { Widget _buildSearchBar() {
@@ -826,16 +816,15 @@ class _PeerViewDropdownState extends State<PeerViewDropdown> {
var menuPos = RelativeRect.fromLTRB(0, 0, 0, 0); var menuPos = RelativeRect.fromLTRB(0, 0, 0, 0);
return _hoverAction( return _hoverAction(
context: context, context: context,
child: Tooltip( toolTip: translate('Change view'),
message: translate('Change view'), child: Icon(
child: Icon( peerCardUiType.value == PeerUiType.grid
peerCardUiType.value == PeerUiType.grid ? Icons.grid_view_rounded
? Icons.grid_view_rounded : peerCardUiType.value == PeerUiType.tile
: peerCardUiType.value == PeerUiType.tile ? Icons.view_list_rounded
? Icons.view_list_rounded : Icons.view_agenda_rounded,
: Icons.view_agenda_rounded, size: 18,
size: 18, ),
)),
onTapDown: (details) { onTapDown: (details) {
final x = details.globalPosition.dx; final x = details.globalPosition.dx;
final y = details.globalPosition.dy; final y = details.globalPosition.dy;
@@ -905,12 +894,11 @@ class _PeerSortDropdownState extends State<PeerSortDropdown> {
var menuPos = RelativeRect.fromLTRB(0, 0, 0, 0); var menuPos = RelativeRect.fromLTRB(0, 0, 0, 0);
return _hoverAction( return _hoverAction(
context: context, context: context,
child: Tooltip( toolTip: translate('Sort by'),
message: translate('Sort by'), child: Icon(
child: Icon( Icons.sort_rounded,
Icons.sort_rounded, size: 18,
size: 18, ),
)),
onTapDown: (details) { onTapDown: (details) {
final x = details.globalPosition.dx; final x = details.globalPosition.dx;
final y = details.globalPosition.dy; final y = details.globalPosition.dy;
@@ -992,6 +980,7 @@ Widget _hoverAction(
{required BuildContext context, {required BuildContext context,
required Widget child, required Widget child,
required Function() onTap, required Function() onTap,
required String toolTip,
GestureTapDownCallback? onTapDown, GestureTapDownCallback? onTapDown,
RxBool? hoverableWhenfalse, RxBool? hoverableWhenfalse,
EdgeInsetsGeometry padding = const EdgeInsets.all(4.0)}) { EdgeInsetsGeometry padding = const EdgeInsets.all(4.0)}) {
@@ -1000,16 +989,19 @@ Widget _hoverAction(
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
); );
return Obx( return Tooltip(
() => Container( message: toolTip,
margin: EdgeInsets.symmetric(horizontal: 1), child: Obx(
decoration: () => Container(
(hover.value || hoverableWhenfalse?.value == false) ? deco : null, margin: EdgeInsets.symmetric(horizontal: 1),
child: InkWell( decoration:
onHover: (value) => hover.value = value, (hover.value || hoverableWhenfalse?.value == false) ? deco : null,
onTap: onTap, child: InkWell(
onTapDown: onTapDown, onHover: (value) => hover.value = value,
child: Container(padding: padding, child: child))), onTap: onTap,
onTapDown: onTapDown,
child: Container(padding: padding, child: child))),
),
); );
} }

View File

@@ -78,7 +78,7 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
LoadEvent.lan: 'empty_lan_tip', LoadEvent.lan: 'empty_lan_tip',
LoadEvent.addressBook: 'empty_address_book_tip', LoadEvent.addressBook: 'empty_address_book_tip',
}); });
final space = isDesktop ? 12.0 : 8.0; final space = (isDesktop || isWebDesktop) ? 12.0 : 8.0;
final _curPeers = <String>{}; final _curPeers = <String>{};
var _lastChangeTime = DateTime.now(); var _lastChangeTime = DateTime.now();
var _lastQueryPeers = <String>{}; var _lastQueryPeers = <String>{};
@@ -196,18 +196,25 @@ class _PeersViewState extends State<_PeersView> with WindowListener {
// No need to listen the currentTab change event. // No need to listen the currentTab change event.
// Because the currentTab change event will trigger the peers change event, // Because the currentTab change event will trigger the peers change event,
// and the peers change event will trigger _buildPeersView(). // and the peers change event will trigger _buildPeersView().
final currentTab = Provider.of<PeerTabModel>(context, listen: false).currentTab; final currentTab =
final hideAbTagsPanel = bind.mainGetLocalOption(key: "hideAbTagsPanel").isNotEmpty; Provider.of<PeerTabModel>(context, listen: false).currentTab;
return isDesktop final hideAbTagsPanel =
bind.mainGetLocalOption(key: "hideAbTagsPanel").isNotEmpty;
return (isDesktop || isWebDesktop)
? Obx( ? Obx(
() => SizedBox( () => SizedBox(
width: peerCardUiType.value != PeerUiType.list width: peerCardUiType.value != PeerUiType.list
? 220 ? 220
: currentTab == PeerTabIndex.group.index || (currentTab == PeerTabIndex.ab.index && !hideAbTagsPanel) : currentTab == PeerTabIndex.group.index ||
? windowWidth - 390 : (currentTab == PeerTabIndex.ab.index &&
windowWidth - 227, !hideAbTagsPanel)
height: ? windowWidth - 390
peerCardUiType.value == PeerUiType.grid ? 140 : peerCardUiType.value != PeerUiType.list ? 42 : 45, : windowWidth - 227,
height: peerCardUiType.value == PeerUiType.grid
? 140
: peerCardUiType.value != PeerUiType.list
? 42
: 45,
child: visibilityChild, child: visibilityChild,
), ),
) )
@@ -354,7 +361,7 @@ abstract class BasePeersView extends StatelessWidget {
final String loadEvent; final String loadEvent;
final PeerFilter? peerFilter; final PeerFilter? peerFilter;
final PeerCardBuilder peerCardBuilder; final PeerCardBuilder peerCardBuilder;
final RxList<Peer>? initPeers; final GetInitPeers? getInitPeers;
const BasePeersView({ const BasePeersView({
Key? key, Key? key,
@@ -362,13 +369,14 @@ abstract class BasePeersView extends StatelessWidget {
required this.loadEvent, required this.loadEvent,
this.peerFilter, this.peerFilter,
required this.peerCardBuilder, required this.peerCardBuilder,
required this.initPeers, required this.getInitPeers,
}) : super(key: key); }) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return _PeersView( return _PeersView(
peers: Peers(name: name, loadEvent: loadEvent, initPeers: initPeers), peers:
Peers(name: name, loadEvent: loadEvent, getInitPeers: getInitPeers),
peerFilter: peerFilter, peerFilter: peerFilter,
peerCardBuilder: peerCardBuilder); peerCardBuilder: peerCardBuilder);
} }
@@ -385,7 +393,7 @@ class RecentPeersView extends BasePeersView {
peer: peer, peer: peer,
menuPadding: menuPadding, menuPadding: menuPadding,
), ),
initPeers: null, getInitPeers: null,
); );
@override @override
@@ -407,7 +415,7 @@ class FavoritePeersView extends BasePeersView {
peer: peer, peer: peer,
menuPadding: menuPadding, menuPadding: menuPadding,
), ),
initPeers: null, getInitPeers: null,
); );
@override @override
@@ -429,7 +437,7 @@ class DiscoveredPeersView extends BasePeersView {
peer: peer, peer: peer,
menuPadding: menuPadding, menuPadding: menuPadding,
), ),
initPeers: null, getInitPeers: null,
); );
@override @override
@@ -445,7 +453,7 @@ class AddressBookPeersView extends BasePeersView {
{Key? key, {Key? key,
EdgeInsets? menuPadding, EdgeInsets? menuPadding,
ScrollController? scrollController, ScrollController? scrollController,
required RxList<Peer> initPeers}) required GetInitPeers getInitPeers})
: super( : super(
key: key, key: key,
name: 'address book peer', name: 'address book peer',
@@ -456,7 +464,7 @@ class AddressBookPeersView extends BasePeersView {
peer: peer, peer: peer,
menuPadding: menuPadding, menuPadding: menuPadding,
), ),
initPeers: initPeers, getInitPeers: getInitPeers,
); );
static bool _hitTag(List<dynamic> selectedTags, List<dynamic> idents) { static bool _hitTag(List<dynamic> selectedTags, List<dynamic> idents) {
@@ -486,7 +494,7 @@ class MyGroupPeerView extends BasePeersView {
{Key? key, {Key? key,
EdgeInsets? menuPadding, EdgeInsets? menuPadding,
ScrollController? scrollController, ScrollController? scrollController,
required RxList<Peer> initPeers}) required GetInitPeers getInitPeers})
: super( : super(
key: key, key: key,
name: 'group peer', name: 'group peer',
@@ -496,7 +504,7 @@ class MyGroupPeerView extends BasePeersView {
peer: peer, peer: peer,
menuPadding: menuPadding, menuPadding: menuPadding,
), ),
initPeers: initPeers, getInitPeers: getInitPeers,
); );
static bool filter(Peer peer) { static bool filter(Peer peer) {

View File

@@ -77,7 +77,7 @@ class _RawTouchGestureDetectorRegionState
FFI get ffi => widget.ffi; FFI get ffi => widget.ffi;
FfiModel get ffiModel => widget.ffiModel; FfiModel get ffiModel => widget.ffiModel;
InputModel get inputModel => widget.inputModel; InputModel get inputModel => widget.inputModel;
bool get handleTouch => isDesktop || ffiModel.touchMode; bool get handleTouch => (isDesktop || isWebDesktop) || ffiModel.touchMode;
SessionID get sessionId => ffi.sessionId; SessionID get sessionId => ffi.sessionId;
@override @override
@@ -183,7 +183,7 @@ class _RawTouchGestureDetectorRegionState
if (lastDeviceKind != PointerDeviceKind.touch) { if (lastDeviceKind != PointerDeviceKind.touch) {
return; return;
} }
if (isDesktop || !ffiModel.touchMode) { if ((isDesktop || isWebDesktop) || !ffiModel.touchMode) {
inputModel.tap(MouseButtons.right); inputModel.tap(MouseButtons.right);
} }
} }
@@ -262,7 +262,7 @@ class _RawTouchGestureDetectorRegionState
if (lastDeviceKind != PointerDeviceKind.touch) { if (lastDeviceKind != PointerDeviceKind.touch) {
return; return;
} }
if (isDesktop) { if ((isDesktop || isWebDesktop)) {
final scale = ((d.scale - _scale) * 1000).toInt(); final scale = ((d.scale - _scale) * 1000).toInt();
_scale = d.scale; _scale = d.scale;
@@ -286,7 +286,7 @@ class _RawTouchGestureDetectorRegionState
if (lastDeviceKind != PointerDeviceKind.touch) { if (lastDeviceKind != PointerDeviceKind.touch) {
return; return;
} }
if (isDesktop) { if ((isDesktop || isWebDesktop)) {
bind.sessionSendPointer( bind.sessionSendPointer(
sessionId: sessionId, sessionId: sessionId,
msg: json.encode( msg: json.encode(
@@ -409,7 +409,9 @@ class RawPointerMouseRegion extends StatelessWidget {
onPointerPanZoomUpdate: inputModel.onPointerPanZoomUpdate, onPointerPanZoomUpdate: inputModel.onPointerPanZoomUpdate,
onPointerPanZoomEnd: inputModel.onPointerPanZoomEnd, onPointerPanZoomEnd: inputModel.onPointerPanZoomEnd,
child: MouseRegion( child: MouseRegion(
cursor: cursor ?? MouseCursor.defer, cursor: inputModel.isViewOnly
? MouseCursor.defer
: (cursor ?? MouseCursor.defer),
onEnter: onEnter, onEnter: onEnter,
onExit: onExit, onExit: onExit,
child: child, child: child,

View File

@@ -209,10 +209,10 @@ List<Widget> ServerConfigImportExportWidgets(
List<(String, String)> otherDefaultSettings() { List<(String, String)> otherDefaultSettings() {
List<(String, String)> v = [ List<(String, String)> v = [
('View Mode', 'view_only'), ('View Mode', 'view_only'),
if (isDesktop) ('show_monitors_tip', kKeyShowMonitorsToolbar), if ((isDesktop || isWebDesktop)) ('show_monitors_tip', kKeyShowMonitorsToolbar),
if (isDesktop) ('Collapse toolbar', 'collapse_toolbar'), if ((isDesktop || isWebDesktop)) ('Collapse toolbar', 'collapse_toolbar'),
('Show remote cursor', 'show_remote_cursor'), ('Show remote cursor', 'show_remote_cursor'),
if (isDesktop) ('Zoom cursor', 'zoom-cursor'), if ((isDesktop || isWebDesktop)) ('Zoom cursor', 'zoom-cursor'),
('Show quality monitor', 'show_quality_monitor'), ('Show quality monitor', 'show_quality_monitor'),
('Mute', 'disable_audio'), ('Mute', 'disable_audio'),
if (isDesktop) ('Enable file copy and paste', 'enable_file_transfer'), if (isDesktop) ('Enable file copy and paste', 'enable_file_transfer'),
@@ -221,7 +221,7 @@ List<(String, String)> otherDefaultSettings() {
('Privacy mode', 'privacy_mode'), ('Privacy mode', 'privacy_mode'),
if (isMobile) ('Touch mode', 'touch-mode'), if (isMobile) ('Touch mode', 'touch-mode'),
('True color (4:4:4)', 'i444'), ('True color (4:4:4)', 'i444'),
('Reverse mouse wheel', 'reverse_mouse_wheel'), ('Reverse mouse wheel', kKeyReverseMouseWheel),
('swap-left-right-mouse', 'swap-left-right-mouse'), ('swap-left-right-mouse', 'swap-left-right-mouse'),
if (isDesktop && useTextureRender) if (isDesktop && useTextureRender)
( (

View File

@@ -1,5 +1,4 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@@ -95,7 +94,7 @@ List<TTextMenu> toolbarControls(BuildContext context, String id, FFI ffi) {
Text(translate(pi.isHeadless ? 'OS Account' : 'OS Password')), Text(translate(pi.isHeadless ? 'OS Account' : 'OS Password')),
]), ]),
trailingIcon: Transform.scale( trailingIcon: Transform.scale(
scale: isDesktop ? 0.8 : 1, scale: (isDesktop || isWebDesktop) ? 0.8 : 1,
child: IconButton( child: IconButton(
onPressed: () { onPressed: () {
if (isMobile && Navigator.canPop(context)) { if (isMobile && Navigator.canPop(context)) {
@@ -161,7 +160,7 @@ List<TTextMenu> toolbarControls(BuildContext context, String id, FFI ffi) {
); );
} }
// divider // divider
if (isDesktop) { if (isDesktop || isWebDesktop) {
v.add(TTextMenu(child: Offstage(), onPressed: () {}, divider: true)); v.add(TTextMenu(child: Offstage(), onPressed: () {}, divider: true));
} }
// ctrlAltDel // ctrlAltDel
@@ -230,7 +229,7 @@ List<TTextMenu> toolbarControls(BuildContext context, String id, FFI ffi) {
)); ));
} }
// record // record
if (!isDesktop && if (!(isDesktop || isWeb) &&
(ffi.recordingModel.start || (perms["recording"] != false))) { (ffi.recordingModel.start || (perms["recording"] != false))) {
v.add(TTextMenu( v.add(TTextMenu(
child: Row( child: Row(
@@ -251,7 +250,7 @@ List<TTextMenu> toolbarControls(BuildContext context, String id, FFI ffi) {
onPressed: () => ffi.recordingModel.toggle())); onPressed: () => ffi.recordingModel.toggle()));
} }
// fingerprint // fingerprint
if (!isDesktop) { if (!(isDesktop || isWebDesktop)) {
v.add(TTextMenu( v.add(TTextMenu(
child: Text(translate('Copy Fingerprint')), child: Text(translate('Copy Fingerprint')),
onPressed: () => onCopyFingerprint(FingerprintState.find(id).value), onPressed: () => onCopyFingerprint(FingerprintState.find(id).value),
@@ -512,8 +511,8 @@ Future<List<TToggleMenu>> toolbarDisplayToggle(
child: Text(translate('Show displays as individual windows')))); child: Text(translate('Show displays as individual windows'))));
} }
final screenList = await getScreenRectList(); final isMultiScreens = !isWeb && (await getScreenRectList()).length > 1;
if (useTextureRender && pi.isSupportMultiDisplay && screenList.length > 1) { if (useTextureRender && pi.isSupportMultiDisplay && isMultiScreens) {
final value = bind.sessionGetUseAllMyDisplaysForTheRemoteSession( final value = bind.sessionGetUseAllMyDisplaysForTheRemoteSession(
sessionId: ffi.sessionId) == sessionId: ffi.sessionId) ==
'Y'; 'Y';
@@ -633,8 +632,8 @@ List<TToggleMenu> toolbarKeyboardToggles(FFI ffi) {
// swap key // swap key
if (ffiModel.keyboard && if (ffiModel.keyboard &&
((Platform.isMacOS && pi.platform != kPeerPlatformMacOS) || ((isMacOS && pi.platform != kPeerPlatformMacOS) ||
(!Platform.isMacOS && pi.platform == kPeerPlatformMacOS))) { (!isMacOS && pi.platform == kPeerPlatformMacOS))) {
final option = 'allow_swap_key'; final option = 'allow_swap_key';
final value = final value =
bind.sessionGetToggleOptionSync(sessionId: sessionId, arg: option); bind.sessionGetToggleOptionSync(sessionId: sessionId, arg: option);
@@ -655,7 +654,7 @@ List<TToggleMenu> toolbarKeyboardToggles(FFI ffi) {
var optionValue = var optionValue =
bind.sessionGetReverseMouseWheelSync(sessionId: sessionId) ?? ''; bind.sessionGetReverseMouseWheelSync(sessionId: sessionId) ?? '';
if (optionValue == '') { if (optionValue == '') {
optionValue = bind.mainGetUserDefaultOption(key: 'reverse_mouse_wheel'); optionValue = bind.mainGetUserDefaultOption(key: kKeyReverseMouseWheel);
} }
onChanged(bool? value) async { onChanged(bool? value) async {
if (value == null) return; if (value == null) return;

View File

@@ -1,5 +1,3 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hbb/common.dart'; import 'package:flutter_hbb/common.dart';
import 'package:flutter_hbb/models/state_model.dart'; import 'package:flutter_hbb/models/state_model.dart';
@@ -23,7 +21,8 @@ const String kPlatformAdditionsHeadless = "headless";
const String kPlatformAdditionsIsInstalled = "is_installed"; const String kPlatformAdditionsIsInstalled = "is_installed";
const String kPlatformAdditionsVirtualDisplays = "virtual_displays"; const String kPlatformAdditionsVirtualDisplays = "virtual_displays";
const String kPlatformAdditionsHasFileClipboard = "has_file_clipboard"; const String kPlatformAdditionsHasFileClipboard = "has_file_clipboard";
const String kPlatformAdditionsSupportedPrivacyModeImpl = "supported_privacy_mode_impl"; const String kPlatformAdditionsSupportedPrivacyModeImpl =
"supported_privacy_mode_impl";
const String kPeerPlatformWindows = "Windows"; const String kPeerPlatformWindows = "Windows";
const String kPeerPlatformLinux = "Linux"; const String kPeerPlatformLinux = "Linux";
@@ -68,8 +67,8 @@ const String kOptionOpenNewConnInTabs = "enable-open-new-connections-in-tabs";
const String kOptionOpenInTabs = "allow-open-in-tabs"; const String kOptionOpenInTabs = "allow-open-in-tabs";
const String kOptionOpenInWindows = "allow-open-in-windows"; const String kOptionOpenInWindows = "allow-open-in-windows";
const String kOptionForceAlwaysRelay = "force-always-relay"; const String kOptionForceAlwaysRelay = "force-always-relay";
const String kOptionViewOnly = "view-only";
const String kUniLinksPrefix = "rustdesk://";
const String kUrlActionClose = "close"; const String kUrlActionClose = "close";
const String kTabLabelHomePage = "Home"; const String kTabLabelHomePage = "Home";
@@ -86,6 +85,7 @@ const String kKeyShowDisplaysAsIndividualWindows =
const String kKeyUseAllMyDisplaysForTheRemoteSession = const String kKeyUseAllMyDisplaysForTheRemoteSession =
'use_all_my_displays_for_the_remote_session'; 'use_all_my_displays_for_the_remote_session';
const String kKeyShowMonitorsToolbar = 'show_monitors_toolbar'; const String kKeyShowMonitorsToolbar = 'show_monitors_toolbar';
const String kKeyReverseMouseWheel = "reverse_mouse_wheel";
// the executable name of the portable version // the executable name of the portable version
const String kEnvPortableExecutable = "RUSTDESK_APPNAME"; const String kEnvPortableExecutable = "RUSTDESK_APPNAME";
@@ -113,16 +113,16 @@ const double kDefaultQuality = 50;
const double kMaxQuality = 100; const double kMaxQuality = 100;
const double kMaxMoreQuality = 2000; const double kMaxMoreQuality = 2000;
double kNewWindowOffset = Platform.isWindows double kNewWindowOffset = isWindows
? 56.0 ? 56.0
: Platform.isLinux : isLinux
? 50.0 ? 50.0
: Platform.isMacOS : isMacOS
? 30.0 ? 30.0
: 50.0; : 50.0;
EdgeInsets get kDragToResizeAreaPadding => EdgeInsets get kDragToResizeAreaPadding =>
!kUseCompatibleUiMode && Platform.isLinux !kUseCompatibleUiMode && isLinux
? stateGlobal.fullscreen.isTrue || stateGlobal.isMaximized.value ? stateGlobal.fullscreen.isTrue || stateGlobal.isMaximized.value
? EdgeInsets.zero ? EdgeInsets.zero
: EdgeInsets.all(5.0) : EdgeInsets.all(5.0)
@@ -150,7 +150,7 @@ const kDefaultScrollDuration = Duration(milliseconds: 50);
const kDefaultMouseWheelThrottleDuration = Duration(milliseconds: 50); const kDefaultMouseWheelThrottleDuration = Duration(milliseconds: 50);
const kFullScreenEdgeSize = 0.0; const kFullScreenEdgeSize = 0.0;
const kMaximizeEdgeSize = 0.0; const kMaximizeEdgeSize = 0.0;
var kWindowEdgeSize = Platform.isWindows ? 1.0 : 5.0; var kWindowEdgeSize = isWindows ? 1.0 : 5.0;
const kWindowBorderWidth = 1.0; const kWindowBorderWidth = 1.0;
const kDesktopMenuPadding = EdgeInsets.only(left: 12.0, right: 3.0); const kDesktopMenuPadding = EdgeInsets.only(left: 12.0, right: 3.0);

View File

@@ -2,7 +2,6 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -20,6 +19,173 @@ import '../../common/widgets/autocomplete.dart';
import '../../models/platform_model.dart'; import '../../models/platform_model.dart';
import '../widgets/button.dart'; import '../widgets/button.dart';
class OnlineStatusWidget extends StatefulWidget {
const OnlineStatusWidget({Key? key, this.onSvcStatusChanged})
: super(key: key);
final VoidCallback? onSvcStatusChanged;
@override
State<OnlineStatusWidget> createState() => _OnlineStatusWidgetState();
}
/// State for the connection page.
class _OnlineStatusWidgetState extends State<OnlineStatusWidget> {
final _svcStopped = Get.find<RxBool>(tag: 'stop-service');
final _svcIsUsingPublicServer = true.obs;
Timer? _updateTimer;
double get em => 14.0;
double? get height => bind.isIncomingOnly() ? null : em * 3;
void onUsePublicServerGuide() {
const url = "https://rustdesk.com/pricing.html";
canLaunchUrlString(url).then((can) {
if (can) {
launchUrlString(url);
}
});
}
@override
void initState() {
super.initState();
_updateTimer = periodic_immediate(Duration(seconds: 1), () async {
updateStatus();
});
}
@override
void dispose() {
_updateTimer?.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
final isIncomingOnly = bind.isIncomingOnly();
startServiceWidget() => Offstage(
offstage: !_svcStopped.value,
child: InkWell(
onTap: () async {
await start_service(true);
},
child: Text(translate("Start service"),
style: TextStyle(
decoration: TextDecoration.underline, fontSize: em)))
.marginOnly(left: em),
);
setupServerWidget() => Flexible(
child: Offstage(
offstage: !(!_svcStopped.value &&
stateGlobal.svcStatus.value == SvcStatus.ready &&
_svcIsUsingPublicServer.value),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(', ', style: TextStyle(fontSize: em)),
Flexible(
child: InkWell(
onTap: onUsePublicServerGuide,
child: Row(
children: [
Flexible(
child: Text(
translate('setup_server_tip'),
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: em),
),
),
],
),
),
)
],
),
),
);
basicWidget() => Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 8,
width: 8,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: _svcStopped.value ||
stateGlobal.svcStatus.value == SvcStatus.connecting
? kColorWarn
: (stateGlobal.svcStatus.value == SvcStatus.ready
? Color.fromARGB(255, 50, 190, 166)
: Color.fromARGB(255, 224, 79, 95)),
),
).marginSymmetric(horizontal: em),
Container(
width: isIncomingOnly ? 226 : null,
child: _buildConnStatusMsg(),
),
// stop
if (!isIncomingOnly) startServiceWidget(),
// ready && public
// No need to show the guide if is custom client.
if (!isIncomingOnly) setupServerWidget(),
],
);
return Container(
height: height,
child: Obx(() => isIncomingOnly
? Column(
children: [
basicWidget(),
Align(
child: startServiceWidget(),
alignment: Alignment.centerLeft)
.marginOnly(top: 2.0, left: 22.0),
],
)
: basicWidget()),
).paddingOnly(right: isIncomingOnly ? 8 : 0);
}
_buildConnStatusMsg() {
widget.onSvcStatusChanged?.call();
return Text(
_svcStopped.value
? translate("Service is not running")
: stateGlobal.svcStatus.value == SvcStatus.connecting
? translate("connecting_status")
: stateGlobal.svcStatus.value == SvcStatus.notReady
? translate("not_ready_status")
: translate('Ready'),
style: TextStyle(fontSize: em),
);
}
updateStatus() async {
final status =
jsonDecode(await bind.mainGetConnectStatus()) as Map<String, dynamic>;
final statusNum = status['status_num'] as int;
final preStatus = stateGlobal.svcStatus.value;
if (statusNum == 0) {
stateGlobal.svcStatus.value = SvcStatus.connecting;
} else if (statusNum == -1) {
stateGlobal.svcStatus.value = SvcStatus.notReady;
} else if (statusNum == 1) {
stateGlobal.svcStatus.value = SvcStatus.ready;
if (preStatus != SvcStatus.ready) {
gFFI.userModel.refreshCurrentUser();
}
} else {
stateGlobal.svcStatus.value = SvcStatus.notReady;
}
_svcIsUsingPublicServer.value = await bind.mainIsUsingPublicServer();
}
}
/// Connection page for connecting to a remote peer. /// Connection page for connecting to a remote peer.
class ConnectionPage extends StatefulWidget { class ConnectionPage extends StatefulWidget {
const ConnectionPage({Key? key}) : super(key: key); const ConnectionPage({Key? key}) : super(key: key);
@@ -34,13 +200,8 @@ class _ConnectionPageState extends State<ConnectionPage>
/// Controller for the id input bar. /// Controller for the id input bar.
final _idController = IDTextEditingController(); final _idController = IDTextEditingController();
Timer? _updateTimer;
final RxBool _idInputFocused = false.obs; final RxBool _idInputFocused = false.obs;
var svcStopped = Get.find<RxBool>(tag: 'stop-service');
var svcIsUsingPublicServer = true.obs;
bool isWindowMinimized = false; bool isWindowMinimized = false;
List<Peer> peers = []; List<Peer> peers = [];
@@ -60,9 +221,6 @@ class _ConnectionPageState extends State<ConnectionPage>
} }
}(); }();
} }
_updateTimer = periodic_immediate(Duration(seconds: 1), () async {
updateStatus();
});
Get.put<IDTextEditingController>(_idController); Get.put<IDTextEditingController>(_idController);
windowManager.addListener(this); windowManager.addListener(this);
} }
@@ -70,7 +228,6 @@ class _ConnectionPageState extends State<ConnectionPage>
@override @override
void dispose() { void dispose() {
_idController.dispose(); _idController.dispose();
_updateTimer?.cancel();
windowManager.removeListener(this); windowManager.removeListener(this);
if (Get.isRegistered<IDTextEditingController>()) { if (Get.isRegistered<IDTextEditingController>()) {
Get.delete<IDTextEditingController>(); Get.delete<IDTextEditingController>();
@@ -87,7 +244,7 @@ class _ConnectionPageState extends State<ConnectionPage>
if (eventName == 'minimize') { if (eventName == 'minimize') {
isWindowMinimized = true; isWindowMinimized = true;
} else if (eventName == 'maximize' || eventName == 'restore') { } else if (eventName == 'maximize' || eventName == 'restore') {
if (isWindowMinimized && Platform.isWindows) { if (isWindowMinimized && isWindows) {
// windows can't update when minimized. // windows can't update when minimized.
Get.forceAppUpdate(); Get.forceAppUpdate();
} }
@@ -116,6 +273,7 @@ class _ConnectionPageState extends State<ConnectionPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isOutgoingOnly = bind.isOutgoingOnly();
return Column( return Column(
children: [ children: [
Expanded( Expanded(
@@ -131,8 +289,8 @@ class _ConnectionPageState extends State<ConnectionPage>
Expanded(child: PeerTabPage()), Expanded(child: PeerTabPage()),
], ],
).paddingOnly(left: 12.0)), ).paddingOnly(left: 12.0)),
const Divider(height: 1), if (!isOutgoingOnly) const Divider(height: 1),
buildStatus() if (!isOutgoingOnly) OnlineStatusWidget()
], ],
); );
} }
@@ -214,6 +372,7 @@ class _ConnectionPageState extends State<ConnectionPage>
platform: '', platform: '',
tags: [], tags: [],
hash: '', hash: '',
password: '',
forceAlwaysRelay: false, forceAlwaysRelay: false,
rdpPort: '', rdpPort: '',
rdpUsername: '', rdpUsername: '',
@@ -289,6 +448,9 @@ class _ConnectionPageState extends State<ConnectionPage>
onChanged: (v) { onChanged: (v) {
_idController.id = v; _idController.id = v;
}, },
onSubmitted: (_) {
onConnect();
},
)); ));
}, },
onSelected: (option) { onSelected: (option) {
@@ -383,111 +545,4 @@ class _ConnectionPageState extends State<ConnectionPage>
return Container( return Container(
constraints: const BoxConstraints(maxWidth: 600), child: w); constraints: const BoxConstraints(maxWidth: 600), child: w);
} }
Widget buildStatus() {
final em = 14.0;
return Container(
height: 3 * em,
child: Obx(() => Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 8,
width: 8,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: svcStopped.value ||
stateGlobal.svcStatus.value == SvcStatus.connecting
? kColorWarn
: (stateGlobal.svcStatus.value == SvcStatus.ready
? Color.fromARGB(255, 50, 190, 166)
: Color.fromARGB(255, 224, 79, 95)),
),
).marginSymmetric(horizontal: em),
Text(
svcStopped.value
? translate("Service is not running")
: stateGlobal.svcStatus.value == SvcStatus.connecting
? translate("connecting_status")
: stateGlobal.svcStatus.value == SvcStatus.notReady
? translate("not_ready_status")
: translate('Ready'),
style: TextStyle(fontSize: em)),
// stop
Offstage(
offstage: !svcStopped.value,
child: InkWell(
onTap: () async {
await start_service(true);
},
child: Text(translate("Start service"),
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: em)))
.marginOnly(left: em),
),
// ready && public
Flexible(
child: Offstage(
offstage: !(!svcStopped.value &&
stateGlobal.svcStatus.value == SvcStatus.ready &&
svcIsUsingPublicServer.value),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(', ', style: TextStyle(fontSize: em)),
Flexible(
child: InkWell(
onTap: onUsePublicServerGuide,
child: Row(
children: [
Flexible(
child: Text(
translate('setup_server_tip'),
style: TextStyle(
decoration: TextDecoration.underline,
fontSize: em),
),
),
],
),
),
)
],
),
),
)
],
)),
);
}
void onUsePublicServerGuide() {
const url = "https://rustdesk.com/pricing.html";
canLaunchUrlString(url).then((can) {
if (can) {
launchUrlString(url);
}
});
}
updateStatus() async {
final status =
jsonDecode(await bind.mainGetConnectStatus()) as Map<String, dynamic>;
final statusNum = status['status_num'] as int;
final preStatus = stateGlobal.svcStatus.value;
if (statusNum == 0) {
stateGlobal.svcStatus.value = SvcStatus.connecting;
} else if (statusNum == -1) {
stateGlobal.svcStatus.value = SvcStatus.notReady;
} else if (statusNum == 1) {
stateGlobal.svcStatus.value = SvcStatus.ready;
if (preStatus != SvcStatus.ready) {
gFFI.userModel.refreshCurrentUser();
}
} else {
stateGlobal.svcStatus.value = SvcStatus.notReady;
}
svcIsUsingPublicServer.value = await bind.mainIsUsingPublicServer();
}
} }

View File

@@ -20,6 +20,7 @@ import 'package:flutter_hbb/utils/multi_window_manager.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'package:window_manager/window_manager.dart';
import 'package:window_size/window_size.dart' as window_size; import 'package:window_size/window_size.dart' as window_size;
import '../widgets/button.dart'; import '../widgets/button.dart';
@@ -50,50 +51,167 @@ class _DesktopHomePageState extends State<DesktopHomePage>
Timer? _updateTimer; Timer? _updateTimer;
bool isCardClosed = false; bool isCardClosed = false;
final RxBool _editHover = false.obs;
final GlobalKey _childKey = GlobalKey();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
final isIncomingOnly = bind.isIncomingOnly();
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
buildLeftPane(context), buildLeftPane(context),
const VerticalDivider(width: 1), if (!isIncomingOnly) const VerticalDivider(width: 1),
Expanded( if (!isIncomingOnly) Expanded(child: buildRightPane(context)),
child: buildRightPane(context),
),
], ],
); );
} }
Widget buildPresetPasswordWarning() {
return FutureBuilder<bool>(
future: bind.isPresetPassword(),
builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator(); // Show a loading spinner while waiting for the Future to complete
} else if (snapshot.hasError) {
return Text(
'Error: ${snapshot.error}'); // Show an error message if the Future completed with an error
} else if (snapshot.hasData && snapshot.data == true) {
return Container(
color: Colors.yellow,
child: Column(
children: [
Align(
child: Text(
translate("Security Alert"),
style: TextStyle(
color: Colors.red,
fontSize: 20,
fontWeight: FontWeight.bold,
),
)).paddingOnly(bottom: 8),
Text(
translate("preset_password_warning"),
style: TextStyle(color: Colors.red),
)
],
).paddingAll(8),
); // Show a warning message if the Future completed with true
} else {
return SizedBox
.shrink(); // Show nothing if the Future completed with false or null
}
},
);
}
Widget buildLeftPane(BuildContext context) { Widget buildLeftPane(BuildContext context) {
final isIncomingOnly = bind.isIncomingOnly();
final isOutgoingOnly = bind.isOutgoingOnly();
final children = <Widget>[
if (!isOutgoingOnly) buildPresetPasswordWarning(),
if (bind.isCustomClient())
Align(
alignment: Alignment.center,
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: () {
launchUrl(Uri.parse('https://rustdesk.com'));
},
child: Opacity(
opacity: 0.5,
child: Text(
translate("powered_by_me"),
overflow: TextOverflow.clip,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
fontSize: 9, decoration: TextDecoration.underline),
)),
),
).marginOnly(top: 6),
),
Align(
alignment: Alignment.center,
child: loadLogo(),
),
buildTip(context),
if (!isOutgoingOnly) buildIDBoard(context),
if (!isOutgoingOnly) buildPasswordBoard(context),
FutureBuilder<Widget>(
future: buildHelpCards(),
builder: (_, data) {
if (data.hasData) {
if (isIncomingOnly) {
if (isInHomePage()) {
Future.delayed(Duration(milliseconds: 300), () {
_updateWindowSize();
});
}
}
return data.data!;
} else {
return const Offstage();
}
},
),
buildPluginEntry(),
];
if (isIncomingOnly) {
children.addAll([
Divider(),
OnlineStatusWidget(
onSvcStatusChanged: () {
if (isInHomePage()) {
Future.delayed(Duration(milliseconds: 300), () {
_updateWindowSize();
});
}
},
).marginOnly(bottom: 6, right: 6)
]);
}
final textColor = Theme.of(context).textTheme.titleLarge?.color;
return ChangeNotifierProvider.value( return ChangeNotifierProvider.value(
value: gFFI.serverModel, value: gFFI.serverModel,
child: Container( child: Container(
width: 200, width: isIncomingOnly ? 280.0 : 200.0,
color: Theme.of(context).colorScheme.background, color: Theme.of(context).colorScheme.background,
child: DesktopScrollWrapper( child: DesktopScrollWrapper(
scrollController: _leftPaneScrollController, scrollController: _leftPaneScrollController,
child: SingleChildScrollView( child: Stack(
controller: _leftPaneScrollController, children: [
physics: DraggableNeverScrollableScrollPhysics(), SingleChildScrollView(
child: Column( controller: _leftPaneScrollController,
children: [ physics: DraggableNeverScrollableScrollPhysics(),
buildTip(context), child: Column(
buildIDBoard(context), key: _childKey,
buildPasswordBoard(context), children: children,
FutureBuilder<Widget>(
future: buildHelpCards(),
builder: (_, data) {
if (data.hasData) {
return data.data!;
} else {
return const Offstage();
}
},
), ),
buildPluginEntry() ),
], if (isOutgoingOnly)
), Positioned(
bottom: 6,
left: 12,
child: Align(
alignment: Alignment.centerLeft,
child: InkWell(
child: Obx(
() => Icon(
Icons.settings,
color: _editHover.value
? textColor
: Colors.grey.withOpacity(0.5),
size: 22,
),
),
onTap: () => DesktopSettingPage.switch2page(0),
onHover: (value) => _editHover.value = value,
),
),
)
],
), ),
), ),
), ),
@@ -266,21 +384,22 @@ class _DesktopHomePageState extends State<DesktopHomePage>
)))), )))),
onHover: (value) => refreshHover.value = value, onHover: (value) => refreshHover.value = value,
).marginOnly(right: 8, top: 4), ).marginOnly(right: 8, top: 4),
InkWell( if (!bind.isDisableSettings())
child: Obx( InkWell(
() => Tooltip( child: Obx(
message: translate('Change Password'), () => Tooltip(
child: Icon( message: translate('Change Password'),
Icons.edit, child: Icon(
color: editHover.value Icons.edit,
? textColor color: editHover.value
: Color(0xFFDDDDDD), ? textColor
size: 22, : Color(0xFFDDDDDD),
)).marginOnly(right: 8, top: 4), size: 22,
)).marginOnly(right: 8, top: 4),
),
onTap: () => DesktopSettingPage.switch2page(0),
onHover: (value) => editHover.value = value,
), ),
onTap: () => DesktopSettingPage.switch2page(1),
onHover: (value) => editHover.value = value,
),
], ],
), ),
], ],
@@ -293,6 +412,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
} }
buildTip(BuildContext context) { buildTip(BuildContext context) {
final isOutgoingOnly = bind.isOutgoingOnly();
return Padding( return Padding(
padding: padding:
const EdgeInsets.only(left: 20.0, right: 16, top: 16.0, bottom: 5), const EdgeInsets.only(left: 20.0, right: 16, top: 16.0, bottom: 5),
@@ -300,29 +420,43 @@ class _DesktopHomePageState extends State<DesktopHomePage>
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Column(
translate("Your Desktop"), children: [
style: Theme.of(context).textTheme.titleLarge, if (!isOutgoingOnly)
// style: TextStyle( Align(
// // color: MyTheme.color(context).text, alignment: Alignment.centerLeft,
// fontWeight: FontWeight.normal, child: Text(
// fontSize: 19), translate("Your Desktop"),
style: Theme.of(context).textTheme.titleLarge,
),
),
],
), ),
SizedBox( SizedBox(
height: 10.0, height: 10.0,
), ),
Text( if (!isOutgoingOnly)
translate("desk_tip"), Text(
overflow: TextOverflow.clip, translate("desk_tip"),
style: Theme.of(context).textTheme.bodySmall, overflow: TextOverflow.clip,
) style: Theme.of(context).textTheme.bodySmall,
),
if (isOutgoingOnly)
Text(
translate("outgoing_only_desk_tip"),
overflow: TextOverflow.clip,
style: Theme.of(context).textTheme.bodySmall,
),
], ],
), ),
); );
} }
Future<Widget> buildHelpCards() async { Future<Widget> buildHelpCards() async {
if (updateUrl.isNotEmpty && !isCardClosed) { if (!bind.isCustomClient() &&
updateUrl.isNotEmpty &&
!isCardClosed &&
bind.mainUriPrefixSync().contains('rustdesk')) {
return buildInstallCard( return buildInstallCard(
"Status", "Status",
"There is a newer version of ${bind.mainGetAppNameSync()} ${bind.mainGetNewVersion()} available.", "There is a newer version of ${bind.mainGetAppNameSync()} ${bind.mainGetNewVersion()} available.",
@@ -334,9 +468,12 @@ class _DesktopHomePageState extends State<DesktopHomePage>
if (systemError.isNotEmpty) { if (systemError.isNotEmpty) {
return buildInstallCard("", systemError, "", () {}); return buildInstallCard("", systemError, "", () {});
} }
if (Platform.isWindows) {
if (isWindows && !bind.isDisableInstallation()) {
if (!bind.mainIsInstalled()) { if (!bind.mainIsInstalled()) {
return buildInstallCard("", "install_tip", "Install", () async { return buildInstallCard(
"", bind.isOutgoingOnly() ? "" : "install_tip", "Install",
() async {
await rustDeskWinManager.closeAllSubWindows(); await rustDeskWinManager.closeAllSubWindows();
bind.mainGotoInstall(); bind.mainGotoInstall();
}); });
@@ -348,8 +485,9 @@ class _DesktopHomePageState extends State<DesktopHomePage>
bind.mainUpdateMe(); bind.mainUpdateMe();
}); });
} }
} else if (Platform.isMacOS) { } else if (isMacOS) {
if (!bind.mainIsCanScreenRecording(prompt: false)) { if (!(bind.isOutgoingOnly() ||
bind.mainIsCanScreenRecording(prompt: false))) {
return buildInstallCard("Permissions", "config_screen", "Configure", return buildInstallCard("Permissions", "config_screen", "Configure",
() async { () async {
bind.mainIsCanScreenRecording(prompt: true); bind.mainIsCanScreenRecording(prompt: true);
@@ -383,7 +521,10 @@ class _DesktopHomePageState extends State<DesktopHomePage>
// watchIsCanRecordAudio = true; // watchIsCanRecordAudio = true;
// }); // });
// } // }
} else if (Platform.isLinux) { } else if (isLinux) {
if (bind.isOutgoingOnly()) {
return Container();
}
final LinuxCards = <Widget>[]; final LinuxCards = <Widget>[];
if (bind.isSelinuxEnforcing()) { if (bind.isSelinuxEnforcing()) {
// Check is SELinux enforcing, but show user a tip of is SELinux enabled for simple. // Check is SELinux enforcing, but show user a tip of is SELinux enabled for simple.
@@ -422,6 +563,21 @@ class _DesktopHomePageState extends State<DesktopHomePage>
); );
} }
} }
if (bind.isIncomingOnly()) {
return Align(
alignment: Alignment.centerRight,
child: OutlinedButton(
onPressed: () {
SystemNavigator.pop(); // Close the application
// https://github.com/flutter/flutter/issues/66631
if (isWindows) {
exit(0);
}
},
child: Text(translate('Quit')),
),
).marginAll(14);
}
return Container(); return Container();
} }
@@ -450,7 +606,8 @@ class _DesktopHomePageState extends State<DesktopHomePage>
return Stack( return Stack(
children: [ children: [
Container( Container(
margin: EdgeInsets.only(top: marginTop), margin: EdgeInsets.fromLTRB(
0, marginTop, 0, bind.isIncomingOnly() ? marginTop : 0),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
@@ -478,14 +635,15 @@ class _DesktopHomePageState extends State<DesktopHomePage>
] ]
: <Widget>[]) + : <Widget>[]) +
<Widget>[ <Widget>[
Text( if (content.isNotEmpty)
translate(content), Text(
style: TextStyle( translate(content),
height: 1.5, style: TextStyle(
color: Colors.white, height: 1.5,
fontWeight: FontWeight.normal, color: Colors.white,
fontSize: 13), fontWeight: FontWeight.normal,
).marginOnly(bottom: 20) fontSize: 13),
).marginOnly(bottom: 20)
] + ] +
(btnText.isNotEmpty (btnText.isNotEmpty
? <Widget>[ ? <Widget>[
@@ -582,7 +740,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
} }
} }
if (watchIsCanRecordAudio) { if (watchIsCanRecordAudio) {
if (Platform.isMacOS) { if (isMacOS) {
Future.microtask(() async { Future.microtask(() async {
if ((await osxCanRecordAudio() == if ((await osxCanRecordAudio() ==
PermissionAuthorizeType.authorized)) { PermissionAuthorizeType.authorized)) {
@@ -642,6 +800,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
isFileTransfer: call.arguments['isFileTransfer'], isFileTransfer: call.arguments['isFileTransfer'],
isTcpTunneling: call.arguments['isTcpTunneling'], isTcpTunneling: call.arguments['isTcpTunneling'],
isRDP: call.arguments['isRDP'], isRDP: call.arguments['isRDP'],
password: call.arguments['password'],
forceRelay: call.arguments['forceRelay'], forceRelay: call.arguments['forceRelay'],
); );
} else if (call.method == kWindowEventMoveTabToNewWindow) { } else if (call.method == kWindowEventMoveTabToNewWindow) {
@@ -668,6 +827,26 @@ class _DesktopHomePageState extends State<DesktopHomePage>
} }
}); });
_uniLinksSubscription = listenUniLinks(); _uniLinksSubscription = listenUniLinks();
if (bind.isIncomingOnly()) {
WidgetsBinding.instance.addPostFrameCallback((_) {
_updateWindowSize();
});
}
}
_updateWindowSize() {
RenderObject? renderObject = _childKey.currentContext?.findRenderObject();
if (renderObject == null) {
return;
}
if (renderObject is RenderBox) {
final size = renderObject.size;
if (size != imcomingOnlyHomeSize) {
imcomingOnlyHomeSize = size;
windowManager.setSize(getIncomingOnlyHomeSize());
}
}
} }
@override @override

View File

@@ -106,33 +106,34 @@ class _DesktopSettingPageState extends State<DesktopSettingPage>
List<_TabInfo> _settingTabs() { List<_TabInfo> _settingTabs() {
final List<_TabInfo> settingTabs = <_TabInfo>[ final List<_TabInfo> settingTabs = <_TabInfo>[
_TabInfo('General', Icons.settings_outlined, Icons.settings), _TabInfo('General', Icons.settings_outlined, Icons.settings),
_TabInfo('Security', Icons.enhanced_encryption_outlined, if (!bind.isOutgoingOnly() && !bind.isDisableSettings())
Icons.enhanced_encryption), _TabInfo('Security', Icons.enhanced_encryption_outlined,
_TabInfo('Network', Icons.link_outlined, Icons.link), Icons.enhanced_encryption),
_TabInfo( if (!bind.isDisableSettings())
'Display', Icons.desktop_windows_outlined, Icons.desktop_windows), _TabInfo('Network', Icons.link_outlined, Icons.link),
_TabInfo('Account', Icons.person_outline, Icons.person), if (!bind.isIncomingOnly())
_TabInfo(
'Display', Icons.desktop_windows_outlined, Icons.desktop_windows),
if (!isWeb && !bind.isIncomingOnly() && bind.pluginFeatureIsEnabled())
_TabInfo('Plugin', Icons.extension_outlined, Icons.extension),
if (!bind.isDisableAccount())
_TabInfo('Account', Icons.person_outline, Icons.person),
_TabInfo('About', Icons.info_outline, Icons.info) _TabInfo('About', Icons.info_outline, Icons.info)
]; ];
if (bind.pluginFeatureIsEnabled()) {
settingTabs.insert(
4, _TabInfo('Plugin', Icons.extension_outlined, Icons.extension));
}
return settingTabs; return settingTabs;
} }
List<Widget> _children() { List<Widget> _children() {
final children = [ final children = [
_General(), _General(),
_Safety(), if (!bind.isOutgoingOnly() && !bind.isDisableSettings()) _Safety(),
_Network(), if (!bind.isDisableSettings()) _Network(),
_Display(), if (!bind.isIncomingOnly()) _Display(),
_Account(), if (!isWeb && !bind.isIncomingOnly() && bind.pluginFeatureIsEnabled())
_Plugin(),
if (!bind.isDisableAccount()) _Account(),
_About(), _About(),
]; ];
if (bind.pluginFeatureIsEnabled()) {
children.insert(4, _Plugin());
}
return children; return children;
} }
@@ -303,6 +304,10 @@ class _GeneralState extends State<_General> {
} }
Widget service() { Widget service() {
if (bind.isOutgoingOnly()) {
return const Offstage();
}
return _Card(title: 'Service', children: [ return _Card(title: 'Service', children: [
Obx(() => _Button(serviceStop.value ? 'Start' : 'Stop', () { Obx(() => _Button(serviceStop.value ? 'Start' : 'Stop', () {
() async { () async {
@@ -318,31 +323,34 @@ class _GeneralState extends State<_General> {
} }
Widget other() { Widget other() {
final children = [ final children = <Widget>[
_OptionCheckBox(context, 'Confirm before closing multiple tabs', if (!bind.isIncomingOnly())
'enable-confirm-closing-tabs', _OptionCheckBox(context, 'Confirm before closing multiple tabs',
isServer: false), 'enable-confirm-closing-tabs',
isServer: false),
_OptionCheckBox(context, 'Adaptive bitrate', 'enable-abr'), _OptionCheckBox(context, 'Adaptive bitrate', 'enable-abr'),
wallpaper(), wallpaper(),
_OptionCheckBox( if (!bind.isIncomingOnly()) ...[
context, _OptionCheckBox(
'Open connection in new tab', context,
kOptionOpenNewConnInTabs, 'Open connection in new tab',
isServer: false, kOptionOpenNewConnInTabs,
), isServer: false,
),
// though this is related to GUI, but opengl problem affects all users, so put in config rather than local
Tooltip(
message: translate('software_render_tip'),
child: _OptionCheckBox(context, "Always use software rendering",
'allow-always-software-render'),
),
_OptionCheckBox(
context,
'Check for software update on startup',
'enable-check-update',
isServer: false,
)
],
]; ];
// though this is related to GUI, but opengl problem affects all users, so put in config rather than local
children.add(Tooltip(
message: translate('software_render_tip'),
child: _OptionCheckBox(context, "Always use software rendering",
'allow-always-software-render'),
));
children.add(_OptionCheckBox(
context,
'Check for software update on startup',
'enable-check-update',
isServer: false,
));
if (bind.mainShowOption(key: 'allow-linux-headless')) { if (bind.mainShowOption(key: 'allow-linux-headless')) {
children.add(_OptionCheckBox( children.add(_OptionCheckBox(
context, 'Allow linux headless', 'allow-linux-headless')); context, 'Allow linux headless', 'allow-linux-headless'));
@@ -351,6 +359,10 @@ class _GeneralState extends State<_General> {
} }
Widget wallpaper() { Widget wallpaper() {
if (bind.isOutgoingOnly()) {
return const Offstage();
}
return futureBuilder(future: () async { return futureBuilder(future: () async {
final support = await bind.mainSupportRemoveWallpaper(); final support = await bind.mainSupportRemoveWallpaper();
return support; return support;
@@ -398,8 +410,12 @@ class _GeneralState extends State<_General> {
} }
Widget audio(BuildContext context) { Widget audio(BuildContext context) {
if (bind.isOutgoingOnly()) {
return const Offstage();
}
String getDefault() { String getDefault() {
if (Platform.isWindows) return translate('System Sound'); if (isWindows) return translate('System Sound');
return ''; return '';
} }
@@ -419,7 +435,7 @@ class _GeneralState extends State<_General> {
return futureBuilder(future: () async { return futureBuilder(future: () async {
List<String> devices = (await bind.mainGetSoundInputs()).toList(); List<String> devices = (await bind.mainGetSoundInputs()).toList();
if (Platform.isWindows) { if (isWindows) {
devices.insert(0, translate('System Sound')); devices.insert(0, translate('System Sound'));
} }
String current = await getValue(); String current = await getValue();
@@ -690,7 +706,7 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
_OptionCheckBox( _OptionCheckBox(
context, 'Enable recording session', 'enable-record-session', context, 'Enable recording session', 'enable-record-session',
enabled: enabled, fakeValue: fakeValue), enabled: enabled, fakeValue: fakeValue),
if (Platform.isWindows) if (isWindows)
_OptionCheckBox( _OptionCheckBox(
context, 'Enable blocking user input', 'enable-block-input', context, 'Enable blocking user input', 'enable-block-input',
enabled: enabled, fakeValue: fakeValue), enabled: enabled, fakeValue: fakeValue),
@@ -830,7 +846,7 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
bool value = bind.mainIsShareRdp(); bool value = bind.mainIsShareRdp();
return Offstage( return Offstage(
offstage: !(Platform.isWindows && bind.mainIsRdpServiceOpen()), offstage: !(isWindows && bind.mainIsInstalled()),
child: GestureDetector( child: GestureDetector(
child: Row( child: Row(
children: [ children: [
@@ -1622,7 +1638,7 @@ class _AboutState extends State<_About> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'Copyright © 2023 Purslane Ltd.\n$license', 'Copyright © ${DateTime.now().toString().substring(0, 4)} Purslane Ltd.\n$license',
style: const TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
), ),
Text( Text(
@@ -2029,7 +2045,7 @@ void changeSocks5Proxy() async {
ConstrainedBox( ConstrainedBox(
constraints: const BoxConstraints(minWidth: 140), constraints: const BoxConstraints(minWidth: 140),
child: Text( child: Text(
'${translate("Hostname")}:', '${translate("Server")}:',
textAlign: TextAlign.right, textAlign: TextAlign.right,
).marginOnly(right: 10)), ).marginOnly(right: 10)),
Expanded( Expanded(

View File

@@ -1,11 +1,10 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hbb/common.dart'; import 'package:flutter_hbb/common.dart';
import 'package:flutter_hbb/consts.dart'; import 'package:flutter_hbb/consts.dart';
import 'package:flutter_hbb/desktop/pages/desktop_home_page.dart'; import 'package:flutter_hbb/desktop/pages/desktop_home_page.dart';
import 'package:flutter_hbb/desktop/pages/desktop_setting_page.dart'; import 'package:flutter_hbb/desktop/pages/desktop_setting_page.dart';
import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart'; import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
import 'package:flutter_hbb/models/platform_model.dart';
import 'package:flutter_hbb/models/state_model.dart'; import 'package:flutter_hbb/models/state_model.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:window_manager/window_manager.dart'; import 'package:window_manager/window_manager.dart';
@@ -53,6 +52,17 @@ class _DesktopTabPageState extends State<DesktopTabPage> {
page: DesktopHomePage( page: DesktopHomePage(
key: const ValueKey(kTabLabelHomePage), key: const ValueKey(kTabLabelHomePage),
))); )));
if (bind.isIncomingOnly()) {
tabController.onSelected = (key) {
if (key == kTabLabelHomePage) {
windowManager.setSize(getIncomingOnlyHomeSize());
windowManager.setResizable(false);
} else {
windowManager.setSize(getIncomingOnlySettingsSize());
windowManager.setResizable(true);
}
};
}
} }
@override @override
@@ -68,14 +78,17 @@ class _DesktopTabPageState extends State<DesktopTabPage> {
backgroundColor: Theme.of(context).colorScheme.background, backgroundColor: Theme.of(context).colorScheme.background,
body: DesktopTab( body: DesktopTab(
controller: tabController, controller: tabController,
tail: ActionIcon( tail: Offstage(
message: 'Settings', offstage: bind.isIncomingOnly() || bind.isDisableSettings(),
icon: IconFont.menu, child: ActionIcon(
onTap: DesktopTabPage.onAddSetting, message: 'Settings',
isClose: false, icon: IconFont.menu,
onTap: DesktopTabPage.onAddSetting,
isClose: false,
),
), ),
))); )));
return Platform.isMacOS || kUseCompatibleUiMode return isMacOS || kUseCompatibleUiMode
? tabWidget ? tabWidget
: Obx( : Obx(
() => DragToResizeArea( () => DragToResizeArea(

View File

@@ -53,11 +53,13 @@ class FileManagerPage extends StatefulWidget {
{Key? key, {Key? key,
required this.id, required this.id,
required this.password, required this.password,
required this.isSharedPassword,
required this.tabController, required this.tabController,
this.forceRelay}) this.forceRelay})
: super(key: key); : super(key: key);
final String id; final String id;
final String? password; final String? password;
final bool? isSharedPassword;
final bool? forceRelay; final bool? forceRelay;
final DesktopTabController tabController; final DesktopTabController tabController;
@@ -84,13 +86,14 @@ class _FileManagerPageState extends State<FileManagerPage>
_ffi.start(widget.id, _ffi.start(widget.id,
isFileTransfer: true, isFileTransfer: true,
password: widget.password, password: widget.password,
isSharedPassword: widget.isSharedPassword,
forceRelay: widget.forceRelay); forceRelay: widget.forceRelay);
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
_ffi.dialogManager _ffi.dialogManager
.showLoading(translate('Connecting...'), onCancel: closeConnection); .showLoading(translate('Connecting...'), onCancel: closeConnection);
}); });
Get.put(_ffi, tag: 'ft_${widget.id}'); Get.put(_ffi, tag: 'ft_${widget.id}');
if (!Platform.isLinux) { if (!isLinux) {
WakelockPlus.enable(); WakelockPlus.enable();
} }
debugPrint("File manager page init success with id ${widget.id}"); debugPrint("File manager page init success with id ${widget.id}");
@@ -103,7 +106,7 @@ class _FileManagerPageState extends State<FileManagerPage>
model.close().whenComplete(() { model.close().whenComplete(() {
_ffi.close(); _ffi.close();
_ffi.dialogManager.dismissAll(); _ffi.dialogManager.dismissAll();
if (!Platform.isLinux) { if (!isLinux) {
WakelockPlus.disable(); WakelockPlus.disable();
} }
Get.delete<FFI>(tag: 'ft_${widget.id}'); Get.delete<FFI>(tag: 'ft_${widget.id}');
@@ -1295,7 +1298,7 @@ class _FileManagerViewState extends State<FileManagerView> {
onPointerSignal: (e) { onPointerSignal: (e) {
if (e is PointerScrollEvent) { if (e is PointerScrollEvent) {
final sc = _breadCrumbScroller; final sc = _breadCrumbScroller;
final scale = Platform.isWindows ? 2 : 4; final scale = isWindows ? 2 : 4;
sc.jumpTo(sc.offset + e.scrollDelta.dy / scale); sc.jumpTo(sc.offset + e.scrollDelta.dy / scale);
} }
}, },

View File

@@ -1,5 +1,4 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'package:desktop_multi_window/desktop_multi_window.dart'; import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -45,6 +44,7 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
key: ValueKey(params['id']), key: ValueKey(params['id']),
id: params['id'], id: params['id'],
password: params['password'], password: params['password'],
isSharedPassword: params['isSharedPassword'],
tabController: tabController, tabController: tabController,
forceRelay: params['forceRelay'], forceRelay: params['forceRelay'],
))); )));
@@ -74,6 +74,7 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
key: ValueKey(id), key: ValueKey(id),
id: id, id: id,
password: args['password'], password: args['password'],
isSharedPassword: args['isSharedPassword'],
tabController: tabController, tabController: tabController,
forceRelay: args['forceRelay'], forceRelay: args['forceRelay'],
))); )));
@@ -102,7 +103,7 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
labelGetter: DesktopTab.tablabelGetter, labelGetter: DesktopTab.tablabelGetter,
)), )),
); );
return Platform.isMacOS || kUseCompatibleUiMode return isMacOS || kUseCompatibleUiMode
? tabWidget ? tabWidget
: SubWindowDragToResizeArea( : SubWindowDragToResizeArea(
child: tabWidget, child: tabWidget,

View File

@@ -25,19 +25,21 @@ class _PortForward {
} }
class PortForwardPage extends StatefulWidget { class PortForwardPage extends StatefulWidget {
const PortForwardPage( const PortForwardPage({
{Key? key, Key? key,
required this.id, required this.id,
required this.password, required this.password,
required this.tabController, required this.tabController,
required this.isRDP, required this.isRDP,
this.forceRelay}) required this.isSharedPassword,
: super(key: key); this.forceRelay,
}) : super(key: key);
final String id; final String id;
final String? password; final String? password;
final DesktopTabController tabController; final DesktopTabController tabController;
final bool isRDP; final bool isRDP;
final bool? forceRelay; final bool? forceRelay;
final bool? isSharedPassword;
@override @override
State<PortForwardPage> createState() => _PortForwardPageState(); State<PortForwardPage> createState() => _PortForwardPageState();
@@ -58,6 +60,7 @@ class _PortForwardPageState extends State<PortForwardPage>
_ffi.start(widget.id, _ffi.start(widget.id,
isPortForward: true, isPortForward: true,
password: widget.password, password: widget.password,
isSharedPassword: widget.isSharedPassword,
forceRelay: widget.forceRelay, forceRelay: widget.forceRelay,
isRdp: widget.isRDP); isRdp: widget.isRDP);
Get.put(_ffi, tag: 'pf_${widget.id}'); Get.put(_ffi, tag: 'pf_${widget.id}');

View File

@@ -1,5 +1,4 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'package:desktop_multi_window/desktop_multi_window.dart'; import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -44,6 +43,7 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
key: ValueKey(params['id']), key: ValueKey(params['id']),
id: params['id'], id: params['id'],
password: params['password'], password: params['password'],
isSharedPassword: params['isSharedPassword'],
tabController: tabController, tabController: tabController,
isRDP: isRDP, isRDP: isRDP,
forceRelay: params['forceRelay'], forceRelay: params['forceRelay'],
@@ -79,6 +79,7 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
key: ValueKey(args['id']), key: ValueKey(args['id']),
id: id, id: id,
password: args['password'], password: args['password'],
isSharedPassword: args['isSharedPassword'],
isRDP: isRDP, isRDP: isRDP,
tabController: tabController, tabController: tabController,
forceRelay: args['forceRelay'], forceRelay: args['forceRelay'],
@@ -111,7 +112,7 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
labelGetter: DesktopTab.tablabelGetter, labelGetter: DesktopTab.tablabelGetter,
)), )),
); );
return Platform.isMacOS || kUseCompatibleUiMode return isMacOS || kUseCompatibleUiMode
? tabWidget ? tabWidget
: Obx( : Obx(
() => SubWindowDragToResizeArea( () => SubWindowDragToResizeArea(

View File

@@ -1,15 +1,11 @@
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'package:desktop_multi_window/desktop_multi_window.dart'; import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_custom_cursor/cursor_manager.dart'
as custom_cursor_manager;
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:wakelock_plus/wakelock_plus.dart'; import 'package:wakelock_plus/wakelock_plus.dart';
import 'package:flutter_custom_cursor/flutter_custom_cursor.dart';
import 'package:flutter_improved_scrolling/flutter_improved_scrolling.dart'; import 'package:flutter_improved_scrolling/flutter_improved_scrolling.dart';
import '../../consts.dart'; import '../../consts.dart';
@@ -27,6 +23,9 @@ import '../widgets/remote_toolbar.dart';
import '../widgets/kb_layout_type_chooser.dart'; import '../widgets/kb_layout_type_chooser.dart';
import '../widgets/tabbar_widget.dart'; import '../widgets/tabbar_widget.dart';
import 'package:flutter_hbb/native/custom_cursor.dart'
if (dart.library.html) 'package:flutter_hbb/web/custom_cursor.dart';
final SimpleWrapper<bool> _firstEnterImage = SimpleWrapper(false); final SimpleWrapper<bool> _firstEnterImage = SimpleWrapper(false);
// Used to skip session close if "move to new window" is clicked. // Used to skip session close if "move to new window" is clicked.
@@ -36,15 +35,16 @@ class RemotePage extends StatefulWidget {
RemotePage({ RemotePage({
Key? key, Key? key,
required this.id, required this.id,
required this.sessionId,
required this.tabWindowId,
required this.display,
required this.displays,
required this.password,
required this.toolbarState, required this.toolbarState,
required this.tabController, this.sessionId,
this.tabWindowId,
this.password,
this.display,
this.displays,
this.tabController,
this.switchUuid, this.switchUuid,
this.forceRelay, this.forceRelay,
this.isSharedPassword,
}) : super(key: key); }) : super(key: key);
final String id; final String id;
@@ -56,8 +56,9 @@ class RemotePage extends StatefulWidget {
final ToolbarState toolbarState; final ToolbarState toolbarState;
final String? switchUuid; final String? switchUuid;
final bool? forceRelay; final bool? forceRelay;
final bool? isSharedPassword;
final SimpleWrapper<State<RemotePage>?> _lastState = SimpleWrapper(null); final SimpleWrapper<State<RemotePage>?> _lastState = SimpleWrapper(null);
final DesktopTabController tabController; final DesktopTabController? tabController;
FFI get ffi => (_lastState.value! as _RemotePageState)._ffi; FFI get ffi => (_lastState.value! as _RemotePageState)._ffi;
@@ -111,6 +112,7 @@ class _RemotePageState extends State<RemotePage>
_ffi.start( _ffi.start(
widget.id, widget.id,
password: widget.password, password: widget.password,
isSharedPassword: widget.isSharedPassword,
switchUuid: widget.switchUuid, switchUuid: widget.switchUuid,
forceRelay: widget.forceRelay, forceRelay: widget.forceRelay,
tabWindowId: widget.tabWindowId, tabWindowId: widget.tabWindowId,
@@ -122,12 +124,12 @@ class _RemotePageState extends State<RemotePage>
_ffi.dialogManager _ffi.dialogManager
.showLoading(translate('Connecting...'), onCancel: closeConnection); .showLoading(translate('Connecting...'), onCancel: closeConnection);
}); });
if (!Platform.isLinux) { if (!isLinux) {
WakelockPlus.enable(); WakelockPlus.enable();
} }
_ffi.ffiModel.updateEventListener(sessionId, widget.id); _ffi.ffiModel.updateEventListener(sessionId, widget.id);
bind.pluginSyncUi(syncTo: kAppTypeDesktopRemote); if (!isWeb) bind.pluginSyncUi(syncTo: kAppTypeDesktopRemote);
_ffi.qualityMonitorModel.checkShowQualityMonitor(sessionId); _ffi.qualityMonitorModel.checkShowQualityMonitor(sessionId);
// Session option should be set after models.dart/FFI.start // Session option should be set after models.dart/FFI.start
_showRemoteCursor.value = bind.sessionGetToggleOptionSync( _showRemoteCursor.value = bind.sessionGetToggleOptionSync(
@@ -148,7 +150,7 @@ class _RemotePageState extends State<RemotePage>
// } // }
_blockableOverlayState.applyFfi(_ffi); _blockableOverlayState.applyFfi(_ffi);
widget.tabController.onSelected?.call(widget.id); widget.tabController?.onSelected?.call(widget.id);
} }
@override @override
@@ -157,7 +159,7 @@ class _RemotePageState extends State<RemotePage>
// On windows, we use `focus` way to handle keyboard better. // On windows, we use `focus` way to handle keyboard better.
// Now on Linux, there's some rdev issues which will break the input. // Now on Linux, there's some rdev issues which will break the input.
// We disable the `focus` way for non-Windows temporarily. // We disable the `focus` way for non-Windows temporarily.
if (Platform.isWindows) { if (isWindows) {
_isWindowBlur = true; _isWindowBlur = true;
// unfocus the primary-focus when the whole window is lost focus, // unfocus the primary-focus when the whole window is lost focus,
// and let OS to handle events instead. // and let OS to handle events instead.
@@ -169,7 +171,7 @@ class _RemotePageState extends State<RemotePage>
void onWindowFocus() { void onWindowFocus() {
super.onWindowFocus(); super.onWindowFocus();
// See [onWindowBlur]. // See [onWindowBlur].
if (Platform.isWindows) { if (isWindows) {
_isWindowBlur = false; _isWindowBlur = false;
} }
} }
@@ -179,10 +181,10 @@ class _RemotePageState extends State<RemotePage>
super.onWindowRestore(); super.onWindowRestore();
// On windows, we use `onWindowRestore` way to handle window restore from // On windows, we use `onWindowRestore` way to handle window restore from
// a minimized state. // a minimized state.
if (Platform.isWindows) { if (isWindows) {
_isWindowBlur = false; _isWindowBlur = false;
} }
if (!Platform.isLinux) { if (!isLinux) {
WakelockPlus.enable(); WakelockPlus.enable();
} }
} }
@@ -191,7 +193,7 @@ class _RemotePageState extends State<RemotePage>
@override @override
void onWindowMaximize() { void onWindowMaximize() {
super.onWindowMaximize(); super.onWindowMaximize();
if (!Platform.isLinux) { if (!isLinux) {
WakelockPlus.enable(); WakelockPlus.enable();
} }
} }
@@ -199,7 +201,7 @@ class _RemotePageState extends State<RemotePage>
@override @override
void onWindowMinimize() { void onWindowMinimize() {
super.onWindowMinimize(); super.onWindowMinimize();
if (!Platform.isLinux) { if (!isLinux) {
WakelockPlus.disable(); WakelockPlus.disable();
} }
} }
@@ -225,7 +227,7 @@ class _RemotePageState extends State<RemotePage>
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, await SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
overlays: SystemUiOverlay.values); overlays: SystemUiOverlay.values);
} }
if (!Platform.isLinux) { if (!isLinux) {
await WakelockPlus.disable(); await WakelockPlus.disable();
} }
await Get.delete<FFI>(tag: widget.id); await Get.delete<FFI>(tag: widget.id);
@@ -263,7 +265,7 @@ class _RemotePageState extends State<RemotePage>
debugPrint( debugPrint(
"onFocusChange(window active:${!_isWindowBlur}) $imageFocused"); "onFocusChange(window active:${!_isWindowBlur}) $imageFocused");
// See [onWindowBlur]. // See [onWindowBlur].
if (Platform.isWindows) { if (isWindows) {
if (_isWindowBlur) { if (_isWindowBlur) {
imageFocused = false; imageFocused = false;
Future.delayed(Duration.zero, () { Future.delayed(Duration.zero, () {
@@ -359,7 +361,7 @@ class _RemotePageState extends State<RemotePage>
} }
} }
// See [onWindowBlur]. // See [onWindowBlur].
if (!Platform.isWindows) { if (!isWindows) {
if (!_rawKeyFocusNode.hasFocus) { if (!_rawKeyFocusNode.hasFocus) {
_rawKeyFocusNode.requestFocus(); _rawKeyFocusNode.requestFocus();
} }
@@ -382,7 +384,7 @@ class _RemotePageState extends State<RemotePage>
} }
} }
// See [onWindowBlur]. // See [onWindowBlur].
if (!Platform.isWindows) { if (!isWindows) {
_ffi.inputModel.enterOrLeave(false); _ffi.inputModel.enterOrLeave(false);
} }
} }
@@ -429,9 +431,9 @@ class _RemotePageState extends State<RemotePage>
Widget getBodyForDesktop(BuildContext context) { Widget getBodyForDesktop(BuildContext context) {
var paints = <Widget>[ var paints = <Widget>[
MouseRegion(onEnter: (evt) { MouseRegion(onEnter: (evt) {
bind.hostStopSystemKeyPropagate(stopped: false); if (!isWeb) bind.hostStopSystemKeyPropagate(stopped: false);
}, onExit: (evt) { }, onExit: (evt) {
bind.hostStopSystemKeyPropagate(stopped: true); if (!isWeb) bind.hostStopSystemKeyPropagate(stopped: true);
}, child: LayoutBuilder(builder: (context, constraints) { }, child: LayoutBuilder(builder: (context, constraints) {
Future.delayed(Duration.zero, () { Future.delayed(Duration.zero, () {
Provider.of<CanvasModel>(context, listen: false).updateViewStyle(); Provider.of<CanvasModel>(context, listen: false).updateViewStyle();
@@ -534,7 +536,7 @@ class _ImagePaintState extends State<ImagePaint> {
double getCursorScale() { double getCursorScale() {
var c = Provider.of<CanvasModel>(context); var c = Provider.of<CanvasModel>(context);
var cursorScale = 1.0; var cursorScale = 1.0;
if (Platform.isWindows) { if (isWindows) {
// debug win10 // debug win10
if (zoomCursor.value && isViewAdaptive()) { if (zoomCursor.value && isViewAdaptive()) {
cursorScale = s * c.devicePixelRatio; cursorScale = s * c.devicePixelRatio;
@@ -601,8 +603,8 @@ class _ImagePaintState extends State<ImagePaint> {
c, c,
s, s,
Offset( Offset(
Platform.isLinux ? c.x.toInt().toDouble() : c.x, isLinux ? c.x.toInt().toDouble() : c.x,
Platform.isLinux ? c.y.toInt().toDouble() : c.y, isLinux ? c.y.toInt().toDouble() : c.y,
), ),
c.size, c.size,
isViewOriginal()) isViewOriginal())
@@ -665,43 +667,16 @@ class _ImagePaintState extends State<ImagePaint> {
); );
} }
MouseCursor _buildCursorOfCache(
CursorModel cursor, double scale, CursorData? cache) {
if (cache == null) {
return MouseCursor.defer;
} else {
final key = cache.updateGetKey(scale);
if (!cursor.cachedKeys.contains(key)) {
debugPrint(
"Register custom cursor with key $key (${cache.hotx},${cache.hoty})");
// [Safety]
// It's ok to call async registerCursor in current synchronous context,
// because activating the cursor is also an async call and will always
// be executed after this.
custom_cursor_manager.CursorManager.instance
.registerCursor(custom_cursor_manager.CursorData()
..buffer = cache.data!
..height = (cache.height * cache.scale).toInt()
..width = (cache.width * cache.scale).toInt()
..hotX = cache.hotx
..hotY = cache.hoty
..name = key);
cursor.addKey(key);
}
return FlutterCustomMemoryImageCursor(key: key);
}
}
MouseCursor _buildCustomCursor(BuildContext context, double scale) { MouseCursor _buildCustomCursor(BuildContext context, double scale) {
final cursor = Provider.of<CursorModel>(context); final cursor = Provider.of<CursorModel>(context);
final cache = cursor.cache ?? preDefaultCursor.cache; final cache = cursor.cache ?? preDefaultCursor.cache;
return _buildCursorOfCache(cursor, scale, cache); return buildCursorOfCache(cursor, scale, cache);
} }
MouseCursor _buildDisabledCursor(BuildContext context, double scale) { MouseCursor _buildDisabledCursor(BuildContext context, double scale) {
final cursor = Provider.of<CursorModel>(context); final cursor = Provider.of<CursorModel>(context);
final cache = preForbiddenCursor.cache; final cache = preForbiddenCursor.cache;
return _buildCursorOfCache(cursor, scale, cache); return buildCursorOfCache(cursor, scale, cache);
} }
Widget _buildCrossScrollbarFromLayout( Widget _buildCrossScrollbarFromLayout(

View File

@@ -1,6 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:desktop_multi_window/desktop_multi_window.dart'; import 'package:desktop_multi_window/desktop_multi_window.dart';
@@ -95,6 +94,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
tabController: tabController, tabController: tabController,
switchUuid: params['switch_uuid'], switchUuid: params['switch_uuid'],
forceRelay: params['forceRelay'], forceRelay: params['forceRelay'],
isSharedPassword: params['isSharedPassword'],
), ),
)); ));
_update_remote_count(); _update_remote_count();
@@ -126,7 +126,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
tryMoveToScreenAndSetFullscreen(screenRect); tryMoveToScreenAndSetFullscreen(screenRect);
if (tabController.length == 0) { if (tabController.length == 0) {
// Show the hidden window. // Show the hidden window.
if (Platform.isMacOS && stateGlobal.closeOnFullscreen == true) { if (isMacOS && stateGlobal.closeOnFullscreen == true) {
stateGlobal.setFullscreen(true); stateGlobal.setFullscreen(true);
} }
// Reset the state // Reset the state
@@ -153,6 +153,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
tabController: tabController, tabController: tabController,
switchUuid: switchUuid, switchUuid: switchUuid,
forceRelay: args['forceRelay'], forceRelay: args['forceRelay'],
isSharedPassword: args['isSharedPassword'],
), ),
)); ));
} else if (call.method == kWindowDisableGrabKeyboard) { } else if (call.method == kWindowDisableGrabKeyboard) {
@@ -326,7 +327,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
), ),
), ),
); );
return Platform.isMacOS || kUseCompatibleUiMode return isMacOS || kUseCompatibleUiMode
? tabWidget ? tabWidget
: Obx(() => SubWindowDragToResizeArea( : Obx(() => SubWindowDragToResizeArea(
key: contentKey, key: contentKey,

View File

@@ -1,7 +1,6 @@
// original cm window in Sciter version. // original cm window in Sciter version.
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'dart:math'; import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -52,7 +51,7 @@ class _DesktopServerPageState extends State<DesktopServerPage>
@override @override
void onWindowClose() { void onWindowClose() {
Future.wait([gFFI.serverModel.closeAll(), gFFI.close()]).then((_) { Future.wait([gFFI.serverModel.closeAll(), gFFI.close()]).then((_) {
if (Platform.isMacOS) { if (isMacOS) {
RdPlatformChannel.instance.terminate(); RdPlatformChannel.instance.terminate();
} else { } else {
windowManager.setPreventClose(false); windowManager.setPreventClose(false);
@@ -327,11 +326,7 @@ class _AppIcon extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
margin: EdgeInsets.symmetric(horizontal: 4.0), margin: EdgeInsets.symmetric(horizontal: 4.0),
child: SvgPicture.asset( child: loadIcon(30),
'assets/logo.svg',
width: 30,
height: 30,
),
); );
} }
} }
@@ -655,7 +650,7 @@ class _PrivilegeBoardState extends State<_PrivilegeBoard> {
translate('Enable recording session'), translate('Enable recording session'),
), ),
// only windows support block input // only windows support block input
if (Platform.isWindows) if (isWindows)
buildPermissionIcon( buildPermissionIcon(
client.blockInput, client.blockInput,
Icons.block, Icons.block,

View File

@@ -1,5 +1,3 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hbb/common.dart'; import 'package:flutter_hbb/common.dart';
import 'package:flutter_hbb/desktop/pages/remote_tab_page.dart'; import 'package:flutter_hbb/desktop/pages/remote_tab_page.dart';
@@ -28,7 +26,7 @@ class DesktopRemoteScreen extends StatelessWidget {
child: Scaffold( child: Scaffold(
// Set transparent background for padding the resize area out of the flutter view. // Set transparent background for padding the resize area out of the flutter view.
// This allows the wallpaper goes through our resize area. (Linux only now). // This allows the wallpaper goes through our resize area. (Linux only now).
backgroundColor: Platform.isLinux ? Colors.transparent : null, backgroundColor: isLinux ? Colors.transparent : null,
body: ConnectionTabPage( body: ConnectionTabPage(
params: params, params: params,
), ),

View File

@@ -1,4 +1,3 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:flutter_hbb/consts.dart'; import 'package:flutter_hbb/consts.dart';
@@ -175,9 +174,9 @@ String getLocalPlatformForKBLayoutType(String peerPlatform) {
return localPlatform; return localPlatform;
} }
if (Platform.isWindows) { if (isWindows) {
localPlatform = kPeerPlatformWindows; localPlatform = kPeerPlatformWindows;
} else if (Platform.isLinux) { } else if (isLinux) {
localPlatform = kPeerPlatformLinux; localPlatform = kPeerPlatformLinux;
} }
// to-do: web desktop support ? // to-do: web desktop support ?

View File

@@ -568,6 +568,47 @@ class MenuEntrySwitch<T> extends MenuEntrySwitchBase<T> {
} }
} }
// Compatible with MenuEntrySwitch, it uses value instead of getter
class MenuEntrySwitchSync<T> extends MenuEntrySwitchBase<T> {
final SwitchSetter setter;
final RxBool _curOption = false.obs;
MenuEntrySwitchSync({
required SwitchType switchType,
required String text,
required bool currentValue,
required this.setter,
Rx<TextStyle>? textStyle,
EdgeInsets? padding,
dismissOnClicked = false,
RxBool? enabled,
dismissCallback,
}) : super(
switchType: switchType,
text: text,
textStyle: textStyle,
padding: padding,
dismissOnClicked: dismissOnClicked,
enabled: enabled,
dismissCallback: dismissCallback,
) {
_curOption.value = currentValue;
}
@override
RxBool get curOption => _curOption;
@override
setOption(bool? option) async {
if (option != null) {
await setter(option);
// Notice: no ensure with getter, best used on menus that are destroyed on click
if (_curOption.value != option) {
_curOption.value = option;
}
}
}
}
typedef Switch2Getter = RxBool Function(); typedef Switch2Getter = RxBool Function();
typedef Switch2Setter = Future<void> Function(bool); typedef Switch2Setter = Future<void> Function(bool);

View File

@@ -1,6 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@@ -112,10 +111,10 @@ class _ToolbarTheme {
static const double iconRadius = 8; static const double iconRadius = 8;
static const double elevation = 3; static const double elevation = 3;
static double dividerSpaceToAction = Platform.isWindows ? 8 : 14; static double dividerSpaceToAction = isWindows ? 8 : 14;
static double menuBorderRadius = Platform.isWindows ? 5.0 : 7.0; static double menuBorderRadius = isWindows ? 5.0 : 7.0;
static EdgeInsets menuPadding = Platform.isWindows static EdgeInsets menuPadding = isWindows
? EdgeInsets.fromLTRB(4, 12, 4, 12) ? EdgeInsets.fromLTRB(4, 12, 4, 12)
: EdgeInsets.fromLTRB(6, 14, 6, 14); : EdgeInsets.fromLTRB(6, 14, 6, 14);
static const double menuButtonBorderRadius = 3.0; static const double menuButtonBorderRadius = 3.0;
@@ -492,7 +491,7 @@ class _RemoteToolbarState extends State<RemoteToolbar> {
toolbarItems.add(_ChatMenu(id: widget.id, ffi: widget.ffi)); toolbarItems.add(_ChatMenu(id: widget.id, ffi: widget.ffi));
toolbarItems.add(_VoiceCallMenu(id: widget.id, ffi: widget.ffi)); toolbarItems.add(_VoiceCallMenu(id: widget.id, ffi: widget.ffi));
} }
toolbarItems.add(_RecordMenu()); if (!isWeb) toolbarItems.add(_RecordMenu());
toolbarItems.add(_CloseMenu(id: widget.id, ffi: widget.ffi)); toolbarItems.add(_CloseMenu(id: widget.id, ffi: widget.ffi));
final toolbarBorderRadius = BorderRadius.all(Radius.circular(4.0)); final toolbarBorderRadius = BorderRadius.all(Radius.circular(4.0));
return Column( return Column(
@@ -637,7 +636,7 @@ class _MonitorMenu extends StatelessWidget {
menuStyle: MenuStyle( menuStyle: MenuStyle(
padding: padding:
MaterialStatePropertyAll(EdgeInsets.symmetric(horizontal: 6))), MaterialStatePropertyAll(EdgeInsets.symmetric(horizontal: 6))),
menuChildren: [buildMonitorSubmenuWidget()]); menuChildrenGetter: () => [buildMonitorSubmenuWidget()]);
} }
Widget buildMultiMonitorMenu() { Widget buildMultiMonitorMenu() {
@@ -759,15 +758,18 @@ class _MonitorMenu extends StatelessWidget {
final children = <Widget>[]; final children = <Widget>[];
for (var i = 0; i < pi.displays.length; i++) { for (var i = 0; i < pi.displays.length; i++) {
final d = pi.displays[i]; final d = pi.displays[i];
final fontSize = (d.width * scale < d.height * scale double s = d.scale;
? d.width * scale int dWidth = d.width.toDouble() ~/ s;
: d.height * scale) * int dHeight = d.height.toDouble() ~/ s;
final fontSize = (dWidth * scale < dHeight * scale
? dWidth * scale
: dHeight * scale) *
0.65; 0.65;
children.add(Positioned( children.add(Positioned(
left: (d.x - rect.left) * scale + startX, left: (d.x - rect.left) * scale + startX,
top: (d.y - rect.top) * scale + startY, top: (d.y - rect.top) * scale + startY,
width: d.width * scale, width: dWidth * scale,
height: d.height * scale, height: dHeight * scale,
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
@@ -841,17 +843,17 @@ class _ControlMenu extends StatelessWidget {
color: _ToolbarTheme.blueColor, color: _ToolbarTheme.blueColor,
hoverColor: _ToolbarTheme.hoverBlueColor, hoverColor: _ToolbarTheme.hoverBlueColor,
ffi: ffi, ffi: ffi,
menuChildren: toolbarControls(context, id, ffi).map((e) { menuChildrenGetter: () => toolbarControls(context, id, ffi).map((e) {
if (e.divider) { if (e.divider) {
return Divider(); return Divider();
} else { } else {
return MenuButton( return MenuButton(
child: e.child, child: e.child,
onPressed: e.onPressed, onPressed: e.onPressed,
ffi: ffi, ffi: ffi,
trailingIcon: e.trailingIcon); trailingIcon: e.trailingIcon);
} }
}).toList()); }).toList());
} }
} }
@@ -938,13 +940,12 @@ class ScreenAdjustor {
} }
updateScreen() async { updateScreen() async {
final v = await rustDeskWinManager.call( final String info =
WindowType.Main, kWindowGetWindowInfo, ''); isWeb ? screenInfo : await _getScreenInfoDesktop() ?? '';
final String valueStr = v.result; if (info.isEmpty) {
if (valueStr.isEmpty) {
_screen = null; _screen = null;
} else { } else {
final screenMap = jsonDecode(valueStr); final screenMap = jsonDecode(info);
_screen = window_size.Screen( _screen = window_size.Screen(
Rect.fromLTRB(screenMap['frame']['l'], screenMap['frame']['t'], Rect.fromLTRB(screenMap['frame']['l'], screenMap['frame']['t'],
screenMap['frame']['r'], screenMap['frame']['b']), screenMap['frame']['r'], screenMap['frame']['b']),
@@ -957,15 +958,23 @@ class ScreenAdjustor {
} }
} }
_getScreenInfoDesktop() async {
final v = await rustDeskWinManager.call(
WindowType.Main, kWindowGetWindowInfo, '');
return v.result;
}
Future<bool> isWindowCanBeAdjusted() async { Future<bool> isWindowCanBeAdjusted() async {
final viewStyle = final viewStyle =
await bind.sessionGetViewStyle(sessionId: ffi.sessionId) ?? ''; await bind.sessionGetViewStyle(sessionId: ffi.sessionId) ?? '';
if (viewStyle != kRemoteViewStyleOriginal) { if (viewStyle != kRemoteViewStyleOriginal) {
return false; return false;
} }
final remoteCount = RemoteCountState.find().value; if (!isWeb) {
if (remoteCount != 1) { final remoteCount = RemoteCountState.find().value;
return false; if (remoteCount != 1) {
return false;
}
} }
if (_screen == null) { if (_screen == null) {
return false; return false;
@@ -1037,53 +1046,56 @@ class _DisplayMenuState extends State<_DisplayMenu> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
_screenAdjustor.updateScreen(); _screenAdjustor.updateScreen();
final menuChildren = <Widget>[ menuChildrenGetter() {
_screenAdjustor.adjustWindow(context), final menuChildren = <Widget>[
viewStyle(), _screenAdjustor.adjustWindow(context),
scrollStyle(), viewStyle(),
imageQuality(), scrollStyle(),
codec(), imageQuality(),
_ResolutionsMenu( codec(),
id: widget.id, _ResolutionsMenu(
ffi: widget.ffi, id: widget.id,
screenAdjustor: _screenAdjustor, ffi: widget.ffi,
), screenAdjustor: _screenAdjustor,
// We may add this feature if it is needed and we have an EV certificate. ),
// _VirtualDisplayMenu( // We may add this feature if it is needed and we have an EV certificate.
// id: widget.id, // _VirtualDisplayMenu(
// ffi: widget.ffi, // id: widget.id,
// ), // ffi: widget.ffi,
Divider(), // ),
toggles(), Divider(),
]; toggles(),
// privacy mode ];
if (ffiModel.keyboard && pi.features.privacyMode) { // privacy mode
final privacyModeState = PrivacyModeState.find(id); if (ffiModel.keyboard && pi.features.privacyMode) {
final privacyModeList = final privacyModeState = PrivacyModeState.find(id);
toolbarPrivacyMode(privacyModeState, context, id, ffi); final privacyModeList =
if (privacyModeList.length == 1) { toolbarPrivacyMode(privacyModeState, context, id, ffi);
menuChildren.add(CkbMenuButton( if (privacyModeList.length == 1) {
value: privacyModeList[0].value, menuChildren.add(CkbMenuButton(
onChanged: privacyModeList[0].onChanged, value: privacyModeList[0].value,
child: privacyModeList[0].child, onChanged: privacyModeList[0].onChanged,
ffi: ffi)); child: privacyModeList[0].child,
} else if (privacyModeList.length > 1) { ffi: ffi));
menuChildren.addAll([ } else if (privacyModeList.length > 1) {
Divider(), menuChildren.addAll([
_SubmenuButton( Divider(),
ffi: widget.ffi, _SubmenuButton(
child: Text(translate('Privacy mode')), ffi: widget.ffi,
menuChildren: privacyModeList child: Text(translate('Privacy mode')),
.map((e) => CkbMenuButton( menuChildren: privacyModeList
value: e.value, .map((e) => CkbMenuButton(
onChanged: e.onChanged, value: e.value,
child: e.child, onChanged: e.onChanged,
ffi: ffi)) child: e.child,
.toList()), ffi: ffi))
]); .toList()),
]);
}
} }
menuChildren.add(widget.pluginItem);
return menuChildren;
} }
menuChildren.add(widget.pluginItem);
return _IconSubmenuButton( return _IconSubmenuButton(
tooltip: 'Display Settings', tooltip: 'Display Settings',
@@ -1091,7 +1103,7 @@ class _DisplayMenuState extends State<_DisplayMenu> {
ffi: widget.ffi, ffi: widget.ffi,
color: _ToolbarTheme.blueColor, color: _ToolbarTheme.blueColor,
hoverColor: _ToolbarTheme.hoverBlueColor, hoverColor: _ToolbarTheme.hoverBlueColor,
menuChildren: menuChildren, menuChildrenGetter: menuChildrenGetter,
); );
} }
@@ -1244,7 +1256,7 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> {
FFI get ffi => widget.ffi; FFI get ffi => widget.ffi;
PeerInfo get pi => widget.ffi.ffiModel.pi; PeerInfo get pi => widget.ffi.ffiModel.pi;
FfiModel get ffiModel => widget.ffi.ffiModel; FfiModel get ffiModel => widget.ffi.ffiModel;
Rect? get rect => ffiModel.rect; Rect? get rect => scaledRect();
List<Resolution> get resolutions => pi.resolutions; List<Resolution> get resolutions => pi.resolutions;
bool get isWayland => bind.mainCurrentIsWayland(); bool get isWayland => bind.mainCurrentIsWayland();
@@ -1254,6 +1266,20 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> {
_getLocalResolutionWayland(); _getLocalResolutionWayland();
} }
Rect? scaledRect() {
final scale = pi.scaleOfDisplay(pi.currentDisplay);
final rect = ffiModel.rect;
if (rect == null) {
return null;
}
return Rect.fromLTWH(
rect.left,
rect.top,
rect.width / scale,
rect.height / scale,
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isVirtualDisplay = ffiModel.isVirtualDisplayResolution; final isVirtualDisplay = ffiModel.isVirtualDisplayResolution;
@@ -1287,7 +1313,8 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> {
if (lastGroupValue == _kCustomResolutionValue) { if (lastGroupValue == _kCustomResolutionValue) {
_groupValue = _kCustomResolutionValue; _groupValue = _kCustomResolutionValue;
} else { } else {
_groupValue = '${rect?.width.toInt()}x${rect?.height.toInt()}'; _groupValue =
'${(rect?.width ?? 0).toInt()}x${(rect?.height ?? 0).toInt()}';
} }
} }
@@ -1321,6 +1348,14 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> {
final display = json.decode(mainDisplay); final display = json.decode(mainDisplay);
if (display['w'] != null && display['h'] != null) { if (display['w'] != null && display['h'] != null) {
_localResolution = Resolution(display['w'], display['h']); _localResolution = Resolution(display['w'], display['h']);
if (isWeb) {
if (display['scaleFactor'] != null) {
_localResolution = Resolution(
(display['w'] / display['scaleFactor']).toInt(),
(display['h'] / display['scaleFactor']).toInt(),
);
}
}
} }
} catch (e) { } catch (e) {
debugPrint('Failed to decode $mainDisplay, $e'); debugPrint('Failed to decode $mainDisplay, $e');
@@ -1386,6 +1421,11 @@ class _ResolutionsMenuState extends State<_ResolutionsMenu> {
if (display == null) { if (display == null) {
return Offstage(); return Offstage();
} }
if (!resolutions.any((e) =>
e.width == display.originalWidth &&
e.height == display.originalHeight)) {
return Offstage();
}
return Offstage( return Offstage(
offstage: !showOriginalBtn, offstage: !showOriginalBtn,
child: MenuButton( child: MenuButton(
@@ -1586,19 +1626,7 @@ class _KeyboardMenu extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
var ffiModel = Provider.of<FfiModel>(context); var ffiModel = Provider.of<FfiModel>(context);
if (!ffiModel.keyboard) return Offstage(); if (!ffiModel.keyboard) return Offstage();
// If use flutter to grab keys, we can only use one mode. toolbarToggles() => toolbarKeyboardToggles(ffi)
// Map mode and Legacy mode, at least one of them is supported.
String? modeOnly;
if (isInputSourceFlutter) {
if (bind.sessionIsKeyboardModeSupported(
sessionId: ffi.sessionId, mode: kKeyMapMode)) {
modeOnly = kKeyMapMode;
} else if (bind.sessionIsKeyboardModeSupported(
sessionId: ffi.sessionId, mode: kKeyLegacyMode)) {
modeOnly = kKeyLegacyMode;
}
}
final toolbarToggles = toolbarKeyboardToggles(ffi)
.map((e) => CkbMenuButton( .map((e) => CkbMenuButton(
value: e.value, onChanged: e.onChanged, child: e.child, ffi: ffi)) value: e.value, onChanged: e.onChanged, child: e.child, ffi: ffi))
.toList(); .toList();
@@ -1608,18 +1636,18 @@ class _KeyboardMenu extends StatelessWidget {
ffi: ffi, ffi: ffi,
color: _ToolbarTheme.blueColor, color: _ToolbarTheme.blueColor,
hoverColor: _ToolbarTheme.hoverBlueColor, hoverColor: _ToolbarTheme.hoverBlueColor,
menuChildren: [ menuChildrenGetter: () => [
keyboardMode(modeOnly), keyboardMode(),
localKeyboardType(), localKeyboardType(),
inputSource(), inputSource(),
Divider(), Divider(),
viewMode(), viewMode(),
Divider(), Divider(),
...toolbarToggles, ...toolbarToggles(),
]); ]);
} }
keyboardMode(String? modeOnly) { keyboardMode() {
return futureBuilder(future: () async { return futureBuilder(future: () async {
return await bind.sessionGetKeyboardMode(sessionId: ffi.sessionId) ?? return await bind.sessionGetKeyboardMode(sessionId: ffi.sessionId) ??
kKeyLegacyMode; kKeyLegacyMode;
@@ -1639,6 +1667,19 @@ class _KeyboardMenu extends StatelessWidget {
await ffi.inputModel.updateKeyboardMode(); await ffi.inputModel.updateKeyboardMode();
} }
// If use flutter to grab keys, we can only use one mode.
// Map mode and Legacy mode, at least one of them is supported.
String? modeOnly;
if (isInputSourceFlutter) {
if (bind.sessionIsKeyboardModeSupported(
sessionId: ffi.sessionId, mode: kKeyMapMode)) {
modeOnly = kKeyMapMode;
} else if (bind.sessionIsKeyboardModeSupported(
sessionId: ffi.sessionId, mode: kKeyLegacyMode)) {
modeOnly = kKeyLegacyMode;
}
}
for (InputModeMenu mode in modes) { for (InputModeMenu mode in modes) {
if (modeOnly != null && mode.key != modeOnly) { if (modeOnly != null && mode.key != modeOnly) {
continue; continue;
@@ -1732,7 +1773,7 @@ class _KeyboardMenu extends StatelessWidget {
? (value) async { ? (value) async {
if (value == null) return; if (value == null) return;
await bind.sessionToggleOption( await bind.sessionToggleOption(
sessionId: ffi.sessionId, value: 'view-only'); sessionId: ffi.sessionId, value: kOptionViewOnly);
ffiModel.setViewOnly(id, value); ffiModel.setViewOnly(id, value);
} }
: null, : null,
@@ -1767,7 +1808,7 @@ class _ChatMenuState extends State<_ChatMenu> {
ffi: widget.ffi, ffi: widget.ffi,
color: _ToolbarTheme.blueColor, color: _ToolbarTheme.blueColor,
hoverColor: _ToolbarTheme.hoverBlueColor, hoverColor: _ToolbarTheme.hoverBlueColor,
menuChildren: [textChat(), voiceCall()]); menuChildrenGetter: () => [textChat(), voiceCall()]);
} }
textChat() { textChat() {
@@ -1971,7 +2012,7 @@ class _IconSubmenuButton extends StatefulWidget {
final Widget? icon; final Widget? icon;
final Color color; final Color color;
final Color hoverColor; final Color hoverColor;
final List<Widget> menuChildren; final List<Widget> Function() menuChildrenGetter;
final MenuStyle? menuStyle; final MenuStyle? menuStyle;
final FFI ffi; final FFI ffi;
final double? width; final double? width;
@@ -1983,7 +2024,7 @@ class _IconSubmenuButton extends StatefulWidget {
required this.tooltip, required this.tooltip,
required this.color, required this.color,
required this.hoverColor, required this.hoverColor,
required this.menuChildren, required this.menuChildrenGetter,
required this.ffi, required this.ffi,
this.menuStyle, this.menuStyle,
this.width, this.width,
@@ -2027,7 +2068,8 @@ class _IconSubmenuButtonState extends State<_IconSubmenuButton> {
color: hover ? widget.hoverColor : widget.color, color: hover ? widget.hoverColor : widget.color,
), ),
child: icon))), child: icon))),
menuChildren: widget.menuChildren menuChildren: widget
.menuChildrenGetter()
.map((e) => _buildPointerTrackWidget(e, widget.ffi)) .map((e) => _buildPointerTrackWidget(e, widget.ffi))
.toList())); .toList()));
return MenuBar(children: [ return MenuBar(children: [

View File

@@ -1,5 +1,4 @@
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'dart:math'; import 'dart:math';
import 'dart:ui' as ui; import 'dart:ui' as ui;
@@ -13,7 +12,6 @@ import 'package:flutter_hbb/desktop/pages/remote_page.dart';
import 'package:flutter_hbb/main.dart'; import 'package:flutter_hbb/main.dart';
import 'package:flutter_hbb/models/platform_model.dart'; import 'package:flutter_hbb/models/platform_model.dart';
import 'package:flutter_hbb/models/state_model.dart'; import 'package:flutter_hbb/models/state_model.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:get/get_rx/src/rx_workers/utils/debouncer.dart'; import 'package:get/get_rx/src/rx_workers/utils/debouncer.dart';
import 'package:scroll_pos/scroll_pos.dart'; import 'package:scroll_pos/scroll_pos.dart';
@@ -166,7 +164,8 @@ class DesktopTabController {
})); }));
} }
}); });
if (callOnSelected) { if ((isDesktop && (bind.isIncomingOnly() || bind.isOutgoingOnly())) ||
callOnSelected) {
if (state.value.tabs.length > index) { if (state.value.tabs.length > index) {
final key = state.value.tabs[index].key; final key = state.value.tabs[index].key;
onSelected?.call(key); onSelected?.call(key);
@@ -375,7 +374,8 @@ class DesktopTab extends StatelessWidget {
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
// custom double tap handler // custom double tap handler
onTap: showMaximize onTap: !(bind.isIncomingOnly() && isInHomePage()) &&
showMaximize
? () { ? () {
final current = DateTime.now().millisecondsSinceEpoch; final current = DateTime.now().millisecondsSinceEpoch;
final elapsed = current - _lastClickTime; final elapsed = current - _lastClickTime;
@@ -391,20 +391,17 @@ class DesktopTab extends StatelessWidget {
child: Row( child: Row(
children: [ children: [
Offstage( Offstage(
offstage: !Platform.isMacOS, offstage: !isMacOS,
child: const SizedBox( child: const SizedBox(
width: 78, width: 78,
)), )),
Offstage( Offstage(
offstage: kUseCompatibleUiMode || Platform.isMacOS, offstage: kUseCompatibleUiMode || isMacOS,
child: Row(children: [ child: Row(children: [
Offstage( Offstage(
offstage: !showLogo, offstage: !showLogo,
child: SvgPicture.asset( child: loadIcon(16),
'assets/logo.svg', ),
width: 16,
height: 16,
)),
Offstage( Offstage(
offstage: !showTitle, offstage: !showTitle,
child: const Text( child: const Text(
@@ -586,8 +583,8 @@ class WindowActionPanelState extends State<WindowActionPanel>
mainWindowClose() async => await windowManager.hide(); mainWindowClose() async => await windowManager.hide();
notMainWindowClose(WindowController controller) async { notMainWindowClose(WindowController controller) async {
if (widget.tabController.length != 0) { if (widget.tabController.length != 0) {
debugPrint("close not emtpy multiwindow from taskbar"); debugPrint("close not empty multiwindow from taskbar");
if (Platform.isWindows) { if (isWindows) {
await controller.show(); await controller.show();
await controller.focus(); await controller.focus();
final res = await widget.onClose?.call() ?? true; final res = await widget.onClose?.call() ?? true;
@@ -622,7 +619,7 @@ class WindowActionPanelState extends State<WindowActionPanel>
await rustDeskWinManager.unregisterActiveWindow(kMainWindowId); await rustDeskWinManager.unregisterActiveWindow(kMainWindowId);
} }
// macOS specific workaround, the window is not hiding when in fullscreen. // macOS specific workaround, the window is not hiding when in fullscreen.
if (Platform.isMacOS && await windowManager.isFullScreen()) { if (isMacOS && await windowManager.isFullScreen()) {
stateGlobal.closeOnFullscreen ??= true; stateGlobal.closeOnFullscreen ??= true;
await windowManager.setFullScreen(false); await windowManager.setFullScreen(false);
await macOSWindowClose( await macOSWindowClose(
@@ -636,7 +633,7 @@ class WindowActionPanelState extends State<WindowActionPanel>
} else { } else {
// it's safe to hide the subwindow // it's safe to hide the subwindow
final controller = WindowController.fromWindowId(kWindowId!); final controller = WindowController.fromWindowId(kWindowId!);
if (Platform.isMacOS) { if (isMacOS) {
// onWindowClose() maybe called multiple times because of loopCloseWindow() in remote_tab_page.dart. // onWindowClose() maybe called multiple times because of loopCloseWindow() in remote_tab_page.dart.
// use ??= to make sure the value is set on first call. // use ??= to make sure the value is set on first call.
@@ -672,7 +669,7 @@ class WindowActionPanelState extends State<WindowActionPanel>
child: Row( child: Row(
children: [ children: [
Offstage( Offstage(
offstage: !widget.showMinimize || Platform.isMacOS, offstage: !widget.showMinimize || isMacOS,
child: ActionIcon( child: ActionIcon(
message: 'Minimize', message: 'Minimize',
icon: IconFont.min, icon: IconFont.min,
@@ -686,7 +683,7 @@ class WindowActionPanelState extends State<WindowActionPanel>
isClose: false, isClose: false,
)), )),
Offstage( Offstage(
offstage: !widget.showMaximize || Platform.isMacOS, offstage: !widget.showMaximize || isMacOS,
child: Obx(() => ActionIcon( child: Obx(() => ActionIcon(
message: stateGlobal.isMaximized.isTrue message: stateGlobal.isMaximized.isTrue
? 'Restore' ? 'Restore'
@@ -694,11 +691,13 @@ class WindowActionPanelState extends State<WindowActionPanel>
icon: stateGlobal.isMaximized.isTrue icon: stateGlobal.isMaximized.isTrue
? IconFont.restore ? IconFont.restore
: IconFont.max, : IconFont.max,
onTap: _toggleMaximize, onTap: bind.isIncomingOnly() && isInHomePage()
? null
: _toggleMaximize,
isClose: false, isClose: false,
))), ))),
Offstage( Offstage(
offstage: !widget.showClose || Platform.isMacOS, offstage: !widget.showClose || isMacOS,
child: ActionIcon( child: ActionIcon(
message: 'Close', message: 'Close',
icon: IconFont.close, icon: IconFont.close,
@@ -1110,7 +1109,7 @@ class _CloseButton extends StatelessWidget {
class ActionIcon extends StatefulWidget { class ActionIcon extends StatefulWidget {
final String? message; final String? message;
final IconData icon; final IconData icon;
final Function() onTap; final GestureTapCallback? onTap;
final bool isClose; final bool isClose;
final double iconSize; final double iconSize;
final double boxSize; final double boxSize;
@@ -1119,7 +1118,7 @@ class ActionIcon extends StatefulWidget {
{Key? key, {Key? key,
this.message, this.message,
required this.icon, required this.icon,
required this.onTap, this.onTap,
this.isClose = false, this.isClose = false,
this.iconSize = _kActionIconSize, this.iconSize = _kActionIconSize,
this.boxSize = _kTabBarHeight - 1}) this.boxSize = _kTabBarHeight - 1})
@@ -1143,24 +1142,30 @@ class _ActionIconState extends State<ActionIcon> {
return Tooltip( return Tooltip(
message: widget.message != null ? translate(widget.message!) : "", message: widget.message != null ? translate(widget.message!) : "",
waitDuration: const Duration(seconds: 1), waitDuration: const Duration(seconds: 1),
child: Obx( child: InkWell(
() => InkWell( hoverColor: widget.isClose
hoverColor: widget.isClose ? const Color.fromARGB(255, 196, 43, 28)
? const Color.fromARGB(255, 196, 43, 28) : MyTheme.tabbar(context).hoverColor,
: MyTheme.tabbar(context).hoverColor, onHover: (value) => hover.value = value,
onHover: (value) => hover.value = value, onTap: widget.onTap,
onTap: widget.onTap, child: SizedBox(
child: SizedBox( height: widget.boxSize,
height: widget.boxSize, width: widget.boxSize,
width: widget.boxSize, child: widget.onTap == null
child: Icon( ? Icon(
widget.icon, widget.icon,
color: hover.value && widget.isClose color: Colors.grey,
? Colors.white size: widget.iconSize,
: MyTheme.tabbar(context).unSelectedIconColor, )
size: widget.iconSize, : Obx(
), () => Icon(
), widget.icon,
color: hover.value && widget.isClose
? Colors.white
: MyTheme.tabbar(context).unSelectedIconColor,
size: widget.iconSize,
),
),
), ),
), ),
); );

View File

@@ -14,21 +14,21 @@ import 'package:flutter_hbb/desktop/screen/desktop_port_forward_screen.dart';
import 'package:flutter_hbb/desktop/screen/desktop_remote_screen.dart'; import 'package:flutter_hbb/desktop/screen/desktop_remote_screen.dart';
import 'package:flutter_hbb/desktop/widgets/refresh_wrapper.dart'; import 'package:flutter_hbb/desktop/widgets/refresh_wrapper.dart';
import 'package:flutter_hbb/models/state_model.dart'; import 'package:flutter_hbb/models/state_model.dart';
import 'package:flutter_hbb/plugin/handlers.dart';
import 'package:flutter_hbb/utils/multi_window_manager.dart'; import 'package:flutter_hbb/utils/multi_window_manager.dart';
import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:window_manager/window_manager.dart'; import 'package:window_manager/window_manager.dart';
// import 'package:window_manager/window_manager.dart';
import 'common.dart'; import 'common.dart';
import 'consts.dart'; import 'consts.dart';
import 'mobile/pages/home_page.dart'; import 'mobile/pages/home_page.dart';
import 'mobile/pages/server_page.dart'; import 'mobile/pages/server_page.dart';
import 'models/platform_model.dart'; import 'models/platform_model.dart';
import 'package:flutter_hbb/plugin/handlers.dart'
if (dart.library.html) 'package:flutter_hbb/web/plugin/handlers.dart';
/// Basic window and launch properties. /// Basic window and launch properties.
int? kWindowId; int? kWindowId;
WindowType? kWindowType; WindowType? kWindowType;
@@ -36,6 +36,7 @@ late List<String> kBootArgs;
Future<void> main(List<String> args) async { Future<void> main(List<String> args) async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
debugPrint("launch args: $args"); debugPrint("launch args: $args");
kBootArgs = List.from(args); kBootArgs = List.from(args);
@@ -47,7 +48,7 @@ Future<void> main(List<String> args) async {
if (args.isNotEmpty && args.first == 'multi_window') { if (args.isNotEmpty && args.first == 'multi_window') {
kWindowId = int.parse(args[1]); kWindowId = int.parse(args[1]);
stateGlobal.setWindowId(kWindowId!); stateGlobal.setWindowId(kWindowId!);
if (!Platform.isMacOS) { if (!isMacOS) {
WindowController.fromWindowId(kWindowId!).showTitleBar(false); WindowController.fromWindowId(kWindowId!).showTitleBar(false);
} }
final argument = args[2].isEmpty final argument = args[2].isEmpty
@@ -58,14 +59,12 @@ Future<void> main(List<String> args) async {
// Because stateGlobal.windowId is a global value. // Because stateGlobal.windowId is a global value.
argument['windowId'] = kWindowId; argument['windowId'] = kWindowId;
kWindowType = type.windowType; kWindowType = type.windowType;
final windowName = getWindowName();
switch (kWindowType) { switch (kWindowType) {
case WindowType.RemoteDesktop: case WindowType.RemoteDesktop:
desktopType = DesktopType.remote; desktopType = DesktopType.remote;
runMultiWindow( runMultiWindow(
argument, argument,
kAppTypeDesktopRemote, kAppTypeDesktopRemote,
windowName,
); );
break; break;
case WindowType.FileTransfer: case WindowType.FileTransfer:
@@ -73,7 +72,6 @@ Future<void> main(List<String> args) async {
runMultiWindow( runMultiWindow(
argument, argument,
kAppTypeDesktopFileTransfer, kAppTypeDesktopFileTransfer,
windowName,
); );
break; break;
case WindowType.PortForward: case WindowType.PortForward:
@@ -81,7 +79,6 @@ Future<void> main(List<String> args) async {
runMultiWindow( runMultiWindow(
argument, argument,
kAppTypeDesktopPortForward, kAppTypeDesktopPortForward,
windowName,
); );
break; break;
default: default:
@@ -128,6 +125,7 @@ void runMainApp(bool startService) async {
await Future.wait([gFFI.abModel.loadCache(), gFFI.groupModel.loadCache()]); await Future.wait([gFFI.abModel.loadCache(), gFFI.groupModel.loadCache()]);
gFFI.userModel.refreshCurrentUser(); gFFI.userModel.refreshCurrentUser();
runApp(App()); runApp(App());
// Set window option. // Set window option.
WindowOptions windowOptions = getHiddenTitleBarWindowOptions(); WindowOptions windowOptions = getHiddenTitleBarWindowOptions();
windowManager.waitUntilReadyToShow(windowOptions, () async { windowManager.waitUntilReadyToShow(windowOptions, () async {
@@ -146,25 +144,26 @@ void runMainApp(bool startService) async {
} }
windowManager.setOpacity(1); windowManager.setOpacity(1);
windowManager.setTitle(getWindowName()); windowManager.setTitle(getWindowName());
windowManager.setResizable(!bind.isIncomingOnly());
}); });
} }
void runMobileApp() async { void runMobileApp() async {
await initEnv(kAppTypeMain); await initEnv(kAppTypeMain);
if (isAndroid) androidChannelInit(); if (isAndroid) androidChannelInit();
platformFFI.syncAndroidServiceAppDirConfigPath(); if (isAndroid) platformFFI.syncAndroidServiceAppDirConfigPath();
await Future.wait([gFFI.abModel.loadCache(), gFFI.groupModel.loadCache()]); await Future.wait([gFFI.abModel.loadCache(), gFFI.groupModel.loadCache()]);
gFFI.userModel.refreshCurrentUser(); gFFI.userModel.refreshCurrentUser();
runApp(App()); runApp(App());
await initUniLinks(); if (!isWeb) await initUniLinks();
} }
void runMultiWindow( void runMultiWindow(
Map<String, dynamic> argument, Map<String, dynamic> argument,
String appType, String appType,
String title,
) async { ) async {
await initEnv(appType); await initEnv(appType);
final title = getWindowName();
// set prevent close to true, we handle close event manually // set prevent close to true, we handle close event manually
WindowController.fromWindowId(kWindowId!).setPreventClose(true); WindowController.fromWindowId(kWindowId!).setPreventClose(true);
late Widget widget; late Widget widget;

View File

@@ -53,7 +53,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_uniLinksSubscription = listenUniLinks(); if (!isWeb) _uniLinksSubscription = listenUniLinks();
if (_idController.text.isEmpty) { if (_idController.text.isEmpty) {
() async { () async {
final lastRemoteId = await bind.mainGetLastRemoteId(); final lastRemoteId = await bind.mainGetLastRemoteId();
@@ -166,6 +166,7 @@ class _ConnectionPageState extends State<ConnectionPage> {
platform: '', platform: '',
tags: [], tags: [],
hash: '', hash: '',
password: '',
forceAlwaysRelay: false, forceAlwaysRelay: false,
rdpPort: '', rdpPort: '',
rdpUsername: '', rdpUsername: '',

View File

@@ -3,7 +3,6 @@ import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_breadcrumb/flutter_breadcrumb.dart'; import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
import 'package:flutter_hbb/models/file_model.dart'; import 'package:flutter_hbb/models/file_model.dart';
import 'package:flutter_hbb/models/platform_model.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:toggle_switch/toggle_switch.dart'; import 'package:toggle_switch/toggle_switch.dart';
import 'package:wakelock_plus/wakelock_plus.dart'; import 'package:wakelock_plus/wakelock_plus.dart';
@@ -12,8 +11,12 @@ import '../../common.dart';
import '../../common/widgets/dialog.dart'; import '../../common/widgets/dialog.dart';
class FileManagerPage extends StatefulWidget { class FileManagerPage extends StatefulWidget {
FileManagerPage({Key? key, required this.id}) : super(key: key); FileManagerPage(
{Key? key, required this.id, this.password, this.isSharedPassword})
: super(key: key);
final String id; final String id;
final String? password;
final bool? isSharedPassword;
@override @override
State<StatefulWidget> createState() => _FileManagerPageState(); State<StatefulWidget> createState() => _FileManagerPageState();
@@ -68,7 +71,10 @@ class _FileManagerPageState extends State<FileManagerPage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
gFFI.start(widget.id, isFileTransfer: true); gFFI.start(widget.id,
isFileTransfer: true,
password: widget.password,
isSharedPassword: widget.isSharedPassword);
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
gFFI.dialogManager gFFI.dialogManager
.showLoading(translate('Connecting...'), onCancel: closeConnection); .showLoading(translate('Connecting...'), onCancel: closeConnection);

View File

@@ -25,9 +25,12 @@ import '../widgets/dialog.dart';
final initText = '1' * 1024; final initText = '1' * 1024;
class RemotePage extends StatefulWidget { class RemotePage extends StatefulWidget {
RemotePage({Key? key, required this.id}) : super(key: key); RemotePage({Key? key, required this.id, this.password, this.isSharedPassword})
: super(key: key);
final String id; final String id;
final String? password;
final bool? isSharedPassword;
@override @override
State<RemotePage> createState() => _RemotePageState(); State<RemotePage> createState() => _RemotePageState();
@@ -54,7 +57,12 @@ class _RemotePageState extends State<RemotePage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
gFFI.start(widget.id); gFFI.ffiModel.updateEventListener(sessionId, widget.id);
gFFI.start(
widget.id,
password: widget.password,
isSharedPassword: widget.isSharedPassword,
);
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
gFFI.dialogManager gFFI.dialogManager
@@ -62,7 +70,6 @@ class _RemotePageState extends State<RemotePage> {
}); });
WakelockPlus.enable(); WakelockPlus.enable();
_physicalFocusNode.requestFocus(); _physicalFocusNode.requestFocus();
gFFI.ffiModel.updateEventListener(sessionId, widget.id);
gFFI.inputModel.listenToMouse(true); gFFI.inputModel.listenToMouse(true);
gFFI.qualityMonitorModel.checkShowQualityMonitor(sessionId); gFFI.qualityMonitorModel.checkShowQualityMonitor(sessionId);
keyboardSubscription = keyboardSubscription =
@@ -288,25 +295,26 @@ class _RemotePageState extends State<RemotePage> {
: Offstage(), : Offstage(),
], ],
)), )),
body: getRawPointerAndKeyBody(Overlay( body: Obx(
initialEntries: [ () => getRawPointerAndKeyBody(Overlay(
OverlayEntry(builder: (context) { initialEntries: [
return Container( OverlayEntry(builder: (context) {
return Container(
color: Colors.black, color: Colors.black,
child: isWebDesktop child: isWebDesktop
? getBodyForDesktopWithListener(keyboard) ? getBodyForDesktopWithListener(keyboard)
: SafeArea(child: : SafeArea(
OrientationBuilder(builder: (ctx, orientation) { child:
if (_currentOrientation != orientation) { OrientationBuilder(builder: (ctx, orientation) {
Timer(const Duration(milliseconds: 200), () { if (_currentOrientation != orientation) {
gFFI.dialogManager Timer(const Duration(milliseconds: 200), () {
.resetMobileActionsOverlay(ffi: gFFI); gFFI.dialogManager
_currentOrientation = orientation; .resetMobileActionsOverlay(ffi: gFFI);
gFFI.canvasModel.updateViewStyle(); _currentOrientation = orientation;
}); gFFI.canvasModel.updateViewStyle();
} });
return Obx( }
() => Container( return Container(
color: MyTheme.canvasColor, color: MyTheme.canvasColor,
child: inputModel.isPhysicalMouse.value child: inputModel.isPhysicalMouse.value
? getBodyForMobile() ? getBodyForMobile()
@@ -314,12 +322,14 @@ class _RemotePageState extends State<RemotePage> {
child: getBodyForMobile(), child: getBodyForMobile(),
ffi: gFFI, ffi: gFFI,
), ),
), );
); }),
}))); ),
}) );
], })
))), ],
)),
)),
); );
} }

View File

@@ -8,7 +8,7 @@ import 'package:qr_code_scanner/qr_code_scanner.dart';
import 'package:zxing2/qrcode.dart'; import 'package:zxing2/qrcode.dart';
import '../../common.dart'; import '../../common.dart';
import '../../consts.dart'; import '../../models/platform_model.dart';
import '../widgets/dialog.dart'; import '../widgets/dialog.dart';
class ScanPage extends StatefulWidget { class ScanPage extends StatefulWidget {
@@ -61,7 +61,7 @@ class _ScanPageState extends State<ScanPage> {
var reader = QRCodeReader(); var reader = QRCodeReader();
try { try {
var result = reader.decode(bitmap); var result = reader.decode(bitmap);
if (result.text.startsWith(kUniLinksPrefix)) { if (result.text.startsWith(bind.mainUriPrefixSync())) {
handleUriLink(uriString: result.text); handleUriLink(uriString: result.text);
} else { } else {
showServerSettingFromQr(result.text); showServerSettingFromQr(result.text);

View File

@@ -42,25 +42,21 @@ class ServerPage extends StatefulWidget implements PageShape {
return [ return [
PopupMenuItem( PopupMenuItem(
enabled: gFFI.serverModel.connectStatus > 0, enabled: gFFI.serverModel.connectStatus > 0,
padding: const EdgeInsets.symmetric(horizontal: 16.0),
value: "changeID", value: "changeID",
child: Text(translate("Change ID")), child: Text(translate("Change ID")),
), ),
const PopupMenuDivider(), const PopupMenuDivider(),
PopupMenuItem( PopupMenuItem(
padding: const EdgeInsets.symmetric(horizontal: 0.0),
value: 'AcceptSessionsViaPassword', value: 'AcceptSessionsViaPassword',
child: listTile( child: listTile(
'Accept sessions via password', approveMode == 'password'), 'Accept sessions via password', approveMode == 'password'),
), ),
PopupMenuItem( PopupMenuItem(
padding: const EdgeInsets.symmetric(horizontal: 0.0),
value: 'AcceptSessionsViaClick', value: 'AcceptSessionsViaClick',
child: child:
listTile('Accept sessions via click', approveMode == 'click'), listTile('Accept sessions via click', approveMode == 'click'),
), ),
PopupMenuItem( PopupMenuItem(
padding: const EdgeInsets.symmetric(horizontal: 0.0),
value: "AcceptSessionsViaBoth", value: "AcceptSessionsViaBoth",
child: listTile("Accept sessions via both", child: listTile("Accept sessions via both",
approveMode != 'password' && approveMode != 'click'), approveMode != 'password' && approveMode != 'click'),
@@ -69,35 +65,30 @@ class ServerPage extends StatefulWidget implements PageShape {
if (showPasswordOption && if (showPasswordOption &&
verificationMethod != kUseTemporaryPassword) verificationMethod != kUseTemporaryPassword)
PopupMenuItem( PopupMenuItem(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
value: "setPermanentPassword", value: "setPermanentPassword",
child: Text(translate("Set permanent password")), child: Text(translate("Set permanent password")),
), ),
if (showPasswordOption && if (showPasswordOption &&
verificationMethod != kUsePermanentPassword) verificationMethod != kUsePermanentPassword)
PopupMenuItem( PopupMenuItem(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
value: "setTemporaryPasswordLength", value: "setTemporaryPasswordLength",
child: Text(translate("One-time password length")), child: Text(translate("One-time password length")),
), ),
if (showPasswordOption) const PopupMenuDivider(), if (showPasswordOption) const PopupMenuDivider(),
if (showPasswordOption) if (showPasswordOption)
PopupMenuItem( PopupMenuItem(
padding: const EdgeInsets.symmetric(horizontal: 0.0),
value: kUseTemporaryPassword, value: kUseTemporaryPassword,
child: listTile('Use one-time password', child: listTile('Use one-time password',
verificationMethod == kUseTemporaryPassword), verificationMethod == kUseTemporaryPassword),
), ),
if (showPasswordOption) if (showPasswordOption)
PopupMenuItem( PopupMenuItem(
padding: const EdgeInsets.symmetric(horizontal: 0.0),
value: kUsePermanentPassword, value: kUsePermanentPassword,
child: listTile('Use permanent password', child: listTile('Use permanent password',
verificationMethod == kUsePermanentPassword), verificationMethod == kUsePermanentPassword),
), ),
if (showPasswordOption) if (showPasswordOption)
PopupMenuItem( PopupMenuItem(
padding: const EdgeInsets.symmetric(horizontal: 0.0),
value: kUseBothPasswords, value: kUseBothPasswords,
child: listTile( child: listTile(
'Use both passwords', 'Use both passwords',
@@ -392,7 +383,7 @@ class ScamWarningDialogState extends State<ScamWarningDialog> {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
primary: Colors.blueAccent, backgroundColor: Colors.blueAccent,
), ),
child: Text( child: Text(
translate("Decline"), translate("Decline"),

File diff suppressed because it is too large Load Diff

View File

@@ -3,13 +3,16 @@ import 'package:flutter_gpu_texture_renderer/flutter_gpu_texture_renderer.dart';
import 'package:flutter_hbb/consts.dart'; import 'package:flutter_hbb/consts.dart';
import 'package:flutter_hbb/models/model.dart'; import 'package:flutter_hbb/models/model.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:texture_rgba_renderer/texture_rgba_renderer.dart';
import '../../common.dart'; import '../../common.dart';
import './platform_model.dart'; import './platform_model.dart';
final useTextureRender = import 'package:texture_rgba_renderer/texture_rgba_renderer.dart'
bind.mainHasPixelbufferTextureRender() || bind.mainHasGpuTextureRender(); if (dart.library.html) 'package:flutter_hbb/web/texture_rgba_renderer.dart';
// Feature flutter_texture_render need to be enabled if feature gpucodec is enabled.
final useTextureRender = !isWeb &&
(bind.mainHasPixelbufferTextureRender() || bind.mainHasGpuTextureRender());
class _PixelbufferTexture { class _PixelbufferTexture {
int _textureKey = -1; int _textureKey = -1;

View File

@@ -1,6 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hbb/common.dart'; import 'package:flutter_hbb/common.dart';
@@ -292,7 +291,7 @@ class FileController {
name: isLocal ? "local_show_hidden" : "remote_show_hidden")) name: isLocal ? "local_show_hidden" : "remote_show_hidden"))
.isNotEmpty; .isNotEmpty;
options.value.isWindows = isLocal options.value.isWindows = isLocal
? Platform.isWindows ? isWindows
: rootState.target?.ffiModel.pi.platform == kPeerPlatformWindows; : rootState.target?.ffiModel.pi.platform == kPeerPlatformWindows;
await Future.delayed(Duration(milliseconds: 100)); await Future.delayed(Duration(milliseconds: 100));

View File

@@ -193,6 +193,7 @@ class InputModel {
bool get keyboardPerm => parent.target!.ffiModel.keyboard; bool get keyboardPerm => parent.target!.ffiModel.keyboard;
String get id => parent.target?.id ?? ''; String get id => parent.target?.id ?? '';
String? get peerPlatform => parent.target?.ffiModel.pi.platform; String? get peerPlatform => parent.target?.ffiModel.pi.platform;
bool get isViewOnly => parent.target!.ffiModel.viewOnly;
InputModel(this.parent) { InputModel(this.parent) {
sessionId = parent.target!.sessionId; sessionId = parent.target!.sessionId;
@@ -207,7 +208,7 @@ class InputModel {
updateKeyboardMode() async { updateKeyboardMode() async {
// * Currently mobile does not enable map mode // * Currently mobile does not enable map mode
if (isDesktop) { if (isDesktop || isWebDesktop) {
if (keyboardMode.isEmpty) { if (keyboardMode.isEmpty) {
keyboardMode = keyboardMode =
await bind.sessionGetKeyboardMode(sessionId: sessionId) ?? await bind.sessionGetKeyboardMode(sessionId: sessionId) ??
@@ -217,7 +218,8 @@ class InputModel {
} }
KeyEventResult handleRawKeyEvent(RawKeyEvent e) { KeyEventResult handleRawKeyEvent(RawKeyEvent e) {
if (isDesktop && !isInputSourceFlutter) { if (isViewOnly) return KeyEventResult.handled;
if ((isDesktop || isWebDesktop) && !isInputSourceFlutter) {
return KeyEventResult.handled; return KeyEventResult.handled;
} }
@@ -256,7 +258,7 @@ class InputModel {
} }
// * Currently mobile does not enable map mode // * Currently mobile does not enable map mode
if (isDesktop && keyboardMode == 'map') { if ((isDesktop || isWebDesktop) && keyboardMode == 'map') {
mapKeyboardMode(e); mapKeyboardMode(e);
} else { } else {
legacyKeyboardMode(e); legacyKeyboardMode(e);
@@ -467,6 +469,7 @@ class InputModel {
void onPointHoverImage(PointerHoverEvent e) { void onPointHoverImage(PointerHoverEvent e) {
_stopFling = true; _stopFling = true;
if (isViewOnly) return;
if (e.kind != ui.PointerDeviceKind.mouse) return; if (e.kind != ui.PointerDeviceKind.mouse) return;
if (!isPhysicalMouse.value) { if (!isPhysicalMouse.value) {
isPhysicalMouse.value = true; isPhysicalMouse.value = true;
@@ -479,7 +482,7 @@ class InputModel {
void onPointerPanZoomStart(PointerPanZoomStartEvent e) { void onPointerPanZoomStart(PointerPanZoomStartEvent e) {
_lastScale = 1.0; _lastScale = 1.0;
_stopFling = true; _stopFling = true;
if (isViewOnly) return;
if (peerPlatform == kPeerPlatformAndroid) { if (peerPlatform == kPeerPlatformAndroid) {
handlePointerEvent('touch', 'pan_start', e.position); handlePointerEvent('touch', 'pan_start', e.position);
} }
@@ -487,6 +490,7 @@ class InputModel {
// https://docs.flutter.dev/release/breaking-changes/trackpad-gestures // https://docs.flutter.dev/release/breaking-changes/trackpad-gestures
void onPointerPanZoomUpdate(PointerPanZoomUpdateEvent e) { void onPointerPanZoomUpdate(PointerPanZoomUpdateEvent e) {
if (isViewOnly) return;
if (peerPlatform != kPeerPlatformAndroid) { if (peerPlatform != kPeerPlatformAndroid) {
final scale = ((e.scale - _lastScale) * 1000).toInt(); final scale = ((e.scale - _lastScale) * 1000).toInt();
_lastScale = e.scale; _lastScale = e.scale;
@@ -612,6 +616,7 @@ class InputModel {
void onPointDownImage(PointerDownEvent e) { void onPointDownImage(PointerDownEvent e) {
debugPrint("onPointDownImage ${e.kind}"); debugPrint("onPointDownImage ${e.kind}");
_stopFling = true; _stopFling = true;
if (isViewOnly) return;
if (e.kind != ui.PointerDeviceKind.mouse) { if (e.kind != ui.PointerDeviceKind.mouse) {
if (isPhysicalMouse.value) { if (isPhysicalMouse.value) {
isPhysicalMouse.value = false; isPhysicalMouse.value = false;
@@ -623,6 +628,7 @@ class InputModel {
} }
void onPointUpImage(PointerUpEvent e) { void onPointUpImage(PointerUpEvent e) {
if (isViewOnly) return;
if (e.kind != ui.PointerDeviceKind.mouse) return; if (e.kind != ui.PointerDeviceKind.mouse) return;
if (isPhysicalMouse.value) { if (isPhysicalMouse.value) {
handleMouse(_getMouseEvent(e, _kMouseEventUp), e.position); handleMouse(_getMouseEvent(e, _kMouseEventUp), e.position);
@@ -630,6 +636,7 @@ class InputModel {
} }
void onPointMoveImage(PointerMoveEvent e) { void onPointMoveImage(PointerMoveEvent e) {
if (isViewOnly) return;
if (e.kind != ui.PointerDeviceKind.mouse) return; if (e.kind != ui.PointerDeviceKind.mouse) return;
if (isPhysicalMouse.value) { if (isPhysicalMouse.value) {
handleMouse(_getMouseEvent(e, _kMouseEventMove), e.position); handleMouse(_getMouseEvent(e, _kMouseEventMove), e.position);
@@ -637,6 +644,7 @@ class InputModel {
} }
void onPointerSignalImage(PointerSignalEvent e) { void onPointerSignalImage(PointerSignalEvent e) {
if (isViewOnly) return;
if (e is PointerScrollEvent) { if (e is PointerScrollEvent) {
var dx = e.scrollDelta.dx.toInt(); var dx = e.scrollDelta.dx.toInt();
var dy = e.scrollDelta.dy.toInt(); var dy = e.scrollDelta.dy.toInt();
@@ -902,9 +910,11 @@ class InputModel {
int minX = rect.left.toInt(); int minX = rect.left.toInt();
// https://github.com/rustdesk/rustdesk/issues/6678 // https://github.com/rustdesk/rustdesk/issues/6678
// For Windows, [0,maxX], [0,maxY] should be set to enable window snapping. // For Windows, [0,maxX], [0,maxY] should be set to enable window snapping.
int maxX = (rect.left + rect.width).toInt() - (peerPlatform == kPeerPlatformWindows ? 0 : 1); int maxX = (rect.left + rect.width).toInt() -
(peerPlatform == kPeerPlatformWindows ? 0 : 1);
int minY = rect.top.toInt(); int minY = rect.top.toInt();
int maxY = (rect.top + rect.height).toInt() - (peerPlatform == kPeerPlatformWindows ? 0 : 1); int maxY = (rect.top + rect.height).toInt() -
(peerPlatform == kPeerPlatformWindows ? 0 : 1);
evtX = trySetNearestRange(evtX, minX, maxX, 5); evtX = trySetNearestRange(evtX, minX, maxX, 5);
evtY = trySetNearestRange(evtY, minY, maxY, 5); evtY = trySetNearestRange(evtY, minY, maxY, 5);
if (kind == kPointerEventKindMouse) { if (kind == kPointerEventKindMouse) {

View File

@@ -1,6 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'dart:math'; import 'dart:math';
import 'dart:typed_data'; import 'dart:typed_data';
import 'dart:ui' as ui; import 'dart:ui' as ui;
@@ -9,7 +8,6 @@ import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_hbb/consts.dart'; import 'package:flutter_hbb/consts.dart';
import 'package:flutter_hbb/generated_bridge.dart';
import 'package:flutter_hbb/models/ab_model.dart'; import 'package:flutter_hbb/models/ab_model.dart';
import 'package:flutter_hbb/models/chat_model.dart'; import 'package:flutter_hbb/models/chat_model.dart';
import 'package:flutter_hbb/models/cm_file_model.dart'; import 'package:flutter_hbb/models/cm_file_model.dart';
@@ -27,7 +25,6 @@ import 'package:flutter_hbb/common/shared_state.dart';
import 'package:flutter_hbb/utils/multi_window_manager.dart'; import 'package:flutter_hbb/utils/multi_window_manager.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import 'package:image/image.dart' as img2; import 'package:image/image.dart' as img2;
import 'package:flutter_custom_cursor/cursor_manager.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
@@ -39,6 +36,11 @@ import '../common/widgets/dialog.dart';
import 'input_model.dart'; import 'input_model.dart';
import 'platform_model.dart'; import 'platform_model.dart';
import 'package:flutter_hbb/generated_bridge.dart'
if (dart.library.html) 'package:flutter_hbb/web/bridge.dart';
import 'package:flutter_hbb/native/custom_cursor.dart'
if (dart.library.html) 'package:flutter_hbb/web/custom_cursor.dart';
typedef HandleMsgBox = Function(Map<String, dynamic> evt, String id); typedef HandleMsgBox = Function(Map<String, dynamic> evt, String id);
typedef ReconnectHandle = Function(OverlayDialogManager, SessionID, bool); typedef ReconnectHandle = Function(OverlayDialogManager, SessionID, bool);
final _constSessionId = Uuid().v4obj(); final _constSessionId = Uuid().v4obj();
@@ -138,21 +140,29 @@ class FfiModel with ChangeNotifier {
sessionId = parent.target!.sessionId; sessionId = parent.target!.sessionId;
} }
Rect? globalDisplaysRect() => _getDisplaysRect(_pi.displays); Rect? globalDisplaysRect() => _getDisplaysRect(_pi.displays, true);
Rect? displaysRect() => _getDisplaysRect(_pi.getCurDisplays()); Rect? displaysRect() => _getDisplaysRect(_pi.getCurDisplays(), false);
Rect? _getDisplaysRect(List<Display> displays) { Rect? _getDisplaysRect(List<Display> displays, bool useDisplayScale) {
if (displays.isEmpty) { if (displays.isEmpty) {
return null; return null;
} }
int scale(int len, double s) {
if (useDisplayScale) {
return len.toDouble() ~/ s;
} else {
return len;
}
}
double l = displays[0].x; double l = displays[0].x;
double t = displays[0].y; double t = displays[0].y;
double r = displays[0].x + displays[0].width; double r = displays[0].x + scale(displays[0].width, displays[0].scale);
double b = displays[0].y + displays[0].height; double b = displays[0].y + scale(displays[0].height, displays[0].scale);
for (var display in displays.sublist(1)) { for (var display in displays.sublist(1)) {
l = min(l, display.x); l = min(l, display.x);
t = min(t, display.y); t = min(t, display.y);
r = max(r, display.x + display.width); r = max(r, display.x + scale(display.width, display.scale));
b = max(b, display.y + display.height); b = max(b, display.y + scale(display.height, display.scale));
} }
return Rect.fromLTRB(l, t, r, b); return Rect.fromLTRB(l, t, r, b);
} }
@@ -342,30 +352,43 @@ class FfiModel with ChangeNotifier {
handleReloading(evt); handleReloading(evt);
} else if (name == 'plugin_option') { } else if (name == 'plugin_option') {
handleOption(evt); handleOption(evt);
} else if (name == "sync_peer_password_to_ab") { } else if (name == "sync_peer_hash_password_to_personal_ab") {
if (desktopType == DesktopType.main) { if (desktopType == DesktopType.main) {
final id = evt['id']; final id = evt['id'];
final password = evt['password']; final hash = evt['hash'];
if (id != null && password != null) { if (id != null && hash != null) {
if (gFFI.abModel gFFI.abModel
.changePassword(id.toString(), password.toString())) { .changePersonalHashPassword(id.toString(), hash.toString());
gFFI.abModel.pushAb(toastIfFail: false, toastIfSucc: false);
}
} }
} }
} else if (name == "cm_file_transfer_log") { } else if (name == "cm_file_transfer_log") {
if (isDesktop) { if (isDesktop) {
gFFI.cmFileModel.onFileTransferLog(evt); gFFI.cmFileModel.onFileTransferLog(evt);
} }
} else if (name == 'sync_peer_option') {
_handleSyncPeerOption(evt, peerId);
} else { } else {
debugPrint('Unknown event name: $name'); debugPrint('Unknown event name: $name');
} }
}; };
} }
_handleSyncPeerOption(Map<String, dynamic> evt, String peer) {
final k = evt['k'];
final v = evt['v'];
if (k == kOptionViewOnly) {
setViewOnly(peer, v as bool);
} else if (k == 'keyboard_mode') {
parent.target?.inputModel.updateKeyboardMode();
} else if (k == 'input_source') {
stateGlobal.getInputSource(force: true);
}
}
onUrlSchemeReceived(Map<String, dynamic> evt) { onUrlSchemeReceived(Map<String, dynamic> evt) {
final url = evt['url'].toString().trim(); final url = evt['url'].toString().trim();
if (url.startsWith(kUniLinksPrefix) && handleUriLink(uriString: url)) { if (url.startsWith(bind.mainUriPrefixSync()) &&
handleUriLink(uriString: url)) {
return; return;
} }
switch (url) { switch (url) {
@@ -407,7 +430,7 @@ class FfiModel with ChangeNotifier {
} }
handleAliasChanged(Map<String, dynamic> evt) { handleAliasChanged(Map<String, dynamic> evt) {
if (!isDesktop) return; if (!(isDesktop || isWebDesktop)) return;
final String peerId = evt['id']; final String peerId = evt['id'];
final String alias = evt['alias']; final String alias = evt['alias'];
String label = getDesktopTabLabel(peerId, alias); String label = getDesktopTabLabel(peerId, alias);
@@ -462,6 +485,7 @@ class FfiModel with ChangeNotifier {
int.tryParse(evt['original_width']) ?? kInvalidResolutionValue; int.tryParse(evt['original_width']) ?? kInvalidResolutionValue;
newDisplay.originalHeight = newDisplay.originalHeight =
int.tryParse(evt['original_height']) ?? kInvalidResolutionValue; int.tryParse(evt['original_height']) ?? kInvalidResolutionValue;
newDisplay._scale = _pi.scaleOfDisplay(display);
_pi.displays[display] = newDisplay; _pi.displays[display] = newDisplay;
if (!_pi.isSupportMultiUiSession || _pi.currentDisplay == display) { if (!_pi.isSupportMultiUiSession || _pi.currentDisplay == display) {
@@ -667,7 +691,7 @@ class FfiModel with ChangeNotifier {
// Because this function is asynchronous, there's an "await" in this function. // Because this function is asynchronous, there's an "await" in this function.
cachedPeerData.peerInfo = {...evt}; cachedPeerData.peerInfo = {...evt};
// recent peer updated by handle_peer_info(ui_session_interface.rs) --> handle_peer_info(client.rs) --> save_config(client.rs) // Recent peer is updated by handle_peer_info(ui_session_interface.rs) --> handle_peer_info(client.rs) --> save_config(client.rs)
bind.mainLoadRecentPeers(); bind.mainLoadRecentPeers();
parent.target?.dialogManager.dismissAll(); parent.target?.dialogManager.dismissAll();
@@ -728,7 +752,7 @@ class FfiModel with ChangeNotifier {
setViewOnly( setViewOnly(
peerId, peerId,
bind.sessionGetToggleOptionSync( bind.sessionGetToggleOptionSync(
sessionId: sessionId, arg: 'view-only')); sessionId: sessionId, arg: kOptionViewOnly));
} }
if (connType == ConnType.defaultConn) { if (connType == ConnType.defaultConn) {
final platformAdditions = evt['platform_additions']; final platformAdditions = evt['platform_additions'];
@@ -744,7 +768,7 @@ class FfiModel with ChangeNotifier {
_pi.isSet.value = true; _pi.isSet.value = true;
stateGlobal.resetLastResolutionGroupValues(peerId); stateGlobal.resetLastResolutionGroupValues(peerId);
if (isDesktop) { if (isDesktop || isWebDesktop) {
checkDesktopKeyboardMode(); checkDesktopKeyboardMode();
} }
@@ -845,7 +869,16 @@ class FfiModel with ChangeNotifier {
handleResolutions(String id, dynamic resolutions) { handleResolutions(String id, dynamic resolutions) {
try { try {
final List<dynamic> dynamicArray = jsonDecode(resolutions as String); final resolutionsObj = json.decode(resolutions as String);
late List<dynamic> dynamicArray;
if (resolutionsObj is Map) {
// The web version
dynamicArray = (resolutionsObj as Map<String, dynamic>)['resolutions']
as List<dynamic>;
} else {
// The rust version
dynamicArray = resolutionsObj as List<dynamic>;
}
List<Resolution> arr = List.empty(growable: true); List<Resolution> arr = List.empty(growable: true);
for (int i = 0; i < dynamicArray.length; i++) { for (int i = 0; i < dynamicArray.length; i++) {
var width = dynamicArray[i]["width"]; var width = dynamicArray[i]["width"];
@@ -876,6 +909,8 @@ class FfiModel with ChangeNotifier {
d.cursorEmbedded = evt['cursor_embedded'] == 1; d.cursorEmbedded = evt['cursor_embedded'] == 1;
d.originalWidth = evt['original_width'] ?? kInvalidResolutionValue; d.originalWidth = evt['original_width'] ?? kInvalidResolutionValue;
d.originalHeight = evt['original_height'] ?? kInvalidResolutionValue; d.originalHeight = evt['original_height'] ?? kInvalidResolutionValue;
double v = (evt['scale']?.toDouble() ?? 100.0) / 100;
d._scale = v > 1.0 ? v : 1.0;
return d; return d;
} }
@@ -1080,7 +1115,7 @@ class ImageModel with ChangeNotifier {
update(ui.Image? image) async { update(ui.Image? image) async {
if (_image == null && image != null) { if (_image == null && image != null) {
if (isWebDesktop || isDesktop) { if (isDesktop || isWebDesktop) {
await parent.target?.canvasModel.updateViewStyle(); await parent.target?.canvasModel.updateViewStyle();
await parent.target?.canvasModel.updateScrollStyle(); await parent.target?.canvasModel.updateScrollStyle();
} else { } else {
@@ -1254,18 +1289,15 @@ class CanvasModel with ChangeNotifier {
double get scrollX => _scrollX; double get scrollX => _scrollX;
double get scrollY => _scrollY; double get scrollY => _scrollY;
static double get leftToEdge => (isDesktop || isWebDesktop) static double get leftToEdge =>
? windowBorderWidth + kDragToResizeAreaPadding.left isDesktop ? windowBorderWidth + kDragToResizeAreaPadding.left : 0;
: 0; static double get rightToEdge =>
static double get rightToEdge => (isDesktop || isWebDesktop) isDesktop ? windowBorderWidth + kDragToResizeAreaPadding.right : 0;
? windowBorderWidth + kDragToResizeAreaPadding.right static double get topToEdge => isDesktop
: 0;
static double get topToEdge => (isDesktop || isWebDesktop)
? tabBarHeight + windowBorderWidth + kDragToResizeAreaPadding.top ? tabBarHeight + windowBorderWidth + kDragToResizeAreaPadding.top
: 0; : 0;
static double get bottomToEdge => (isDesktop || isWebDesktop) static double get bottomToEdge =>
? windowBorderWidth + kDragToResizeAreaPadding.bottom isDesktop ? windowBorderWidth + kDragToResizeAreaPadding.bottom : 0;
: 0;
updateViewStyle({refreshMousePos = true}) async { updateViewStyle({refreshMousePos = true}) async {
Size getSize() { Size getSize() {
@@ -1388,7 +1420,7 @@ class CanvasModel with ChangeNotifier {
// If keyboard is not permitted, do not move cursor when mouse is moving. // If keyboard is not permitted, do not move cursor when mouse is moving.
if (parent.target != null && parent.target!.ffiModel.keyboard) { if (parent.target != null && parent.target!.ffiModel.keyboard) {
// Draw cursor if is not desktop. // Draw cursor if is not desktop.
if (!isDesktop) { if (!(isDesktop || isWebDesktop)) {
parent.target!.cursorModel.moveLocal(x, y); parent.target!.cursorModel.moveLocal(x, y);
} else { } else {
try { try {
@@ -1511,7 +1543,7 @@ class CursorData {
} }
if (_doubleToInt(oldScale) != _doubleToInt(scale)) { if (_doubleToInt(oldScale) != _doubleToInt(scale)) {
if (Platform.isWindows) { if (isWindows) {
data = img2 data = img2
.copyResize( .copyResize(
image, image,
@@ -1590,7 +1622,7 @@ class PredefinedCursor {
data, defaultImg.width, defaultImg.height, ui.PixelFormat.rgba8888); data, defaultImg.width, defaultImg.height, ui.PixelFormat.rgba8888);
double scale = 1.0; double scale = 1.0;
if (Platform.isWindows) { if (isWindows) {
data = _image2!.getBytes(order: img2.ChannelOrder.bgra); data = _image2!.getBytes(order: img2.ChannelOrder.bgra);
} else { } else {
data = Uint8List.fromList(img2.encodePng(_image2!)); data = Uint8List.fromList(img2.encodePng(_image2!));
@@ -1815,7 +1847,7 @@ class CursorModel with ChangeNotifier {
Uint8List? data; Uint8List? data;
img2.Image imgOrigin = img2.Image.fromBytes( img2.Image imgOrigin = img2.Image.fromBytes(
width: w, height: h, bytes: rgba.buffer, order: img2.ChannelOrder.rgba); width: w, height: h, bytes: rgba.buffer, order: img2.ChannelOrder.rgba);
if (Platform.isWindows) { if (isWindows) {
data = imgOrigin.getBytes(order: img2.ChannelOrder.bgra); data = imgOrigin.getBytes(order: img2.ChannelOrder.bgra);
} else { } else {
ByteData? imgBytes = ByteData? imgBytes =
@@ -1920,7 +1952,7 @@ class CursorModel with ChangeNotifier {
final keys = {...cachedKeys}; final keys = {...cachedKeys};
for (var k in keys) { for (var k in keys) {
debugPrint("deleting cursor with key $k"); debugPrint("deleting cursor with key $k");
CursorManager.instance.deleteCursor(k); deleteCustomCursor(k);
} }
} }
} }
@@ -2153,6 +2185,7 @@ class FFI {
bool isRdp = false, bool isRdp = false,
String? switchUuid, String? switchUuid,
String? password, String? password,
bool? isSharedPassword,
bool? forceRelay, bool? forceRelay,
int? tabWindowId, int? tabWindowId,
int? display, int? display,
@@ -2173,6 +2206,7 @@ class FFI {
imageModel.id = id; imageModel.id = id;
cursorModel.peerId = id; cursorModel.peerId = id;
} }
// If tabWindowId != null, this session is a "tab -> window" one. // If tabWindowId != null, this session is a "tab -> window" one.
// Else this session is a new one. // Else this session is a new one.
if (tabWindowId == null) { if (tabWindowId == null) {
@@ -2186,6 +2220,7 @@ class FFI {
switchUuid: switchUuid ?? '', switchUuid: switchUuid ?? '',
forceRelay: forceRelay ?? false, forceRelay: forceRelay ?? false,
password: password ?? '', password: password ?? '',
isSharedPassword: isSharedPassword ?? false,
); );
} else if (display != null) { } else if (display != null) {
if (displays == null) { if (displays == null) {
@@ -2203,7 +2238,18 @@ class FFI {
sessionId: sessionId, displays: Int32List.fromList(displays)); sessionId: sessionId, displays: Int32List.fromList(displays));
ffiModel.pi.currentDisplay = display; ffiModel.pi.currentDisplay = display;
} }
if (connType == ConnType.defaultConn && useTextureRender) {
textureModel.updateCurrentDisplay(display ?? 0);
}
final stream = bind.sessionStart(sessionId: sessionId, id: id); final stream = bind.sessionStart(sessionId: sessionId, id: id);
if (isWeb) {
platformFFI.setRgbaCallback((int display, Uint8List data) {
onEvent2UIRgba();
imageModel.onRgba(display, data);
});
return;
}
final cb = ffiModel.startEventListener(sessionId, id); final cb = ffiModel.startEventListener(sessionId, id);
// Force refresh displays. // Force refresh displays.
@@ -2370,6 +2416,8 @@ class Display {
bool cursorEmbedded = false; bool cursorEmbedded = false;
int originalWidth = kInvalidResolutionValue; int originalWidth = kInvalidResolutionValue;
int originalHeight = kInvalidResolutionValue; int originalHeight = kInvalidResolutionValue;
double _scale = 1.0;
double get scale => _scale > 1.0 ? _scale : 1.0;
Display() { Display() {
width = (isDesktop || isWebDesktop) width = (isDesktop || isWebDesktop)
@@ -2445,7 +2493,8 @@ class PeerInfo with ChangeNotifier {
List<int> get virtualDisplays => List<int>.from( List<int> get virtualDisplays => List<int>.from(
platformAdditions[kPlatformAdditionsVirtualDisplays] ?? []); platformAdditions[kPlatformAdditionsVirtualDisplays] ?? []);
bool get isSupportMultiDisplay => isDesktop && isSupportMultiUiSession; bool get isSupportMultiDisplay =>
(isDesktop || isWebDesktop) && isSupportMultiUiSession;
bool get cursorEmbedded => tryGetDisplay()?.cursorEmbedded ?? false; bool get cursorEmbedded => tryGetDisplay()?.cursorEmbedded ?? false;
@@ -2489,6 +2538,13 @@ class PeerInfo with ChangeNotifier {
} }
} }
} }
double scaleOfDisplay(int display) {
if (display >= 0 && display < displays.length) {
return displays[display].scale;
}
return 1.0;
}
} }
const canvasKey = 'canvas'; const canvasKey = 'canvas';

View File

@@ -111,13 +111,13 @@ class PlatformFFI {
/// Init the FFI class, loads the native Rust core library. /// Init the FFI class, loads the native Rust core library.
Future<void> init(String appType) async { Future<void> init(String appType) async {
_appType = appType; _appType = appType;
final dylib = Platform.isAndroid final dylib = isAndroid
? DynamicLibrary.open('librustdesk.so') ? DynamicLibrary.open('librustdesk.so')
: Platform.isLinux : isLinux
? DynamicLibrary.open('librustdesk.so') ? DynamicLibrary.open('librustdesk.so')
: Platform.isWindows : isWindows
? DynamicLibrary.open('librustdesk.dll') ? DynamicLibrary.open('librustdesk.dll')
: Platform.isMacOS : isMacOS
? DynamicLibrary.open("liblibrustdesk.dylib") ? DynamicLibrary.open("liblibrustdesk.dylib")
: DynamicLibrary.process(); : DynamicLibrary.process();
debugPrint('initializing FFI $_appType'); debugPrint('initializing FFI $_appType');
@@ -130,11 +130,12 @@ class PlatformFFI {
debugPrint('Failed to get documents directory: $e'); debugPrint('Failed to get documents directory: $e');
} }
_ffiBind = RustdeskImpl(dylib); _ffiBind = RustdeskImpl(dylib);
if (Platform.isLinux) {
if (isLinux) {
// Start a dbus service, no need to await // Start a dbus service, no need to await
_ffiBind.mainStartDbusServer(); _ffiBind.mainStartDbusServer();
_ffiBind.mainStartPa(); _ffiBind.mainStartPa();
} else if (Platform.isMacOS && isMain) { } else if (isMacOS && isMain) {
// Start ipc service for uri links. // Start ipc service for uri links.
_ffiBind.mainStartIpcUrlServer(); _ffiBind.mainStartIpcUrlServer();
} }
@@ -154,20 +155,20 @@ class PlatformFFI {
String id = 'NA'; String id = 'NA';
String name = 'Flutter'; String name = 'Flutter';
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin(); DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
if (Platform.isAndroid) { if (isAndroid) {
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo; AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
name = '${androidInfo.brand}-${androidInfo.model}'; name = '${androidInfo.brand}-${androidInfo.model}';
id = androidInfo.id.hashCode.toString(); id = androidInfo.id.hashCode.toString();
androidVersion = androidInfo.version.sdkInt; androidVersion = androidInfo.version.sdkInt;
} else if (Platform.isIOS) { } else if (isIOS) {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo; IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
name = iosInfo.utsname.machine; name = iosInfo.utsname.machine;
id = iosInfo.identifierForVendor.hashCode.toString(); id = iosInfo.identifierForVendor.hashCode.toString();
} else if (Platform.isLinux) { } else if (isLinux) {
LinuxDeviceInfo linuxInfo = await deviceInfo.linuxInfo; LinuxDeviceInfo linuxInfo = await deviceInfo.linuxInfo;
name = linuxInfo.name; name = linuxInfo.name;
id = linuxInfo.machineId ?? linuxInfo.id; id = linuxInfo.machineId ?? linuxInfo.id;
} else if (Platform.isWindows) { } else if (isWindows) {
try { try {
// request windows build number to fix overflow on win7 // request windows build number to fix overflow on win7
windowsBuildNumber = getWindowsTargetBuildNumber(); windowsBuildNumber = getWindowsTargetBuildNumber();
@@ -179,7 +180,7 @@ class PlatformFFI {
name = "unknown"; name = "unknown";
id = "unknown"; id = "unknown";
} }
} else if (Platform.isMacOS) { } else if (isMacOS) {
MacOsDeviceInfo macOsInfo = await deviceInfo.macOsInfo; MacOsDeviceInfo macOsInfo = await deviceInfo.macOsInfo;
name = macOsInfo.computerName; name = macOsInfo.computerName;
id = macOsInfo.systemGUID ?? ''; id = macOsInfo.systemGUID ?? '';
@@ -246,7 +247,7 @@ class PlatformFFI {
_eventCallback = fun; _eventCallback = fun;
} }
void setRgbaCallback(void Function(Uint8List) fun) async {} void setRgbaCallback(void Function(int, Uint8List) fun) async {}
void startDesktopWebListener() {} void startDesktopWebListener() {}

View File

@@ -7,7 +7,8 @@ import 'package:collection/collection.dart';
class Peer { class Peer {
final String id; final String id;
String hash; String hash; // personal ab hash password
String password; // shared ab password
String username; // pc username String username; // pc username
String hostname; String hostname;
String platform; String platform;
@@ -18,6 +19,7 @@ class Peer {
String rdpUsername; String rdpUsername;
bool online = false; bool online = false;
String loginName; //login username String loginName; //login username
bool? sameServer;
String getId() { String getId() {
if (alias != '') { if (alias != '') {
@@ -29,6 +31,7 @@ class Peer {
Peer.fromJson(Map<String, dynamic> json) Peer.fromJson(Map<String, dynamic> json)
: id = json['id'] ?? '', : id = json['id'] ?? '',
hash = json['hash'] ?? '', hash = json['hash'] ?? '',
password = json['password'] ?? '',
username = json['username'] ?? '', username = json['username'] ?? '',
hostname = json['hostname'] ?? '', hostname = json['hostname'] ?? '',
platform = json['platform'] ?? '', platform = json['platform'] ?? '',
@@ -37,12 +40,14 @@ class Peer {
forceAlwaysRelay = json['forceAlwaysRelay'] == 'true', forceAlwaysRelay = json['forceAlwaysRelay'] == 'true',
rdpPort = json['rdpPort'] ?? '', rdpPort = json['rdpPort'] ?? '',
rdpUsername = json['rdpUsername'] ?? '', rdpUsername = json['rdpUsername'] ?? '',
loginName = json['loginName'] ?? ''; loginName = json['loginName'] ?? '',
sameServer = json['same_server'];
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return <String, dynamic>{ return <String, dynamic>{
"id": id, "id": id,
"hash": hash, "hash": hash,
"password": password,
"username": username, "username": username,
"hostname": hostname, "hostname": hostname,
"platform": platform, "platform": platform,
@@ -52,19 +57,23 @@ class Peer {
"rdpPort": rdpPort, "rdpPort": rdpPort,
"rdpUsername": rdpUsername, "rdpUsername": rdpUsername,
'loginName': loginName, 'loginName': loginName,
'same_server': sameServer,
}; };
} }
Map<String, dynamic> toAbUploadJson() { Map<String, dynamic> toCustomJson({required bool includingHash}) {
return <String, dynamic>{ var res = <String, dynamic>{
"id": id, "id": id,
"hash": hash,
"username": username, "username": username,
"hostname": hostname, "hostname": hostname,
"platform": platform, "platform": platform,
"alias": alias, "alias": alias,
"tags": tags, "tags": tags,
}; };
if (includingHash) {
res['hash'] = hash;
}
return res;
} }
Map<String, dynamic> toGroupCacheJson() { Map<String, dynamic> toGroupCacheJson() {
@@ -80,6 +89,7 @@ class Peer {
Peer({ Peer({
required this.id, required this.id,
required this.hash, required this.hash,
required this.password,
required this.username, required this.username,
required this.hostname, required this.hostname,
required this.platform, required this.platform,
@@ -89,12 +99,14 @@ class Peer {
required this.rdpPort, required this.rdpPort,
required this.rdpUsername, required this.rdpUsername,
required this.loginName, required this.loginName,
this.sameServer,
}); });
Peer.loading() Peer.loading()
: this( : this(
id: '...', id: '...',
hash: '', hash: '',
password: '',
username: '...', username: '...',
hostname: '...', hostname: '...',
platform: '...', platform: '...',
@@ -108,6 +120,7 @@ class Peer {
bool equal(Peer other) { bool equal(Peer other) {
return id == other.id && return id == other.id &&
hash == other.hash && hash == other.hash &&
password == other.password &&
username == other.username && username == other.username &&
hostname == other.hostname && hostname == other.hostname &&
platform == other.platform && platform == other.platform &&
@@ -121,33 +134,38 @@ class Peer {
Peer.copy(Peer other) Peer.copy(Peer other)
: this( : this(
id: other.id, id: other.id,
hash: other.hash, hash: other.hash,
username: other.username, password: other.password,
hostname: other.hostname, username: other.username,
platform: other.platform, hostname: other.hostname,
alias: other.alias, platform: other.platform,
tags: other.tags.toList(), alias: other.alias,
forceAlwaysRelay: other.forceAlwaysRelay, tags: other.tags.toList(),
rdpPort: other.rdpPort, forceAlwaysRelay: other.forceAlwaysRelay,
rdpUsername: other.rdpUsername, rdpPort: other.rdpPort,
loginName: other.loginName, rdpUsername: other.rdpUsername,
); loginName: other.loginName,
sameServer: other.sameServer);
} }
enum UpdateEvent { online, load } enum UpdateEvent { online, load }
typedef GetInitPeers = RxList<Peer> Function();
class Peers extends ChangeNotifier { class Peers extends ChangeNotifier {
final String name; final String name;
final String loadEvent; final String loadEvent;
List<Peer> peers = List.empty(growable: true); List<Peer> peers = List.empty(growable: true);
final RxList<Peer>? initPeers; final GetInitPeers? getInitPeers;
UpdateEvent event = UpdateEvent.load; UpdateEvent event = UpdateEvent.load;
static const _cbQueryOnlines = 'callback_query_onlines'; static const _cbQueryOnlines = 'callback_query_onlines';
Peers( Peers(
{required this.name, required this.initPeers, required this.loadEvent}) { {required this.name,
peers = initPeers ?? []; required this.getInitPeers,
required this.loadEvent}) {
peers = getInitPeers?.call() ?? [];
platformFFI.registerEventHandler(_cbQueryOnlines, name, (evt) async { platformFFI.registerEventHandler(_cbQueryOnlines, name, (evt) async {
_updateOnlineState(evt); _updateOnlineState(evt);
}); });
@@ -198,8 +216,8 @@ class Peers extends ChangeNotifier {
void _updatePeers(Map<String, dynamic> evt) { void _updatePeers(Map<String, dynamic> evt) {
final onlineStates = _getOnlineStates(); final onlineStates = _getOnlineStates();
if (initPeers != null) { if (getInitPeers != null) {
peers = initPeers!; peers = getInitPeers?.call() ?? [];
} else { } else {
peers = _decodePeers(evt['peers']); peers = _decodePeers(evt['peers']);
} }

View File

@@ -21,24 +21,43 @@ class PeerTabModel with ChangeNotifier {
WeakReference<FFI> parent; WeakReference<FFI> parent;
int get currentTab => _currentTab; int get currentTab => _currentTab;
int _currentTab = 0; // index in tabNames int _currentTab = 0; // index in tabNames
List<String> tabNames = [ static const int maxTabCount = 5;
static const String kPeerTabIndex = 'peer-tab-index';
static const String kPeerTabOrder = 'peer-tab-order';
static const String kPeerTabVisible = 'peer-tab-visible';
static const List<String> tabNames = [
'Recent sessions', 'Recent sessions',
'Favorites', 'Favorites',
'Discovered', 'Discovered',
'Address book', 'Address book',
'Group', 'Group',
]; ];
final List<IconData> icons = [ static const List<IconData> icons = [
Icons.access_time_filled, Icons.access_time_filled,
Icons.star, Icons.star,
Icons.explore, Icons.explore,
IconFont.addressBook, IconFont.addressBook,
Icons.group, Icons.group,
]; ];
final List<bool> _isVisible = List.filled(5, true, growable: false); List<bool> isEnabled = List.from([
List<bool> get isVisible => _isVisible; true,
List<int> get indexs => List.generate(tabNames.length, (index) => index); true,
List<int> get visibleIndexs => indexs.where((e) => _isVisible[e]).toList(); !isWeb,
!(bind.isDisableAb() || bind.isDisableAccount()),
!bind.isDisableAccount(),
]);
final List<bool> _isVisible = List.filled(maxTabCount, true, growable: false);
List<bool> get isVisibleEnabled => () {
final list = _isVisible.toList();
for (int i = 0; i < maxTabCount; i++) {
list[i] = list[i] && isEnabled[i];
}
return list;
}();
final List<int> orders =
List.generate(maxTabCount, (index) => index, growable: false);
List<int> get visibleEnabledOrderedIndexs =>
orders.where((e) => isVisibleEnabled[e]).toList();
List<Peer> _selectedPeers = List.empty(growable: true); List<Peer> _selectedPeers = List.empty(growable: true);
List<Peer> get selectedPeers => _selectedPeers; List<Peer> get selectedPeers => _selectedPeers;
bool _multiSelectionMode = false; bool _multiSelectionMode = false;
@@ -53,7 +72,7 @@ class PeerTabModel with ChangeNotifier {
PeerTabModel(this.parent) { PeerTabModel(this.parent) {
// visible // visible
try { try {
final option = bind.getLocalFlutterOption(k: 'peer-tab-visible'); final option = bind.getLocalFlutterOption(k: kPeerTabVisible);
if (option.isNotEmpty) { if (option.isNotEmpty) {
List<dynamic> decodeList = jsonDecode(option); List<dynamic> decodeList = jsonDecode(option);
if (decodeList.length == _isVisible.length) { if (decodeList.length == _isVisible.length) {
@@ -67,13 +86,37 @@ class PeerTabModel with ChangeNotifier {
} catch (e) { } catch (e) {
debugPrint("failed to get peer tab visible list:$e"); debugPrint("failed to get peer tab visible list:$e");
} }
// order
try {
final option = bind.getLocalFlutterOption(k: kPeerTabOrder);
if (option.isNotEmpty) {
List<dynamic> decodeList = jsonDecode(option);
if (decodeList.length == maxTabCount) {
var sortedList = decodeList.toList();
sortedList.sort();
bool valid = true;
for (int i = 0; i < maxTabCount; i++) {
if (sortedList[i] is! int || sortedList[i] != i) {
valid = false;
}
}
if (valid) {
for (int i = 0; i < orders.length; i++) {
orders[i] = decodeList[i];
}
}
}
}
} catch (e) {
debugPrint("failed to get peer tab order list: $e");
}
// init currentTab // init currentTab
_currentTab = _currentTab =
int.tryParse(bind.getLocalFlutterOption(k: 'peer-tab-index')) ?? 0; int.tryParse(bind.getLocalFlutterOption(k: kPeerTabIndex)) ?? 0;
if (_currentTab < 0 || _currentTab >= tabNames.length) { if (_currentTab < 0 || _currentTab >= maxTabCount) {
_currentTab = 0; _currentTab = 0;
} }
_trySetCurrentTabToFirstVisible(); _trySetCurrentTabToFirstVisibleEnabled();
} }
setCurrentTab(int index) { setCurrentTab(int index) {
@@ -87,15 +130,13 @@ class PeerTabModel with ChangeNotifier {
if (index >= 0 && index < tabNames.length) { if (index >= 0 && index < tabNames.length) {
return translate(tabNames[index]); return translate(tabNames[index]);
} }
assert(false);
return index.toString(); return index.toString();
} }
IconData tabIcon(int index) { IconData tabIcon(int index) {
if (index >= 0 && index < tabNames.length) { if (index >= 0 && index < icons.length) {
return icons[index]; return icons[index];
} }
assert(false);
return Icons.help; return Icons.help;
} }
@@ -171,29 +212,54 @@ class PeerTabModel with ChangeNotifier {
} }
setTabVisible(int index, bool visible) { setTabVisible(int index, bool visible) {
if (index >= 0 && index < _isVisible.length) { if (index >= 0 && index < maxTabCount) {
if (_isVisible[index] != visible) { if (_isVisible[index] != visible) {
_isVisible[index] = visible; _isVisible[index] = visible;
if (index == _currentTab && !visible) { if (index == _currentTab && !visible) {
_trySetCurrentTabToFirstVisible(); _trySetCurrentTabToFirstVisibleEnabled();
} else if (visible && visibleIndexs.length == 1) { } else if (visible && visibleEnabledOrderedIndexs.length == 1) {
_currentTab = index; _currentTab = index;
} }
try { try {
bind.setLocalFlutterOption( bind.setLocalFlutterOption(
k: 'peer-tab-visible', v: jsonEncode(_isVisible)); k: kPeerTabVisible, v: jsonEncode(_isVisible));
} catch (_) {} } catch (_) {}
notifyListeners(); notifyListeners();
} }
} }
} }
_trySetCurrentTabToFirstVisible() { _trySetCurrentTabToFirstVisibleEnabled() {
if (!_isVisible[_currentTab]) { if (!visibleEnabledOrderedIndexs.contains(_currentTab)) {
int firstVisible = _isVisible.indexWhere((e) => e); if (visibleEnabledOrderedIndexs.isNotEmpty) {
if (firstVisible >= 0) { _currentTab = visibleEnabledOrderedIndexs.first;
_currentTab = firstVisible;
} }
} }
} }
reorder(int oldIndex, int newIndex) {
if (oldIndex < newIndex) {
newIndex -= 1;
}
if (oldIndex < 0 || oldIndex >= visibleEnabledOrderedIndexs.length) {
return;
}
if (newIndex < 0 || newIndex >= visibleEnabledOrderedIndexs.length) {
return;
}
final oldTabValue = visibleEnabledOrderedIndexs[oldIndex];
final newTabValue = visibleEnabledOrderedIndexs[newIndex];
int oldValueIndex = orders.indexOf(oldTabValue);
int newValueIndex = orders.indexOf(newTabValue);
final list = orders.toList();
if (oldIndex != -1 && newIndex != -1) {
list.removeAt(oldValueIndex);
list.insert(newValueIndex, oldTabValue);
for (int i = 0; i < list.length; i++) {
orders[i] = list[i];
}
bind.setLocalFlutterOption(k: kPeerTabOrder, v: jsonEncode(orders));
notifyListeners();
}
}
} }

View File

@@ -1,5 +1,6 @@
import 'package:flutter_hbb/generated_bridge.dart';
import 'native_model.dart' if (dart.library.html) 'web_model.dart'; import 'native_model.dart' if (dart.library.html) 'web_model.dart';
import 'package:flutter_hbb/generated_bridge.dart'
if (dart.library.html) 'package:flutter_hbb/web/bridge.dart';
final platformFFI = PlatformFFI.instance; final platformFFI = PlatformFFI.instance;
final localeName = PlatformFFI.localeName; final localeName = PlatformFFI.localeName;

View File

@@ -1,6 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hbb/consts.dart'; import 'package:flutter_hbb/consts.dart';
@@ -383,7 +382,7 @@ class ServerModel with ChangeNotifier {
// ugly is here, because for desktop, below is useless // ugly is here, because for desktop, below is useless
await bind.mainStartService(); await bind.mainStartService();
updateClientState(); updateClientState();
if (Platform.isAndroid) { if (isAndroid) {
WakelockPlus.enable(); WakelockPlus.enable();
} }
} }
@@ -395,7 +394,7 @@ class ServerModel with ChangeNotifier {
await parent.target?.invokeMethod("stop_service"); await parent.target?.invokeMethod("stop_service");
await bind.mainStopService(); await bind.mainStopService();
notifyListeners(); notifyListeners();
if (!Platform.isLinux) { if (!isLinux) {
// current linux is not supported // current linux is not supported
WakelockPlus.disable(); WakelockPlus.disable();
} }

View File

@@ -1,5 +1,3 @@
import 'dart:io';
import 'package:desktop_multi_window/desktop_multi_window.dart'; import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hbb/common.dart'; import 'package:flutter_hbb/common.dart';
@@ -60,7 +58,7 @@ class StateGlobal {
_resizeEdgeSize.value = _resizeEdgeSize.value =
isMaximized.isTrue ? kMaximizeEdgeSize : kWindowEdgeSize; isMaximized.isTrue ? kMaximizeEdgeSize : kWindowEdgeSize;
} }
if (!Platform.isMacOS) { if (!isMacOS) {
_windowBorderWidth.value = v ? 0 : kWindowBorderWidth; _windowBorderWidth.value = v ? 0 : kWindowBorderWidth;
} }
} }
@@ -84,7 +82,7 @@ class StateGlobal {
final wc = WindowController.fromWindowId(windowId); final wc = WindowController.fromWindowId(windowId);
wc.setFullscreen(_fullscreen.isTrue).then((_) { wc.setFullscreen(_fullscreen.isTrue).then((_) {
// https://github.com/leanflutter/window_manager/issues/131#issuecomment-1111587982 // https://github.com/leanflutter/window_manager/issues/131#issuecomment-1111587982
if (Platform.isWindows && !v) { if (isWindows && !v) {
Future.delayed(Duration.zero, () async { Future.delayed(Duration.zero, () async {
final frame = await wc.getFrame(); final frame = await wc.getFrame();
final newRect = Rect.fromLTWH( final newRect = Rect.fromLTWH(

View File

@@ -4,6 +4,7 @@ import 'dart:convert';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hbb/common/hbbs/hbbs.dart'; import 'package:flutter_hbb/common/hbbs/hbbs.dart';
import 'package:flutter_hbb/models/ab_model.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
@@ -22,6 +23,7 @@ class UserModel {
UserModel(this.parent); UserModel(this.parent);
void refreshCurrentUser() async { void refreshCurrentUser() async {
if (bind.isDisableAccount()) return;
final token = bind.mainGetLocalOption(key: 'access_token'); final token = bind.mainGetLocalOption(key: 'access_token');
if (token == '') { if (token == '') {
await updateOtherModels(); await updateOtherModels();
@@ -102,7 +104,10 @@ class UserModel {
// update ab and group status // update ab and group status
static Future<void> updateOtherModels() async { static Future<void> updateOtherModels() async {
await Future.wait([gFFI.abModel.pullAb(), gFFI.groupModel.pull()]); await Future.wait([
gFFI.abModel.pullAb(force: ForcePullAb.listAndCurrent, quiet: false),
gFFI.groupModel.pull()
]);
} }
Future<void> logOut({String? apiServer}) async { Future<void> logOut({String? apiServer}) async {

View File

@@ -3,15 +3,23 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:typed_data'; import 'dart:typed_data';
import 'dart:js'; import 'dart:js';
import '../common.dart';
import 'dart:html'; import 'dart:html';
import 'dart:async'; import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter_hbb/web/bridge.dart';
import 'package:flutter_hbb/common.dart';
final List<StreamSubscription<MouseEvent>> mouseListeners = []; final List<StreamSubscription<MouseEvent>> mouseListeners = [];
final List<StreamSubscription<KeyboardEvent>> keyListeners = []; final List<StreamSubscription<KeyboardEvent>> keyListeners = [];
typedef HandleEvent = Future<void> Function(Map<String, dynamic> evt);
class PlatformFFI { class PlatformFFI {
final _eventHandlers = <String, Map<String, HandleEvent>>{};
final RustdeskImpl _ffiBind = RustdeskImpl();
static String getByName(String name, [String arg = '']) { static String getByName(String name, [String arg = '']) {
return context.callMethod('getByName', [name, arg]); return context.callMethod('getByName', [name, arg]);
} }
@@ -24,15 +32,89 @@ class PlatformFFI {
static final PlatformFFI instance = PlatformFFI._(); static final PlatformFFI instance = PlatformFFI._();
static get localeName => window.navigator.language; static get localeName => window.navigator.language;
RustdeskImpl get ffiBind => _ffiBind;
static Future<void> init(String appType) async { static Future<String> getVersion() async {
isWeb = true; throw UnimplementedError();
isWebDesktop = !context.callMethod('isMobile');
context.callMethod('init');
version = getByName('version');
} }
static void setEventCallback(void Function(Map<String, dynamic>) fun) { bool registerEventHandler(
String eventName, String handlerName, HandleEvent handler) {
debugPrint('registerEventHandler $eventName $handlerName');
var handlers = _eventHandlers[eventName];
if (handlers == null) {
_eventHandlers[eventName] = {handlerName: handler};
return true;
} else {
if (handlers.containsKey(handlerName)) {
return false;
} else {
handlers[handlerName] = handler;
return true;
}
}
}
void unregisterEventHandler(String eventName, String handlerName) {
debugPrint('unregisterEventHandler $eventName $handlerName');
var handlers = _eventHandlers[eventName];
if (handlers != null) {
handlers.remove(handlerName);
}
}
Future<bool> tryHandle(Map<String, dynamic> evt) async {
final name = evt['name'];
if (name != null) {
final handlers = _eventHandlers[name];
if (handlers != null) {
if (handlers.isNotEmpty) {
for (var handler in handlers.values) {
await handler(evt);
}
return true;
}
}
}
return false;
}
String translate(String name, String locale) =>
_ffiBind.translate(name: name, locale: locale);
Uint8List? getRgba(SessionID sessionId, int display, int bufSize) {
throw UnimplementedError();
}
int getRgbaSize(SessionID sessionId, int display) =>
_ffiBind.sessionGetRgbaSize(sessionId: sessionId, display: display);
void nextRgba(SessionID sessionId, int display) =>
_ffiBind.sessionNextRgba(sessionId: sessionId, display: display);
void registerPixelbufferTexture(SessionID sessionId, int display, int ptr) =>
_ffiBind.sessionRegisterPixelbufferTexture(
sessionId: sessionId, display: display, ptr: ptr);
void registerGpuTexture(SessionID sessionId, int display, int ptr) =>
_ffiBind.sessionRegisterGpuTexture(
sessionId: sessionId, display: display, ptr: ptr);
Future<void> init(String appType) async {
context.callMethod('init');
version = getByName('version');
window.onContextMenu.listen((event) {
event.preventDefault();
});
context['onRegisteredEvent'] = (String message) {
try {
Map<String, dynamic> event = json.decode(message);
tryHandle(event);
} catch (e) {
print('json.decode fail(): $e');
}
};
}
void setEventCallback(void Function(Map<String, dynamic>) fun) {
context["onGlobalEvent"] = (String message) { context["onGlobalEvent"] = (String message) {
try { try {
Map<String, dynamic> event = json.decode(message); Map<String, dynamic> event = json.decode(message);
@@ -43,20 +125,20 @@ class PlatformFFI {
}; };
} }
static void setRgbaCallback(void Function(Uint8List) fun) { void setRgbaCallback(void Function(int, Uint8List) fun) {
context["onRgba"] = (Uint8List? rgba) { context["onRgba"] = (int display, Uint8List? rgba) {
if (rgba != null) { if (rgba != null) {
fun(rgba); fun(display, rgba);
} }
}; };
} }
static void startDesktopWebListener() { void startDesktopWebListener() {
mouseListeners.add( mouseListeners.add(
window.document.onContextMenu.listen((evt) => evt.preventDefault())); window.document.onContextMenu.listen((evt) => evt.preventDefault()));
} }
static void stopDesktopWebListener() { void stopDesktopWebListener() {
for (var ml in mouseListeners) { for (var ml in mouseListeners) {
ml.cancel(); ml.cancel();
} }
@@ -67,9 +149,12 @@ class PlatformFFI {
keyListeners.clear(); keyListeners.clear();
} }
static void setMethodCallHandler(FMethod callback) {} void setMethodCallHandler(FMethod callback) {}
static Future<bool> invokeMethod(String method, [dynamic arguments]) async { invokeMethod(String method, [dynamic arguments]) async {
return true; return true;
} }
// just for compilation
void syncAndroidServiceAppDirConfigPath() {}
} }

View File

@@ -0,0 +1,13 @@
import 'dart:io';
final isAndroid_ = Platform.isAndroid;
final isIOS_ = Platform.isIOS;
final isWindows_ = Platform.isWindows;
final isMacOS_ = Platform.isMacOS;
final isLinux_ = Platform.isLinux;
final isWeb_ = false;
final isWebDesktop_ = false;
final isDesktop_ = Platform.isWindows || Platform.isMacOS || Platform.isLinux;
String get screenInfo_ => '';

View File

@@ -0,0 +1,43 @@
import 'package:flutter_custom_cursor/cursor_manager.dart'
as custom_cursor_manager;
import 'package:flutter_custom_cursor/flutter_custom_cursor.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter_hbb/models/model.dart';
deleteCustomCursor(String key) =>
custom_cursor_manager.CursorManager.instance.deleteCursor(key);
MouseCursor buildCursorOfCache(
CursorModel cursor, double scale, CursorData? cache) {
if (cache == null) {
return MouseCursor.defer;
} else {
final key = cache.updateGetKey(scale);
if (!cursor.cachedKeys.contains(key)) {
// data should be checked here, because it may be changed after `updateGetKey()`
final data = cache.data;
if (data == null) {
return MouseCursor.defer;
}
debugPrint(
"Register custom cursor with key $key (${cache.hotx},${cache.hoty})");
// [Safety]
// It's ok to call async registerCursor in current synchronous context,
// because activating the cursor is also an async call and will always
// be executed after this.
custom_cursor_manager.CursorManager.instance
.registerCursor(custom_cursor_manager.CursorData()
..name = key
..buffer = data
..width = (cache.width * cache.scale).toInt()
..height = (cache.height * cache.scale).toInt()
..hotX = cache.hotx
..hotY = cache.hoty);
cursor.addKey(key);
}
return FlutterCustomMemoryImageCursor(key: key);
}
}

View File

@@ -0,0 +1,41 @@
import 'dart:ffi' hide Size;
import 'package:ffi/ffi.dart';
import 'package:win32/win32.dart' as win32;
/// Get windows target build number.
///
/// [Note]
/// Please use this function wrapped with `Platform.isWindows`.
int getWindowsTargetBuildNumber_() {
final rtlGetVersion = DynamicLibrary.open('ntdll.dll').lookupFunction<
Void Function(Pointer<win32.OSVERSIONINFOEX>),
void Function(Pointer<win32.OSVERSIONINFOEX>)>('RtlGetVersion');
final osVersionInfo = _getOSVERSIONINFOEXPointer();
rtlGetVersion(osVersionInfo);
int buildNumber = osVersionInfo.ref.dwBuildNumber;
calloc.free(osVersionInfo);
return buildNumber;
}
/// Get Windows OS version pointer
///
/// [Note]
/// Please use this function wrapped with `Platform.isWindows`.
Pointer<win32.OSVERSIONINFOEX> _getOSVERSIONINFOEXPointer() {
final pointer = calloc<win32.OSVERSIONINFOEX>();
pointer.ref
..dwOSVersionInfoSize = sizeOf<win32.OSVERSIONINFOEX>()
..dwBuildNumber = 0
..dwMajorVersion = 0
..dwMinorVersion = 0
..dwPlatformId = 0
..szCSDVersion = ''
..wServicePackMajor = 0
..wServicePackMinor = 0
..wSuiteMask = 0
..wProductType = 0
..wReserved = 0;
return pointer;
}

View File

@@ -3,6 +3,8 @@ import 'dart:ui' as ui;
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_hbb/common.dart';
Future<ui.Image> decodeImageFromPixels( Future<ui.Image> decodeImageFromPixels(
Uint8List pixels, Uint8List pixels,
int width, int width,
@@ -79,6 +81,11 @@ class ImagePainter extends CustomPainter {
paint.filterQuality = FilterQuality.high; paint.filterQuality = FilterQuality.high;
} }
} }
// It's strange that if (scale < 0.5 && paint.filterQuality == FilterQuality.medium)
// The canvas.drawImage will not work on web
if (isWeb) {
paint.filterQuality = FilterQuality.high;
}
canvas.drawImage( canvas.drawImage(
image!, Offset(x.toInt().toDouble(), y.toInt().toDouble()), paint); image!, Offset(x.toInt().toDouble(), y.toInt().toDouble()), paint);
} }

View File

@@ -1,5 +1,4 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'package:desktop_multi_window/desktop_multi_window.dart'; import 'package:desktop_multi_window/desktop_multi_window.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
@@ -139,7 +138,7 @@ class RustDeskMultiWindowManager {
overrideType: type, overrideType: type,
)); ));
} }
if (Platform.isMacOS) { if (isMacOS) {
Future.microtask(() => windowController.show()); Future.microtask(() => windowController.show());
} }
registerActiveWindow(windowId); registerActiveWindow(windowId);
@@ -194,6 +193,7 @@ class RustDeskMultiWindowManager {
bool? forceRelay, bool? forceRelay,
String? switchUuid, String? switchUuid,
bool? isRDP, bool? isRDP,
bool? isSharedPassword,
}) async { }) async {
var params = { var params = {
"type": type.index, "type": type.index,
@@ -207,6 +207,9 @@ class RustDeskMultiWindowManager {
if (isRDP != null) { if (isRDP != null) {
params['isRDP'] = isRDP; params['isRDP'] = isRDP;
} }
if (isSharedPassword != null) {
params['isSharedPassword'] = isSharedPassword;
}
final msg = jsonEncode(params); final msg = jsonEncode(params);
// separate window for file transfer is not supported // separate window for file transfer is not supported
@@ -228,6 +231,7 @@ class RustDeskMultiWindowManager {
Future<MultiWindowCallResult> newRemoteDesktop( Future<MultiWindowCallResult> newRemoteDesktop(
String remoteId, { String remoteId, {
String? password, String? password,
bool? isSharedPassword,
String? switchUuid, String? switchUuid,
bool? forceRelay, bool? forceRelay,
}) async { }) async {
@@ -239,11 +243,12 @@ class RustDeskMultiWindowManager {
password: password, password: password,
forceRelay: forceRelay, forceRelay: forceRelay,
switchUuid: switchUuid, switchUuid: switchUuid,
isSharedPassword: isSharedPassword,
); );
} }
Future<MultiWindowCallResult> newFileTransfer(String remoteId, Future<MultiWindowCallResult> newFileTransfer(String remoteId,
{String? password, bool? forceRelay}) async { {String? password, bool? isSharedPassword, bool? forceRelay}) async {
return await newSession( return await newSession(
WindowType.FileTransfer, WindowType.FileTransfer,
kWindowEventNewFileTransfer, kWindowEventNewFileTransfer,
@@ -251,11 +256,12 @@ class RustDeskMultiWindowManager {
_fileTransferWindows, _fileTransferWindows,
password: password, password: password,
forceRelay: forceRelay, forceRelay: forceRelay,
isSharedPassword: isSharedPassword,
); );
} }
Future<MultiWindowCallResult> newPortForward(String remoteId, bool isRDP, Future<MultiWindowCallResult> newPortForward(String remoteId, bool isRDP,
{String? password, bool? forceRelay}) async { {String? password, bool? isSharedPassword, bool? forceRelay}) async {
return await newSession( return await newSession(
WindowType.PortForward, WindowType.PortForward,
kWindowEventNewPortForward, kWindowEventNewPortForward,
@@ -264,6 +270,7 @@ class RustDeskMultiWindowManager {
password: password, password: password,
forceRelay: forceRelay, forceRelay: forceRelay,
isRDP: isRDP, isRDP: isRDP,
isSharedPassword: isSharedPassword,
); );
} }

View File

@@ -1,8 +1,7 @@
import 'dart:io';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_hbb/main.dart'; import 'package:flutter_hbb/main.dart';
import 'package:flutter_hbb/common.dart';
enum SystemWindowTheme { light, dark } enum SystemWindowTheme { light, dark }
@@ -19,7 +18,7 @@ class RdPlatformChannel {
/// Change the theme of the system window /// Change the theme of the system window
Future<void> changeSystemWindowTheme(SystemWindowTheme theme) { Future<void> changeSystemWindowTheme(SystemWindowTheme theme) {
assert(Platform.isMacOS); assert(isMacOS);
if (kDebugMode) { if (kDebugMode) {
print( print(
"[Window ${kWindowId ?? 'Main'}] change system window theme to ${theme.name}"); "[Window ${kWindowId ?? 'Main'}] change system window theme to ${theme.name}");
@@ -30,7 +29,7 @@ class RdPlatformChannel {
/// Terminate .app manually. /// Terminate .app manually.
Future<void> terminate() { Future<void> terminate() {
assert(Platform.isMacOS); assert(isMacOS);
return _osxMethodChannel.invokeMethod("terminate"); return _osxMethodChannel.invokeMethod("terminate");
} }
} }

1577
flutter/lib/web/bridge.dart Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
import 'dart:js' as js;
final isAndroid_ = false;
final isIOS_ = false;
final isWindows_ = false;
final isMacOS_ = false;
final isLinux_ = false;
final isWeb_ = true;
final isWebDesktop_ = !js.context.callMethod('isMobile');
final isDesktop_ = false;
String get screenInfo_ => js.context.callMethod('getByName', ['screen_info']);

View File

@@ -0,0 +1,121 @@
import 'dart:convert';
import 'dart:js' as js;
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter_hbb/models/model.dart' as model;
class CursorData {
final String key;
final String url;
final double hotX;
final double hotY;
final int width;
final int height;
CursorData({
required this.key,
required this.url,
required this.hotX,
required this.hotY,
required this.width,
required this.height,
});
}
/// The cursor manager
class CursorManager {
final Map<String, CursorData> _cursors = <String, CursorData>{};
String latestKey = '';
CursorManager._();
static CursorManager instance = CursorManager._();
Future<void> registerCursor(CursorData data) async {
_cursors[data.key] = data;
}
Future<void> deleteCursor(String key) async {
_cursors.remove(key);
}
Future<void> setSystemCursor(String key) async {
if (latestKey == key) {
return;
}
latestKey = key;
final CursorData? cursorData = _cursors[key];
if (cursorData != null) {
js.context.callMethod('setByName', [
'cursor',
jsonEncode({
'url': cursorData.url,
'hotx': cursorData.hotX.toInt(),
'hoty': cursorData.hotY.toInt(),
})
]);
}
}
}
class FlutterCustomMemoryImageCursor extends MouseCursor {
final String key;
const FlutterCustomMemoryImageCursor({required this.key});
@override
MouseCursorSession createSession(int device) =>
_FlutterCustomMemoryImageCursorSession(this, device);
@override
String get debugDescription =>
objectRuntimeType(this, 'FlutterCustomMemoryImageCursor');
}
class _FlutterCustomMemoryImageCursorSession extends MouseCursorSession {
_FlutterCustomMemoryImageCursorSession(
FlutterCustomMemoryImageCursor cursor, int device)
: super(cursor, device);
@override
FlutterCustomMemoryImageCursor get cursor =>
super.cursor as FlutterCustomMemoryImageCursor;
@override
Future<void> activate() async {
await CursorManager.instance.setSystemCursor(cursor.key);
}
@override
void dispose() {}
}
deleteCustomCursor(String key) => CursorManager.instance.deleteCursor(key);
MouseCursor buildCursorOfCache(
model.CursorModel cursor, double scale, model.CursorData? cache) {
if (cache == null) {
return MouseCursor.defer;
} else {
final key = cache.updateGetKey(scale);
if (!cursor.cachedKeys.contains(key)) {
// data should be checked here, because it may be changed after `updateGetKey()`
final data = cache.data;
if (data == null) {
return MouseCursor.defer;
}
debugPrint(
"Register custom cursor with key $key (${cache.hotx},${cache.hoty})");
CursorManager.instance.registerCursor(CursorData(
key: key,
url: 'data:image/rgba;base64,${base64Encode(data)}',
width: (cache.width * cache.scale).toInt(),
height: (cache.height * cache.scale).toInt(),
hotX: cache.hotx,
hotY: cache.hoty));
cursor.addKey(key);
}
return FlutterCustomMemoryImageCursor(key: key);
}
}

View File

@@ -0,0 +1,14 @@
abstract class NativeHandler {
bool onEvent(Map<String, dynamic> evt);
}
class NativeUiHandler extends NativeHandler {
NativeUiHandler._();
static NativeUiHandler instance = NativeUiHandler._();
@override
bool onEvent(Map<String, dynamic> evt) {
throw UnimplementedError();
}
}

View File

@@ -0,0 +1,20 @@
import 'dart:typed_data';
class TextureRgbaRenderer {
Future<int> createTexture(int key) {
throw UnimplementedError();
}
Future<bool> closeTexture(int key) {
throw UnimplementedError();
}
Future<bool> onRgba(
int key, Uint8List data, int height, int width, int strideAlign) {
throw UnimplementedError();
}
Future<int> getTexturePtr(int key) {
throw UnimplementedError();
}
}

View File

@@ -0,0 +1,5 @@
/// No use, for compilation only.
int getWindowsTargetBuildNumber_() {
return 0;
}

View File

@@ -10,9 +10,6 @@ PODS:
- flutter_custom_cursor (0.0.1): - flutter_custom_cursor (0.0.1):
- FlutterMacOS - FlutterMacOS
- FlutterMacOS (1.0.0) - FlutterMacOS (1.0.0)
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- package_info_plus (0.0.1): - package_info_plus (0.0.1):
- FlutterMacOS - FlutterMacOS
- path_provider_foundation (0.0.1): - path_provider_foundation (0.0.1):
@@ -20,9 +17,9 @@ PODS:
- FlutterMacOS - FlutterMacOS
- screen_retriever (0.0.1): - screen_retriever (0.0.1):
- FlutterMacOS - FlutterMacOS
- sqflite (0.0.2): - sqflite (0.0.3):
- Flutter
- FlutterMacOS - FlutterMacOS
- FMDB (>= 2.7.5)
- texture_rgba_renderer (0.0.1): - texture_rgba_renderer (0.0.1):
- FlutterMacOS - FlutterMacOS
- uni_links_desktop (0.0.1): - uni_links_desktop (0.0.1):
@@ -49,7 +46,7 @@ DEPENDENCIES:
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- screen_retriever (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos`) - screen_retriever (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos`)
- sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`) - sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/darwin`)
- texture_rgba_renderer (from `Flutter/ephemeral/.symlinks/plugins/texture_rgba_renderer/macos`) - texture_rgba_renderer (from `Flutter/ephemeral/.symlinks/plugins/texture_rgba_renderer/macos`)
- uni_links_desktop (from `Flutter/ephemeral/.symlinks/plugins/uni_links_desktop/macos`) - uni_links_desktop (from `Flutter/ephemeral/.symlinks/plugins/uni_links_desktop/macos`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
@@ -58,10 +55,6 @@ DEPENDENCIES:
- window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`) - window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`)
- window_size (from `Flutter/ephemeral/.symlinks/plugins/window_size/macos`) - window_size (from `Flutter/ephemeral/.symlinks/plugins/window_size/macos`)
SPEC REPOS:
trunk:
- FMDB
EXTERNAL SOURCES: EXTERNAL SOURCES:
desktop_drop: desktop_drop:
:path: Flutter/ephemeral/.symlinks/plugins/desktop_drop/macos :path: Flutter/ephemeral/.symlinks/plugins/desktop_drop/macos
@@ -82,7 +75,7 @@ EXTERNAL SOURCES:
screen_retriever: screen_retriever:
:path: Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos :path: Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos
sqflite: sqflite:
:path: Flutter/ephemeral/.symlinks/plugins/sqflite/macos :path: Flutter/ephemeral/.symlinks/plugins/sqflite/darwin
texture_rgba_renderer: texture_rgba_renderer:
:path: Flutter/ephemeral/.symlinks/plugins/texture_rgba_renderer/macos :path: Flutter/ephemeral/.symlinks/plugins/texture_rgba_renderer/macos
uni_links_desktop: uni_links_desktop:
@@ -105,19 +98,18 @@ SPEC CHECKSUMS:
file_selector_macos: 468fb6b81fac7c0e88d71317f3eec34c3b008ff9 file_selector_macos: 468fb6b81fac7c0e88d71317f3eec34c3b008ff9
flutter_custom_cursor: 629957115075c672287bd0fa979d863ccf6024f7 flutter_custom_cursor: 629957115075c672287bd0fa979d863ccf6024f7
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38 screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38
sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
texture_rgba_renderer: cbed959a3c127122194a364e14b8577bd62dc8f2 texture_rgba_renderer: cbed959a3c127122194a364e14b8577bd62dc8f2
uni_links_desktop: 45900fb319df48fcdea2df0756e9c2626696b026 uni_links_desktop: 45900fb319df48fcdea2df0756e9c2626696b026
url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95
video_player_avfoundation: 8563f13d8fc8b2c29dc2d09e60b660e4e8128837 video_player_avfoundation: 02011213dab73ae3687df27ce441fbbcc82b5579
wakelock_plus: 4783562c9a43d209c458cb9b30692134af456269 wakelock_plus: 4783562c9a43d209c458cb9b30692134af456269
window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8 window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8
window_size: 339dafa0b27a95a62a843042038fa6c3c48de195 window_size: 339dafa0b27a95a62a843042038fa6c3c48de195
PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7
COCOAPODS: 1.12.1 COCOAPODS: 1.15.2

View File

@@ -23,9 +23,9 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; };
33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; };
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
7ED2B35F2BB007420099885C /* AppIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 7ED2B35E2BB007420099885C /* AppIcon.icns */; };
84010BA8292CF66600152837 /* liblibrustdesk.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 84010BA7292CF66600152837 /* liblibrustdesk.dylib */; settings = {ATTRIBUTES = (Weak, ); }; }; 84010BA8292CF66600152837 /* liblibrustdesk.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 84010BA7292CF66600152837 /* liblibrustdesk.dylib */; settings = {ATTRIBUTES = (Weak, ); }; };
84010BA9292CF68300152837 /* liblibrustdesk.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 84010BA7292CF66600152837 /* liblibrustdesk.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 84010BA9292CF68300152837 /* liblibrustdesk.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 84010BA7292CF66600152837 /* liblibrustdesk.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
C5E54335B73C89F72DB1B606 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26C84465887F29AE938039CB /* Pods_Runner.framework */; }; C5E54335B73C89F72DB1B606 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26C84465887F29AE938039CB /* Pods_Runner.framework */; };
@@ -62,7 +62,6 @@
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
33CC10ED2044A3C60003C045 /* RustDesk.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RustDesk.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10ED2044A3C60003C045 /* RustDesk.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RustDesk.app; sourceTree = BUILT_PRODUCTS_DIR; };
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = "<group>"; }; 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = "<group>"; };
33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = "<group>"; }; 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = "<group>"; };
@@ -74,6 +73,7 @@
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
7436B85D94E8F7B5A9324869 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; }; 7436B85D94E8F7B5A9324869 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
7ED2B35E2BB007420099885C /* AppIcon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = AppIcon.icns; path = Runner/AppIcon.icns; sourceTree = "<group>"; };
84010BA7292CF66600152837 /* liblibrustdesk.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = liblibrustdesk.dylib; path = ../../target/release/liblibrustdesk.dylib; sourceTree = "<group>"; }; 84010BA7292CF66600152837 /* liblibrustdesk.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = liblibrustdesk.dylib; path = ../../target/release/liblibrustdesk.dylib; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
C3BB669FF6190AE1B11BCAEA /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; }; C3BB669FF6190AE1B11BCAEA /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
@@ -127,7 +127,7 @@
33CC11242044D66E0003C045 /* Resources */ = { 33CC11242044D66E0003C045 /* Resources */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
33CC10F22044A3C60003C045 /* Assets.xcassets */, 7ED2B35E2BB007420099885C /* AppIcon.icns */,
33CC10F42044A3C60003C045 /* MainMenu.xib */, 33CC10F42044A3C60003C045 /* MainMenu.xib */,
33CC10F72044A3C60003C045 /* Info.plist */, 33CC10F72044A3C60003C045 /* Info.plist */,
); );
@@ -253,8 +253,8 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */,
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */,
7ED2B35F2BB007420099885C /* AppIcon.icns in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

Some files were not shown because too many files have changed in this diff Show More