Add CI/CD configuration and API documentation

This commit is contained in:
2026-07-01 21:40:53 +08:00
commit c590135d68
4168 changed files with 740252 additions and 0 deletions
@@ -0,0 +1,81 @@
import ApplicationLibrary
import Foundation
import Libbox
import Library
import Network
import UIKit
/// UUVPN
/// VPN
class ApplicationDelegate: NSObject, UIApplicationDelegate {
/// iOS 16+
private var profileServer: ProfileServer?
///
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
// Libbox VPN
LibboxSetup(FilePath.sharedDirectory.relativePath, FilePath.workingDirectory.relativePath, FilePath.cacheDirectory.relativePath, false)
setup()
return true
}
///
private func setup() {
do {
//
try UIProfileUpdateTask.configure()
NSLog("setup background task success")
} catch {
NSLog("setup background task error: \(error.localizedDescription)")
}
//
Task {
if UIDevice.current.userInterfaceIdiom == .phone {
// iPhone
await requestNetworkPermission()
}
//
await setupBackground()
}
}
/// iOS 16+
private nonisolated func setupBackground() async {
if #available(iOS 16.0, *) {
do {
let profileServer = try ProfileServer()
profileServer.start()
// 线
await MainActor.run {
self.profileServer = profileServer
}
NSLog("started profile server")
} catch {
NSLog("setup profile server error: \(error.localizedDescription)")
}
}
}
///
private nonisolated func requestNetworkPermission() async {
if await SharedPreferences.networkPermissionRequested.get() {
return
}
if !DeviceCensorship.isChinaDevice() {
await SharedPreferences.networkPermissionRequested.set(true)
return
}
URLSession.shared.dataTask(with: URL(string: "http://captive.apple.com")!) { _, response, _ in
if let response = response as? HTTPURLResponse {
if response.statusCode == 200 {
Task {
await SharedPreferences.networkPermissionRequested.set(true)
}
}
}
}.resume()
}
}