mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-12-21 23:19:08 +08:00
Compare commits
1 Commits
76b475450b
...
v1.1.5-202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3c905d175 |
95
.github/workflows/update-version-json.yml
vendored
95
.github/workflows/update-version-json.yml
vendored
@@ -73,59 +73,68 @@ jobs:
|
|||||||
curl -f -s "https://version.crossdesk.cn/version.json" -o version.json || echo "Failed to download, will create new one"
|
curl -f -s "https://version.crossdesk.cn/version.json" -o version.json || echo "Failed to download, will create new one"
|
||||||
|
|
||||||
- name: Generate or update version.json
|
- name: Generate or update version.json
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
TAG_NAME="${{ steps.version.outputs.TAG_NAME }}"
|
||||||
|
VERSION_ONLY="${{ steps.version.outputs.VERSION_ONLY }}"
|
||||||
|
BUILD_DATE_ISO="${{ steps.version.outputs.BUILD_DATE_ISO }}"
|
||||||
|
RELEASE_NAME_JSON="${{ steps.release_info.outputs.RELEASE_NAME }}"
|
||||||
|
RELEASE_BODY_JSON="${{ steps.release_info.outputs.RELEASE_BODY }}"
|
||||||
|
|
||||||
|
# Default downloads structure - use jq to build JSON safely
|
||||||
|
DEFAULT_DOWNLOADS=$(jq -n \
|
||||||
|
--arg tag "${TAG_NAME}" \
|
||||||
|
'{
|
||||||
|
"windows-x64": {
|
||||||
|
"url": ("https://downloads.crossdesk.cn/crossdesk-win-x64-" + $tag + ".exe"),
|
||||||
|
"filename": ("crossdesk-win-x64-" + $tag + ".exe")
|
||||||
|
},
|
||||||
|
"macos-x64": {
|
||||||
|
"url": ("https://downloads.crossdesk.cn/crossdesk-macos-x64-" + $tag + ".pkg"),
|
||||||
|
"filename": ("crossdesk-macos-x64-" + $tag + ".pkg")
|
||||||
|
},
|
||||||
|
"macos-arm64": {
|
||||||
|
"url": ("https://downloads.crossdesk.cn/crossdesk-macos-arm64-" + $tag + ".pkg"),
|
||||||
|
"filename": ("crossdesk-macos-arm64-" + $tag + ".pkg")
|
||||||
|
},
|
||||||
|
"linux-amd64": {
|
||||||
|
"url": ("https://downloads.crossdesk.cn/crossdesk-linux-amd64-" + $tag + ".deb"),
|
||||||
|
"filename": ("crossdesk-linux-amd64-" + $tag + ".deb")
|
||||||
|
},
|
||||||
|
"linux-arm64": {
|
||||||
|
"url": ("https://downloads.crossdesk.cn/crossdesk-linux-arm64-" + $tag + ".deb"),
|
||||||
|
"filename": ("crossdesk-linux-arm64-" + $tag + ".deb")
|
||||||
|
}
|
||||||
|
}')
|
||||||
|
|
||||||
# If version.json exists, try to preserve downloads section
|
# If version.json exists, try to preserve downloads section
|
||||||
if [ -f version.json ] && jq -e '.downloads' version.json > /dev/null 2>&1; then
|
if [ -f version.json ] && jq -e '.downloads' version.json > /dev/null 2>&1; then
|
||||||
EXISTING_DOWNLOADS=$(jq -c '.downloads' version.json)
|
EXISTING_DOWNLOADS=$(jq -c '.downloads' version.json)
|
||||||
if [ "$EXISTING_DOWNLOADS" != "null" ] && [ "$EXISTING_DOWNLOADS" != "{}" ]; then
|
if [ "$EXISTING_DOWNLOADS" != "null" ] && [ "$EXISTING_DOWNLOADS" != "{}" ]; then
|
||||||
DOWNLOADS_JSON="$EXISTING_DOWNLOADS"
|
DOWNLOADS="$EXISTING_DOWNLOADS"
|
||||||
else
|
else
|
||||||
DOWNLOADS_JSON=""
|
DOWNLOADS="$DEFAULT_DOWNLOADS"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
DOWNLOADS_JSON=""
|
DOWNLOADS="$DEFAULT_DOWNLOADS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If downloads is empty, use default structure
|
# Create version.json using jq for proper JSON formatting
|
||||||
if [ -z "$DOWNLOADS_JSON" ]; then
|
jq -n \
|
||||||
DOWNLOADS_JSON=$(cat << DOWNLOADS_EOF
|
--arg version "$VERSION_ONLY" \
|
||||||
{
|
--arg releaseDate "$BUILD_DATE_ISO" \
|
||||||
"windows-x64": {
|
--argjson releaseName "$RELEASE_NAME_JSON" \
|
||||||
"url": "https://downloads.crossdesk.cn/crossdesk-win-x64-${{ steps.version.outputs.TAG_NAME }}.exe",
|
--argjson releaseNotes "$RELEASE_BODY_JSON" \
|
||||||
"filename": "crossdesk-win-x64-${{ steps.version.outputs.TAG_NAME }}.exe"
|
--arg tagName "$TAG_NAME" \
|
||||||
},
|
--argjson downloads "$DOWNLOADS" \
|
||||||
"macos-x64": {
|
'{
|
||||||
"url": "https://downloads.crossdesk.cn/crossdesk-macos-x64-${{ steps.version.outputs.TAG_NAME }}.pkg",
|
version: $version,
|
||||||
"filename": "crossdesk-macos-x64-${{ steps.version.outputs.TAG_NAME }}.pkg"
|
releaseDate: $releaseDate,
|
||||||
},
|
releaseName: $releaseName,
|
||||||
"macos-arm64": {
|
releaseNotes: $releaseNotes,
|
||||||
"url": "https://downloads.crossdesk.cn/crossdesk-macos-arm64-${{ steps.version.outputs.TAG_NAME }}.pkg",
|
tagName: $tagName,
|
||||||
"filename": "crossdesk-macos-arm64-${{ steps.version.outputs.TAG_NAME }}.pkg"
|
downloads: $downloads
|
||||||
},
|
}' > version.json
|
||||||
"linux-amd64": {
|
|
||||||
"url": "https://downloads.crossdesk.cn/crossdesk-linux-amd64-${{ steps.version.outputs.TAG_NAME }}.deb",
|
|
||||||
"filename": "crossdesk-linux-amd64-${{ steps.version.outputs.TAG_NAME }}.deb"
|
|
||||||
},
|
|
||||||
"linux-arm64": {
|
|
||||||
"url": "https://downloads.crossdesk.cn/crossdesk-linux-arm64-${{ steps.version.outputs.TAG_NAME }}.deb",
|
|
||||||
"filename": "crossdesk-linux-arm64-${{ steps.version.outputs.TAG_NAME }}.deb"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DOWNLOADS_EOF
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Generate version.json using cat and heredoc
|
|
||||||
cat > version.json << EOF
|
|
||||||
{
|
|
||||||
"version": "${{ steps.version.outputs.VERSION_ONLY }}",
|
|
||||||
"releaseDate": "${{ steps.version.outputs.BUILD_DATE_ISO }}",
|
|
||||||
"releaseName": ${{ steps.release_info.outputs.RELEASE_NAME }},
|
|
||||||
"releaseNotes": ${{ steps.release_info.outputs.RELEASE_BODY }},
|
|
||||||
"tagName": "${{ steps.version.outputs.TAG_NAME }}",
|
|
||||||
"downloads": ${DOWNLOADS_JSON}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat version.json
|
cat version.json
|
||||||
|
|
||||||
|
|||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,10 +1,10 @@
|
|||||||
# Xmake cache
|
# Xmake cache
|
||||||
.xmake/
|
.xmake/
|
||||||
build/
|
build/
|
||||||
certs/
|
|
||||||
|
|
||||||
# MacOS Cache
|
# MacOS Cache
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
# VSCode cache
|
# VSCode cache
|
||||||
.vscode
|
.vscode
|
||||||
|
continuous-desk.code-workspace
|
||||||
@@ -315,10 +315,10 @@ Generation complete. Deployment files::
|
|||||||
Server certificate: crossdesk.cn_bundle.crt
|
Server certificate: crossdesk.cn_bundle.crt
|
||||||
```
|
```
|
||||||
|
|
||||||
### 服务端
|
#### 服务端
|
||||||
将 **crossdesk.cn.key** 和 **crossdesk.cn_bundle.crt** 放置到 **/path/to/your/certs** 目录下。
|
将 **crossdesk.cn.key** 和 **crossdesk.cn_bundle.crt** 放置到 **/path/to/your/certs** 目录下。
|
||||||
|
|
||||||
### 客户端
|
#### 客户端
|
||||||
1. 点击右上角设置进入设置页面。<br>
|
1. 点击右上角设置进入设置页面。<br>
|
||||||
<img width="600" height="210" alt="image" src="https://github.com/user-attachments/assets/6431131d-b32a-4726-8783-6788f47baa3b" /><br><br>
|
<img width="600" height="210" alt="image" src="https://github.com/user-attachments/assets/6431131d-b32a-4726-8783-6788f47baa3b" /><br><br>
|
||||||
|
|
||||||
@@ -331,8 +331,5 @@ Generation complete. Deployment files::
|
|||||||
7. 勾选使用**自托管服务器配置**,点击确认配置生效。<br><br>
|
7. 勾选使用**自托管服务器配置**,点击确认配置生效。<br><br>
|
||||||
<img width="600" height="160" alt="image" src="https://github.com/user-attachments/assets/1e455dc3-4087-4f37-a544-1ff9f8789383" /><br><br>
|
<img width="600" height="160" alt="image" src="https://github.com/user-attachments/assets/1e455dc3-4087-4f37-a544-1ff9f8789383" /><br><br>
|
||||||
|
|
||||||
### Web 客户端
|
|
||||||
详情见项目 [CrossDesk Web Client](https://github.com/kunkundi/crossdesk-web-client)。
|
|
||||||
|
|
||||||
# 常见问题
|
# 常见问题
|
||||||
见 [常见问题](https://github.com/kunkundi/crossdesk/blob/self-hosted-server/docs/FAQ.md) 。
|
见 [常见问题](https://github.com/kunkundi/crossdesk/blob/self-hosted-server/docs/FAQ.md) 。
|
||||||
|
|||||||
@@ -323,10 +323,10 @@ Generation complete. Deployment files::
|
|||||||
Server certificate: crossdesk.cn_bundle.crt
|
Server certificate: crossdesk.cn_bundle.crt
|
||||||
```
|
```
|
||||||
|
|
||||||
### Server Side
|
#### Server Side
|
||||||
Place **crossdesk.cn.key** and **crossdesk.cn_bundle.crt** into the **/path/to/your/certs** directory.
|
Place **crossdesk.cn.key** and **crossdesk.cn_bundle.crt** into the **/path/to/your/certs** directory.
|
||||||
|
|
||||||
### Client Side
|
#### Client Side
|
||||||
1. Click the settings icon in the top-right corner to enter the settings page.<br>
|
1. Click the settings icon in the top-right corner to enter the settings page.<br>
|
||||||
<img width="600" height="210" alt="image" src="https://github.com/user-attachments/assets/6431131d-b32a-4726-8783-6788f47baa3b" /><br><br>
|
<img width="600" height="210" alt="image" src="https://github.com/user-attachments/assets/6431131d-b32a-4726-8783-6788f47baa3b" /><br><br>
|
||||||
|
|
||||||
@@ -339,8 +339,5 @@ Place **crossdesk.cn.key** and **crossdesk.cn_bundle.crt** into the **/path/to/y
|
|||||||
4. Check the option to use **Self-Hosted Server Configuration**.<br><br>
|
4. Check the option to use **Self-Hosted Server Configuration**.<br><br>
|
||||||
<img width="600" height="160" alt="image" src="https://github.com/user-attachments/assets/1e455dc3-4087-4f37-a544-1ff9f8789383" /><br><br>
|
<img width="600" height="160" alt="image" src="https://github.com/user-attachments/assets/1e455dc3-4087-4f37-a544-1ff9f8789383" /><br><br>
|
||||||
|
|
||||||
### Web Client
|
|
||||||
See [CrossDesk Web Client](https://github.com/kunkundi/crossdesk-web-client)。
|
|
||||||
|
|
||||||
# FAQ
|
# FAQ
|
||||||
See [FAQ](https://github.com/kunkundi/crosssesk/blob/self-hosted-server/docs/FAQ.md) .
|
See [FAQ](https://github.com/kunkundi/crosssesk/blob/self-hosted-server/docs/FAQ.md) .
|
||||||
|
|||||||
@@ -86,9 +86,9 @@ pkgbuild \
|
|||||||
--component "${APP_BUNDLE}" \
|
--component "${APP_BUNDLE}" \
|
||||||
build_pkg_temp/${APP_NAME}-component.pkg
|
build_pkg_temp/${APP_NAME}-component.pkg
|
||||||
|
|
||||||
mkdir -p build_pkg_scripts
|
mkdir -p scripts
|
||||||
|
|
||||||
cat > build_pkg_scripts/postinstall <<'EOF'
|
cat > scripts/postinstall <<'EOF'
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
USER_HOME=$( /usr/bin/stat -f "%Su" /dev/console )
|
USER_HOME=$( /usr/bin/stat -f "%Su" /dev/console )
|
||||||
HOME_DIR=$( /usr/bin/dscl . -read /Users/$USER_HOME NFSHomeDirectory | awk '{print $2}' )
|
HOME_DIR=$( /usr/bin/dscl . -read /Users/$USER_HOME NFSHomeDirectory | awk '{print $2}' )
|
||||||
@@ -101,14 +101,14 @@ cp -R "/Library/Application Support/CrossDesk/certs/"* "$DEST/"
|
|||||||
exit 0
|
exit 0
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
chmod +x build_pkg_scripts/postinstall
|
chmod +x scripts/postinstall
|
||||||
|
|
||||||
pkgbuild \
|
pkgbuild \
|
||||||
--root "${CERTS_SOURCE}" \
|
--root "${CERTS_SOURCE}" \
|
||||||
--identifier "${IDENTIFIER}.certs" \
|
--identifier "${IDENTIFIER}.certs" \
|
||||||
--version "${APP_VERSION}" \
|
--version "${APP_VERSION}" \
|
||||||
--install-location "/Library/Application Support/CrossDesk/certs" \
|
--install-location "/Library/Application Support/CrossDesk/certs" \
|
||||||
--scripts build_pkg_scripts \
|
--scripts scripts \
|
||||||
build_pkg_temp/${APP_NAME}-certs.pkg
|
build_pkg_temp/${APP_NAME}-certs.pkg
|
||||||
|
|
||||||
productbuild \
|
productbuild \
|
||||||
@@ -118,7 +118,7 @@ productbuild \
|
|||||||
|
|
||||||
echo "PKG package created: ${PKG_NAME}"
|
echo "PKG package created: ${PKG_NAME}"
|
||||||
|
|
||||||
rm -rf build_pkg_temp build_pkg_scripts ${APP_BUNDLE}
|
rm -rf build_pkg_temp scripts ${APP_BUNDLE}
|
||||||
|
|
||||||
echo "PKG package created successfully."
|
echo "PKG package created successfully."
|
||||||
echo "package ${APP_BUNDLE}"
|
echo "package ${APP_BUNDLE}"
|
||||||
|
|||||||
10
scripts/macosx/pkg_x64.sh
Executable file → Normal file
10
scripts/macosx/pkg_x64.sh
Executable file → Normal file
@@ -86,9 +86,9 @@ pkgbuild \
|
|||||||
--component "${APP_BUNDLE}" \
|
--component "${APP_BUNDLE}" \
|
||||||
build_pkg_temp/${APP_NAME}-component.pkg
|
build_pkg_temp/${APP_NAME}-component.pkg
|
||||||
|
|
||||||
mkdir -p build_pkg_scripts
|
mkdir -p scripts
|
||||||
|
|
||||||
cat > build_pkg_scripts/postinstall <<'EOF'
|
cat > scripts/postinstall <<'EOF'
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
USER_HOME=$( /usr/bin/stat -f "%Su" /dev/console )
|
USER_HOME=$( /usr/bin/stat -f "%Su" /dev/console )
|
||||||
HOME_DIR=$( /usr/bin/dscl . -read /Users/$USER_HOME NFSHomeDirectory | awk '{print $2}' )
|
HOME_DIR=$( /usr/bin/dscl . -read /Users/$USER_HOME NFSHomeDirectory | awk '{print $2}' )
|
||||||
@@ -101,14 +101,14 @@ cp -R "/Library/Application Support/CrossDesk/certs/"* "$DEST/"
|
|||||||
exit 0
|
exit 0
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
chmod +x build_pkg_scripts/postinstall
|
chmod +x scripts/postinstall
|
||||||
|
|
||||||
pkgbuild \
|
pkgbuild \
|
||||||
--root "${CERTS_SOURCE}" \
|
--root "${CERTS_SOURCE}" \
|
||||||
--identifier "${IDENTIFIER}.certs" \
|
--identifier "${IDENTIFIER}.certs" \
|
||||||
--version "${APP_VERSION}" \
|
--version "${APP_VERSION}" \
|
||||||
--install-location "/Library/Application Support/CrossDesk/certs" \
|
--install-location "/Library/Application Support/CrossDesk/certs" \
|
||||||
--scripts build_pkg_scripts \
|
--scripts scripts \
|
||||||
build_pkg_temp/${APP_NAME}-certs.pkg
|
build_pkg_temp/${APP_NAME}-certs.pkg
|
||||||
|
|
||||||
productbuild \
|
productbuild \
|
||||||
@@ -118,7 +118,7 @@ productbuild \
|
|||||||
|
|
||||||
echo "PKG package created: ${PKG_NAME}"
|
echo "PKG package created: ${PKG_NAME}"
|
||||||
|
|
||||||
rm -rf build_pkg_temp build_pkg_scripts ${APP_BUNDLE}
|
rm -rf build_pkg_temp scripts ${APP_BUNDLE}
|
||||||
|
|
||||||
echo "PKG package created successfully."
|
echo "PKG package created successfully."
|
||||||
echo "package ${APP_BUNDLE}"
|
echo "package ${APP_BUNDLE}"
|
||||||
|
|||||||
@@ -75,8 +75,5 @@
|
|||||||
#define SELF_HOSTED_SERVER_CONFIG_OK_BUTTON_PADDING_EN 91
|
#define SELF_HOSTED_SERVER_CONFIG_OK_BUTTON_PADDING_EN 91
|
||||||
#define UPDATE_NOTIFICATION_OK_BUTTON_PADDING_CN 162
|
#define UPDATE_NOTIFICATION_OK_BUTTON_PADDING_CN 162
|
||||||
#define UPDATE_NOTIFICATION_OK_BUTTON_PADDING_EN 146
|
#define UPDATE_NOTIFICATION_OK_BUTTON_PADDING_EN 146
|
||||||
#define REQUEST_PERMISSION_WINDOW_WIDTH_CN 180
|
|
||||||
#define REQUEST_PERMISSION_WINDOW_HEIGHT_CN 128
|
|
||||||
#define REQUEST_PERMISSION_WINDOW_WIDTH_EN 380
|
|
||||||
#define REQUEST_PERMISSION_WINDOW_HEIGHT_EN 122
|
|
||||||
#endif
|
#endif
|
||||||
@@ -188,27 +188,6 @@ static std::vector<std::string> minimize_to_tray = {
|
|||||||
"Minimize to system tray when exit:"};
|
"Minimize to system tray when exit:"};
|
||||||
static std::vector<LPCWSTR> exit_program = {L"退出", L"Exit"};
|
static std::vector<LPCWSTR> exit_program = {L"退出", L"Exit"};
|
||||||
#endif
|
#endif
|
||||||
#ifdef __APPLE__
|
|
||||||
static std::vector<std::string> request_permissions = {
|
|
||||||
reinterpret_cast<const char*>(u8"权限请求"), "Request Permissions"};
|
|
||||||
static std::vector<std::string> screen_recording_permission = {
|
|
||||||
reinterpret_cast<const char*>(u8"录屏权限"), "Screen Recording Permission"};
|
|
||||||
static std::vector<std::string> accessibility_permission = {
|
|
||||||
reinterpret_cast<const char*>(u8"键鼠权限"), "Keyboard & Mouse Permission"};
|
|
||||||
static std::vector<std::string> permission_granted = {
|
|
||||||
reinterpret_cast<const char*>(u8"已授权"), "Granted"};
|
|
||||||
static std::vector<std::string> permission_denied = {
|
|
||||||
reinterpret_cast<const char*>(u8"未授权"), "Denied"};
|
|
||||||
static std::vector<std::string> open_screen_recording_settings = {
|
|
||||||
reinterpret_cast<const char*>(u8"打开录屏设置"),
|
|
||||||
"Open Screen Recording Settings"};
|
|
||||||
static std::vector<std::string> open_keyboard_mouse_settings = {
|
|
||||||
reinterpret_cast<const char*>(u8"打开键鼠设置"),
|
|
||||||
"Open Keyboard & Mouse Settings"};
|
|
||||||
static std::vector<std::string> permission_required_message = {
|
|
||||||
reinterpret_cast<const char*>(u8"应用需要以下权限才能正常工作:"),
|
|
||||||
"The application requires the following permissions to work properly:"};
|
|
||||||
#endif
|
|
||||||
} // namespace localization
|
} // namespace localization
|
||||||
} // namespace crossdesk
|
} // namespace crossdesk
|
||||||
#endif
|
#endif
|
||||||
@@ -895,12 +895,6 @@ int Render::DrawMainWindow() {
|
|||||||
|
|
||||||
UpdateNotificationWindow();
|
UpdateNotificationWindow();
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
if (show_request_permission_window_) {
|
|
||||||
RequestPermissionWindow();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
|
|||||||
@@ -188,14 +188,6 @@ class Render {
|
|||||||
int NetTrafficStats(std::shared_ptr<SubStreamWindowProperties>& props);
|
int NetTrafficStats(std::shared_ptr<SubStreamWindowProperties>& props);
|
||||||
void DrawConnectionStatusText(
|
void DrawConnectionStatusText(
|
||||||
std::shared_ptr<SubStreamWindowProperties>& props);
|
std::shared_ptr<SubStreamWindowProperties>& props);
|
||||||
#ifdef __APPLE__
|
|
||||||
int RequestPermissionWindow();
|
|
||||||
bool CheckScreenRecordingPermission();
|
|
||||||
bool CheckAccessibilityPermission();
|
|
||||||
void OpenSystemPreferences();
|
|
||||||
void OpenScreenRecordingPreferences();
|
|
||||||
void OpenAccessibilityPreferences();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void OnReceiveVideoBufferCb(const XVideoFrame* video_frame,
|
static void OnReceiveVideoBufferCb(const XVideoFrame* video_frame,
|
||||||
@@ -457,9 +449,6 @@ class Render {
|
|||||||
bool show_new_version_icon_in_menu_ = true;
|
bool show_new_version_icon_in_menu_ = true;
|
||||||
uint64_t new_version_icon_last_trigger_time_ = 0;
|
uint64_t new_version_icon_last_trigger_time_ = 0;
|
||||||
uint64_t new_version_icon_render_start_time_ = 0;
|
uint64_t new_version_icon_render_start_time_ = 0;
|
||||||
#ifdef __APPLE__
|
|
||||||
bool show_request_permission_window_ = true;
|
|
||||||
#endif
|
|
||||||
char client_id_[10] = "";
|
char client_id_[10] = "";
|
||||||
char client_id_display_[12] = "";
|
char client_id_display_[12] = "";
|
||||||
char client_id_with_password_[17] = "";
|
char client_id_with_password_[17] = "";
|
||||||
|
|||||||
@@ -1,184 +0,0 @@
|
|||||||
#include "layout.h"
|
|
||||||
#include "localization.h"
|
|
||||||
#include "rd_log.h"
|
|
||||||
#include "render.h"
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
|
||||||
#include <CoreGraphics/CoreGraphics.h>
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <cstdlib>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace crossdesk {
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
bool Render::CheckScreenRecordingPermission() {
|
|
||||||
// CGPreflightScreenCaptureAccess is available on macOS 10.15+
|
|
||||||
if (@available(macOS 10.15, *)) {
|
|
||||||
bool granted = CGPreflightScreenCaptureAccess();
|
|
||||||
LOG_INFO("CGPreflightScreenCaptureAccess returned: {}", granted);
|
|
||||||
return granted;
|
|
||||||
}
|
|
||||||
// For older macOS versions, assume permission is granted
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Render::CheckAccessibilityPermission() {
|
|
||||||
// Check if the process is trusted for accessibility
|
|
||||||
// Note: This may require app restart to reflect permission changes
|
|
||||||
NSDictionary* options = @{(__bridge id)kAXTrustedCheckOptionPrompt : @NO};
|
|
||||||
bool trusted = AXIsProcessTrustedWithOptions((__bridge CFDictionaryRef)options);
|
|
||||||
LOG_INFO("AXIsProcessTrustedWithOptions returned: {}", trusted);
|
|
||||||
return trusted;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Render::OpenSystemPreferences() {
|
|
||||||
// Open System Preferences to the Privacy & Security > Screen Recording or
|
|
||||||
// Accessibility section
|
|
||||||
system("open "
|
|
||||||
"\"x-apple.systempreferences:com.apple.preference.security?Privacy_"
|
|
||||||
"ScreenCapture\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Render::OpenScreenRecordingPreferences() {
|
|
||||||
// Request screen recording permission first to ensure app appears in System Settings
|
|
||||||
if (@available(macOS 10.15, *)) {
|
|
||||||
CGRequestScreenCaptureAccess();
|
|
||||||
}
|
|
||||||
// Open System Preferences to the Privacy & Security > Screen Recording section
|
|
||||||
system("open "
|
|
||||||
"\"x-apple.systempreferences:com.apple.preference.security?Privacy_"
|
|
||||||
"ScreenCapture\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Render::OpenAccessibilityPreferences() {
|
|
||||||
// Request accessibility permission first to ensure app appears in System Settings
|
|
||||||
NSDictionary* options = @{(__bridge id)kAXTrustedCheckOptionPrompt : @YES};
|
|
||||||
AXIsProcessTrustedWithOptions((__bridge CFDictionaryRef)options);
|
|
||||||
// Open System Preferences to the Privacy & Security > Accessibility section
|
|
||||||
system("open "
|
|
||||||
"\"x-apple.systempreferences:com.apple.preference.security?Privacy_"
|
|
||||||
"Accessibility\"");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int Render::RequestPermissionWindow() {
|
|
||||||
#ifdef __APPLE__
|
|
||||||
// Check permissions - recheck every frame to update status immediately after user grants
|
|
||||||
// permission
|
|
||||||
bool screen_recording_granted = CheckScreenRecordingPermission();
|
|
||||||
bool accessibility_granted = CheckAccessibilityPermission();
|
|
||||||
|
|
||||||
// Update show_request_permission_window_ based on permission status
|
|
||||||
// Keep window visible if any permission is not granted
|
|
||||||
show_request_permission_window_ = !screen_recording_granted || !accessibility_granted;
|
|
||||||
|
|
||||||
// Log permission status for debugging
|
|
||||||
LOG_INFO("Screen recording permission: {}, Accessibility permission: {}",
|
|
||||||
screen_recording_granted, accessibility_granted);
|
|
||||||
|
|
||||||
if (!show_request_permission_window_) {
|
|
||||||
LOG_INFO("Request permission window is not shown");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
LOG_INFO("Request permission window is shown");
|
|
||||||
|
|
||||||
const ImGuiViewport* viewport = ImGui::GetMainViewport();
|
|
||||||
float window_width = localization_language_index_ == 0 ? REQUEST_PERMISSION_WINDOW_WIDTH_CN
|
|
||||||
: REQUEST_PERMISSION_WINDOW_WIDTH_EN;
|
|
||||||
float window_height = localization_language_index_ == 0 ? REQUEST_PERMISSION_WINDOW_HEIGHT_CN
|
|
||||||
: REQUEST_PERMISSION_WINDOW_HEIGHT_EN;
|
|
||||||
|
|
||||||
// Center the window on screen
|
|
||||||
ImVec2 center_pos = ImVec2((viewport->WorkSize.x - window_width) * 0.5f + viewport->WorkPos.x,
|
|
||||||
(viewport->WorkSize.y - window_height) * 0.5f + viewport->WorkPos.y);
|
|
||||||
ImGui::SetNextWindowPos(center_pos, ImGuiCond_Always);
|
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(window_width, window_height), ImGuiCond_Always);
|
|
||||||
|
|
||||||
// Make window always on top and modal-like
|
|
||||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 1.0f);
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 5.0f);
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 15.0f));
|
|
||||||
|
|
||||||
ImGui::Begin(localization::request_permissions[localization_language_index_].c_str(), nullptr,
|
|
||||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove |
|
|
||||||
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_Modal);
|
|
||||||
|
|
||||||
ImGui::SetWindowFontScale(0.3f);
|
|
||||||
|
|
||||||
// use system Chinese font
|
|
||||||
if (system_chinese_font_ != nullptr) {
|
|
||||||
ImGui::PushFont(system_chinese_font_);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message
|
|
||||||
ImGui::SetCursorPosX(10.0f);
|
|
||||||
ImGui::TextWrapped(
|
|
||||||
"%s", localization::permission_required_message[localization_language_index_].c_str());
|
|
||||||
|
|
||||||
ImGui::Spacing();
|
|
||||||
ImGui::Spacing();
|
|
||||||
ImGui::Spacing();
|
|
||||||
|
|
||||||
// Accessibility Permission
|
|
||||||
ImGui::SetCursorPosX(10.0f);
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::Text("1. %s:",
|
|
||||||
localization::accessibility_permission[localization_language_index_].c_str());
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
if (accessibility_granted) {
|
|
||||||
ImGui::Text("%s", localization::permission_granted[localization_language_index_].c_str());
|
|
||||||
} else {
|
|
||||||
ImGui::Text("%s", localization::permission_denied[localization_language_index_].c_str());
|
|
||||||
ImGui::SameLine();
|
|
||||||
if (ImGui::Button(
|
|
||||||
localization::open_keyboard_mouse_settings[localization_language_index_].c_str())) {
|
|
||||||
OpenAccessibilityPreferences();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Spacing();
|
|
||||||
|
|
||||||
// Screen Recording Permission
|
|
||||||
ImGui::SetCursorPosX(10.0f);
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
ImGui::Text("2. %s:",
|
|
||||||
localization::screen_recording_permission[localization_language_index_].c_str());
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::AlignTextToFramePadding();
|
|
||||||
if (screen_recording_granted) {
|
|
||||||
ImGui::Text("%s", localization::permission_granted[localization_language_index_].c_str());
|
|
||||||
} else {
|
|
||||||
ImGui::Text("%s", localization::permission_denied[localization_language_index_].c_str());
|
|
||||||
ImGui::SameLine();
|
|
||||||
if (ImGui::Button(
|
|
||||||
localization::open_screen_recording_settings[localization_language_index_].c_str())) {
|
|
||||||
OpenScreenRecordingPreferences();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SetWindowFontScale(1.0f);
|
|
||||||
ImGui::SetWindowFontScale(0.45f);
|
|
||||||
|
|
||||||
// pop system font
|
|
||||||
if (system_chinese_font_ != nullptr) {
|
|
||||||
ImGui::PopFont();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::End();
|
|
||||||
ImGui::SetWindowFontScale(1.0f);
|
|
||||||
ImGui::PopStyleVar(4);
|
|
||||||
ImGui::PopStyleColor();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
} // namespace crossdesk
|
|
||||||
@@ -182,8 +182,6 @@ target("gui")
|
|||||||
if is_os("windows") then
|
if is_os("windows") then
|
||||||
add_files("src/gui/tray/*.cpp")
|
add_files("src/gui/tray/*.cpp")
|
||||||
add_includedirs("src/gui/tray", {public = true})
|
add_includedirs("src/gui/tray", {public = true})
|
||||||
elseif is_os("macosx") then
|
|
||||||
add_files("src/gui/windows/*.mm")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
target("crossdesk")
|
target("crossdesk")
|
||||||
|
|||||||
Reference in New Issue
Block a user