From e3bce37c46e143e15a3b2439f6f8551f7b9dd40e Mon Sep 17 00:00:00 2001 From: Le Tan Date: Fri, 19 Jul 2024 10:23:56 +0800 Subject: [PATCH 1/2] codesign --remove-signature will cause broken binary --- .github/workflows/ci-macos.yml | 2 +- src/CPackMacDeployQt.cmake.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index ceb9fad06f..7917e9cb44 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -49,7 +49,7 @@ jobs: - name: Install Dependencies run: | - brew install tree libiodbc libpq + brew install tree libiodbc libpq optool - name: Fix SQL run: | diff --git a/src/CPackMacDeployQt.cmake.in b/src/CPackMacDeployQt.cmake.in index 890a1b54fb..b9003ddf08 100644 --- a/src/CPackMacDeployQt.cmake.in +++ b/src/CPackMacDeployQt.cmake.in @@ -1,4 +1,4 @@ -execute_process(COMMAND "codesign" --remove-signature ${CMAKE_CURRENT_BINARY_DIR}/VNote.app +execute_process(COMMAND "optool" strip -t ${CMAKE_CURRENT_BINARY_DIR}/VNote.app WORKING_DIRECTORY ${CPACK_PACKAGE_DIRECTORY} ) execute_process(COMMAND "${MACDEPLOYQT_EXECUTABLE}" ${CMAKE_CURRENT_BINARY_DIR}/VNote.app -dmg From 35a754ab5c6f871d4cc8400be074c91ae479d799 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Fri, 19 Jul 2024 10:58:47 +0800 Subject: [PATCH 2/2] fix --- .github/workflows/ci-macos.yml | 9 ++++++++- src/utils/widgetutils.cpp | 25 ++++++++++++++----------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 7917e9cb44..87c7d7e892 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -49,7 +49,7 @@ jobs: - name: Install Dependencies run: | - brew install tree libiodbc libpq optool + brew install tree libiodbc libpq - name: Fix SQL run: | @@ -72,6 +72,13 @@ jobs: git clone https://github.com/tamlok/macdeployqtfix.git macdeployqtfix --depth=1 working-directory: ${{runner.workspace}} + - name: Install optool + run: | + wget --no-verbose https://github.com/alexzielenski/optool/releases/download/0.1/optool.zip + unzip ./optool.zip + sudo ln -s ./optool /usr/local/bin/optool + working-directory: ${{runner.workspace}} + - name: Cache Qt id: cache-qt uses: actions/cache@v1 # not v2! diff --git a/src/utils/widgetutils.cpp b/src/utils/widgetutils.cpp index e88a7e6b37..a04e1a2f80 100644 --- a/src/utils/widgetutils.cpp +++ b/src/utils/widgetutils.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -78,19 +79,21 @@ QSize WidgetUtils::availableScreenSize(QWidget *p_widget) void WidgetUtils::openUrlByDesktop(const QUrl &p_url) { const auto scheme = p_url.scheme(); - if (scheme != "http" && scheme != "https") { - // Prompt for user. - int ret = MessageBoxHelper::questionYesNo(MessageBoxHelper::Warning, - MainWindow::tr("Are you sure to open link (%1)?").arg(p_url.toString()), - MainWindow::tr("Malicious link might do harm to your device."), - QString(), - nullptr); - if (ret == QMessageBox::No) { - return; - } + if (scheme == "http" || scheme == "https" || + (p_url.isLocalFile() && QFileInfo(p_url.toLocalFile()).isDir())) { + QDesktopServices::openUrl(p_url); + return; } - QDesktopServices::openUrl(p_url); + // Prompt for user. + int ret = MessageBoxHelper::questionYesNo(MessageBoxHelper::Warning, + MainWindow::tr("Are you sure to open link (%1)?").arg(p_url.toString()), + MainWindow::tr("Malicious link might do harm to your device."), + QString(), + nullptr); + if (ret == QMessageBox::No) { + return; + } } bool WidgetUtils::processKeyEventLikeVi(QWidget *p_widget,