Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CF Scanner #1100

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: Build
on:
workflow_dispatch:
push:
branches:
- main
- dev
workflow_call:
inputs:
upload-artifact:
Expand All @@ -11,13 +16,16 @@ on:
channel:
type: string
default: "dev"
apple:
type: boolean
default: false

env:
IS_GITHUB_ACTIONS: 1
CHANNEL: "${{ inputs.channel }}"
FLUTTER_VERSION: '3.22.2'
NDK_VERSION: r26d
UPLOAD_ARTIFACT: "${{ inputs.upload-artifact }}"
UPLOAD_ARTIFACT: true
TAG_NAME: "${{ inputs.tag-name }}"
TARGET_NAME_AppImage: "Hiddify-Linux-x64"
TARGET_NAME_deb: "Hiddify-Debian-x64"
Expand Down Expand Up @@ -92,14 +100,14 @@ jobs:
- name: checkout
uses: actions/checkout@v3
- name: Import Apple Codesign Certificates
if: ${{ inputs.upload-artifact && startsWith(matrix.os,'macos') }}
if: ${{ inputs.apple && startsWith(matrix.os,'macos') }}
uses: apple-actions/import-codesign-certs@v2
with:
p12-file-base64: "${{ secrets.APPLE_CERTIFICATE_P12 }}"
p12-password: "${{ secrets.APPLE_CERTIFICATE_P12_PASSWORD }}"

- name: Import Apple Mobile Provisioning Profile
if: ${{ inputs.upload-artifact && startsWith(matrix.os,'macos') }}
if: ${{ inputs.apple && startsWith(matrix.os,'macos') }}
run: |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
echo "${{secrets.APPLE_MOBILE_PROVISIONING_PROFILES_TARGZ_BASE64}}"|base64 --decode | tar xz -C ~/Library/MobileDevice/Provisioning\ Profiles
Expand Down Expand Up @@ -145,7 +153,7 @@ jobs:
- name: Setup Android Signing Properties
if: ${{ inputs.upload-artifact && startsWith(matrix.platform,'android') }}
run: |
echo "${{ secrets.ANDROID_SIGNING_KEY }}" | base64 --decode > android/key.jks
# echo "${{ secrets.ANDROID_SIGNING_KEY }}" | base64 --decode > android/key.jks
echo "storeFile=$(pwd)/android/key.jks" > android/key.properties
echo "storePassword=${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}" >> android/key.properties
echo "keyPassword=${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}" >> android/key.properties
Expand Down Expand Up @@ -275,7 +283,7 @@ jobs:
rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision ||echo ok
update-draft:
permissions: write-all
if: ${{ inputs.upload-artifact }}
# if: ${{ inputs.upload-artifact }}
needs: [build]
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -323,6 +331,7 @@ jobs:
tag_name: 'draft'
body_path: './release.md'
prerelease: true

upload-release:
permissions: write-all
if: ${{ inputs.upload-artifact && inputs.tag-name != 'draft' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- 'appcast.xml'
push:
branches:
- main
# - main
- dev
- android-fix-action-bug
paths-ignore:
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "libcore"]
path = libcore
url = https://github.com/hiddify/hiddify-next-core
url = https://github.com/donnanszex7654/hiddify-core
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ CORE_NAME=$(CORE_PRODUCT_NAME)
LIB_NAME=libcore

ifeq ($(CHANNEL),prod)
CORE_URL=https://github.com/hiddify/hiddify-next-core/releases/download/v$(core.version)
# CORE_URL=https://github.com/hiddify/hiddify-next-core/releases/download/v$(core.version)
CORE_URL=https://github.com/donnanszex7654/hiddify-core/releases/download/draft #TODO: change to prod
else
CORE_URL=https://github.com/hiddify/hiddify-next-core/releases/download/draft
CORE_URL=https://github.com/donnanszex7654/hiddify-core/releases/download/draft
endif

ifeq ($(CHANNEL),prod)
Expand Down Expand Up @@ -221,7 +222,7 @@ 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"
@bash -c '\
[ "404" == $$(curl -I -s -w "%{http_code}" https://github.com/hiddify/hiddify-next-core/releases/download/v$(core.version)/hiddify-core-linux-amd64.tar.gz -o /dev/null) ]&&{ echo "Core Not Found"; exit 1 ; };\
[ "404" == $$(curl -I -s -w "%{http_code}" https://github.com/donnanszex7654/hiddify-core/releases/download/draft/hiddify-core-linux-amd64.tar.gz -o /dev/null) ]&&{ echo "Core Not Found"; exit 1 ; };\
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"`; \
cbuild_number=`echo "$${cversion_string}" | sed -n "s/.*+\\([0-9]\\+\\)/\\1/p"`; \
Expand Down
1 change: 1 addition & 0 deletions assets/translations/flutter
Submodule flutter added at 761747
3 changes: 3 additions & 0 deletions assets/translations/strings_en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@
"warpConfigGenerated": "WARP Config Generated",
"pageTitle": "Config Options",
"logLevel": "Log Level",
"cloudflareSpeedTest": "Cloudflare Speed Test",
"cloudflareNumber": "Cloudflare Number",
"blockAds": "Block Advertisements",
"resolveDestination": "Resolve Destination",
"ipv6Mode": "IPv6 Route",
Expand All @@ -384,6 +386,7 @@
"urlTestInterval": "URL Test Interval",
"enableClashApi": "Enable Clash API",
"clashApiPort": "Clash API Port",
"webSecret": "Clash API Secret",
"enableTun": "Enable TUN",
"setSystemProxy": "Set System Proxy",
"enableDnsRouting": "Enable DNS Routing",
Expand Down
2 changes: 1 addition & 1 deletion ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@
/* Begin XCRemoteSwiftPackageReference section */
684380FC2B57068900C06CAA /* XCRemoteSwiftPackageReference "hiddify-next-core" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/hiddify/hiddify-next-core.git";
repositoryURL = "https://github.com/donnanszex7654/hiddify-core.git";
requirement = {
branch = main;
kind = branch;
Expand Down
26 changes: 24 additions & 2 deletions lib/features/config_option/data/config_option_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ abstract class ConfigOptions {
mapTo: (value) => value.name,
);

static final cloudflareSpeedTest = PreferencesNotifier.create<bool, bool>(
"cloudflare-speed-test",
false,
);

static final cloudflareNumber = PreferencesNotifier.create<int, int>(
"cloudflare-number",
200,
validator: (value) => value > 10,
);

static final blockAds = PreferencesNotifier.create<bool, bool>(
"block-ads",
false,
Expand All @@ -57,7 +68,7 @@ abstract class ConfigOptions {

static final remoteDnsAddress = PreferencesNotifier.create<String, String>(
"remote-dns-address",
"udp://1.1.1.1",
"tls://8.8.8.8",
validator: (value) => value.isNotBlank,
);

Expand All @@ -70,7 +81,7 @@ abstract class ConfigOptions {

static final directDnsAddress = PreferencesNotifier.create<String, String>(
"direct-dns-address",
"1.1.1.1",
"local",
validator: (value) => value.isNotBlank,
);

Expand Down Expand Up @@ -134,6 +145,11 @@ abstract class ConfigOptions {
validator: (value) => isPort(value.toString()),
);

static final webSecret = PreferencesNotifier.create<String, String>(
"web-secret",
"hiddifynext",
);

static final bypassLan = PreferencesNotifier.create<bool, bool>("bypass-lan", false);

static final allowConnectionFromLan = PreferencesNotifier.create<bool, bool>(
Expand Down Expand Up @@ -326,6 +342,8 @@ abstract class ConfigOptions {

static final Map<String, StateNotifierProvider<PreferencesNotifier, dynamic>> preferences = {
"region": region,
"cloudflare-speed-test": cloudflareSpeedTest,
"cloudflare-number": cloudflareNumber,
"block-ads": blockAds,
"service-mode": serviceMode,
"log-level": logLevel,
Expand All @@ -344,6 +362,7 @@ abstract class ConfigOptions {
"connection-test-url": connectionTestUrl,
"url-test-interval": urlTestInterval,
"clash-api-port": clashApiPort,
"web-secret": webSecret,
"bypass-lan": bypassLan,
"allow-connection-from-lan": allowConnectionFromLan,
"enable-dns-routing": enableDnsRouting,
Expand Down Expand Up @@ -422,6 +441,8 @@ abstract class ConfigOptions {

return SingboxConfigOption(
region: ref.watch(region).name,
cloudflareSpeedTest: ref.watch(cloudflareSpeedTest),
cloudflareNumber: ref.watch(cloudflareNumber),
blockAds: ref.watch(blockAds),
executeConfigAsIs: false,
logLevel: ref.watch(logLevel),
Expand All @@ -441,6 +462,7 @@ abstract class ConfigOptions {
urlTestInterval: ref.watch(urlTestInterval),
enableClashApi: ref.watch(enableClashApi),
clashApiPort: ref.watch(clashApiPort),
webSecret: ref.watch(webSecret),
enableTun: mode == ServiceMode.tun,
enableTunService: mode == ServiceMode.tunService,
setSystemProxy: mode == ServiceMode.systemProxy,
Expand Down
17 changes: 17 additions & 0 deletions lib/features/config_option/overview/config_options_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ class ConfigOptionsPage extends HookConsumerWidget {
title: t.settings.general.region,
presentChoice: (value) => value.present(t),
),
SwitchListTile(
title: Text(t.config.cloudflareSpeedTest),
value: ref.watch(ConfigOptions.cloudflareSpeedTest),
onChanged: ref.watch(ConfigOptions.cloudflareSpeedTest.notifier).update,
),
ValuePreferenceWidget(
value: ref.watch(ConfigOptions.cloudflareNumber),
preferences: ref.watch(ConfigOptions.cloudflareNumber.notifier),
title: t.config.cloudflareNumber,
inputToValue: int.tryParse,
digitsOnly: true,
),
SwitchListTile(
title: Text(experimental(t.config.blockAds)),
value: ref.watch(ConfigOptions.blockAds),
Expand Down Expand Up @@ -356,6 +368,11 @@ class ConfigOptionsPage extends HookConsumerWidget {
digitsOnly: true,
inputToValue: int.tryParse,
),
ValuePreferenceWidget(
title: t.config.webSecret,
value: ref.watch(ConfigOptions.webSecret),
preferences: ref.watch(ConfigOptions.webSecret.notifier),
),
const Gap(24),
],
),
Expand Down
3 changes: 3 additions & 0 deletions lib/singbox/model/singbox_config_option.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class SingboxConfigOption with _$SingboxConfigOption {
@JsonSerializable(fieldRename: FieldRename.kebab)
const factory SingboxConfigOption({
required String region,
required bool cloudflareSpeedTest,
required int cloudflareNumber,
required bool blockAds,
required bool executeConfigAsIs,
required LogLevel logLevel,
Expand All @@ -36,6 +38,7 @@ class SingboxConfigOption with _$SingboxConfigOption {
@IntervalInSecondsConverter() required Duration urlTestInterval,
required bool enableClashApi,
required int clashApiPort,
required String webSecret,
required bool enableTun,
required bool enableTunService,
required bool setSystemProxy,
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -730,10 +730,10 @@ packages:
dependency: transitive
description:
name: googleapis_auth
sha256: cafc46446574fd42826aa4cd4d623c94482598fda0a5a5649bf2781bcbc09258
sha256: "1401a9e55f9e0f565d3eebb18d990290f53a12d38a5f7f0230b112895778a85b"
url: "https://pub.dev"
source: hosted
version: "1.5.0"
version: "1.5.1"
graphs:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion windows/packaging/msix/make_config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
display_name: Hiddify
publisher_display_name: Hiddify
identity_name: Hiddify.HiddifyNext
msix_version: 1.7.0.0
msix_version: 1.7.0.0
logo_path: windows\runner\resources\app_icon.ico
capabilities: internetClient, internetClientServer, privateNetworkClientServer
languages: en-us, zh-cn, zh-tw, tr-tr,fa-ir,ru-ru,pt-br,es-es
Expand Down
Loading