From 3de6808a81d82a0a2cb39f8755818791bb030c57 Mon Sep 17 00:00:00 2001 From: hiddify <114227601+hiddify-com@users.noreply.github.com> Date: Sun, 29 Sep 2024 20:27:07 +0200 Subject: [PATCH] release: version 2.5.2 --- .github/change_version.sh | 35 +++++++++++++++++++ HISTORY.md | 10 +++++- Makefile | 35 +------------------ .../com/hiddify/hiddify/MethodHandler.kt | 17 +++++++-- .../com/hiddify/hiddify/bg/BoxService.kt | 4 ++- dependencies.properties | 2 +- .../service/platform_singbox_service.dart | 2 +- 7 files changed, 65 insertions(+), 40 deletions(-) create mode 100755 .github/change_version.sh diff --git a/.github/change_version.sh b/.github/change_version.sh new file mode 100755 index 00000000..bf03f88c --- /dev/null +++ b/.github/change_version.sh @@ -0,0 +1,35 @@ +#! /bin/bash +echo "previous version was $(git describe --tags $(git rev-list --tags --max-count=1))" +echo "WARNING: This operation will creates version tag and push to github" +if [ "$(curl -o /dev/null -I -s -w "%{http_code}" https://github.com/hiddify/hiddify-core/releases/download/v${CORE_VERSION}/hiddify-core-linux-amd64.tar.gz)" = "404" ]; then + echo "Core v${CORE_VERSION} not Found"; + exit 3; +fi + + +cversion_string=$(grep -e "^version:" pubspec.yaml | cut -d: -f2-) +cstr_version=`echo "${cversion_string}" | sed -n "s/[ ]*\\([0-9]\\+\\.[0-9]\\+\\.[0-9]\\+\\)+.*/\\1/p"` +[ "$cversion_string" == "" ] && { echo "getting old version error"; exit 1 ; } +cbuild_number=`echo "${cversion_string}" | sed -n "s/.*+\\([0-9]\\+\\)/\\1/p"` +echo "Current Version Name:${cstr_version} Build Number:${cbuild_number}" +read -p "new Version? (provide the next x.y.z semver) : " TAG +echo $TAG +[[ "$TAG" =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(\.dev)?$ ]] || { echo "Incorrect tag. e.g., 1.2.3 or 1.2.3.dev"; exit 1; } +IFS="." read -r -a VERSION_ARRAY <<< "$TAG" +VERSION_STR="${VERSION_ARRAY[0]}.${VERSION_ARRAY[1]}.${VERSION_ARRAY[2]}" +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: ${VERSION_ARRAY[0]}.${VERSION_ARRAY[1]}.${VERSION_ARRAY[2]}.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 tag ${TAG} > /dev/null +gitchangelog > HISTORY.md || { git tag -d ${TAG}; echo "Please run pip install gitchangelog pystache mustache markdown"; exit 2; } +git tag -d ${TAG} > /dev/null +git add ios/Runner.xcodeproj/project.pbxproj pubspec.yaml windows/packaging/msix/make_config.yaml HISTORY.md +git commit -m "release: version ${TAG}" +echo "creating git tag : v${TAG}" +git push +git tag v${TAG} +git push -u origin HEAD --tags +echo "Github Actions will detect the new tag and release the new version." diff --git a/HISTORY.md b/HISTORY.md index b387385d..43fd5fa3 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,7 +1,15 @@ # Changelog -## 2.5.1 (2024-09-29) +## 2.5.2 (2024-09-29) + +#### Fix + +* Typo. + + + +## v2.5.1 (2024-09-29) #### Fix diff --git a/Makefile b/Makefile index a81e4875..9868908d 100644 --- a/Makefile +++ b/Makefile @@ -220,40 +220,7 @@ build-ios-libs: mv $(BINDIR)/Libcore.xcframework $(IOS_OUT)/Libcore.xcframework release: # Create a new tag for release. - - @echo "previous version was $$(git describe --tags $$(git rev-list --tags --max-count=1))" - @echo "WARNING: This operation will creates version tag and push to github" - @if [ "$$(curl -o /dev/null -I -s -w "%{http_code}" https://github.com/hiddify/hiddify-core/releases/download/v$(core.version)/hiddify-core-linux-amd64.tar.gz)" = "404" ]; then \ - echo "Core v$(core.version) not Found"; \ - exit 3; \ - fi - bash -c '\ - cversion_string=$$(grep -e "^version:" pubspec.yaml | cut -d: -f2-); \ - cstr_version=`echo "$${cversion_string}" | sed -n "s/[ ]*\\([0-9]\\+\\.[0-9]\\+\\.[0-9]\\+\\)+.*/\\1/p"`; \ - [ "$$cversion_string" == "" ] && { echo "getting old version error"; exit 1 ; }; \ - cbuild_number=`echo "$${cversion_string}" | sed -n "s/.*+\\([0-9]\\+\\)/\\1/p"`; \ - echo "Current Version Name:$${cstr_version} Build Number:$${cbuild_number}"; \ - read -p "new Version? (provide the next x.y.z semver) : " TAG && \ - echo $$TAG && \ - [[ "$$TAG" =~ ^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{1,2}(\.dev)?$$ ]] || { echo "Incorrect tag. e.g., 1.2.3 or 1.2.3.dev"; exit 1; } && \ - IFS="." read -r -a VERSION_ARRAY <<< "$$TAG" && \ - VERSION_STR="$${VERSION_ARRAY[0]}.$${VERSION_ARRAY[1]}.$${VERSION_ARRAY[2]}" && \ - 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: $${VERSION_ARRAY[0]}.$${VERSION_ARRAY[1]}.$${VERSION_ARRAY[2]}.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 tag $${TAG} > /dev/null && \ - gitchangelog > HISTORY.md || { git tag -d $${TAG}; echo "Please run pip install gitchangelog pystache mustache markdown"; exit 2; } && \ - git tag -d $${TAG} > /dev/null && \ - git add ios/Runner.xcodeproj/project.pbxproj pubspec.yaml windows/packaging/msix/make_config.yaml HISTORY.md && \ - git commit -m "release: version $${TAG}" && \ - echo "creating git tag : v$${TAG}" && \ - git push && \ - git tag v$${TAG} && \ - git push -u origin HEAD --tags && \ - echo "Github Actions will detect the new tag and release the new version."' + @CORE_VERSION=$(core.version) .github/change_version.sh diff --git a/android/app/src/main/kotlin/com/hiddify/hiddify/MethodHandler.kt b/android/app/src/main/kotlin/com/hiddify/hiddify/MethodHandler.kt index 88e52908..f47c5c53 100644 --- a/android/app/src/main/kotlin/com/hiddify/hiddify/MethodHandler.kt +++ b/android/app/src/main/kotlin/com/hiddify/hiddify/MethodHandler.kt @@ -13,6 +13,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.delay import kotlinx.coroutines.launch +import java.io.File class MethodHandler(private val scope: CoroutineScope) : FlutterPlugin, MethodChannel.MethodCallHandler { @@ -54,8 +55,20 @@ class MethodHandler(private val scope: CoroutineScope) : FlutterPlugin, Trigger.Setup.method -> { GlobalScope.launch { result.runCatching { - Mobile.setup() - success("") + val baseDir = Application.application.filesDir + baseDir.mkdirs() + val workingDir = Application.application.getExternalFilesDir(null) + workingDir?.mkdirs() + val tempDir = Application.application.cacheDir + tempDir.mkdirs() + Log.d(TAG, "base dir: ${baseDir.path}") + Log.d(TAG, "working dir: ${workingDir?.path}") + Log.d(TAG, "temp dir: ${tempDir.path}") + + Mobile.setup(baseDir.path, workingDir?.path, tempDir.path, false) + Libbox.redirectStderr(File(workingDir, "stderr2.log").path) + + success("") } } } diff --git a/android/app/src/main/kotlin/com/hiddify/hiddify/bg/BoxService.kt b/android/app/src/main/kotlin/com/hiddify/hiddify/bg/BoxService.kt index 8045d9ff..b322e248 100644 --- a/android/app/src/main/kotlin/com/hiddify/hiddify/bg/BoxService.kt +++ b/android/app/src/main/kotlin/com/hiddify/hiddify/bg/BoxService.kt @@ -48,6 +48,7 @@ class BoxService( private fun initialize() { if (initializeOnce) return val baseDir = Application.application.filesDir + baseDir.mkdirs() workingDir = Application.application.getExternalFilesDir(null) ?: return workingDir.mkdirs() @@ -56,7 +57,8 @@ class BoxService( Log.d(TAG, "base dir: ${baseDir.path}") Log.d(TAG, "working dir: ${workingDir.path}") Log.d(TAG, "temp dir: ${tempDir.path}") - Libbox.setup(baseDir.path, workingDir.path, tempDir.path, false) + + Mobile.setup(baseDir.path, workingDir.path, tempDir.path, false) Libbox.redirectStderr(File(workingDir, "stderr.log").path) initializeOnce = true return diff --git a/dependencies.properties b/dependencies.properties index 09bce535..7807af9c 100644 --- a/dependencies.properties +++ b/dependencies.properties @@ -1 +1 @@ -core.version=3.1.1 \ No newline at end of file +core.version=3.1.3 \ No newline at end of file diff --git a/lib/singbox/service/platform_singbox_service.dart b/lib/singbox/service/platform_singbox_service.dart index 005ae4ed..e65db621 100644 --- a/lib/singbox/service/platform_singbox_service.dart +++ b/lib/singbox/service/platform_singbox_service.dart @@ -74,7 +74,7 @@ class PlatformSingboxService with InfraLogger implements SingboxService { () async { loggy.debug("changing options"); await methodChannel.invokeMethod( - "change_config_options", + "change_hiddify_options", jsonEncode(options.toJson()), ); return right(unit);