chore: fix redundant health check & remove set proxy support for l2tp & update ci

This commit is contained in:
yicheng 2020-04-22 18:25:35 +08:00
parent aeef5261dd
commit b01b1ab5e6
6 changed files with 48 additions and 18 deletions

View File

@ -1 +0,0 @@
security set-key-partition-list -S apple-tool:,apple: -s -k mysecretpassword build.keychain

View File

@ -5,27 +5,18 @@ on: [push]
jobs:
build:
runs-on: macOS-latest
env:
CODE_SIGN_IDENTITY: "Developer ID Application: Fuzhou West2Online Internet Inc. (MEWHFZ92DY)"
steps:
- uses: actions/checkout@v1
- name: import certs
run: |
openssl aes-256-cbc -k "${{ secrets.ENCRYPTION_SECRET }}" -in ".github/certs/dist.p12.enc" -d -a -out ".github/certs/dist.p12"
security create-keychain -p mysecretpassword build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p mysecretpassword build.keychain
security set-keychain-settings -t 3600 -u build.keychain
security import "./.github/certs/dist.p12" -k build.keychain -T /usr/bin/codesign -P ""
bash .github/enableKeyChain.sh
gem install bundler:1.16.2
bundle install
- name: setup Go
uses: actions/setup-go@v1
with:
go-version: 1.13.x
go-version: 1.14.x
- name: update beta build version
if: contains(github.event.head_commit.message, '[beta]') && !startsWith(github.ref, 'refs/tags/')
@ -34,6 +25,8 @@ jobs:
bundle exec fastlane run set_info_plist_value path:ClashX/Info.plist key:BETA value:YES
- name: build
env:
CODE_SIGN_IDENTITY: "Developer ID Application: Fuzhou West2Online Internet Inc. (MEWHFZ92DY)"
run: |
bash install_dependency.sh
cd ClashX

View File

@ -253,8 +253,15 @@ class AppDelegate: NSObject, NSApplicationDelegate {
NotificationCenter
.default
.rx
.notification(.systemNetworkStatusIPUpdate)
.observeOn(MainScheduler.instance).debounce(.seconds(5), scheduler: MainScheduler.instance).bind { [weak self] _ in
.notification(.systemNetworkStatusIPUpdate).map({ _ in
NetworkChangeNotifier.getPrimaryIPAddress(allowIPV6: false)
})
.startWith(NetworkChangeNotifier.getPrimaryIPAddress(allowIPV6: false))
.distinctUntilChanged()
.skip(1)
.filter { $0 != nil }
.observeOn(MainScheduler.instance)
.debounce(.seconds(5), scheduler: MainScheduler.instance).bind { [weak self] _ in
self?.healthHeckOnNetworkChange()
}.disposed(by: disposeBag)
@ -425,7 +432,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
@objc func healthHeckOnNetworkChange() {
guard NetworkChangeNotifier.getPrimaryIPAddress() != nil else { return }
ApiRequest.requestProxyGroupList {
res in
for group in res.proxyGroups {

View File

@ -102,7 +102,7 @@ class NetworkChangeNotifier {
return dict?[kSCDynamicStorePropNetPrimaryInterface as String]
}
static func getPrimaryIPAddress() -> String? {
static func getPrimaryIPAddress(allowIPV6: Bool = false) -> String? {
guard let primary = getPrimaryInterface() else {
return nil
}
@ -141,6 +141,6 @@ class NetworkChangeNotifier {
}
}
}
return ipv6
return allowIPV6 ? ipv6 : nil
}
}

View File

@ -221,7 +221,6 @@
if ([hardware isEqualToString:@"AirPort"]
|| [hardware isEqualToString:@"Wi-Fi"]
|| [hardware isEqualToString:@"Ethernet"]
|| hardware == nil// VPN
) {
callback(key,dict);
}

View File

@ -1,10 +1,16 @@
lane :build do
addKeyChain
build_app(
workspace: "ClashX.xcworkspace",
scheme: "ClashX",
export_method: "developer-id",
skip_package_pkg: "true"
skip_package_pkg: "true",
clean: "true"
)
sh(command: "rm -vfr ~/Library/Developer/Xcode/Archives/*")
end
lane :beta do
@ -24,4 +30,31 @@ increment_build_number_in_plist(
build_number: new_version,
target: 'ClashX'
)
end
lane :addKeyChain do
if is_ci?
puts("create custom keychain")
delete_keychain(
name: "clashBuild"
) if File.exist? File.expand_path("~/Library/Keychains/clashBuild-db")
create_keychain(
name: "clashBuild",
default_keychain: false,
unlock: true,
timeout: 3600,
lock_when_sleeps: false,
password: "password"
)
import_certificate(
certificate_path: ".github/certs/dist.p12",
keychain_name:"clashBuild",
keychain_password:"password",
certificate_password:""
)
end
end