mirror of
https://github.com/bolucat/Archive.git
synced 2025-09-26 20:21:35 +08:00
Update On Fri May 31 20:31:22 CEST 2024
This commit is contained in:
@@ -8,14 +8,13 @@ target 'V2rayU' do
|
||||
use_frameworks!
|
||||
|
||||
# Pods for V2rayU
|
||||
pod 'AppCenter'
|
||||
pod 'FirebaseAnalytics'
|
||||
pod 'FirebaseAnalytics', '~> 10.24.0'
|
||||
pod 'FirebaseCrashlytics'
|
||||
pod 'Alamofire'
|
||||
pod 'SwiftyJSON'
|
||||
# master branch
|
||||
pod 'Preferences', :git => 'https://github.com/sindresorhus/Preferences.git'
|
||||
pod 'Sparkle'
|
||||
pod 'Sparkle' ,'~> 2.0'
|
||||
pod 'QRCoder'
|
||||
pod 'MASShortcut'
|
||||
pod 'Swifter'
|
||||
|
@@ -1,15 +1,7 @@
|
||||
PODS:
|
||||
- Alamofire (4.8.2)
|
||||
- AppCenter (5.0.2):
|
||||
- AppCenter/Analytics (= 5.0.2)
|
||||
- AppCenter/Crashes (= 5.0.2)
|
||||
- AppCenter/Analytics (5.0.2):
|
||||
- AppCenter/Core
|
||||
- AppCenter/Core (5.0.2)
|
||||
- AppCenter/Crashes (5.0.2):
|
||||
- AppCenter/Core
|
||||
- FirebaseAnalytics (10.24.0):
|
||||
- FirebaseAnalytics/AdIdSupport (= 10.24.0)
|
||||
- FirebaseAnalytics (10.27.0):
|
||||
- FirebaseAnalytics/AdIdSupport (= 10.27.0)
|
||||
- FirebaseCore (~> 10.0)
|
||||
- FirebaseInstallations (~> 10.0)
|
||||
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
|
||||
@@ -17,10 +9,10 @@ PODS:
|
||||
- GoogleUtilities/Network (~> 7.11)
|
||||
- "GoogleUtilities/NSData+zlib (~> 7.11)"
|
||||
- nanopb (< 2.30911.0, >= 2.30908.0)
|
||||
- FirebaseAnalytics/AdIdSupport (10.24.0):
|
||||
- FirebaseAnalytics/AdIdSupport (10.27.0):
|
||||
- FirebaseCore (~> 10.0)
|
||||
- FirebaseInstallations (~> 10.0)
|
||||
- GoogleAppMeasurement (= 10.24.0)
|
||||
- GoogleAppMeasurement (= 10.27.0)
|
||||
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
|
||||
- GoogleUtilities/MethodSwizzler (~> 7.11)
|
||||
- GoogleUtilities/Network (~> 7.11)
|
||||
@@ -43,7 +35,7 @@ PODS:
|
||||
- GoogleUtilities/Environment (~> 7.8)
|
||||
- nanopb (< 2.30911.0, >= 2.30908.0)
|
||||
- PromisesObjC (~> 2.1)
|
||||
- FirebaseInstallations (10.24.0):
|
||||
- FirebaseInstallations (10.27.0):
|
||||
- FirebaseCore (~> 10.0)
|
||||
- GoogleUtilities/Environment (~> 7.8)
|
||||
- GoogleUtilities/UserDefaults (~> 7.8)
|
||||
@@ -57,21 +49,21 @@ PODS:
|
||||
- GoogleUtilities/Environment (~> 7.10)
|
||||
- nanopb (< 2.30911.0, >= 2.30908.0)
|
||||
- PromisesSwift (~> 2.1)
|
||||
- GoogleAppMeasurement (10.24.0):
|
||||
- GoogleAppMeasurement/AdIdSupport (= 10.24.0)
|
||||
- GoogleAppMeasurement (10.27.0):
|
||||
- GoogleAppMeasurement/AdIdSupport (= 10.27.0)
|
||||
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
|
||||
- GoogleUtilities/MethodSwizzler (~> 7.11)
|
||||
- GoogleUtilities/Network (~> 7.11)
|
||||
- "GoogleUtilities/NSData+zlib (~> 7.11)"
|
||||
- nanopb (< 2.30911.0, >= 2.30908.0)
|
||||
- GoogleAppMeasurement/AdIdSupport (10.24.0):
|
||||
- GoogleAppMeasurement/WithoutAdIdSupport (= 10.24.0)
|
||||
- GoogleAppMeasurement/AdIdSupport (10.27.0):
|
||||
- GoogleAppMeasurement/WithoutAdIdSupport (= 10.27.0)
|
||||
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
|
||||
- GoogleUtilities/MethodSwizzler (~> 7.11)
|
||||
- GoogleUtilities/Network (~> 7.11)
|
||||
- "GoogleUtilities/NSData+zlib (~> 7.11)"
|
||||
- nanopb (< 2.30911.0, >= 2.30908.0)
|
||||
- GoogleAppMeasurement/WithoutAdIdSupport (10.24.0):
|
||||
- GoogleAppMeasurement/WithoutAdIdSupport (10.27.0):
|
||||
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
|
||||
- GoogleUtilities/MethodSwizzler (~> 7.11)
|
||||
- GoogleUtilities/Network (~> 7.11)
|
||||
@@ -120,20 +112,19 @@ PODS:
|
||||
- PromisesSwift (2.4.0):
|
||||
- PromisesObjC (= 2.4.0)
|
||||
- QRCoder (1.1.0)
|
||||
- Sparkle (1.24.0)
|
||||
- Sparkle (2.6.2)
|
||||
- Swifter (1.4.7)
|
||||
- SwiftyJSON (5.0.0)
|
||||
- Yams (5.0.6)
|
||||
|
||||
DEPENDENCIES:
|
||||
- Alamofire
|
||||
- AppCenter
|
||||
- FirebaseAnalytics
|
||||
- FirebaseAnalytics (> 10.24.0)
|
||||
- FirebaseCrashlytics
|
||||
- MASShortcut
|
||||
- Preferences (from `https://github.com/sindresorhus/Preferences.git`)
|
||||
- QRCoder
|
||||
- Sparkle
|
||||
- Sparkle (~> 2.0)
|
||||
- Swifter
|
||||
- SwiftyJSON
|
||||
- Yams
|
||||
@@ -141,7 +132,6 @@ DEPENDENCIES:
|
||||
SPEC REPOS:
|
||||
https://github.com/CocoaPods/Specs.git:
|
||||
- Alamofire
|
||||
- AppCenter
|
||||
- FirebaseAnalytics
|
||||
- FirebaseCore
|
||||
- FirebaseCoreExtension
|
||||
@@ -174,16 +164,15 @@ CHECKOUT OPTIONS:
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3
|
||||
AppCenter: 355ba776b273d30147c3ac385c558bec60a7d4b1
|
||||
FirebaseAnalytics: b5efc493eb0f40ec560b04a472e3e1a15d39ca13
|
||||
FirebaseAnalytics: f9211b719db260cc91aebee8bb539cb367d0dfd1
|
||||
FirebaseCore: 11dc8a16dfb7c5e3c3f45ba0e191a33ac4f50894
|
||||
FirebaseCoreExtension: af5fd85e817ea9d19f9a2659a376cf9cf99f03c0
|
||||
FirebaseCoreInternal: bcb5acffd4ea05e12a783ecf835f2210ce3dc6af
|
||||
FirebaseCrashlytics: af38ea4adfa606f6e63fcc22091b61e7938fcf66
|
||||
FirebaseInstallations: 8f581fca6478a50705d2bd2abd66d306e0f5736e
|
||||
FirebaseInstallations: 766dabca09fd94aef922538aaf144cc4a6fb6869
|
||||
FirebaseRemoteConfigInterop: 6c349a466490aeace3ce9c091c86be1730711634
|
||||
FirebaseSessions: 2651b464e241c93fd44112f995d5ab663c970487
|
||||
GoogleAppMeasurement: f3abf08495ef2cba7829f15318c373b8d9226491
|
||||
GoogleAppMeasurement: f65fc137531af9ad647f1c0a42f3b6a4d3a98049
|
||||
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
|
||||
GoogleUtilities: d053d902a8edaa9904e1bd00c37535385b8ed152
|
||||
MASShortcut: 9c215e8a8a78f3d01ce56da48e2730ab66b538fa
|
||||
@@ -192,11 +181,11 @@ SPEC CHECKSUMS:
|
||||
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
|
||||
PromisesSwift: 9d77319bbe72ebf6d872900551f7eeba9bce2851
|
||||
QRCoder: cbd2bee531cc86d286df7942334cfed94c803ae4
|
||||
Sparkle: 270cd27377bf04e9c128af06e3a22d0f572d6ee3
|
||||
Sparkle: a62c7dc4f410ced73beb2169cf1d3cc3f028a295
|
||||
Swifter: 2327ef5d872c638aebab79646ce494af508b0c8f
|
||||
SwiftyJSON: 36413e04c44ee145039d332b4f4e2d3e8d6c4db7
|
||||
Yams: e10dae147f517ed57ecae37c5e8681bdf8fcab65
|
||||
|
||||
PODFILE CHECKSUM: f64539699369b56c80c40cf2ac40609ff3753e2c
|
||||
PODFILE CHECKSUM: 071aabe40b11d56fb50a9b83f6ed47079838bdee
|
||||
|
||||
COCOAPODS: 1.15.2
|
||||
|
@@ -18,6 +18,7 @@
|
||||
6618372E23E9BF74000F7410 /* ToastWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6618372C23E9BF73000F7410 /* ToastWindow.xib */; };
|
||||
66193A8623EE45B200289B6A /* PreferenceRouting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66193A8523EE45B200289B6A /* PreferenceRouting.swift */; };
|
||||
66193A8923EE46BC00289B6A /* PreferenceRouting.xib in Resources */ = {isa = PBXBuildFile; fileRef = 66193A8723EE46BC00289B6A /* PreferenceRouting.xib */; };
|
||||
6633A43F2C0A120000C54CA5 /* Sparkle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6633A43E2C0A120000C54CA5 /* Sparkle.swift */; };
|
||||
663F040625ED4B2C00687600 /* V2rayLaunch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 663F040525ED4B2C00687600 /* V2rayLaunch.swift */; };
|
||||
664EB375216C9A5E00B6AE0D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 664EB374216C9A5E00B6AE0D /* AppDelegate.swift */; };
|
||||
664EB377216C9A5F00B6AE0D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 664EB376216C9A5F00B6AE0D /* Assets.xcassets */; };
|
||||
@@ -119,6 +120,7 @@
|
||||
6625848D2AB745E700DFDC1E /* sign.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = sign.sh; sourceTree = "<group>"; };
|
||||
6625848E2AB746D500DFDC1E /* appdmg.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = appdmg.sh; sourceTree = "<group>"; };
|
||||
662F0ACE2AB720C700884C17 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = ../en.lproj/PreferenceGeneral.strings; sourceTree = "<group>"; };
|
||||
6633A43E2C0A120000C54CA5 /* Sparkle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sparkle.swift; sourceTree = "<group>"; };
|
||||
663F040525ED4B2C00687600 /* V2rayLaunch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = V2rayLaunch.swift; sourceTree = "<group>"; };
|
||||
664666A021CBD6C60094F0B7 /* libPods-V2rayUTool.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libPods-V2rayUTool.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
664B95DD217062A500DBC941 /* Alamofire */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Alamofire; path = Pods/Alamofire; sourceTree = "<group>"; };
|
||||
@@ -282,6 +284,7 @@
|
||||
6D6DF7F662C35646734A352E /* install.sh */,
|
||||
6D6DF11F0983AFCBEF1E347B /* Uri.swift */,
|
||||
6D6DF79424C83391C205CB9C /* Share.swift */,
|
||||
6633A43E2C0A120000C54CA5 /* Sparkle.swift */,
|
||||
);
|
||||
path = V2rayU;
|
||||
sourceTree = "<group>";
|
||||
@@ -561,6 +564,7 @@
|
||||
6D6DF807BE591BE396221EF3 /* PreferenceAdvance.swift in Sources */,
|
||||
6D6DFC1D9432F2A60D2156E2 /* PreferenceDns.swift in Sources */,
|
||||
6D6DF670FFB063EE2360776C /* Uri.swift in Sources */,
|
||||
6633A43F2C0A120000C54CA5 /* Sparkle.swift in Sources */,
|
||||
6D6DF41FA8F7C7B020AC4115 /* Share.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -841,7 +845,7 @@
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 4.1.0;
|
||||
CURRENT_PROJECT_VERSION = 4.2.0;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_ONLY_ACTIVE_RESOURCES = YES;
|
||||
@@ -852,7 +856,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MARKETING_VERSION = 4.1.0;
|
||||
MARKETING_VERSION = 4.2.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = net.yanue.V2rayU;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -875,7 +879,7 @@
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 4.1.0;
|
||||
CURRENT_PROJECT_VERSION = 4.2.0;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
ENABLE_ONLY_ACTIVE_RESOURCES = YES;
|
||||
@@ -886,7 +890,7 @@
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
||||
MARKETING_VERSION = 4.1.0;
|
||||
MARKETING_VERSION = 4.2.0;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = net.yanue.V2rayU;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
@@ -8,9 +8,6 @@
|
||||
|
||||
import Cocoa
|
||||
import ServiceManagement
|
||||
import AppCenter
|
||||
import AppCenterAnalytics
|
||||
import AppCenterCrashes
|
||||
import MASShortcut
|
||||
import Preferences
|
||||
import Sparkle
|
||||
@@ -18,7 +15,7 @@ import FirebaseCore
|
||||
|
||||
let launcherAppIdentifier = "net.yanue.V2rayU.Launcher"
|
||||
let appVersion = getAppVersion()
|
||||
let V2rayUpdater = SUUpdater()
|
||||
let V2rayUpdater = V2rayUpdaterController()
|
||||
|
||||
let NOTIFY_TOGGLE_RUNNING_SHORTCUT = Notification.Name(rawValue: "NOTIFY_TOGGLE_RUNNING_SHORTCUT")
|
||||
let NOTIFY_SWITCH_PROXY_MODE_SHORTCUT = Notification.Name(rawValue: "NOTIFY_SWITCH_PROXY_MODE_SHORTCUT")
|
||||
@@ -53,11 +50,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||
print("applicationDidFinishLaunching")
|
||||
FirebaseApp.configure()
|
||||
// appcenter init
|
||||
AppCenter.start(withAppSecret: "d52dd1a1-7a3a-4143-b159-a30434f87713", services:[
|
||||
Analytics.self,
|
||||
Crashes.self
|
||||
])
|
||||
|
||||
// default settings
|
||||
self.checkDefault()
|
||||
@@ -100,9 +92,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
|
||||
// auto check updates
|
||||
if UserDefaults.getBool(forKey: .autoCheckVersion) {
|
||||
checkV2rayUVersion()
|
||||
// check version
|
||||
V2rayUpdater.checkForUpdatesInBackground()
|
||||
// 初始化更新控制器
|
||||
V2rayUpdater.checkForUpdates()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,9 +140,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
}
|
||||
// auto check updates
|
||||
if UserDefaults.getBool(forKey: .autoCheckVersion) {
|
||||
checkV2rayUVersion()
|
||||
// check version
|
||||
V2rayUpdater.checkForUpdatesInBackground()
|
||||
V2rayUpdater.checkForUpdates()
|
||||
}
|
||||
// auto update subscribe servers
|
||||
if UserDefaults.getBool(forKey: .autoUpdateServers) {
|
||||
|
@@ -53,7 +53,7 @@
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>SUFeedURL</key>
|
||||
<string>https://api.appcenter.ms/v0.1/public/sparkle/apps/d52dd1a1-7a3a-4143-b159-a30434f87713</string>
|
||||
<string>https://v2rayu-61f76.web.app/appcast.xml</string>
|
||||
<key>SUPublicEDKey</key>
|
||||
<string>PW8pDnr5VZkmC93gZjUDlHI8gkJSspPoDU3DdhsMkps</string>
|
||||
</dict>
|
||||
|
@@ -283,9 +283,8 @@ class MenuController: NSObject, NSMenuDelegate {
|
||||
}
|
||||
|
||||
@IBAction func checkForUpdate(_ sender: NSMenuItem) {
|
||||
checkV2rayUVersion()
|
||||
// need set SUFeedURL into plist
|
||||
V2rayUpdater.checkForUpdates(sender)
|
||||
V2rayUpdater.checkForUpdates()
|
||||
}
|
||||
|
||||
@IBAction func generateQrcode(_ sender: NSMenuItem) {
|
||||
|
@@ -69,7 +69,7 @@ final class PreferenceGeneralViewController: NSViewController, PreferencePane {
|
||||
|
||||
@IBAction func checkVersion(_ sender: NSButton) {
|
||||
// need set SUFeedURL into plist
|
||||
V2rayUpdater.checkForUpdates(sender)
|
||||
V2rayUpdater.checkForUpdates()
|
||||
}
|
||||
|
||||
}
|
||||
|
88
v2rayu/V2rayU/Sparkle.swift
Normal file
88
v2rayu/V2rayU/Sparkle.swift
Normal file
@@ -0,0 +1,88 @@
|
||||
//
|
||||
// Sparkle.swift
|
||||
// V2rayU
|
||||
//
|
||||
// Created by yanue on 2024/5/31.
|
||||
// Copyright © 2024 yanue. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Sparkle
|
||||
|
||||
class V2rayUpdaterController: NSObject, SPUUpdaterDelegate {
|
||||
private let primaryFeedURL = "https://v2rayu-61f76.web.app/appcast.xml"
|
||||
private let backupFeedURL = "https://raw.githubusercontent.com/yanue/V2rayU/master/appcast.xml"
|
||||
private var usePrimaryFeedURL = true
|
||||
private var updater: SPUUpdater?
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
let userDriver = SPUStandardUserDriver(hostBundle: Bundle.main, delegate: nil)
|
||||
updater = SPUUpdater(hostBundle: Bundle.main, applicationBundle: Bundle.main, userDriver: userDriver, delegate: self)
|
||||
}
|
||||
|
||||
func checkForUpdates() {
|
||||
// check version by github release
|
||||
checkV2rayUVersion()
|
||||
// check by sparkle
|
||||
fetchAppcast(from: primaryFeedURL) { success in
|
||||
// 主线程
|
||||
DispatchQueue.main.async {
|
||||
if success {
|
||||
self.usePrimaryFeedURL = true
|
||||
self.startUpdateProcess()
|
||||
} else {
|
||||
self.fetchAppcast(from: self.backupFeedURL) { success in
|
||||
// 主线程
|
||||
DispatchQueue.main.async {
|
||||
if success {
|
||||
self.usePrimaryFeedURL = false
|
||||
self.startUpdateProcess()
|
||||
} else {
|
||||
print("Failed to fetch appcast from both primary and backup URLs.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func fetchAppcast(from urlString: String, completion: @escaping (Bool) -> Void) {
|
||||
guard let url = URL(string: urlString) else {
|
||||
completion(false)
|
||||
return
|
||||
}
|
||||
|
||||
let task = URLSession.shared.dataTask(with: url) { data, response, error in
|
||||
if let error = error {
|
||||
print("Failed to fetch appcast: \(error)")
|
||||
completion(false)
|
||||
return
|
||||
}
|
||||
guard data != nil else {
|
||||
print("No data received from appcast URL")
|
||||
completion(false)
|
||||
return
|
||||
}
|
||||
// 解析 appcast 数据,确保它是有效的
|
||||
completion(true)
|
||||
}
|
||||
task.resume()
|
||||
}
|
||||
|
||||
private func startUpdateProcess() {
|
||||
guard let updater = updater else { return }
|
||||
do {
|
||||
try updater.start()
|
||||
updater.checkForUpdates()
|
||||
} catch {
|
||||
print("Failed to start updater or check for updates: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
// SPUUpdaterDelegate 方法实现
|
||||
func feedURLString(for updater: SPUUpdater) -> String? {
|
||||
return usePrimaryFeedURL ? primaryFeedURL : backupFeedURL
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user