mirror of
				https://github.com/kunkundi/crossdesk.git
				synced 2025-10-29 12:32:58 +08:00 
			
		
		
		
	Compare commits
	
		
			13 Commits
		
	
	
		
			release
			...
			multi-stre
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 9912a88a13 | ||
|  | 8a8f2cd5d7 | ||
|  | e77e16d9c2 | ||
|  | 1616d0ec33 | ||
|  | 374453775f | ||
|  | 6f8fd6a030 | ||
|  | c7166975b3 | ||
|  | 2ae5e5a969 | ||
|  | 85cdc995c5 | ||
|  | b051c8a059 | ||
|  | 508b7dc7a1 | ||
|  | f203566b81 | ||
|  | 8360c1725f | 
							
								
								
									
										343
									
								
								.github/workflows/build.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										343
									
								
								.github/workflows/build.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,343 @@ | |||||||
|  | name: Build and Release CrossDesk | ||||||
|  |  | ||||||
|  | on: | ||||||
|  |   push: | ||||||
|  |     branches: | ||||||
|  |       - "**" | ||||||
|  |     tags: | ||||||
|  |       - "*" | ||||||
|  |   workflow_dispatch: | ||||||
|  |  | ||||||
|  | permissions: | ||||||
|  |   contents: write | ||||||
|  |  | ||||||
|  | env: | ||||||
|  |   GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
|  |  | ||||||
|  | jobs: | ||||||
|  |   # Linux x86_64 | ||||||
|  |   build-linux-x86_64: | ||||||
|  |     name: Build on Ubuntu 22.04 x86_64 | ||||||
|  |     runs-on: ubuntu-22.04 | ||||||
|  |     container: | ||||||
|  |       image: crossdesk/ubuntu22.04:latest | ||||||
|  |       options: --user root | ||||||
|  |     steps: | ||||||
|  |       - name: Extract version number | ||||||
|  |         id: version | ||||||
|  |         run: | | ||||||
|  |           VERSION="${GITHUB_REF##*/}" | ||||||
|  |           VERSION_NUM="${VERSION#v}" | ||||||
|  |           echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_ENV | ||||||
|  |  | ||||||
|  |       - name: Set legal Debian version | ||||||
|  |         shell: bash | ||||||
|  |         id: set_deb_version | ||||||
|  |         run: | | ||||||
|  |           if [[ ! "${VERSION_NUM}" =~ ^[0-9] ]]; then | ||||||
|  |             LEGAL_VERSION="0.0.0-${VERSION_NUM}" | ||||||
|  |           else | ||||||
|  |             LEGAL_VERSION="${VERSION_NUM}" | ||||||
|  |           fi | ||||||
|  |           echo "LEGAL_VERSION=${LEGAL_VERSION}" >> $GITHUB_ENV | ||||||
|  |  | ||||||
|  |       - name: Checkout code | ||||||
|  |         uses: actions/checkout@v4 | ||||||
|  |         with: | ||||||
|  |           submodules: recursive | ||||||
|  |  | ||||||
|  |       - name: Build CrossDesk | ||||||
|  |         env: | ||||||
|  |           CUDA_PATH: /usr/local/cuda | ||||||
|  |           XMAKE_GLOBALDIR: /data | ||||||
|  |         run: | | ||||||
|  |           ls -la $XMAKE_GLOBALDIR | ||||||
|  |           xmake b -vy --root crossdesk | ||||||
|  |  | ||||||
|  |       - name: Decode and save certificate | ||||||
|  |         shell: bash | ||||||
|  |         run: | | ||||||
|  |           mkdir -p certs | ||||||
|  |           echo "${{ secrets.CROSSDESK_CERT_BASE64 }}" | base64 --decode > certs/crossdesk.cn_root.crt | ||||||
|  |  | ||||||
|  |       - name: Package | ||||||
|  |         run: | | ||||||
|  |           chmod +x ./scripts/linux/pkg_x86_64.sh | ||||||
|  |           ./scripts/linux/pkg_x86_64.sh ${LEGAL_VERSION} | ||||||
|  |  | ||||||
|  |       - name: Upload artifact | ||||||
|  |         uses: actions/upload-artifact@v4 | ||||||
|  |         with: | ||||||
|  |           name: crossdesk-linux-x86_64-${{ env.LEGAL_VERSION }} | ||||||
|  |           path: ${{ github.workspace }}/crossdesk-linux-x86_64-${{ env.LEGAL_VERSION }}.deb | ||||||
|  |  | ||||||
|  |   # Linux arm64 | ||||||
|  |   build-linux-arm64: | ||||||
|  |     name: Build on Ubuntu 22.04 arm64 | ||||||
|  |     runs-on: ubuntu-22.04-arm | ||||||
|  |     strategy: | ||||||
|  |       matrix: | ||||||
|  |         include: | ||||||
|  |           - arch: arm64 | ||||||
|  |             image: crossdesk/ubuntu20.04-arm64v8:latest | ||||||
|  |             package_script: ./scripts/linux/pkg_arm64.sh | ||||||
|  |     container: | ||||||
|  |       image: ${{ matrix.image }} | ||||||
|  |       options: --user root | ||||||
|  |     steps: | ||||||
|  |       - name: Extract version number | ||||||
|  |         id: version | ||||||
|  |         run: | | ||||||
|  |           VERSION="${GITHUB_REF##*/}" | ||||||
|  |           VERSION_NUM="${VERSION#v}" | ||||||
|  |           echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_ENV | ||||||
|  |  | ||||||
|  |       - name: Set legal Debian version | ||||||
|  |         shell: bash | ||||||
|  |         id: set_deb_version | ||||||
|  |         run: | | ||||||
|  |           if [[ ! "${VERSION_NUM}" =~ ^[0-9] ]]; then | ||||||
|  |             LEGAL_VERSION="0.0.0-${VERSION_NUM}" | ||||||
|  |           else | ||||||
|  |             LEGAL_VERSION="${VERSION_NUM}" | ||||||
|  |           fi | ||||||
|  |           echo "LEGAL_VERSION=${LEGAL_VERSION}" >> $GITHUB_ENV | ||||||
|  |  | ||||||
|  |       - name: Checkout code | ||||||
|  |         uses: actions/checkout@v4 | ||||||
|  |         with: | ||||||
|  |           submodules: recursive | ||||||
|  |  | ||||||
|  |       - name: Build CrossDesk | ||||||
|  |         env: | ||||||
|  |           CUDA_PATH: /usr/local/cuda | ||||||
|  |           XMAKE_GLOBALDIR: /data | ||||||
|  |         run: | | ||||||
|  |           xmake b -vy --root crossdesk | ||||||
|  |  | ||||||
|  |       - name: Decode and save certificate | ||||||
|  |         shell: bash | ||||||
|  |         run: | | ||||||
|  |           mkdir -p certs | ||||||
|  |           echo "${{ secrets.CROSSDESK_CERT_BASE64 }}" | base64 --decode > certs/crossdesk.cn_root.crt | ||||||
|  |  | ||||||
|  |       - name: Package | ||||||
|  |         run: | | ||||||
|  |           chmod +x ${{ matrix.package_script }} | ||||||
|  |           ${{ matrix.package_script }} ${LEGAL_VERSION} | ||||||
|  |  | ||||||
|  |       - name: Upload artifact | ||||||
|  |         uses: actions/upload-artifact@v4 | ||||||
|  |         with: | ||||||
|  |           name: crossdesk-linux-${{ matrix.arch }}-${{ env.LEGAL_VERSION }} | ||||||
|  |           path: ${{ github.workspace }}/crossdesk-linux-${{ matrix.arch }}-${{ env.LEGAL_VERSION }}.deb | ||||||
|  |  | ||||||
|  |   # macOS | ||||||
|  |   build-macos: | ||||||
|  |     name: Build on macOS | ||||||
|  |     runs-on: ${{ matrix.runner }} | ||||||
|  |     strategy: | ||||||
|  |       matrix: | ||||||
|  |         include: | ||||||
|  |           - arch: x86_64 | ||||||
|  |             runner: macos-13 | ||||||
|  |             cache-key: intel | ||||||
|  |             out-dir: ./build/macosx/x86_64/release/crossdesk | ||||||
|  |             package_script: ./scripts/macosx/pkg_x86_64.sh | ||||||
|  |           - arch: arm64 | ||||||
|  |             runner: macos-14 | ||||||
|  |             cache-key: arm | ||||||
|  |             out-dir: ./build/macosx/arm64/release/crossdesk | ||||||
|  |             package_script: ./scripts/macosx/pkg_arm64.sh | ||||||
|  |  | ||||||
|  |     steps: | ||||||
|  |       - name: Extract version number | ||||||
|  |         id: version | ||||||
|  |         run: | | ||||||
|  |           VERSION="${GITHUB_REF##*/}" | ||||||
|  |           VERSION_NUM="${VERSION#v}" | ||||||
|  |           echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_ENV | ||||||
|  |           echo "VERSION_NUM=${VERSION_NUM}" | ||||||
|  |  | ||||||
|  |       - name: Cache xmake dependencies | ||||||
|  |         uses: actions/cache@v4 | ||||||
|  |         with: | ||||||
|  |           path: ~/.xmake/packages | ||||||
|  |           key: ${{ runner.os }}-xmake-deps-${{ matrix.cache-key }}-${{ hashFiles('**/xmake.lua') }} | ||||||
|  |           restore-keys: | | ||||||
|  |             ${{ runner.os }}-xmake-deps-${{ matrix.cache-key }}- | ||||||
|  |  | ||||||
|  |       - name: Install xmake | ||||||
|  |         run: brew install xmake | ||||||
|  |  | ||||||
|  |       - name: Checkout code | ||||||
|  |         uses: actions/checkout@v4 | ||||||
|  |  | ||||||
|  |       - name: Initialize submodules | ||||||
|  |         run: git submodule update --init --recursive | ||||||
|  |  | ||||||
|  |       - name: Build CrossDesk | ||||||
|  |         run: xmake b -vy crossdesk | ||||||
|  |  | ||||||
|  |       - name: Decode and save certificate | ||||||
|  |         shell: bash | ||||||
|  |         run: | | ||||||
|  |           mkdir -p certs | ||||||
|  |           echo "${{ secrets.CROSSDESK_CERT_BASE64 }}" | base64 --decode > certs/crossdesk.cn_root.crt | ||||||
|  |  | ||||||
|  |       - name: Package CrossDesk app | ||||||
|  |         run: | | ||||||
|  |           chmod +x ${{ matrix.package_script }} | ||||||
|  |           ${{ matrix.package_script }} ${VERSION_NUM} | ||||||
|  |  | ||||||
|  |       - name: Upload build artifacts | ||||||
|  |         uses: actions/upload-artifact@v4 | ||||||
|  |         with: | ||||||
|  |           name: crossdesk-macos-${{ matrix.arch }}-${{ env.VERSION_NUM }} | ||||||
|  |           path: crossdesk-macos-${{ matrix.arch }}-${{ env.VERSION_NUM }}.pkg | ||||||
|  |  | ||||||
|  |       - name: Move files to release dir | ||||||
|  |         run: | | ||||||
|  |           mkdir -p release | ||||||
|  |           cp crossdesk-macos-${{ matrix.arch }}-${{ env.VERSION_NUM }}.pkg release/ | ||||||
|  |  | ||||||
|  |   # Windows | ||||||
|  |   build-windows: | ||||||
|  |     name: Build on Windows | ||||||
|  |     runs-on: windows-2022 | ||||||
|  |     env: | ||||||
|  |       XMAKE_GLOBALDIR: D:\xmake_global | ||||||
|  |     steps: | ||||||
|  |       - name: Extract version number | ||||||
|  |         shell: pwsh | ||||||
|  |         run: | | ||||||
|  |           $ref = $env:GITHUB_REF | ||||||
|  |           $version = $ref -replace '^refs/(tags|heads)/', '' | ||||||
|  |           $version = $version -replace '^v', '' | ||||||
|  |           $version = $version -replace '/', '-' | ||||||
|  |           echo "VERSION_NUM=$version" >> $env:GITHUB_ENV | ||||||
|  |  | ||||||
|  |       - name: Cache xmake dependencies | ||||||
|  |         uses: actions/cache@v4 | ||||||
|  |         with: | ||||||
|  |           path: D:\xmake_global\.xmake\packages | ||||||
|  |           key: ${{ runner.os }}-xmake-deps-intel-${{ hashFiles('**/xmake.lua') }} | ||||||
|  |           restore-keys: | | ||||||
|  |             ${{ runner.os }}-xmake-deps-intel- | ||||||
|  |  | ||||||
|  |       - name: Install xmake | ||||||
|  |         run: | | ||||||
|  |           Invoke-Expression (Invoke-Webrequest 'https://raw.githubusercontent.com/tboox/xmake/master/scripts/get.ps1' -UseBasicParsing).Content | ||||||
|  |           echo "C:\Users\runneradmin\xmake" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | ||||||
|  |           xmake create cuda | ||||||
|  |           Set-Location cuda | ||||||
|  |           xmake g --theme=plain | ||||||
|  |           $cudaPath = "" | ||||||
|  |           $packagesPath = "D:\xmake_global\.xmake\packages" | ||||||
|  |  | ||||||
|  |           if (Test-Path $packagesPath) { | ||||||
|  |               Write-Host "Packages directory exists: $packagesPath" | ||||||
|  |               try { | ||||||
|  |                   $info = xmake require --info "cuda 12.6.3" 2>$null | ||||||
|  |                   if ($null -ne $info -and $info -ne "") { | ||||||
|  |                       $cudaPath = (($info | Select-String installdir).ToString() -replace '.*installdir:\s*','').Trim() | ||||||
|  |                   } | ||||||
|  |               } catch {} | ||||||
|  |           } else { | ||||||
|  |               Write-Host "Packages directory not found: $packagesPath" | ||||||
|  |               Write-Host "Installing CUDA package..." | ||||||
|  |               xmake require -vy "cuda 12.6.3" | ||||||
|  |               $info = xmake require --info "cuda 12.6.3" | ||||||
|  |               $cudaPath = (($info | Select-String installdir).ToString() -replace '.*installdir:\s*','').Trim() | ||||||
|  |           } | ||||||
|  |  | ||||||
|  |           echo "CUDA_PATH=$cudaPath" >> $env:GITHUB_ENV | ||||||
|  |           Write-Host "Resolved CUDA_PATH = $cudaPath" | ||||||
|  |           Pop-Location | ||||||
|  |  | ||||||
|  |       - name: Checkout code | ||||||
|  |         uses: actions/checkout@v4 | ||||||
|  |  | ||||||
|  |       - name: Initialize submodules | ||||||
|  |         run: git submodule update --init --recursive | ||||||
|  |  | ||||||
|  |       - name: Build CrossDesk | ||||||
|  |         run: xmake b -vy crossdesk | ||||||
|  |  | ||||||
|  |       - name: Decode and save certificate | ||||||
|  |         shell: powershell | ||||||
|  |         run: | | ||||||
|  |           New-Item -ItemType Directory -Force -Path certs | ||||||
|  |           [System.IO.File]::WriteAllBytes('certs\crossdesk.cn_root.crt', [Convert]::FromBase64String('${{ secrets.CROSSDESK_CERT_BASE64 }}')) | ||||||
|  |  | ||||||
|  |       - name: Package | ||||||
|  |         shell: pwsh | ||||||
|  |         run: | | ||||||
|  |           cd "${{ github.workspace }}\scripts\windows" | ||||||
|  |           makensis /DVERSION=$env:VERSION_NUM nsis_script.nsi | ||||||
|  |  | ||||||
|  |       - name: Upload artifact | ||||||
|  |         uses: actions/upload-artifact@v4 | ||||||
|  |         with: | ||||||
|  |           name: crossdesk-win-x86_64-${{ env.VERSION_NUM }} | ||||||
|  |           path: ${{ github.workspace }}/scripts/windows/crossdesk-win-x86_64-${{ env.VERSION_NUM }}.exe | ||||||
|  |  | ||||||
|  |   release: | ||||||
|  |     name: Publish Release | ||||||
|  |     if: startsWith(github.ref, 'refs/tags/v') | ||||||
|  |     needs: [build-linux-x86_64, build-linux-arm64, build-macos, build-windows] | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |  | ||||||
|  |     steps: | ||||||
|  |       - name: Checkout repository | ||||||
|  |         uses: actions/checkout@v4 | ||||||
|  |  | ||||||
|  |       - name: Download all artifacts | ||||||
|  |         uses: actions/download-artifact@v4 | ||||||
|  |         with: | ||||||
|  |           path: artifacts | ||||||
|  |  | ||||||
|  |       - name: Extract version number | ||||||
|  |         id: version | ||||||
|  |         run: | | ||||||
|  |           VERSION="${GITHUB_REF##*/}" | ||||||
|  |           VERSION_NUM="${VERSION#v}" | ||||||
|  |           echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_OUTPUT | ||||||
|  |  | ||||||
|  |       - name: Rename artifacts | ||||||
|  |         run: | | ||||||
|  |           mkdir -p release | ||||||
|  |           cp artifacts/crossdesk-macos-x86_64-${{ steps.version.outputs.VERSION_NUM }}/* release/crossdesk-macos-x86_64-${{ steps.version.outputs.VERSION_NUM }}.pkg | ||||||
|  |           cp artifacts/crossdesk-macos-arm64-${{ steps.version.outputs.VERSION_NUM }}/* release/crossdesk-macos-arm64-${{ steps.version.outputs.VERSION_NUM }}.pkg | ||||||
|  |           cp artifacts/crossdesk-linux-x86_64-${{ steps.version.outputs.VERSION_NUM }}/* release/crossdesk-linux-x86_64-${{ steps.version.outputs.VERSION_NUM }}.deb | ||||||
|  |           cp artifacts/crossdesk-linux-arm64-${{ steps.version.outputs.VERSION_NUM }}/* release/crossdesk-linux-arm64-${{ steps.version.outputs.VERSION_NUM }}.deb | ||||||
|  |           cp artifacts/crossdesk-win-x86_64-${{ steps.version.outputs.VERSION_NUM }}/* release/crossdesk-win-x86_64-${{ steps.version.outputs.VERSION_NUM }}.exe | ||||||
|  |  | ||||||
|  |       - name: Upload to Versioned GitHub Release | ||||||
|  |         uses: softprops/action-gh-release@v2 | ||||||
|  |         with: | ||||||
|  |           tag_name: v${{ steps.version.outputs.VERSION_NUM }} | ||||||
|  |           name: Release v${{ steps.version.outputs.VERSION_NUM }} | ||||||
|  |           draft: false | ||||||
|  |           prerelease: false | ||||||
|  |           files: release/* | ||||||
|  |           generate_release_notes: false | ||||||
|  |           body: | | ||||||
|  |             Binary release only. Source code is not included. | ||||||
|  |  | ||||||
|  |       - name: Create or update 'latest' tag | ||||||
|  |         run: | | ||||||
|  |           git config user.name "github-actions[bot]" | ||||||
|  |           git config user.email "github-actions[bot]@users.noreply.github.com" | ||||||
|  |           git tag -f latest | ||||||
|  |           git push origin latest --force | ||||||
|  |  | ||||||
|  |       - name: Upload to GitHub Release (latest) | ||||||
|  |         uses: softprops/action-gh-release@v2 | ||||||
|  |         with: | ||||||
|  |           tag_name: latest | ||||||
|  |           name: Latest Release | ||||||
|  |           draft: false | ||||||
|  |           prerelease: false | ||||||
|  |           files: release/* | ||||||
|  |           generate_release_notes: false | ||||||
							
								
								
									
										186
									
								
								.github/workflows/release.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										186
									
								
								.github/workflows/release.yaml
									
									
									
									
										vendored
									
									
								
							| @@ -1,186 +0,0 @@ | |||||||
| name: Build and Release CrossDesk |  | ||||||
|  |  | ||||||
| on: |  | ||||||
|   push: |  | ||||||
|     branches: [release] |  | ||||||
|     tags: |  | ||||||
|       - "v*" |  | ||||||
|   workflow_dispatch: |  | ||||||
|  |  | ||||||
| permissions: |  | ||||||
|   contents: write |  | ||||||
|  |  | ||||||
| env: |  | ||||||
|   GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |  | ||||||
|  |  | ||||||
| jobs: |  | ||||||
|   # Linux |  | ||||||
|   build-linux: |  | ||||||
|     name: Build on Ubuntu |  | ||||||
|     runs-on: ubuntu-22.04 |  | ||||||
|     container: |  | ||||||
|       image: crossdesk/ubuntu22.04:latest |  | ||||||
|       options: --user root |  | ||||||
|     steps: |  | ||||||
|       - name: Checkout code |  | ||||||
|         uses: actions/checkout@v4 |  | ||||||
|         with: |  | ||||||
|           submodules: recursive |  | ||||||
|  |  | ||||||
|       - name: Build CrossDesk |  | ||||||
|         env: |  | ||||||
|           CUDA_PATH: /usr/local/cuda |  | ||||||
|           XMAKE_GLOBALDIR: /data |  | ||||||
|         run: | |  | ||||||
|           ls -la $XMAKE_GLOBALDIR |  | ||||||
|           xmake b -vy --root crossdesk |  | ||||||
|  |  | ||||||
|       - name: Decode and save certificate |  | ||||||
|         shell: bash |  | ||||||
|         run: | |  | ||||||
|           mkdir -p certs |  | ||||||
|           echo "${{ secrets.CROSSDESK_CERT_BASE64 }}" | base64 --decode > certs/crossdesk.cn_root.crt |  | ||||||
|  |  | ||||||
|       - name: Package |  | ||||||
|         run: | |  | ||||||
|           chmod +x ./scripts/linux/pkg_x86_64.sh |  | ||||||
|           ./scripts/linux/pkg_x86_64.sh |  | ||||||
|  |  | ||||||
|       - name: Upload artifact |  | ||||||
|         uses: actions/upload-artifact@v4 |  | ||||||
|         with: |  | ||||||
|           name: crossdesk-linux-x86_64 |  | ||||||
|           path: ${{ github.workspace }}/CrossDesk-0.0.1.deb |  | ||||||
|  |  | ||||||
|   # macOS |  | ||||||
|   build-macos: |  | ||||||
|     name: Build on macOS |  | ||||||
|     runs-on: ${{ matrix.runner }} |  | ||||||
|     strategy: |  | ||||||
|       matrix: |  | ||||||
|         include: |  | ||||||
|           - arch: x86_64 |  | ||||||
|             runner: macos-13 |  | ||||||
|             cache-key: intel |  | ||||||
|             out-dir: ./build/macosx/x86_64/release/crossdesk |  | ||||||
|             artifact-name: crossdesk-macos-x86_64 |  | ||||||
|             package_script: ./scripts/macosx/pkg_x86_64.sh |  | ||||||
|           - arch: arm64 |  | ||||||
|             runner: macos-14 |  | ||||||
|             cache-key: arm |  | ||||||
|             out-dir: ./build/macosx/arm64/release/crossdesk |  | ||||||
|             artifact-name: crossdesk-macos-arm64 |  | ||||||
|             package_script: ./scripts/macosx/pkg_arm64.sh |  | ||||||
|     steps: |  | ||||||
|       - name: Cache xmake dependencies |  | ||||||
|         uses: actions/cache@v4 |  | ||||||
|         with: |  | ||||||
|           path: ~/.xmake/packages |  | ||||||
|           key: ${{ runner.os }}-xmake-deps-${{ matrix.cache-key }}-${{ hashFiles('**/xmake.lua') }} |  | ||||||
|           restore-keys: | |  | ||||||
|             ${{ runner.os }}-xmake-deps-${{ matrix.cache-key }}- |  | ||||||
|  |  | ||||||
|       - name: Install xmake |  | ||||||
|         run: brew install xmake |  | ||||||
|  |  | ||||||
|       - name: Checkout code |  | ||||||
|         uses: actions/checkout@v4 |  | ||||||
|  |  | ||||||
|       - name: Initialize submodules |  | ||||||
|         run: git submodule update --init --recursive |  | ||||||
|  |  | ||||||
|       - name: Build CrossDesk |  | ||||||
|         run: xmake b -vy crossdesk |  | ||||||
|  |  | ||||||
|       - name: Decode and save certificate |  | ||||||
|         shell: bash |  | ||||||
|         run: | |  | ||||||
|           mkdir -p certs |  | ||||||
|           echo "${{ secrets.CROSSDESK_CERT_BASE64 }}" | base64 --decode > certs/crossdesk.cn_root.crt |  | ||||||
|  |  | ||||||
|       - name: Package CrossDesk app |  | ||||||
|         run: | |  | ||||||
|           chmod +x ${{ matrix.package_script }} |  | ||||||
|           ${{ matrix.package_script }} |  | ||||||
|  |  | ||||||
|       - name: Upload build artifacts |  | ||||||
|         uses: actions/upload-artifact@v4 |  | ||||||
|         with: |  | ||||||
|           name: ${{ matrix.artifact-name }} |  | ||||||
|           path: crossdesk-macos-${{ matrix.arch }}-v0.0.1.pkg |  | ||||||
|  |  | ||||||
|       - name: Move files to release dir |  | ||||||
|         run: | |  | ||||||
|           mkdir -p release |  | ||||||
|           cp crossdesk-macos-${{ matrix.arch }}-v0.0.1.pkg release/ |  | ||||||
|  |  | ||||||
|   # Windows |  | ||||||
|   build-windows: |  | ||||||
|     name: Build on Windows |  | ||||||
|     runs-on: windows-2022 |  | ||||||
|     env: |  | ||||||
|       XMAKE_GLOBALDIR: D:\xmake_global |  | ||||||
|     steps: |  | ||||||
|       - name: Cache xmake dependencies |  | ||||||
|         uses: actions/cache@v4 |  | ||||||
|         with: |  | ||||||
|           path: D:\xmake_global\.xmake\packages |  | ||||||
|           key: ${{ runner.os }}-xmake-deps-intel-${{ hashFiles('**/xmake.lua') }} |  | ||||||
|           restore-keys: | |  | ||||||
|             ${{ runner.os }}-xmake-deps-intel- |  | ||||||
|  |  | ||||||
|       - name: Install xmake |  | ||||||
|         run: | |  | ||||||
|           Invoke-Expression (Invoke-Webrequest 'https://raw.githubusercontent.com/tboox/xmake/master/scripts/get.ps1' -UseBasicParsing).Content |  | ||||||
|           echo "C:\Users\runneradmin\xmake" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |  | ||||||
|           xmake create cuda |  | ||||||
|           Set-Location cuda |  | ||||||
|           xmake g --theme=plain |  | ||||||
|           $cudaPath = "" |  | ||||||
|           $packagesPath = "D:\xmake_global\.xmake\packages" |  | ||||||
|  |  | ||||||
|           if (Test-Path $packagesPath) { |  | ||||||
|               Write-Host "Packages directory exists: $packagesPath" |  | ||||||
|               try { |  | ||||||
|                   $info = xmake require --info "cuda 12.6.3" 2>$null |  | ||||||
|                   if ($null -ne $info -and $info -ne "") { |  | ||||||
|                       $cudaPath = (($info | Select-String installdir).ToString() -replace '.*installdir:\s*','').Trim() |  | ||||||
|                   } |  | ||||||
|               } catch {} |  | ||||||
|           } else { |  | ||||||
|               Write-Host "Packages directory not found: $packagesPath" |  | ||||||
|               Write-Host "Installing CUDA package..." |  | ||||||
|               xmake require -vy "cuda 12.6.3" |  | ||||||
|               $info = xmake require --info "cuda 12.6.3" |  | ||||||
|               $cudaPath = (($info | Select-String installdir).ToString() -replace '.*installdir:\s*','').Trim() |  | ||||||
|           } |  | ||||||
|  |  | ||||||
|           echo "CUDA_PATH=$cudaPath" >> $env:GITHUB_ENV |  | ||||||
|           Write-Host "Resolved CUDA_PATH = $cudaPath" |  | ||||||
|           Pop-Location |  | ||||||
|  |  | ||||||
|       - name: Checkout code |  | ||||||
|         uses: actions/checkout@v4 |  | ||||||
|  |  | ||||||
|       - name: Initialize submodules |  | ||||||
|         run: git submodule update --init --recursive |  | ||||||
|  |  | ||||||
|       - name: Build CrossDesk |  | ||||||
|         run: xmake b -vy crossdesk |  | ||||||
|  |  | ||||||
|       - name: Decode and save certificate |  | ||||||
|         shell: powershell |  | ||||||
|         run: | |  | ||||||
|           New-Item -ItemType Directory -Force -Path certs |  | ||||||
|           [System.IO.File]::WriteAllBytes('certs\crossdesk.cn_root.crt', [Convert]::FromBase64String('${{ secrets.CROSSDESK_CERT_BASE64 }}')) |  | ||||||
|  |  | ||||||
|       - name: Package |  | ||||||
|         run: | |  | ||||||
|           cd ./scripts/windows |  | ||||||
|           makensis nsis_script.nsi |  | ||||||
|  |  | ||||||
|       - name: Upload artifact |  | ||||||
|         uses: actions/upload-artifact@v4 |  | ||||||
|         with: |  | ||||||
|           name: crossdesk-win-x86_64 |  | ||||||
|           path: ${{ github.workspace }}/scripts/windows/CrossDesk-0.0.1.exe |  | ||||||
							
								
								
									
										48
									
								
								.github/workflows/update-pages.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								.github/workflows/update-pages.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,48 @@ | |||||||
|  | name: Update GitHub Pages Downloads | ||||||
|  |  | ||||||
|  | on: | ||||||
|  |   push: | ||||||
|  |     tags: | ||||||
|  |       - "v*" | ||||||
|  |  | ||||||
|  | jobs: | ||||||
|  |   update-pages: | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |     steps: | ||||||
|  |       - name: Checkout CrossDesk repo | ||||||
|  |         uses: actions/checkout@v4 | ||||||
|  |  | ||||||
|  |       - name: Set version number | ||||||
|  |         id: version | ||||||
|  |         run: | | ||||||
|  |           VERSION_NUM="${GITHUB_REF##*/}" | ||||||
|  |           VERSION_NUM="${VERSION_NUM#v}" | ||||||
|  |           echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_ENV | ||||||
|  |           echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_OUTPUT | ||||||
|  |  | ||||||
|  |       - name: Checkout Pages repo | ||||||
|  |         uses: actions/checkout@v4 | ||||||
|  |         with: | ||||||
|  |           repository: kunkundi/kunkundi.github.io | ||||||
|  |           token: ${{ secrets.GH_PAGES_PAT }} | ||||||
|  |           path: pages | ||||||
|  |  | ||||||
|  |       - name: Update download links | ||||||
|  |         run: | | ||||||
|  |           cd pages | ||||||
|  |           sed -E -i "s/crossdesk-win-x86_64-[0-9]+\.[0-9]+\.[0-9]+\.exe/crossdesk-win-x86_64-${VERSION_NUM}.exe/g" index.html | ||||||
|  |           sed -E -i "s/crossdesk-macos-x86_64-[0-9]+\.[0-9]+\.[0-9]+\.pkg/crossdesk-macos-x86_64-${VERSION_NUM}.pkg/g" index.html | ||||||
|  |           sed -E -i "s/crossdesk-macos-arm64-[0-9]+\.[0-9]+\.[0-9]+\.pkg/crossdesk-macos-arm64-${VERSION_NUM}.pkg/g" index.html | ||||||
|  |           sed -E -i "s/crossdesk-linux-x86_64-[0-9]+\.[0-9]+\.[0-9]+\.deb/crossdesk-linux-x86_64-${VERSION_NUM}.deb/g" index.html | ||||||
|  |           sed -E -i "s/crossdesk-linux-arm64-[0-9]+\.[0-9]+\.[0-9]+\.deb/crossdesk-linux-arm64-${VERSION_NUM}.deb/g" index.html | ||||||
|  |  | ||||||
|  |       - name: Commit & Push changes | ||||||
|  |         run: | | ||||||
|  |           cd pages | ||||||
|  |           git config user.name "github-actions[bot]" | ||||||
|  |           git config user.email "github-actions[bot]@users.noreply.github.com" | ||||||
|  |           git add index.html | ||||||
|  |           git commit -m "Update download links to v${VERSION_NUM}" || echo "No changes to commit" | ||||||
|  |           git push origin main | ||||||
|  |         env: | ||||||
|  |           VERSION_NUM: ${{ env.VERSION_NUM }} | ||||||
							
								
								
									
										39
									
								
								Info.plist
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								Info.plist
									
									
									
									
									
								
							| @@ -1,39 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> |  | ||||||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |  | ||||||
| <plist version="1.0"> |  | ||||||
| <dict> |  | ||||||
|     <!-- 应用的Bundle identifier,通常使用反向域名标记 --> |  | ||||||
|     <key>CFBundleIdentifier</key> |  | ||||||
|     <string>com.yourcompany.yourappname</string> |  | ||||||
|  |  | ||||||
|     <!-- 应用的显示名称 --> |  | ||||||
|     <key>CFBundleName</key> |  | ||||||
|     <string>Your App Name</string> |  | ||||||
|  |  | ||||||
|     <!-- 应用的版本号 --> |  | ||||||
|     <key>CFBundleShortVersionString</key> |  | ||||||
|     <string>1.0.0</string> |  | ||||||
|  |  | ||||||
|     <!-- 应用的构建版本号 --> |  | ||||||
|     <key>CFBundleVersion</key> |  | ||||||
|     <string>1</string> |  | ||||||
|  |  | ||||||
|     <!-- 请求麦克风访问权限 --> |  | ||||||
|     <key>NSMicrophoneUsageDescription</key> |  | ||||||
|     <string>App requires access to the microphone for audio recording.</string> |  | ||||||
|  |  | ||||||
|     <!-- 请求相机访问权限 --> |  | ||||||
|     <key>NSCameraUsageDescription</key> |  | ||||||
|     <string>App requires access to the camera for video recording.</string> |  | ||||||
|  |  | ||||||
|     <!-- 请求使用连续相机设备 --> |  | ||||||
|     <key>NSCameraUseContinuityCameraDeviceType</key> |  | ||||||
|     <string>Your usage description here</string> |  | ||||||
|  |  | ||||||
|     <!-- High DPI -->> |  | ||||||
|     <key>NSHighResolutionCapable</key> |  | ||||||
|     <true/> |  | ||||||
|  |  | ||||||
|     <!-- 其他权限和配置可以在这里添加 --> |  | ||||||
| </dict> |  | ||||||
| </plist> |  | ||||||
							
								
								
									
										111
									
								
								scripts/linux/pkg_arm64.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								scripts/linux/pkg_arm64.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,111 @@ | |||||||
|  | #!/bin/bash | ||||||
|  | set -e | ||||||
|  |  | ||||||
|  | APP_NAME="CrossDesk" | ||||||
|  | APP_VERSION="$1" | ||||||
|  | ARCHITECTURE="arm64"  # 改为 arm64 | ||||||
|  | MAINTAINER="Junkun Di <junkun.di@hotmail.com>" | ||||||
|  | DESCRIPTION="A simple cross-platform remote desktop client." | ||||||
|  |  | ||||||
|  | DEB_DIR="$APP_NAME-$APP_VERSION" | ||||||
|  | DEBIAN_DIR="$DEB_DIR/DEBIAN" | ||||||
|  | BIN_DIR="$DEB_DIR/usr/local/bin" | ||||||
|  | CERT_SRC_DIR="$DEB_DIR/opt/$APP_NAME/certs" | ||||||
|  | ICON_DIR="$DEB_DIR/usr/share/icons/hicolor/256x256/apps" | ||||||
|  | DESKTOP_DIR="$DEB_DIR/usr/share/applications" | ||||||
|  |  | ||||||
|  | rm -rf "$DEB_DIR" | ||||||
|  |  | ||||||
|  | mkdir -p "$DEBIAN_DIR" "$BIN_DIR" "$CERT_SRC_DIR" "$ICON_DIR" "$DESKTOP_DIR" | ||||||
|  |  | ||||||
|  | cp build/linux/arm64/release/crossdesk "$BIN_DIR" | ||||||
|  | cp certs/crossdesk.cn_root.crt "$CERT_SRC_DIR/crossdesk.cn_root.crt" | ||||||
|  | cp icons/crossdesk.png "$ICON_DIR/crossdesk.png" | ||||||
|  |  | ||||||
|  | chmod +x "$BIN_DIR/crossdesk" | ||||||
|  |  | ||||||
|  | cat > "$DEBIAN_DIR/control" << EOF | ||||||
|  | Package: $APP_NAME | ||||||
|  | Version: $APP_VERSION | ||||||
|  | Architecture: $ARCHITECTURE | ||||||
|  | Maintainer: $MAINTAINER | ||||||
|  | Description: $DESCRIPTION | ||||||
|  | Depends: libc6 (>= 2.29), libstdc++6 (>= 9), libx11-6, libxcb1, | ||||||
|  |  libxcb-randr0, libxcb-xtest0, libxcb-xinerama0, libxcb-shape0, | ||||||
|  |  libxcb-xkb1, libxcb-xfixes0, libxv1, libxtst6, libasound2, | ||||||
|  |  libsndio7.0, libxcb-shm0, libpulse0 | ||||||
|  | Priority: optional | ||||||
|  | Section: utils | ||||||
|  | EOF | ||||||
|  |  | ||||||
|  | cat > "$DESKTOP_DIR/$APP_NAME.desktop" << EOF | ||||||
|  | [Desktop Entry] | ||||||
|  | Version=$APP_VERSION | ||||||
|  | Name=$APP_NAME | ||||||
|  | Comment=$DESCRIPTION | ||||||
|  | Exec=/usr/local/bin/crossdesk | ||||||
|  | Icon=crossdesk | ||||||
|  | Terminal=false | ||||||
|  | Type=Application | ||||||
|  | Categories=Utility; | ||||||
|  | EOF | ||||||
|  |  | ||||||
|  | cat > "$DEBIAN_DIR/postrm" << EOF | ||||||
|  | #!/bin/bash | ||||||
|  | # post-removal script for $APP_NAME | ||||||
|  |  | ||||||
|  | set -e | ||||||
|  |  | ||||||
|  | if [ "\$1" = "remove" ] || [ "\$1" = "purge" ]; then | ||||||
|  |     rm -f /usr/local/bin/crossdesk | ||||||
|  |     rm -f /usr/share/icons/hicolor/256x256/apps/crossdesk.png | ||||||
|  |     rm -f /usr/share/applications/$APP_NAME.desktop | ||||||
|  |     rm -rf /opt/$APP_NAME | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | exit 0 | ||||||
|  | EOF | ||||||
|  |  | ||||||
|  | chmod +x "$DEBIAN_DIR/postrm" | ||||||
|  |  | ||||||
|  | cat > "$DEBIAN_DIR/postinst" << 'EOF' | ||||||
|  | #!/bin/bash | ||||||
|  | set -e | ||||||
|  |  | ||||||
|  | CERT_SRC="/opt/CrossDesk/certs" | ||||||
|  | CERT_FILE="crossdesk.cn_root.crt" | ||||||
|  |  | ||||||
|  | for user_home in /home/*; do | ||||||
|  |     [ -d "$user_home" ] || continue | ||||||
|  |     username=$(basename "$user_home") | ||||||
|  |     config_dir="$user_home/.config/CrossDesk/certs" | ||||||
|  |     target="$config_dir/$CERT_FILE" | ||||||
|  |  | ||||||
|  |     if [ ! -f "$target" ]; then | ||||||
|  |         mkdir -p "$config_dir" | ||||||
|  |         cp "$CERT_SRC/$CERT_FILE" "$target" | ||||||
|  |         chown -R "$username:$username" "$user_home/.config/CrossDesk" | ||||||
|  |         echo "✔ Installed cert for $username at $target" | ||||||
|  |     fi | ||||||
|  | done | ||||||
|  |  | ||||||
|  | if [ -d "/root" ]; then | ||||||
|  |     config_dir="/root/.config/CrossDesk/certs" | ||||||
|  |     mkdir -p "$config_dir" | ||||||
|  |     cp "$CERT_SRC/$CERT_FILE" "$config_dir/$CERT_FILE" | ||||||
|  |     chown -R root:root /root/.config/CrossDesk | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | exit 0 | ||||||
|  | EOF | ||||||
|  |  | ||||||
|  | chmod +x "$DEBIAN_DIR/postinst" | ||||||
|  |  | ||||||
|  | dpkg-deb --build "$DEB_DIR" | ||||||
|  |  | ||||||
|  | OUTPUT_FILE="crossdesk-linux-arm64-$APP_VERSION.deb" | ||||||
|  | mv "$DEB_DIR.deb" "$OUTPUT_FILE" | ||||||
|  |  | ||||||
|  | rm -rf "$DEB_DIR" | ||||||
|  |  | ||||||
|  | echo "✅ Deb package for $APP_NAME (ARM64) created successfully." | ||||||
| @@ -1,14 +1,12 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
| set -e | set -e | ||||||
|  |  | ||||||
| # 配置变量 |  | ||||||
| APP_NAME="CrossDesk" | APP_NAME="CrossDesk" | ||||||
| APP_VERSION="0.0.1" | APP_VERSION="$1" | ||||||
| ARCHITECTURE="amd64" | ARCHITECTURE="amd64" | ||||||
| MAINTAINER="Junkun Di <junkun.di@hotmail.com>" | MAINTAINER="Junkun Di <junkun.di@hotmail.com>" | ||||||
| DESCRIPTION="A simple cross-platform remote desktop client." | DESCRIPTION="A simple cross-platform remote desktop client." | ||||||
|  |  | ||||||
| # 目录结构 |  | ||||||
| DEB_DIR="$APP_NAME-$APP_VERSION" | DEB_DIR="$APP_NAME-$APP_VERSION" | ||||||
| DEBIAN_DIR="$DEB_DIR/DEBIAN" | DEBIAN_DIR="$DEB_DIR/DEBIAN" | ||||||
| BIN_DIR="$DEB_DIR/usr/local/bin" | BIN_DIR="$DEB_DIR/usr/local/bin" | ||||||
| @@ -16,25 +14,16 @@ CERT_SRC_DIR="$DEB_DIR/opt/$APP_NAME/certs"  # 用于中转安装时分发 | |||||||
| ICON_DIR="$DEB_DIR/usr/share/icons/hicolor/256x256/apps" | ICON_DIR="$DEB_DIR/usr/share/icons/hicolor/256x256/apps" | ||||||
| DESKTOP_DIR="$DEB_DIR/usr/share/applications" | DESKTOP_DIR="$DEB_DIR/usr/share/applications" | ||||||
|  |  | ||||||
| # 清理已有的打包文件夹 |  | ||||||
| rm -rf "$DEB_DIR" | rm -rf "$DEB_DIR" | ||||||
|  |  | ||||||
| # 创建目录结构 |  | ||||||
| mkdir -p "$DEBIAN_DIR" "$BIN_DIR" "$CERT_SRC_DIR" "$ICON_DIR" "$DESKTOP_DIR" | mkdir -p "$DEBIAN_DIR" "$BIN_DIR" "$CERT_SRC_DIR" "$ICON_DIR" "$DESKTOP_DIR" | ||||||
|  |  | ||||||
| # 复制二进制文件 |  | ||||||
| cp build/linux/x86_64/release/crossdesk "$BIN_DIR" | cp build/linux/x86_64/release/crossdesk "$BIN_DIR" | ||||||
|  |  | ||||||
| # 复制证书文件(将来通过 postinst 拷贝到每个用户 XDG_CONFIG_HOME) |  | ||||||
| cp certs/crossdesk.cn_root.crt "$CERT_SRC_DIR/crossdesk.cn_root.crt" | cp certs/crossdesk.cn_root.crt "$CERT_SRC_DIR/crossdesk.cn_root.crt" | ||||||
|  |  | ||||||
| # 复制图标文件 |  | ||||||
| cp icons/crossdesk.png "$ICON_DIR/crossdesk.png" | cp icons/crossdesk.png "$ICON_DIR/crossdesk.png" | ||||||
|  |  | ||||||
| # 设置可执行权限 |  | ||||||
| chmod +x "$BIN_DIR/crossdesk" | chmod +x "$BIN_DIR/crossdesk" | ||||||
|  |  | ||||||
| # 创建 control 文件 |  | ||||||
| cat > "$DEBIAN_DIR/control" << EOF | cat > "$DEBIAN_DIR/control" << EOF | ||||||
| Package: $APP_NAME | Package: $APP_NAME | ||||||
| Version: $APP_VERSION | Version: $APP_VERSION | ||||||
| @@ -49,7 +38,6 @@ Priority: optional | |||||||
| Section: utils | Section: utils | ||||||
| EOF | EOF | ||||||
|  |  | ||||||
| # 创建 desktop 文件 |  | ||||||
| cat > "$DESKTOP_DIR/$APP_NAME.desktop" << EOF | cat > "$DESKTOP_DIR/$APP_NAME.desktop" << EOF | ||||||
| [Desktop Entry] | [Desktop Entry] | ||||||
| Version=$APP_VERSION | Version=$APP_VERSION | ||||||
| @@ -62,7 +50,6 @@ Type=Application | |||||||
| Categories=Utility; | Categories=Utility; | ||||||
| EOF | EOF | ||||||
|  |  | ||||||
| # 创建卸载脚本 postrm |  | ||||||
| cat > "$DEBIAN_DIR/postrm" << EOF | cat > "$DEBIAN_DIR/postrm" << EOF | ||||||
| #!/bin/bash | #!/bin/bash | ||||||
| # post-removal script for $APP_NAME | # post-removal script for $APP_NAME | ||||||
| @@ -81,7 +68,6 @@ EOF | |||||||
|  |  | ||||||
| chmod +x "$DEBIAN_DIR/postrm" | chmod +x "$DEBIAN_DIR/postrm" | ||||||
|  |  | ||||||
| # 创建安装后脚本 postinst(拷贝证书到每个用户 XDG_CONFIG_HOME) |  | ||||||
| cat > "$DEBIAN_DIR/postinst" << 'EOF' | cat > "$DEBIAN_DIR/postinst" << 'EOF' | ||||||
| #!/bin/bash | #!/bin/bash | ||||||
| set -e | set -e | ||||||
| @@ -89,7 +75,6 @@ set -e | |||||||
| CERT_SRC="/opt/CrossDesk/certs" | CERT_SRC="/opt/CrossDesk/certs" | ||||||
| CERT_FILE="crossdesk.cn_root.crt" | CERT_FILE="crossdesk.cn_root.crt" | ||||||
|  |  | ||||||
| # 处理每个普通用户的配置目录 |  | ||||||
| for user_home in /home/*; do | for user_home in /home/*; do | ||||||
|     [ -d "$user_home" ] || continue |     [ -d "$user_home" ] || continue | ||||||
|     username=$(basename "$user_home") |     username=$(basename "$user_home") | ||||||
| @@ -104,7 +89,6 @@ for user_home in /home/*; do | |||||||
|     fi |     fi | ||||||
| done | done | ||||||
|  |  | ||||||
| # 处理 root 用户(可选) |  | ||||||
| if [ -d "/root" ]; then | if [ -d "/root" ]; then | ||||||
|     config_dir="/root/.config/CrossDesk/certs" |     config_dir="/root/.config/CrossDesk/certs" | ||||||
|     mkdir -p "$config_dir" |     mkdir -p "$config_dir" | ||||||
| @@ -117,10 +101,11 @@ EOF | |||||||
|  |  | ||||||
| chmod +x "$DEBIAN_DIR/postinst" | chmod +x "$DEBIAN_DIR/postinst" | ||||||
|  |  | ||||||
| # 构建 .deb 包 |  | ||||||
| dpkg-deb --build "$DEB_DIR" | dpkg-deb --build "$DEB_DIR" | ||||||
|  |  | ||||||
| # 清理构建目录 | OUTPUT_FILE="crossdesk-linux-x86_64-$APP_VERSION.deb" | ||||||
|  | mv "$DEB_DIR.deb" "$OUTPUT_FILE" | ||||||
|  |  | ||||||
| rm -rf "$DEB_DIR" | rm -rf "$DEB_DIR" | ||||||
|  |  | ||||||
| echo "✅ Deb package for $APP_NAME created successfully." | echo "✅ Deb package for $APP_NAME created successfully." | ||||||
| @@ -5,7 +5,7 @@ set -e  # 遇错退出 | |||||||
| APP_NAME="crossdesk" | APP_NAME="crossdesk" | ||||||
| APP_NAME_UPPER="CrossDesk"  # 这个变量用来指定大写的应用名 | APP_NAME_UPPER="CrossDesk"  # 这个变量用来指定大写的应用名 | ||||||
| EXECUTABLE_PATH="./build/macosx/arm64/release/crossdesk"             # 可执行文件路径 | EXECUTABLE_PATH="./build/macosx/arm64/release/crossdesk"             # 可执行文件路径 | ||||||
| APP_VERSION="0.0.1" | APP_VERSION="$1" | ||||||
| PLATFORM="macos" | PLATFORM="macos" | ||||||
| ARCH="arm64" | ARCH="arm64" | ||||||
| IDENTIFIER="cn.crossdesk.app" | IDENTIFIER="cn.crossdesk.app" | ||||||
| @@ -20,8 +20,8 @@ CONTENTS_DIR="${APP_BUNDLE}/Contents" | |||||||
| MACOS_DIR="${CONTENTS_DIR}/MacOS" | MACOS_DIR="${CONTENTS_DIR}/MacOS" | ||||||
| RESOURCES_DIR="${CONTENTS_DIR}/Resources" | RESOURCES_DIR="${CONTENTS_DIR}/Resources" | ||||||
|  |  | ||||||
| PKG_NAME="${APP_NAME}-${PLATFORM}-${ARCH}-v${APP_VERSION}.pkg"  # 保持安装包名称小写 | PKG_NAME="${APP_NAME}-${PLATFORM}-${ARCH}-${APP_VERSION}.pkg"  # 保持安装包名称小写 | ||||||
| DMG_NAME="${APP_NAME}-${PLATFORM}-${ARCH}-v${APP_VERSION}.dmg" | DMG_NAME="${APP_NAME}-${PLATFORM}-${ARCH}-${APP_VERSION}.dmg" | ||||||
| VOL_NAME="Install ${APP_NAME_UPPER}" | VOL_NAME="Install ${APP_NAME_UPPER}" | ||||||
|  |  | ||||||
| # === 清理旧文件 === | # === 清理旧文件 === | ||||||
| @@ -135,18 +135,18 @@ productbuild \ | |||||||
| echo "✅ 生成安装包完成:${PKG_NAME}" | echo "✅ 生成安装包完成:${PKG_NAME}" | ||||||
|  |  | ||||||
| # === 可选:打包成 DMG === | # === 可选:打包成 DMG === | ||||||
| echo "📦 可选打包成 DMG..." | # echo "📦 可选打包成 DMG..." | ||||||
| mkdir -p CrossDesk_dmg_temp | # mkdir -p CrossDesk_dmg_temp | ||||||
| cp "${PKG_NAME}" CrossDesk_dmg_temp/ | # cp "${PKG_NAME}" CrossDesk_dmg_temp/ | ||||||
| ln -s /Applications CrossDesk_dmg_temp/Applications | # ln -s /Applications CrossDesk_dmg_temp/Applications | ||||||
|  |  | ||||||
| hdiutil create -volname "${VOL_NAME}" \ | # hdiutil create -volname "${VOL_NAME}" \ | ||||||
|   -srcfolder CrossDesk_dmg_temp \ | #   -srcfolder CrossDesk_dmg_temp \ | ||||||
|   -ov -format UDZO "${DMG_NAME}" | #   -ov -format UDZO "${DMG_NAME}" | ||||||
|  |  | ||||||
| rm -rf CrossDesk_dmg_temp build_pkg_temp scripts ${APP_BUNDLE} ${DMG_NAME} | rm -rf build_pkg_temp scripts ${APP_BUNDLE} | ||||||
|  |  | ||||||
| echo "🎉 所有打包完成:" | echo "🎉 所有打包完成:" | ||||||
| echo "   ✔️ 应用:${APP_BUNDLE}" | echo "   ✔️ 应用:${APP_BUNDLE}" | ||||||
| echo "   ✔️ 安装包:${PKG_NAME}" | echo "   ✔️ 安装包:${PKG_NAME}" | ||||||
| echo "   ✔️ 镜像包(可选):${DMG_NAME}" | # echo "   ✔️ 镜像包(可选):${DMG_NAME}" | ||||||
| @@ -5,7 +5,7 @@ set -e  # 遇错退出 | |||||||
| APP_NAME="crossdesk" | APP_NAME="crossdesk" | ||||||
| APP_NAME_UPPER="CrossDesk"  # 这个变量用来指定大写的应用名 | APP_NAME_UPPER="CrossDesk"  # 这个变量用来指定大写的应用名 | ||||||
| EXECUTABLE_PATH="build/macosx/x86_64/release/crossdesk"             # 可执行文件路径 | EXECUTABLE_PATH="build/macosx/x86_64/release/crossdesk"             # 可执行文件路径 | ||||||
| APP_VERSION="0.0.1" | APP_VERSION="$1" | ||||||
| PLATFORM="macos" | PLATFORM="macos" | ||||||
| ARCH="x86_64" | ARCH="x86_64" | ||||||
| IDENTIFIER="cn.crossdesk.app" | IDENTIFIER="cn.crossdesk.app" | ||||||
| @@ -20,8 +20,8 @@ CONTENTS_DIR="${APP_BUNDLE}/Contents" | |||||||
| MACOS_DIR="${CONTENTS_DIR}/MacOS" | MACOS_DIR="${CONTENTS_DIR}/MacOS" | ||||||
| RESOURCES_DIR="${CONTENTS_DIR}/Resources" | RESOURCES_DIR="${CONTENTS_DIR}/Resources" | ||||||
|  |  | ||||||
| PKG_NAME="${APP_NAME}-${PLATFORM}-${ARCH}-v${APP_VERSION}.pkg"  # 保持安装包名称小写 | PKG_NAME="${APP_NAME}-${PLATFORM}-${ARCH}-${APP_VERSION}.pkg"  # 保持安装包名称小写 | ||||||
| DMG_NAME="${APP_NAME}-${PLATFORM}-${ARCH}-v${APP_VERSION}.dmg" | DMG_NAME="${APP_NAME}-${PLATFORM}-${ARCH}-${APP_VERSION}.dmg" | ||||||
| VOL_NAME="Install ${APP_NAME_UPPER}" | VOL_NAME="Install ${APP_NAME_UPPER}" | ||||||
|  |  | ||||||
| # === 清理旧文件 === | # === 清理旧文件 === | ||||||
| @@ -135,18 +135,18 @@ productbuild \ | |||||||
| echo "✅ 生成安装包完成:${PKG_NAME}" | echo "✅ 生成安装包完成:${PKG_NAME}" | ||||||
|  |  | ||||||
| # === 可选:打包成 DMG === | # === 可选:打包成 DMG === | ||||||
| echo "📦 可选打包成 DMG..." | # echo "📦 可选打包成 DMG..." | ||||||
| mkdir -p CrossDesk_dmg_temp | # mkdir -p CrossDesk_dmg_temp | ||||||
| cp "${PKG_NAME}" CrossDesk_dmg_temp/ | # cp "${PKG_NAME}" CrossDesk_dmg_temp/ | ||||||
| ln -s /Applications CrossDesk_dmg_temp/Applications | # ln -s /Applications CrossDesk_dmg_temp/Applications | ||||||
|  |  | ||||||
| hdiutil create -volname "${VOL_NAME}" \ | # hdiutil create -volname "${VOL_NAME}" \ | ||||||
|   -srcfolder CrossDesk_dmg_temp \ | #   -srcfolder CrossDesk_dmg_temp \ | ||||||
|   -ov -format UDZO "${DMG_NAME}" | #   -ov -format UDZO "${DMG_NAME}" | ||||||
|  |  | ||||||
| rm -rf CrossDesk_dmg_temp build_pkg_temp scripts ${APP_BUNDLE} ${DMG_NAME} | rm -rf build_pkg_temp scripts ${APP_BUNDLE} | ||||||
|  |  | ||||||
| echo "🎉 所有打包完成:" | echo "🎉 所有打包完成:" | ||||||
| echo "   ✔️ 应用:${APP_BUNDLE}" | echo "   ✔️ 应用:${APP_BUNDLE}" | ||||||
| echo "   ✔️ 安装包:${PKG_NAME}" | echo "   ✔️ 安装包:${PKG_NAME}" | ||||||
| echo "   ✔️ 镜像包(可选):${DMG_NAME}" | # echo "   ✔️ 镜像包(可选):${DMG_NAME}" | ||||||
| @@ -3,7 +3,7 @@ | |||||||
|  |  | ||||||
| ; <20><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>峣<EFBFBD><E5B3A3> | ; <20><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>峣<EFBFBD><E5B3A3> | ||||||
| !define PRODUCT_NAME "CrossDesk" | !define PRODUCT_NAME "CrossDesk" | ||||||
| !define PRODUCT_VERSION "0.0.1" | !define PRODUCT_VERSION "${VERSION}" | ||||||
| !define PRODUCT_PUBLISHER "CrossDesk" | !define PRODUCT_PUBLISHER "CrossDesk" | ||||||
| !define PRODUCT_WEB_SITE "https://www.crossdesk.cn/" | !define PRODUCT_WEB_SITE "https://www.crossdesk.cn/" | ||||||
| !define APP_NAME "CrossDesk" | !define APP_NAME "CrossDesk" | ||||||
| @@ -33,7 +33,7 @@ RequestExecutionLevel admin | |||||||
| ; ------ MUI <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ------ | ; ------ MUI <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ------ | ||||||
|  |  | ||||||
| Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" | Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" | ||||||
| OutFile "CrossDesk-${PRODUCT_VERSION}.exe" | OutFile "crossdesk-win-x86_64-${PRODUCT_VERSION}.exe" | ||||||
| InstallDir "$PROGRAMFILES\CrossDesk" | InstallDir "$PROGRAMFILES\CrossDesk" | ||||||
| ShowInstDetails show | ShowInstDetails show | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,177 +3,169 @@ | |||||||
| #include "rd_log.h" | #include "rd_log.h" | ||||||
| #include "render.h" | #include "render.h" | ||||||
|  |  | ||||||
| int Render::ConnectionStatusWindow( | bool Render::ConnectionStatusWindow( | ||||||
|     std::shared_ptr<SubStreamWindowProperties> &props) { |     std::shared_ptr<SubStreamWindowProperties> &props) { | ||||||
|   if (show_connection_status_window_) { |   const ImGuiViewport *viewport = ImGui::GetMainViewport(); | ||||||
|     const ImGuiViewport *viewport = ImGui::GetMainViewport(); |   bool ret_flag = false; | ||||||
|  |   ImGui::SetNextWindowPos(ImVec2((viewport->WorkSize.x - viewport->WorkPos.x - | ||||||
|  |                                   connection_status_window_width_) / | ||||||
|  |                                      2, | ||||||
|  |                                  (viewport->WorkSize.y - viewport->WorkPos.y - | ||||||
|  |                                   connection_status_window_height_) / | ||||||
|  |                                      2)); | ||||||
|  |  | ||||||
|     ImGui::SetNextWindowPos(ImVec2((viewport->WorkSize.x - viewport->WorkPos.x - |   ImGui::SetNextWindowSize(ImVec2(connection_status_window_width_, | ||||||
|                                     connection_status_window_width_) / |                                   connection_status_window_height_)); | ||||||
|                                        2, |  | ||||||
|                                    (viewport->WorkSize.y - viewport->WorkPos.y - |  | ||||||
|                                     connection_status_window_height_) / |  | ||||||
|                                        2)); |  | ||||||
|  |  | ||||||
|     ImGui::SetNextWindowSize(ImVec2(connection_status_window_width_, |   ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f); | ||||||
|                                     connection_status_window_height_)); |  | ||||||
|  |  | ||||||
|     ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f); |   ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(1.0, 1.0, 1.0, 1.0)); | ||||||
|  |   ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 1.0f); | ||||||
|  |   ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 5.0f); | ||||||
|  |  | ||||||
|     ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(1.0, 1.0, 1.0, 1.0)); |   ImGui::Begin("ConnectionStatusWindow", nullptr, | ||||||
|     ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 1.0f); |                ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | | ||||||
|     ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 5.0f); |                    ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | | ||||||
|  |                    ImGuiWindowFlags_NoSavedSettings); | ||||||
|  |   ImGui::PopStyleVar(2); | ||||||
|  |   ImGui::PopStyleColor(); | ||||||
|  |  | ||||||
|     ImGui::Begin("ConnectionStatusWindow", nullptr, |   ImGui::SetWindowFontScale(0.5f); | ||||||
|                  ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | |   std::string text; | ||||||
|                      ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | |  | ||||||
|                      ImGuiWindowFlags_NoSavedSettings); |  | ||||||
|     ImGui::PopStyleVar(2); |  | ||||||
|     ImGui::PopStyleColor(); |  | ||||||
|  |  | ||||||
|     ImGui::SetWindowFontScale(0.5f); |   if (ConnectionStatus::Connecting == props->connection_status_) { | ||||||
|     std::string text; |     text = localization::p2p_connecting[localization_language_index_]; | ||||||
|  |     ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7); | ||||||
|     if (ConnectionStatus::Connecting == props->connection_status_) { |     ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3); | ||||||
|       text = localization::p2p_connecting[localization_language_index_]; |   } else if (ConnectionStatus::Connected == props->connection_status_) { | ||||||
|       ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7); |     text = localization::p2p_connected[localization_language_index_]; | ||||||
|       ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3); |     ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7); | ||||||
|     } else if (ConnectionStatus::Connected == props->connection_status_) { |     ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3); | ||||||
|       text = localization::p2p_connected[localization_language_index_]; |     // ok | ||||||
|       ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7); |     if (ImGui::Button(localization::ok[localization_language_index_].c_str()) || | ||||||
|       ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3); |         ImGui::IsKeyPressed(ImGuiKey_Enter) || | ||||||
|       // ok |         ImGui::IsKeyPressed(ImGuiKey_Escape)) { | ||||||
|       if (ImGui::Button( |       show_connection_status_window_ = false; | ||||||
|               localization::ok[localization_language_index_].c_str()) || |     } | ||||||
|           ImGui::IsKeyPressed(ImGuiKey_Enter) || |   } else if (ConnectionStatus::Disconnected == props->connection_status_) { | ||||||
|           ImGui::IsKeyPressed(ImGuiKey_Escape)) { |     text = localization::p2p_disconnected[localization_language_index_]; | ||||||
|         show_connection_status_window_ = false; |     ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7); | ||||||
|  |     ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3); | ||||||
|  |     // ok | ||||||
|  |     if (ImGui::Button(localization::ok[localization_language_index_].c_str()) || | ||||||
|  |         ImGui::IsKeyPressed(ImGuiKey_Enter) || | ||||||
|  |         ImGui::IsKeyPressed(ImGuiKey_Escape)) { | ||||||
|  |       show_connection_status_window_ = false; | ||||||
|  |     } | ||||||
|  |   } else if (ConnectionStatus::Failed == props->connection_status_) { | ||||||
|  |     text = localization::p2p_failed[localization_language_index_]; | ||||||
|  |     ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7); | ||||||
|  |     ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3); | ||||||
|  |     // ok | ||||||
|  |     if (ImGui::Button(localization::ok[localization_language_index_].c_str()) || | ||||||
|  |         ImGui::IsKeyPressed(ImGuiKey_Enter) || | ||||||
|  |         ImGui::IsKeyPressed(ImGuiKey_Escape)) { | ||||||
|  |       show_connection_status_window_ = false; | ||||||
|  |     } | ||||||
|  |   } else if (ConnectionStatus::Closed == props->connection_status_) { | ||||||
|  |     text = localization::p2p_closed[localization_language_index_]; | ||||||
|  |     ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7); | ||||||
|  |     ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3); | ||||||
|  |     // ok | ||||||
|  |     if (ImGui::Button(localization::ok[localization_language_index_].c_str()) || | ||||||
|  |         ImGui::IsKeyPressed(ImGuiKey_Enter) || | ||||||
|  |         ImGui::IsKeyPressed(ImGuiKey_Escape)) { | ||||||
|  |       show_connection_status_window_ = false; | ||||||
|  |     } | ||||||
|  |   } else if (ConnectionStatus::IncorrectPassword == props->connection_status_) { | ||||||
|  |     if (!password_validating_) { | ||||||
|  |       if (password_validating_time_ == 1) { | ||||||
|  |         text = localization::input_password[localization_language_index_]; | ||||||
|  |       } else { | ||||||
|  |         text = localization::reinput_password[localization_language_index_]; | ||||||
|       } |       } | ||||||
|     } else if (ConnectionStatus::Disconnected == props->connection_status_) { |  | ||||||
|       text = localization::p2p_disconnected[localization_language_index_]; |       auto window_width = ImGui::GetWindowSize().x; | ||||||
|       ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7); |       auto window_height = ImGui::GetWindowSize().y; | ||||||
|       ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3); |       ImGui::SetCursorPosX((window_width - IPUT_WINDOW_WIDTH / 2) * 0.5f); | ||||||
|       // ok |       ImGui::SetCursorPosY(window_height * 0.4f); | ||||||
|       if (ImGui::Button( |       ImGui::SetNextItemWidth(IPUT_WINDOW_WIDTH / 2); | ||||||
|               localization::ok[localization_language_index_].c_str()) || |  | ||||||
|           ImGui::IsKeyPressed(ImGuiKey_Enter) || |       ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); | ||||||
|           ImGui::IsKeyPressed(ImGuiKey_Escape)) { |  | ||||||
|         show_connection_status_window_ = false; |       if (focus_on_input_widget_) { | ||||||
|  |         ImGui::SetKeyboardFocusHere(); | ||||||
|  |         focus_on_input_widget_ = false; | ||||||
|       } |       } | ||||||
|     } else if (ConnectionStatus::Failed == props->connection_status_) { |  | ||||||
|       text = localization::p2p_failed[localization_language_index_]; |  | ||||||
|       ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7); |  | ||||||
|       ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3); |  | ||||||
|       // ok |  | ||||||
|       if (ImGui::Button( |  | ||||||
|               localization::ok[localization_language_index_].c_str()) || |  | ||||||
|           ImGui::IsKeyPressed(ImGuiKey_Enter) || |  | ||||||
|           ImGui::IsKeyPressed(ImGuiKey_Escape)) { |  | ||||||
|         show_connection_status_window_ = false; |  | ||||||
|       } |  | ||||||
|     } else if (ConnectionStatus::Closed == props->connection_status_) { |  | ||||||
|       text = localization::p2p_closed[localization_language_index_]; |  | ||||||
|       ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7); |  | ||||||
|       ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3); |  | ||||||
|       // ok |  | ||||||
|       if (ImGui::Button( |  | ||||||
|               localization::ok[localization_language_index_].c_str()) || |  | ||||||
|           ImGui::IsKeyPressed(ImGuiKey_Enter) || |  | ||||||
|           ImGui::IsKeyPressed(ImGuiKey_Escape)) { |  | ||||||
|         show_connection_status_window_ = false; |  | ||||||
|       } |  | ||||||
|     } else if (ConnectionStatus::IncorrectPassword == |  | ||||||
|                props->connection_status_) { |  | ||||||
|       if (!password_validating_) { |  | ||||||
|         if (password_validating_time_ == 1) { |  | ||||||
|           text = localization::input_password[localization_language_index_]; |  | ||||||
|         } else { |  | ||||||
|           text = localization::reinput_password[localization_language_index_]; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         auto window_width = ImGui::GetWindowSize().x; |       ImGui::InputText("##password", props->remote_password_, | ||||||
|         auto window_height = ImGui::GetWindowSize().y; |                        IM_ARRAYSIZE(props->remote_password_), | ||||||
|         ImGui::SetCursorPosX((window_width - IPUT_WINDOW_WIDTH / 2) * 0.5f); |                        ImGuiInputTextFlags_CharsNoBlank); | ||||||
|         ImGui::SetCursorPosY(window_height * 0.4f); |  | ||||||
|         ImGui::SetNextItemWidth(IPUT_WINDOW_WIDTH / 2); |  | ||||||
|  |  | ||||||
|         ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); |       ImGui::SetWindowFontScale(0.4f); | ||||||
|  |  | ||||||
|         if (focus_on_input_widget_) { |       ImVec2 text_size = ImGui::CalcTextSize( | ||||||
|           ImGui::SetKeyboardFocusHere(); |           localization::remember_password[localization_language_index_] | ||||||
|           focus_on_input_widget_ = false; |               .c_str()); | ||||||
|         } |       ImGui::SetCursorPosX((window_width - text_size.x) * 0.5f - 13.0f); | ||||||
|  |       ImGui::Checkbox( | ||||||
|  |           localization::remember_password[localization_language_index_].c_str(), | ||||||
|  |           &(props->remember_password_)); | ||||||
|  |       ImGui::SetWindowFontScale(0.5f); | ||||||
|  |       ImGui::PopStyleVar(); | ||||||
|  |  | ||||||
|         ImGui::InputText("##password", props->remote_password_, |       ImGui::SetCursorPosX(window_width * 0.315f); | ||||||
|                          IM_ARRAYSIZE(props->remote_password_), |       ImGui::SetCursorPosY(window_height * 0.75f); | ||||||
|                          ImGuiInputTextFlags_CharsNoBlank); |  | ||||||
|  |  | ||||||
|         ImGui::SetWindowFontScale(0.4f); |  | ||||||
|  |  | ||||||
|         ImVec2 text_size = ImGui::CalcTextSize( |  | ||||||
|             localization::remember_password[localization_language_index_] |  | ||||||
|                 .c_str()); |  | ||||||
|         ImGui::SetCursorPosX((window_width - text_size.x) * 0.5f - 13.0f); |  | ||||||
|         ImGui::Checkbox( |  | ||||||
|             localization::remember_password[localization_language_index_] |  | ||||||
|                 .c_str(), |  | ||||||
|             &(props->remember_password_)); |  | ||||||
|         ImGui::SetWindowFontScale(0.5f); |  | ||||||
|         ImGui::PopStyleVar(); |  | ||||||
|  |  | ||||||
|         ImGui::SetCursorPosX(window_width * 0.315f); |  | ||||||
|         ImGui::SetCursorPosY(window_height * 0.75f); |  | ||||||
|         // ok |  | ||||||
|         if (ImGui::Button( |  | ||||||
|                 localization::ok[localization_language_index_].c_str()) || |  | ||||||
|             ImGui::IsKeyPressed(ImGuiKey_Enter)) { |  | ||||||
|           show_connection_status_window_ = true; |  | ||||||
|           password_validating_ = true; |  | ||||||
|           props->rejoin_ = true; |  | ||||||
|           need_to_rejoin_ = true; |  | ||||||
|           focus_on_input_widget_ = true; |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         ImGui::SameLine(); |  | ||||||
|         // cancel |  | ||||||
|         if (ImGui::Button( |  | ||||||
|                 localization::cancel[localization_language_index_].c_str()) || |  | ||||||
|             ImGui::IsKeyPressed(ImGuiKey_Escape)) { |  | ||||||
|           memset(props->remote_password_, 0, sizeof(props->remote_password_)); |  | ||||||
|           show_connection_status_window_ = false; |  | ||||||
|           focus_on_input_widget_ = true; |  | ||||||
|         } |  | ||||||
|       } else if (password_validating_) { |  | ||||||
|         text = localization::validate_password[localization_language_index_]; |  | ||||||
|         ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7); |  | ||||||
|         ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3); |  | ||||||
|       } |  | ||||||
|     } else if (ConnectionStatus::NoSuchTransmissionId == |  | ||||||
|                props->connection_status_) { |  | ||||||
|       text = localization::no_such_id[localization_language_index_]; |  | ||||||
|       ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7); |  | ||||||
|       ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3); |  | ||||||
|       // ok |       // ok | ||||||
|       if (ImGui::Button( |       if (ImGui::Button( | ||||||
|               localization::ok[localization_language_index_].c_str()) || |               localization::ok[localization_language_index_].c_str()) || | ||||||
|           ImGui::IsKeyPressed(ImGuiKey_Enter)) { |           ImGui::IsKeyPressed(ImGuiKey_Enter)) { | ||||||
|         show_connection_status_window_ = false; |         show_connection_status_window_ = true; | ||||||
|         re_enter_remote_id_ = true; |         password_validating_ = true; | ||||||
|         DestroyPeer(&props->peer_); |         props->rejoin_ = true; | ||||||
|         client_properties_.erase(props->remote_id_); |         need_to_rejoin_ = true; | ||||||
|  |         focus_on_input_widget_ = true; | ||||||
|       } |       } | ||||||
|  |  | ||||||
|  |       ImGui::SameLine(); | ||||||
|  |       // cancel | ||||||
|  |       if (ImGui::Button( | ||||||
|  |               localization::cancel[localization_language_index_].c_str()) || | ||||||
|  |           ImGui::IsKeyPressed(ImGuiKey_Escape)) { | ||||||
|  |         memset(props->remote_password_, 0, sizeof(props->remote_password_)); | ||||||
|  |         show_connection_status_window_ = false; | ||||||
|  |         focus_on_input_widget_ = true; | ||||||
|  |       } | ||||||
|  |     } else if (password_validating_) { | ||||||
|  |       text = localization::validate_password[localization_language_index_]; | ||||||
|  |       ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7); | ||||||
|  |       ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3); | ||||||
|  |     } | ||||||
|  |   } else if (ConnectionStatus::NoSuchTransmissionId == | ||||||
|  |              props->connection_status_) { | ||||||
|  |     text = localization::no_such_id[localization_language_index_]; | ||||||
|  |     ImGui::SetCursorPosX(connection_status_window_width_ * 3 / 7); | ||||||
|  |     ImGui::SetCursorPosY(connection_status_window_height_ * 2 / 3); | ||||||
|  |     // ok | ||||||
|  |     if (ImGui::Button(localization::ok[localization_language_index_].c_str()) || | ||||||
|  |         ImGui::IsKeyPressed(ImGuiKey_Enter)) { | ||||||
|  |       show_connection_status_window_ = false; | ||||||
|  |       re_enter_remote_id_ = true; | ||||||
|  |       DestroyPeer(&props->peer_); | ||||||
|  |       ret_flag = true; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     auto window_width = ImGui::GetWindowSize().x; |  | ||||||
|     auto window_height = ImGui::GetWindowSize().y; |  | ||||||
|     auto text_width = ImGui::CalcTextSize(text.c_str()).x; |  | ||||||
|     ImGui::SetCursorPosX((window_width - text_width) * 0.5f); |  | ||||||
|     ImGui::SetCursorPosY(window_height * 0.2f); |  | ||||||
|     ImGui::Text("%s", text.c_str()); |  | ||||||
|     ImGui::SetWindowFontScale(1.0f); |  | ||||||
|  |  | ||||||
|     ImGui::End(); |  | ||||||
|     ImGui::PopStyleVar(); |  | ||||||
|   } |   } | ||||||
|   return 0; |  | ||||||
|  |   auto window_width = ImGui::GetWindowSize().x; | ||||||
|  |   auto window_height = ImGui::GetWindowSize().y; | ||||||
|  |   auto text_width = ImGui::CalcTextSize(text.c_str()).x; | ||||||
|  |   ImGui::SetCursorPosX((window_width - text_width) * 0.5f); | ||||||
|  |   ImGui::SetCursorPosY(window_height * 0.2f); | ||||||
|  |   ImGui::Text("%s", text.c_str()); | ||||||
|  |   ImGui::SetWindowFontScale(1.0f); | ||||||
|  |  | ||||||
|  |   ImGui::End(); | ||||||
|  |   ImGui::PopStyleVar(); | ||||||
|  |  | ||||||
|  |   return ret_flag; | ||||||
| } | } | ||||||
| @@ -29,8 +29,20 @@ int Render::MainWindow() { | |||||||
|   RecentConnectionsWindow(); |   RecentConnectionsWindow(); | ||||||
|   StatusBar(); |   StatusBar(); | ||||||
|  |  | ||||||
|   for (auto& it : client_properties_) { |   if (show_connection_status_window_) { | ||||||
|     ConnectionStatusWindow(it.second); |     for (auto it = client_properties_.begin(); | ||||||
|  |          it != client_properties_.end();) { | ||||||
|  |       auto& props = it->second; | ||||||
|  |       if (focused_remote_id_ == props->remote_id_) { | ||||||
|  |         if (ConnectionStatusWindow(props)) { | ||||||
|  |           it = client_properties_.erase(it); | ||||||
|  |         } else { | ||||||
|  |           ++it; | ||||||
|  |         } | ||||||
|  |       } else { | ||||||
|  |         ++it; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   return 0; |   return 0; | ||||||
|   | |||||||
| @@ -132,6 +132,7 @@ static int InputTextCallback(ImGuiInputTextCallbackData *data) { | |||||||
| int Render::ConnectTo(const std::string &remote_id, const char *password, | int Render::ConnectTo(const std::string &remote_id, const char *password, | ||||||
|                       bool remember_password) { |                       bool remember_password) { | ||||||
|   LOG_INFO("Connect to [{}]", remote_id); |   LOG_INFO("Connect to [{}]", remote_id); | ||||||
|  |   focused_remote_id_ = remote_id; | ||||||
|  |  | ||||||
|   if (client_properties_.find(remote_id) == client_properties_.end()) { |   if (client_properties_.find(remote_id) == client_properties_.end()) { | ||||||
|     client_properties_[remote_id] = |     client_properties_[remote_id] = | ||||||
|   | |||||||
| @@ -1331,7 +1331,12 @@ void Render::ProcessSdlEvent() { | |||||||
|       case STREAM_FRASH: { |       case STREAM_FRASH: { | ||||||
|         auto* props = static_cast<SubStreamWindowProperties*>(event.user.data1); |         auto* props = static_cast<SubStreamWindowProperties*>(event.user.data1); | ||||||
|         if (!props) { |         if (!props) { | ||||||
|           LOG_ERROR("Invalid stream window properties"); |           continue; | ||||||
|  |         } | ||||||
|  |         if (props->video_width_ <= 0 || props->video_height_ <= 0) { | ||||||
|  |           continue; | ||||||
|  |         } | ||||||
|  |         if (!props->dst_buffer_) { | ||||||
|           continue; |           continue; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -151,7 +151,8 @@ class Render { | |||||||
|   int ControlBar(std::shared_ptr<SubStreamWindowProperties> &props); |   int ControlBar(std::shared_ptr<SubStreamWindowProperties> &props); | ||||||
|   int AboutWindow(); |   int AboutWindow(); | ||||||
|   int StatusBar(); |   int StatusBar(); | ||||||
|   int ConnectionStatusWindow(std::shared_ptr<SubStreamWindowProperties> &props); |   bool ConnectionStatusWindow( | ||||||
|  |       std::shared_ptr<SubStreamWindowProperties> &props); | ||||||
|   int ShowRecentConnections(); |   int ShowRecentConnections(); | ||||||
|  |  | ||||||
|  private: |  private: | ||||||
| @@ -342,6 +343,7 @@ class Render { | |||||||
|   bool need_to_rejoin_ = false; |   bool need_to_rejoin_ = false; | ||||||
|   bool just_created_ = false; |   bool just_created_ = false; | ||||||
|   std::string controlled_remote_id_ = ""; |   std::string controlled_remote_id_ = ""; | ||||||
|  |   std::string focused_remote_id_ = ""; | ||||||
|   bool need_to_send_host_info_ = false; |   bool need_to_send_host_info_ = false; | ||||||
|   SDL_Event last_mouse_event; |   SDL_Event last_mouse_event; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -114,6 +114,8 @@ int Render::StreamWindow() { | |||||||
|  |  | ||||||
|           ControlWindow(props); |           ControlWindow(props); | ||||||
|  |  | ||||||
|  |           focused_remote_id_ = props->remote_id_; | ||||||
|  |  | ||||||
|           if (!props->peer_) { |           if (!props->peer_) { | ||||||
|             it = client_properties_.erase(it); |             it = client_properties_.erase(it); | ||||||
|             if (client_properties_.empty()) { |             if (client_properties_.empty()) { | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								thirdparty/minirtc
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								thirdparty/minirtc
									
									
									
									
										vendored
									
									
								
							 Submodule thirdparty/minirtc updated: 2f4b928649...a994632740
									
								
							
		Reference in New Issue
	
	Block a user