diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index abb4901e..2971fa49 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,7 @@ jobs: - platform: windows os: windows-2019 aarch: amd64 - targets: exe + targets: exe,msix - platform: linux os: ubuntu-22.04 @@ -118,6 +118,14 @@ jobs: echo "keyPassword=${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}" >> android/key.properties echo "keyAlias=${{ secrets.ANDROID_SIGNING_KEY_ALIAS }}" >> android/key.properties + - name: Setup Windows Signing Properties + if: ${{ inputs.upload-artifact && startsWith(matrix.platform,'windows') }} + run: | + $decodedText = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String("${{ secrets.WINDOWS_SIGNING_KEY }}")) + Set-Content -Path "windows\sign.pfx" -Value $decodedText + (Get-Content "windows\packaging\msix\make_config.yaml") -replace '^certificate_password:\s.*$', 'certificate_password: ${{ secrets.WINDOWS_SIGNING_PASSWORD }}' | Set-Content "windows\packaging\msix\make_config.yaml" + + - name: Setup Apple certificate and provisioning profile if: ${{ inputs.upload-artifact && startsWith(matrix.os,'macos') }} env: @@ -224,8 +232,8 @@ jobs: - name: Clean up keychain and provisioning profile if: ${{ always() && startsWith(matrix.os,'macos')}} run: | - security delete-keychain $RUNNER_TEMP/app-signing.keychain-db - rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision + security delete-keychain $RUNNER_TEMP/app-signing.keychain-db ||echo ok + rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision ||echo ok - name: Upload Artifact if: env.UPLOAD_ARTIFACT == 'true' diff --git a/Makefile b/Makefile index ec906c1c..8b035678 100644 --- a/Makefile +++ b/Makefile @@ -124,7 +124,7 @@ android-aab-release: ls -R build/app/outputs windows-release: - flutter_distributor package --flutter-build-args=verbose --platform windows --targets exe $(DISTRIBUTOR_ARGS) + flutter_distributor package --flutter-build-args=verbose --platform windows --targets exe,msix $(DISTRIBUTOR_ARGS) linux-release: flutter_distributor package --platform linux --targets deb,rpm,appimage $(DISTRIBUTOR_ARGS) @@ -207,9 +207,10 @@ release: # Create a new tag for release. BUILD_NUMBER=$$(( $${VERSION_ARRAY[0]} * 10000 + $${VERSION_ARRAY[1]} * 100 + $${VERSION_ARRAY[2]} )) && \ echo "version: $${VERSION_STR}+$${BUILD_NUMBER}" && \ sed -i "s/^version: .*/version: $${VERSION_STR}\+$${BUILD_NUMBER}/g" pubspec.yaml && \ + sed -i "s/^msix_version: .*/msix_version: $${BUILD_NUMBER}.0/g" windows/packaging/msix/make_config.yaml && \ sed -i "s/CURRENT_PROJECT_VERSION = $${cbuild_number}/CURRENT_PROJECT_VERSION = $${BUILD_NUMBER}/g" ios/Runner.xcodeproj/project.pbxproj && \ sed -i "s/MARKETING_VERSION = $${cstr_version}/MARKETING_VERSION = $${VERSION_STR}/g" ios/Runner.xcodeproj/project.pbxproj && \ - git add ios/Runner.xcodeproj/project.pbxproj pubspec.yaml&& \ + git add ios/Runner.xcodeproj/project.pbxproj pubspec.yaml windows/packaging/msix/make_config.yaml && \ git commit -m "release: version $${TAG}" && \ echo "creating git tag : v$${TAG}" && \ git push && \ diff --git a/dependencies.properties b/dependencies.properties index 1ae6f3da..1fd6efb7 100644 --- a/dependencies.properties +++ b/dependencies.properties @@ -1 +1 @@ -core.version=0.16.4 \ No newline at end of file +core.version=0.16.8 \ No newline at end of file diff --git a/lib/bootstrap.dart b/lib/bootstrap.dart index 89caf44b..c580e0a4 100644 --- a/lib/bootstrap.dart +++ b/lib/bootstrap.dart @@ -93,6 +93,7 @@ Future lazyBootstrap( final debug = container.read(debugModeNotifierProvider) || kDebugMode; if (PlatformUtils.isDesktop) { + Logger.bootstrap.info("Starting Window Contoller"); await _init( "window controller", () => container.read(windowNotifierProvider.future), @@ -106,39 +107,43 @@ Future lazyBootstrap( } else { Logger.bootstrap.debug("silent start, remain hidden accessible via tray"); } - + Logger.bootstrap.info("Starting Auto Start Service"); await _init( "auto start service", () => container.read(autoStartNotifierProvider.future), ); } - + Logger.bootstrap.info("Starting Log Repository"); await _init( "logs repository", () => container.read(logRepositoryProvider.future), ); + Logger.bootstrap.info("Starting Logger Contoller"); await _init("logger controller", () => LoggerController.postInit(debug)); - Logger.bootstrap.info(appInfo.format()); + Logger.bootstrap.info(appInfo.format()); + Logger.bootstrap.info("Starting GeoAssets"); await _init( "geo assets repository", () => container.read(geoAssetRepositoryProvider.future), ); + Logger.bootstrap.info("Starting Profile Repository"); await _init( "profile repository", () => container.read(profileRepositoryProvider.future), ); - + Logger.bootstrap.info("Starting Singbox Service Provider"); await _init( "sing-box", () => container.read(singboxServiceProvider).init(), ); - + Logger.bootstrap.info("Starting Active Profile"); await _safeInit( "active profile", () => container.read(activeProfileProvider.future), timeout: 1000, ); + Logger.bootstrap.info("Starting Deep Link Service"); await _safeInit( "deep link service", () => container.read(deepLinkNotifierProvider.future), @@ -146,14 +151,17 @@ Future lazyBootstrap( ); if (PlatformUtils.isDesktop) { + Logger.bootstrap.info("Starting System Tray"); await _safeInit( "system tray", () => container.read(systemTrayNotifierProvider.future), timeout: 1000, ); + Logger.bootstrap.info("System Tray initialized"); } if (Platform.isAndroid) { + Logger.bootstrap.info("Starting FlutterDisplayMode.setHighRefreshRate"); await _safeInit( "android display mode", () async { diff --git a/lib/core/analytics/analytics_controller.dart b/lib/core/analytics/analytics_controller.dart index 9c8e6948..ad0f7649 100644 --- a/lib/core/analytics/analytics_controller.dart +++ b/lib/core/analytics/analytics_controller.dart @@ -48,6 +48,8 @@ class AnalyticsController extends _$AnalyticsController with AppLogger { options.debug = kDebugMode; options.enableNativeCrashHandling = true; options.enableNdkScopeSync = true; + // options.attachScreenshot = true; + options.serverName = ""; options.attachThreads = true; options.tracesSampleRate = 0.20; options.enableUserInteractionTracing = true; diff --git a/lib/core/analytics/analytics_filter.dart b/lib/core/analytics/analytics_filter.dart index a8976a50..92b6e31f 100644 --- a/lib/core/analytics/analytics_filter.dart +++ b/lib/core/analytics/analytics_filter.dart @@ -6,8 +6,10 @@ import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; FutureOr sentryBeforeSend(SentryEvent event, {Hint? hint}) { - if (canSendEvent(event.throwable)) return event; - return null; + if (!canSendEvent(event.throwable)) return null; + return event.copyWith( + user: SentryUser(email: "", username: "", ipAddress: "0.0.0.0"), + ); } bool canSendEvent(dynamic throwable) { diff --git a/lib/features/config_option/model/config_option_entity.dart b/lib/features/config_option/model/config_option_entity.dart index a42858ad..2df83309 100644 --- a/lib/features/config_option/model/config_option_entity.dart +++ b/lib/features/config_option/model/config_option_entity.dart @@ -173,7 +173,7 @@ class ConfigOptionEntity with _$ConfigOptionEntity { enableClashApi: enableClashApi, clashApiPort: clashApiPort, enableTun: serviceMode == ServiceMode.tun, - enableTunService: false && serviceMode == ServiceMode.tunService, + enableTunService: serviceMode == ServiceMode.tunService, setSystemProxy: serviceMode == ServiceMode.systemProxy, bypassLan: bypassLan, allowConnectionFromLan: allowConnectionFromLan, diff --git a/libcore b/libcore index 4dad3022..168fc3db 160000 --- a/libcore +++ b/libcore @@ -1 +1 @@ -Subproject commit 4dad3022f3bb5073a7d7927fa605b81fa1942752 +Subproject commit 168fc3dbe33bd0b84f462ca0d6014fa698b216af diff --git a/scripts/package_windows.ps1 b/scripts/package_windows.ps1 index f4e67308..ed059617 100644 --- a/scripts/package_windows.ps1 +++ b/scripts/package_windows.ps1 @@ -5,6 +5,7 @@ New-Item -ItemType Directory -Force -Name "out" # Get-ChildItem -Recurse -File -Path "dist" -Filter "*windows-setup.exe" | Copy-Item -Destination "dist\tmp\hiddify-next-setup.exe" -ErrorAction SilentlyContinue # Compress-Archive -Force -Path "dist\tmp\hiddify-next-setup.exe",".github\help\mac-windows\*.url" -DestinationPath "out\hiddify-windows-x64-setup.zip" Get-ChildItem -Recurse -File -Path "dist" -Filter "*windows-setup.exe" | Copy-Item -Destination "out\Hiddify-Windows-Setup-x64.exe" -ErrorAction SilentlyContinue +Get-ChildItem -Recurse -File -Path "dist" -Filter "*windows.msix" | Copy-Item -Destination "out\Hiddify-Windows-Setup-x64.msix" -ErrorAction SilentlyContinue # windows portable diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt index aa5685f3..f2e97534 100644 --- a/windows/CMakeLists.txt +++ b/windows/CMakeLists.txt @@ -87,8 +87,8 @@ install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" install(FILES "../libcore/bin/libcore.dll" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime RENAME libcore.dll) -# install(FILES "../libcore/bin/HiddifyService.exe" DESTINATION "${CMAKE_INSTALL_PREFIX}" -# COMPONENT Runtime RENAME HiddifyService.exe) +install(FILES "../libcore/bin/HiddifyService.exe" DESTINATION "${CMAKE_INSTALL_PREFIX}" +COMPONENT Runtime RENAME HiddifyService.exe) if(PLUGIN_BUNDLED_LIBRARIES) diff --git a/windows/packaging/msix/make_config.yaml b/windows/packaging/msix/make_config.yaml index e24f7556..2e06477d 100644 --- a/windows/packaging/msix/make_config.yaml +++ b/windows/packaging/msix/make_config.yaml @@ -1,6 +1,16 @@ display_name: Hiddify publisher_display_name: Hiddify identity_name: app.hiddify.com -msix_version: 1.0.0.0 +msix_version: 0.16.8.0 logo_path: windows\runner\resources\app_icon.ico -capabilities: internetClient, privateNetworkClientServer +capabilities: internetClient, internetClientServer, privateNetworkClientServer +languages: en-us, zh-cn, zh-tw, tr-tr,fa-ir,ru-ru,pt-br,es-es +protocol_activation: hiddify +execution_alias: hiddify +certificate_path: windows\sign.pfx +certificate_password: +publisher: CN=Hiddify, O=Hiddify, C=US +install_certificate: "false" +enable_at_startup: "true" +startup_task: + parameters: --autostart diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp index 63ed8bfe..0c16fb80 100644 --- a/windows/runner/main.cpp +++ b/windows/runner/main.cpp @@ -4,7 +4,7 @@ #include "flutter_window.h" #include "utils.h" - +#include int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, diff --git a/windows/runner/win32_window.h b/windows/runner/win32_window.h index e07579bb..8af2be03 100644 --- a/windows/runner/win32_window.h +++ b/windows/runner/win32_window.h @@ -6,7 +6,7 @@ #include #include #include - +#include // A class abstraction for a high DPI-aware Win32 Window. Intended to be // inherited from by classes that wish to specialize with custom // rendering and input handling