mirror of
https://github.com/yJason/ClashX-Dashboard.git
synced 2025-12-19 12:22:23 +08:00
init
This commit is contained in:
115
.gitignore
vendored
Normal file
115
.gitignore
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
# Xcode
|
||||
#
|
||||
# gitignore contributors: remember to update macOS.gitignore, Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
|
||||
|
||||
## macOS
|
||||
|
||||
*.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
## Build generated
|
||||
build/
|
||||
DerivedData/
|
||||
|
||||
## Xcode generated
|
||||
*/project.xcworkspace/xcshareddata/
|
||||
|
||||
## Various settings
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata/
|
||||
|
||||
## Other
|
||||
*.moved-aside
|
||||
*.xcuserstate
|
||||
|
||||
## Obj-C/Swift specific
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.dSYM.zip
|
||||
*.dSYM
|
||||
|
||||
## Playgrounds
|
||||
timeline.xctimeline
|
||||
playground.xcworkspace
|
||||
|
||||
# Swift Package Manager
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
|
||||
# Packages/
|
||||
.build/
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
# We recommend against adding the Pods directory to your .gitignore. However
|
||||
# you should judge for yourself, the pros and cons are mentioned at:
|
||||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||
#
|
||||
Pods/
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
# Carthage/Checkouts
|
||||
|
||||
Carthage/Build
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
|
||||
|
||||
fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots
|
||||
fastlane/test_output
|
||||
|
||||
other/MPV*.swift
|
||||
psd/
|
||||
temp/
|
||||
|
||||
# FileMerge backup
|
||||
*.orig
|
||||
|
||||
browser/Firefox_Open_In_IINA/*
|
||||
!browser/Firefox_Open_In_IINA/manifest.json
|
||||
|
||||
*.dylib
|
||||
*.so
|
||||
|
||||
*.xcarchive
|
||||
/.vscode
|
||||
|
||||
deps/executable/youtube-dl
|
||||
|
||||
738
ClashX Dashboard.xcodeproj/project.pbxproj
Normal file
738
ClashX Dashboard.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,738 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 56;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
010F693B29ED639A00BAAFB5 /* ClashServerAppStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 010F693A29ED639A00BAAFB5 /* ClashServerAppStorage.swift */; };
|
||||
0140D8F029E6D3C800A515E8 /* ProxyProviderGroupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0140D8EF29E6D3C800A515E8 /* ProxyProviderGroupView.swift */; };
|
||||
0155D39629F2342F00869830 /* TrafficGraphView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0155D39529F2342F00869830 /* TrafficGraphView.swift */; };
|
||||
0155D39829F23BDE00869830 /* OverviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0155D39729F23BDE00869830 /* OverviewView.swift */; };
|
||||
0172CB4D29E542410072DDEF /* ProxyItemData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0172CB4C29E542410072DDEF /* ProxyItemData.swift */; };
|
||||
0172CB4F29E562960072DDEF /* ClearBackgroundList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0172CB4E29E562960072DDEF /* ClearBackgroundList.swift */; };
|
||||
0172CB5129E5AE670072DDEF /* SwiftUIViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0172CB5029E5AE670072DDEF /* SwiftUIViewExtensions.swift */; };
|
||||
017753C029EF7FB2006999DB /* APIServerItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017753BF29EF7FB1006999DB /* APIServerItem.swift */; };
|
||||
017DCADD29E83BFD00B9622A /* RuleProviderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017DCADC29E83BFD00B9622A /* RuleProviderView.swift */; };
|
||||
018A61BD29E9A2ED008608C0 /* APISettingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 018A61BC29E9A2ED008608C0 /* APISettingView.swift */; };
|
||||
018C836C29E17505006366D3 /* ClashApiDatasStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 018C836B29E17505006366D3 /* ClashApiDatasStorage.swift */; };
|
||||
0192315F29DD4DCF00539EDD /* ClashX_DashboardApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192315E29DD4DCF00539EDD /* ClashX_DashboardApp.swift */; };
|
||||
0192316129DD4DCF00539EDD /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192316029DD4DCF00539EDD /* ContentView.swift */; };
|
||||
0192316329DD4DD100539EDD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0192316229DD4DD100539EDD /* Assets.xcassets */; };
|
||||
0192316629DD4DD100539EDD /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0192316529DD4DD100539EDD /* Preview Assets.xcassets */; };
|
||||
0192317129DD566000539EDD /* SidebarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192317029DD566000539EDD /* SidebarView.swift */; };
|
||||
0192317829DD5DA500539EDD /* ProxiesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192317729DD5DA500539EDD /* ProxiesView.swift */; };
|
||||
0192317A29DD5DB000539EDD /* RulesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192317929DD5DB000539EDD /* RulesView.swift */; };
|
||||
0192317C29DD5DF200539EDD /* ConnectionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192317B29DD5DF200539EDD /* ConnectionsView.swift */; };
|
||||
0192317E29DD5E0100539EDD /* ConfigView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192317D29DD5E0100539EDD /* ConfigView.swift */; };
|
||||
0192318029DD5E0B00539EDD /* LogsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192317F29DD5E0B00539EDD /* LogsView.swift */; };
|
||||
0192318329DD70B400539EDD /* SidebarItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192318229DD70B400539EDD /* SidebarItem.swift */; };
|
||||
0192318529DD7DCD00539EDD /* SidebarItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192318429DD7DCD00539EDD /* SidebarItemView.swift */; };
|
||||
0192318729DD83FF00539EDD /* OverviewTopItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192318629DD83FF00539EDD /* OverviewTopItemView.swift */; };
|
||||
0192B5B729DE5098002CDBF3 /* ApiRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192B5B629DE5098002CDBF3 /* ApiRequest.swift */; };
|
||||
0192B5BA29DE50F8002CDBF3 /* Alamofire in Frameworks */ = {isa = PBXBuildFile; productRef = 0192B5B929DE50F8002CDBF3 /* Alamofire */; };
|
||||
0192B5BD29DE5113002CDBF3 /* SwiftyJSON in Frameworks */ = {isa = PBXBuildFile; productRef = 0192B5BC29DE5113002CDBF3 /* SwiftyJSON */; };
|
||||
0192B5C029DE5134002CDBF3 /* Starscream in Frameworks */ = {isa = PBXBuildFile; productRef = 0192B5BF29DE5134002CDBF3 /* Starscream */; };
|
||||
0192B5CA29DE5151002CDBF3 /* ClashConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192B5C229DE5150002CDBF3 /* ClashConfig.swift */; };
|
||||
0192B5CB29DE5151002CDBF3 /* ClashProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192B5C329DE5150002CDBF3 /* ClashProvider.swift */; };
|
||||
0192B5CC29DE5151002CDBF3 /* SavedProxyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192B5C429DE5150002CDBF3 /* SavedProxyModel.swift */; };
|
||||
0192B5CD29DE5151002CDBF3 /* ClashProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192B5C529DE5150002CDBF3 /* ClashProxy.swift */; };
|
||||
0192B5CE29DE5151002CDBF3 /* RemoteConfigModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192B5C629DE5150002CDBF3 /* RemoteConfigModel.swift */; };
|
||||
0192B5CF29DE5151002CDBF3 /* ClashConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192B5C729DE5150002CDBF3 /* ClashConnection.swift */; };
|
||||
0192B5D029DE5151002CDBF3 /* ClashRuleProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192B5C829DE5150002CDBF3 /* ClashRuleProvider.swift */; };
|
||||
0192B5D129DE5151002CDBF3 /* ClashRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192B5C929DE5150002CDBF3 /* ClashRule.swift */; };
|
||||
0192B5D429DE5190002CDBF3 /* CocoaLumberjackSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 0192B5D329DE5190002CDBF3 /* CocoaLumberjackSwift */; };
|
||||
0192B5D629DE5207002CDBF3 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192B5D529DE5206002CDBF3 /* Logger.swift */; };
|
||||
0192B5F629DE5262002CDBF3 /* ConfigManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192B5E029DE5261002CDBF3 /* ConfigManager.swift */; };
|
||||
0192B61129DE5292002CDBF3 /* Array+Safe.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192B60629DE5292002CDBF3 /* Array+Safe.swift */; };
|
||||
0192B61429DE5292002CDBF3 /* String+Encode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192B60929DE5292002CDBF3 /* String+Encode.swift */; };
|
||||
0192B61A29DE5292002CDBF3 /* DateFormatter+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0192B60F29DE5292002CDBF3 /* DateFormatter+.swift */; };
|
||||
019D6A8729F015DF00A6AC02 /* ArrayExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 019D6A8629F015DF00A6AC02 /* ArrayExtensions.swift */; };
|
||||
019D6A9629F194C600A6AC02 /* DSFSparkline in Frameworks */ = {isa = PBXBuildFile; productRef = 019D6A9529F194C600A6AC02 /* DSFSparkline */; };
|
||||
01A351A229DD8F440054894E /* RuleItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01A351A129DD8F440054894E /* RuleItemView.swift */; };
|
||||
01A351A929DD9CB00054894E /* Connections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01A351A829DD9CB00054894E /* Connections.swift */; };
|
||||
01CD0A9229E93ABB00F4C17E /* DifferenceKit in Frameworks */ = {isa = PBXBuildFile; productRef = 01CD0A9129E93ABB00F4C17E /* DifferenceKit */; };
|
||||
01F885CF29DFD8DF008241EB /* CollectionsTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F885CE29DFD8DF008241EB /* CollectionsTableView.swift */; };
|
||||
01F885D129E03F20008241EB /* CollectionTableCellView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 01F885D029E03F20008241EB /* CollectionTableCellView.xib */; };
|
||||
01F885D329E04E21008241EB /* ProxyGroupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F885D229E04E21008241EB /* ProxyGroupView.swift */; };
|
||||
01F885D529E053DE008241EB /* ProxyItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01F885D429E053DE008241EB /* ProxyItemView.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
010F693A29ED639A00BAAFB5 /* ClashServerAppStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClashServerAppStorage.swift; sourceTree = "<group>"; };
|
||||
0140D8EF29E6D3C800A515E8 /* ProxyProviderGroupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProxyProviderGroupView.swift; sourceTree = "<group>"; };
|
||||
0155D39529F2342F00869830 /* TrafficGraphView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrafficGraphView.swift; sourceTree = "<group>"; };
|
||||
0155D39729F23BDE00869830 /* OverviewView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OverviewView.swift; sourceTree = "<group>"; };
|
||||
0172CB4C29E542410072DDEF /* ProxyItemData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProxyItemData.swift; sourceTree = "<group>"; };
|
||||
0172CB4E29E562960072DDEF /* ClearBackgroundList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClearBackgroundList.swift; sourceTree = "<group>"; };
|
||||
0172CB5029E5AE670072DDEF /* SwiftUIViewExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIViewExtensions.swift; sourceTree = "<group>"; };
|
||||
017753BF29EF7FB1006999DB /* APIServerItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIServerItem.swift; sourceTree = "<group>"; };
|
||||
017DCADC29E83BFD00B9622A /* RuleProviderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleProviderView.swift; sourceTree = "<group>"; };
|
||||
018A61BC29E9A2ED008608C0 /* APISettingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APISettingView.swift; sourceTree = "<group>"; };
|
||||
018C836B29E17505006366D3 /* ClashApiDatasStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClashApiDatasStorage.swift; sourceTree = "<group>"; };
|
||||
0192315B29DD4DCF00539EDD /* ClashX Dashboard.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ClashX Dashboard.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
0192315E29DD4DCF00539EDD /* ClashX_DashboardApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClashX_DashboardApp.swift; sourceTree = "<group>"; };
|
||||
0192316029DD4DCF00539EDD /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
||||
0192316229DD4DD100539EDD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
0192316529DD4DD100539EDD /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
|
||||
0192316729DD4DD100539EDD /* ClashX_Dashboard.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ClashX_Dashboard.entitlements; sourceTree = "<group>"; };
|
||||
0192317029DD566000539EDD /* SidebarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarView.swift; sourceTree = "<group>"; };
|
||||
0192317729DD5DA500539EDD /* ProxiesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProxiesView.swift; sourceTree = "<group>"; };
|
||||
0192317929DD5DB000539EDD /* RulesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RulesView.swift; sourceTree = "<group>"; };
|
||||
0192317B29DD5DF200539EDD /* ConnectionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionsView.swift; sourceTree = "<group>"; };
|
||||
0192317D29DD5E0100539EDD /* ConfigView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigView.swift; sourceTree = "<group>"; };
|
||||
0192317F29DD5E0B00539EDD /* LogsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogsView.swift; sourceTree = "<group>"; };
|
||||
0192318229DD70B400539EDD /* SidebarItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarItem.swift; sourceTree = "<group>"; };
|
||||
0192318429DD7DCD00539EDD /* SidebarItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarItemView.swift; sourceTree = "<group>"; };
|
||||
0192318629DD83FF00539EDD /* OverviewTopItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverviewTopItemView.swift; sourceTree = "<group>"; };
|
||||
0192B5B629DE5098002CDBF3 /* ApiRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ApiRequest.swift; path = ../../../ClashX.Meta/ClashX/General/ApiRequest.swift; sourceTree = "<group>"; };
|
||||
0192B5C229DE5150002CDBF3 /* ClashConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClashConfig.swift; sourceTree = "<group>"; };
|
||||
0192B5C329DE5150002CDBF3 /* ClashProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClashProvider.swift; sourceTree = "<group>"; };
|
||||
0192B5C429DE5150002CDBF3 /* SavedProxyModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SavedProxyModel.swift; sourceTree = "<group>"; };
|
||||
0192B5C529DE5150002CDBF3 /* ClashProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClashProxy.swift; sourceTree = "<group>"; };
|
||||
0192B5C629DE5150002CDBF3 /* RemoteConfigModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RemoteConfigModel.swift; sourceTree = "<group>"; };
|
||||
0192B5C729DE5150002CDBF3 /* ClashConnection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClashConnection.swift; sourceTree = "<group>"; };
|
||||
0192B5C829DE5150002CDBF3 /* ClashRuleProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClashRuleProvider.swift; sourceTree = "<group>"; };
|
||||
0192B5C929DE5150002CDBF3 /* ClashRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClashRule.swift; sourceTree = "<group>"; };
|
||||
0192B5D529DE5206002CDBF3 /* Logger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Logger.swift; path = ../../../ClashX.Meta/ClashX/Basic/Logger.swift; sourceTree = "<group>"; };
|
||||
0192B5E029DE5261002CDBF3 /* ConfigManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfigManager.swift; sourceTree = "<group>"; };
|
||||
0192B60629DE5292002CDBF3 /* Array+Safe.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Array+Safe.swift"; sourceTree = "<group>"; };
|
||||
0192B60929DE5292002CDBF3 /* String+Encode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+Encode.swift"; sourceTree = "<group>"; };
|
||||
0192B60F29DE5292002CDBF3 /* DateFormatter+.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DateFormatter+.swift"; sourceTree = "<group>"; };
|
||||
019D6A8629F015DF00A6AC02 /* ArrayExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayExtensions.swift; sourceTree = "<group>"; };
|
||||
01A351A129DD8F440054894E /* RuleItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleItemView.swift; sourceTree = "<group>"; };
|
||||
01A351A829DD9CB00054894E /* Connections.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Connections.swift; sourceTree = "<group>"; };
|
||||
01F885CE29DFD8DF008241EB /* CollectionsTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionsTableView.swift; sourceTree = "<group>"; };
|
||||
01F885D029E03F20008241EB /* CollectionTableCellView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CollectionTableCellView.xib; sourceTree = "<group>"; };
|
||||
01F885D229E04E21008241EB /* ProxyGroupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProxyGroupView.swift; sourceTree = "<group>"; };
|
||||
01F885D429E053DE008241EB /* ProxyItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProxyItemView.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
0192315829DD4DCF00539EDD /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
0192B5BD29DE5113002CDBF3 /* SwiftyJSON in Frameworks */,
|
||||
0192B5BA29DE50F8002CDBF3 /* Alamofire in Frameworks */,
|
||||
019D6A9629F194C600A6AC02 /* DSFSparkline in Frameworks */,
|
||||
0192B5D429DE5190002CDBF3 /* CocoaLumberjackSwift in Frameworks */,
|
||||
01CD0A9229E93ABB00F4C17E /* DifferenceKit in Frameworks */,
|
||||
0192B5C029DE5134002CDBF3 /* Starscream in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
010F693929ED638B00BAAFB5 /* APISetting */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
018A61BC29E9A2ED008608C0 /* APISettingView.swift */,
|
||||
017753BF29EF7FB1006999DB /* APIServerItem.swift */,
|
||||
010F693A29ED639A00BAAFB5 /* ClashServerAppStorage.swift */,
|
||||
);
|
||||
path = APISetting;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
018C836929E1703D006366D3 /* Logs */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192317F29DD5E0B00539EDD /* LogsView.swift */,
|
||||
);
|
||||
path = Logs;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
018C836A29E174CB006366D3 /* Views */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192316029DD4DCF00539EDD /* ContentView.swift */,
|
||||
018C836B29E17505006366D3 /* ClashApiDatasStorage.swift */,
|
||||
010F693929ED638B00BAAFB5 /* APISetting */,
|
||||
0192318129DD709500539EDD /* SidebarView */,
|
||||
0192317429DD5D7400539EDD /* ContentTabs */,
|
||||
0172CB4E29E562960072DDEF /* ClearBackgroundList.swift */,
|
||||
019D6A8629F015DF00A6AC02 /* ArrayExtensions.swift */,
|
||||
0172CB5029E5AE670072DDEF /* SwiftUIViewExtensions.swift */,
|
||||
);
|
||||
path = Views;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0192315229DD4DCF00539EDD = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192315D29DD4DCF00539EDD /* ClashX Dashboard */,
|
||||
0192315C29DD4DCF00539EDD /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0192315C29DD4DCF00539EDD /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192315B29DD4DCF00539EDD /* ClashX Dashboard.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0192315D29DD4DCF00539EDD /* ClashX Dashboard */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192315E29DD4DCF00539EDD /* ClashX_DashboardApp.swift */,
|
||||
018C836A29E174CB006366D3 /* Views */,
|
||||
0192B5B529DE506D002CDBF3 /* ClashX Links */,
|
||||
0192316229DD4DD100539EDD /* Assets.xcassets */,
|
||||
0192316729DD4DD100539EDD /* ClashX_Dashboard.entitlements */,
|
||||
0192316429DD4DD100539EDD /* Preview Content */,
|
||||
);
|
||||
path = "ClashX Dashboard";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0192316429DD4DD100539EDD /* Preview Content */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192316529DD4DD100539EDD /* Preview Assets.xcassets */,
|
||||
);
|
||||
path = "Preview Content";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0192317429DD5D7400539EDD /* ContentTabs */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
01A351A529DD9B2D0054894E /* Overview */,
|
||||
01A351A629DD9BB50054894E /* Proxies */,
|
||||
01A351A029DD8F210054894E /* Rules */,
|
||||
01A351A729DD9C7F0054894E /* Connections */,
|
||||
01A7335F29E2CBD600205699 /* Config */,
|
||||
018C836929E1703D006366D3 /* Logs */,
|
||||
);
|
||||
path = ContentTabs;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0192318129DD709500539EDD /* SidebarView */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192317029DD566000539EDD /* SidebarView.swift */,
|
||||
0192318429DD7DCD00539EDD /* SidebarItemView.swift */,
|
||||
0192318229DD70B400539EDD /* SidebarItem.swift */,
|
||||
);
|
||||
path = SidebarView;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0192B5B529DE506D002CDBF3 /* ClashX Links */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192B60429DE5292002CDBF3 /* Extensions */,
|
||||
0192B5D729DE5261002CDBF3 /* General */,
|
||||
0192B5B629DE5098002CDBF3 /* ApiRequest.swift */,
|
||||
0192B5D529DE5206002CDBF3 /* Logger.swift */,
|
||||
0192B5C129DE5150002CDBF3 /* Models */,
|
||||
);
|
||||
path = "ClashX Links";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0192B5C129DE5150002CDBF3 /* Models */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192B5C229DE5150002CDBF3 /* ClashConfig.swift */,
|
||||
0192B5C329DE5150002CDBF3 /* ClashProvider.swift */,
|
||||
0192B5C429DE5150002CDBF3 /* SavedProxyModel.swift */,
|
||||
0192B5C529DE5150002CDBF3 /* ClashProxy.swift */,
|
||||
0192B5C629DE5150002CDBF3 /* RemoteConfigModel.swift */,
|
||||
0192B5C729DE5150002CDBF3 /* ClashConnection.swift */,
|
||||
0192B5C829DE5150002CDBF3 /* ClashRuleProvider.swift */,
|
||||
0192B5C929DE5150002CDBF3 /* ClashRule.swift */,
|
||||
);
|
||||
name = Models;
|
||||
path = ../../../ClashX.Meta/ClashX/Models;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0192B5D729DE5261002CDBF3 /* General */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192B5D829DE5261002CDBF3 /* Managers */,
|
||||
);
|
||||
name = General;
|
||||
path = ../../../ClashX.Meta/ClashX/General;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0192B5D829DE5261002CDBF3 /* Managers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192B5E029DE5261002CDBF3 /* ConfigManager.swift */,
|
||||
);
|
||||
path = Managers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0192B60429DE5292002CDBF3 /* Extensions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192B60629DE5292002CDBF3 /* Array+Safe.swift */,
|
||||
0192B60929DE5292002CDBF3 /* String+Encode.swift */,
|
||||
0192B60F29DE5292002CDBF3 /* DateFormatter+.swift */,
|
||||
);
|
||||
name = Extensions;
|
||||
path = ../../../ClashX.Meta/ClashX/Extensions;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
01A351A029DD8F210054894E /* Rules */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192317929DD5DB000539EDD /* RulesView.swift */,
|
||||
017DCADC29E83BFD00B9622A /* RuleProviderView.swift */,
|
||||
01A351A129DD8F440054894E /* RuleItemView.swift */,
|
||||
);
|
||||
path = Rules;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
01A351A529DD9B2D0054894E /* Overview */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0155D39729F23BDE00869830 /* OverviewView.swift */,
|
||||
0192318629DD83FF00539EDD /* OverviewTopItemView.swift */,
|
||||
0155D39529F2342F00869830 /* TrafficGraphView.swift */,
|
||||
);
|
||||
path = Overview;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
01A351A629DD9BB50054894E /* Proxies */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192317729DD5DA500539EDD /* ProxiesView.swift */,
|
||||
01F885D229E04E21008241EB /* ProxyGroupView.swift */,
|
||||
0140D8EF29E6D3C800A515E8 /* ProxyProviderGroupView.swift */,
|
||||
01F885D429E053DE008241EB /* ProxyItemView.swift */,
|
||||
0172CB4C29E542410072DDEF /* ProxyItemData.swift */,
|
||||
);
|
||||
path = Proxies;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
01A351A729DD9C7F0054894E /* Connections */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192317B29DD5DF200539EDD /* ConnectionsView.swift */,
|
||||
01A351A829DD9CB00054894E /* Connections.swift */,
|
||||
01F885CE29DFD8DF008241EB /* CollectionsTableView.swift */,
|
||||
01F885D029E03F20008241EB /* CollectionTableCellView.xib */,
|
||||
);
|
||||
path = Connections;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
01A7335F29E2CBD600205699 /* Config */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0192317D29DD5E0100539EDD /* ConfigView.swift */,
|
||||
);
|
||||
path = Config;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
0192315A29DD4DCF00539EDD /* ClashX Dashboard */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 0192316A29DD4DD100539EDD /* Build configuration list for PBXNativeTarget "ClashX Dashboard" */;
|
||||
buildPhases = (
|
||||
0192315729DD4DCF00539EDD /* Sources */,
|
||||
0192315829DD4DCF00539EDD /* Frameworks */,
|
||||
0192315929DD4DCF00539EDD /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "ClashX Dashboard";
|
||||
packageProductDependencies = (
|
||||
0192B5B929DE50F8002CDBF3 /* Alamofire */,
|
||||
0192B5BC29DE5113002CDBF3 /* SwiftyJSON */,
|
||||
0192B5BF29DE5134002CDBF3 /* Starscream */,
|
||||
0192B5D329DE5190002CDBF3 /* CocoaLumberjackSwift */,
|
||||
01CD0A9129E93ABB00F4C17E /* DifferenceKit */,
|
||||
019D6A9529F194C600A6AC02 /* DSFSparkline */,
|
||||
);
|
||||
productName = "ClashX Dashboard";
|
||||
productReference = 0192315B29DD4DCF00539EDD /* ClashX Dashboard.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
0192315329DD4DCF00539EDD /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastSwiftUpdateCheck = 1420;
|
||||
LastUpgradeCheck = 1420;
|
||||
TargetAttributes = {
|
||||
0192315A29DD4DCF00539EDD = {
|
||||
CreatedOnToolsVersion = 14.2;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 0192315629DD4DCF00539EDD /* Build configuration list for PBXProject "ClashX Dashboard" */;
|
||||
compatibilityVersion = "Xcode 14.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 0192315229DD4DCF00539EDD;
|
||||
packageReferences = (
|
||||
0192B5B829DE50F8002CDBF3 /* XCRemoteSwiftPackageReference "Alamofire" */,
|
||||
0192B5BB29DE5113002CDBF3 /* XCRemoteSwiftPackageReference "SwiftyJSON" */,
|
||||
0192B5BE29DE5134002CDBF3 /* XCRemoteSwiftPackageReference "Starscream" */,
|
||||
0192B5D229DE5190002CDBF3 /* XCRemoteSwiftPackageReference "CocoaLumberjack" */,
|
||||
01CD0A9029E93ABB00F4C17E /* XCRemoteSwiftPackageReference "DifferenceKit" */,
|
||||
019D6A9429F194C600A6AC02 /* XCRemoteSwiftPackageReference "DSFSparkline" */,
|
||||
);
|
||||
productRefGroup = 0192315C29DD4DCF00539EDD /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
0192315A29DD4DCF00539EDD /* ClashX Dashboard */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
0192315929DD4DCF00539EDD /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
0192316629DD4DD100539EDD /* Preview Assets.xcassets in Resources */,
|
||||
01F885D129E03F20008241EB /* CollectionTableCellView.xib in Resources */,
|
||||
0192316329DD4DD100539EDD /* Assets.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
0192315729DD4DCF00539EDD /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
0192317A29DD5DB000539EDD /* RulesView.swift in Sources */,
|
||||
019D6A8729F015DF00A6AC02 /* ArrayExtensions.swift in Sources */,
|
||||
0192316129DD4DCF00539EDD /* ContentView.swift in Sources */,
|
||||
0192318729DD83FF00539EDD /* OverviewTopItemView.swift in Sources */,
|
||||
0172CB4F29E562960072DDEF /* ClearBackgroundList.swift in Sources */,
|
||||
0172CB4D29E542410072DDEF /* ProxyItemData.swift in Sources */,
|
||||
0192318029DD5E0B00539EDD /* LogsView.swift in Sources */,
|
||||
0192318529DD7DCD00539EDD /* SidebarItemView.swift in Sources */,
|
||||
0192317E29DD5E0100539EDD /* ConfigView.swift in Sources */,
|
||||
0155D39629F2342F00869830 /* TrafficGraphView.swift in Sources */,
|
||||
0140D8F029E6D3C800A515E8 /* ProxyProviderGroupView.swift in Sources */,
|
||||
017DCADD29E83BFD00B9622A /* RuleProviderView.swift in Sources */,
|
||||
0192318329DD70B400539EDD /* SidebarItem.swift in Sources */,
|
||||
0155D39829F23BDE00869830 /* OverviewView.swift in Sources */,
|
||||
0192B5D629DE5207002CDBF3 /* Logger.swift in Sources */,
|
||||
0192B5CB29DE5151002CDBF3 /* ClashProvider.swift in Sources */,
|
||||
0192B5CF29DE5151002CDBF3 /* ClashConnection.swift in Sources */,
|
||||
018C836C29E17505006366D3 /* ClashApiDatasStorage.swift in Sources */,
|
||||
018A61BD29E9A2ED008608C0 /* APISettingView.swift in Sources */,
|
||||
0192B5CC29DE5151002CDBF3 /* SavedProxyModel.swift in Sources */,
|
||||
010F693B29ED639A00BAAFB5 /* ClashServerAppStorage.swift in Sources */,
|
||||
01F885D329E04E21008241EB /* ProxyGroupView.swift in Sources */,
|
||||
0192315F29DD4DCF00539EDD /* ClashX_DashboardApp.swift in Sources */,
|
||||
0192B5CD29DE5151002CDBF3 /* ClashProxy.swift in Sources */,
|
||||
0192B61129DE5292002CDBF3 /* Array+Safe.swift in Sources */,
|
||||
01A351A229DD8F440054894E /* RuleItemView.swift in Sources */,
|
||||
01F885D529E053DE008241EB /* ProxyItemView.swift in Sources */,
|
||||
0192B5D029DE5151002CDBF3 /* ClashRuleProvider.swift in Sources */,
|
||||
0192B5CE29DE5151002CDBF3 /* RemoteConfigModel.swift in Sources */,
|
||||
0192317129DD566000539EDD /* SidebarView.swift in Sources */,
|
||||
0192B5D129DE5151002CDBF3 /* ClashRule.swift in Sources */,
|
||||
0192317C29DD5DF200539EDD /* ConnectionsView.swift in Sources */,
|
||||
017753C029EF7FB2006999DB /* APIServerItem.swift in Sources */,
|
||||
0192B61429DE5292002CDBF3 /* String+Encode.swift in Sources */,
|
||||
0192317829DD5DA500539EDD /* ProxiesView.swift in Sources */,
|
||||
0192B5F629DE5262002CDBF3 /* ConfigManager.swift in Sources */,
|
||||
0192B61A29DE5292002CDBF3 /* DateFormatter+.swift in Sources */,
|
||||
01F885CF29DFD8DF008241EB /* CollectionsTableView.swift in Sources */,
|
||||
0192B5CA29DE5151002CDBF3 /* ClashConfig.swift in Sources */,
|
||||
0172CB5129E5AE670072DDEF /* SwiftUIViewExtensions.swift in Sources */,
|
||||
01A351A929DD9CB00054894E /* Connections.swift in Sources */,
|
||||
0192B5B729DE5098002CDBF3 /* ApiRequest.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
0192316829DD4DD100539EDD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 12.6;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
0192316929DD4DD100539EDD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 12.6;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
0192316B29DD4DD100539EDD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = "ClashX Dashboard/ClashX_Dashboard.entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"ClashX Dashboard/Preview Content\"";
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 12.0;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.metacubex.ClashX-Dashboard";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
0192316C29DD4DD100539EDD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = "ClashX Dashboard/ClashX_Dashboard.entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"ClashX Dashboard/Preview Content\"";
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 12.0;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.metacubex.ClashX-Dashboard";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
0192315629DD4DCF00539EDD /* Build configuration list for PBXProject "ClashX Dashboard" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
0192316829DD4DD100539EDD /* Debug */,
|
||||
0192316929DD4DD100539EDD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
0192316A29DD4DD100539EDD /* Build configuration list for PBXNativeTarget "ClashX Dashboard" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
0192316B29DD4DD100539EDD /* Debug */,
|
||||
0192316C29DD4DD100539EDD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCRemoteSwiftPackageReference section */
|
||||
0192B5B829DE50F8002CDBF3 /* XCRemoteSwiftPackageReference "Alamofire" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/Alamofire/Alamofire";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 5.0.0;
|
||||
};
|
||||
};
|
||||
0192B5BB29DE5113002CDBF3 /* XCRemoteSwiftPackageReference "SwiftyJSON" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/SwiftyJSON/SwiftyJSON";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 5.0.0;
|
||||
};
|
||||
};
|
||||
0192B5BE29DE5134002CDBF3 /* XCRemoteSwiftPackageReference "Starscream" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/daltoniam/Starscream";
|
||||
requirement = {
|
||||
kind = exactVersion;
|
||||
version = 3.1.1;
|
||||
};
|
||||
};
|
||||
0192B5D229DE5190002CDBF3 /* XCRemoteSwiftPackageReference "CocoaLumberjack" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/CocoaLumberjack/CocoaLumberjack";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 3.0.0;
|
||||
};
|
||||
};
|
||||
019D6A9429F194C600A6AC02 /* XCRemoteSwiftPackageReference "DSFSparkline" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/dagronf/DSFSparkline";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 4.0.0;
|
||||
};
|
||||
};
|
||||
01CD0A9029E93ABB00F4C17E /* XCRemoteSwiftPackageReference "DifferenceKit" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/ra1028/DifferenceKit";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 1.0.0;
|
||||
};
|
||||
};
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
0192B5B929DE50F8002CDBF3 /* Alamofire */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 0192B5B829DE50F8002CDBF3 /* XCRemoteSwiftPackageReference "Alamofire" */;
|
||||
productName = Alamofire;
|
||||
};
|
||||
0192B5BC29DE5113002CDBF3 /* SwiftyJSON */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 0192B5BB29DE5113002CDBF3 /* XCRemoteSwiftPackageReference "SwiftyJSON" */;
|
||||
productName = SwiftyJSON;
|
||||
};
|
||||
0192B5BF29DE5134002CDBF3 /* Starscream */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 0192B5BE29DE5134002CDBF3 /* XCRemoteSwiftPackageReference "Starscream" */;
|
||||
productName = Starscream;
|
||||
};
|
||||
0192B5D329DE5190002CDBF3 /* CocoaLumberjackSwift */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 0192B5D229DE5190002CDBF3 /* XCRemoteSwiftPackageReference "CocoaLumberjack" */;
|
||||
productName = CocoaLumberjackSwift;
|
||||
};
|
||||
019D6A9529F194C600A6AC02 /* DSFSparkline */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 019D6A9429F194C600A6AC02 /* XCRemoteSwiftPackageReference "DSFSparkline" */;
|
||||
productName = DSFSparkline;
|
||||
};
|
||||
01CD0A9129E93ABB00F4C17E /* DifferenceKit */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 01CD0A9029E93ABB00F4C17E /* XCRemoteSwiftPackageReference "DifferenceKit" */;
|
||||
productName = DifferenceKit;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
};
|
||||
rootObject = 0192315329DD4DCF00539EDD /* Project object */;
|
||||
}
|
||||
7
ClashX Dashboard.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
ClashX Dashboard.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "1x",
|
||||
"size" : "16x16"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "2x",
|
||||
"size" : "16x16"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "1x",
|
||||
"size" : "32x32"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "2x",
|
||||
"size" : "32x32"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "1x",
|
||||
"size" : "128x128"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "2x",
|
||||
"size" : "128x128"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "1x",
|
||||
"size" : "256x256"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "2x",
|
||||
"size" : "256x256"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "1x",
|
||||
"size" : "512x512"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"scale" : "2x",
|
||||
"size" : "512x512"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
6
ClashX Dashboard/Assets.xcassets/Contents.json
Normal file
6
ClashX Dashboard/Assets.xcassets/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
14
ClashX Dashboard/ClashX_Dashboard.entitlements
Normal file
14
ClashX Dashboard/ClashX_Dashboard.entitlements
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.files.user-selected.read-only</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
<key>com.apple.security.network.server</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
19
ClashX Dashboard/ClashX_DashboardApp.swift
Normal file
19
ClashX Dashboard/ClashX_DashboardApp.swift
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// ClashX_DashboardApp.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct ClashX_DashboardApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
}
|
||||
.commands {
|
||||
SidebarCommands()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
48
ClashX Dashboard/Views/APISetting/APIServerItem.swift
Normal file
48
ClashX Dashboard/Views/APISetting/APIServerItem.swift
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// APIServerItem.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct APIServerItem: View {
|
||||
@State var server: String
|
||||
|
||||
var action: () -> Void
|
||||
var onDelete: () -> Void
|
||||
|
||||
@State private var mouseOver = false
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
Button("X") {
|
||||
onDelete()
|
||||
}
|
||||
.buttonStyle(.bordered)
|
||||
|
||||
Button() {
|
||||
action()
|
||||
} label: {
|
||||
Text(server)
|
||||
.font(.title2)
|
||||
}
|
||||
.buttonStyle(.borderless)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.frame(height: 21)
|
||||
.padding(EdgeInsets(top: 12, leading: 20, bottom: 12, trailing: 20))
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 6)
|
||||
.stroke(.secondary, lineWidth: 1)
|
||||
.padding(1)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
//struct APIServerItem_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// APIServerItem()
|
||||
// }
|
||||
//}
|
||||
76
ClashX Dashboard/Views/APISetting/APISettingView.swift
Normal file
76
ClashX Dashboard/Views/APISetting/APISettingView.swift
Normal file
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// APISettingView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct APISettingView: View {
|
||||
@State var baseURL: String = ""
|
||||
@State var secret: String = ""
|
||||
|
||||
@State var connectInfo: String = ""
|
||||
|
||||
@AppStorage("savedServers") var savedServers = SavedServersAppStorage()
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .center) {
|
||||
HStack {
|
||||
VStack(alignment: .leading) {
|
||||
Text("API Base URL")
|
||||
TextField("http://127.0.0.1:9090", text: $baseURL)
|
||||
}
|
||||
.frame(width: 250)
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text("Secret(optional)")
|
||||
TextField("", text: $secret)
|
||||
}
|
||||
.frame(width: 120)
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text(connectInfo)
|
||||
Spacer()
|
||||
Button("Add") {
|
||||
savedServers.append(.init(apiURL: baseURL, secret: secret))
|
||||
|
||||
print(savedServers)
|
||||
}
|
||||
}
|
||||
|
||||
List(savedServers, id: \.id) { server in
|
||||
APIServerItem(server: server.apiURL) {
|
||||
|
||||
ConfigManager.shared.overrideApiURL = .init(string: server.apiURL)
|
||||
ConfigManager.shared.overrideSecret = server.secret
|
||||
|
||||
ApiRequest.requestVersion { version in
|
||||
if let version {
|
||||
connectInfo = ""
|
||||
print(version)
|
||||
ConfigManager.shared.isRunning = true
|
||||
} else {
|
||||
connectInfo = "Failed to connect"
|
||||
}
|
||||
}
|
||||
} onDelete: {
|
||||
savedServers.removeAll {
|
||||
$0.id == server.id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.top)
|
||||
.fixedSize(horizontal: true, vertical: false)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct APISettingView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
APISettingView()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// ClashServerAppStorage.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
typealias SavedServersAppStorage = [ClashServerAppStorage]
|
||||
|
||||
struct ClashServerAppStorage: Codable, Identifiable {
|
||||
let id = UUID().uuidString
|
||||
let apiURL: String
|
||||
let secret: String
|
||||
}
|
||||
|
||||
extension SavedServersAppStorage: RawRepresentable {
|
||||
public init?(rawValue: String) {
|
||||
guard let data = rawValue.data(using: .utf8),
|
||||
let result = try? JSONDecoder().decode(SavedServersAppStorage.self, from: data)
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
self = result
|
||||
}
|
||||
|
||||
public var rawValue: String {
|
||||
guard let data = try? JSONEncoder().encode(self),
|
||||
let result = String(data: data, encoding: .utf8)
|
||||
else {
|
||||
return "[]"
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
39
ClashX Dashboard/Views/ArrayExtensions.swift
Normal file
39
ClashX Dashboard/Views/ArrayExtensions.swift
Normal file
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// ArrayExtensions.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
extension Array where Element: NSObject {
|
||||
func sorted(descriptors: [NSSortDescriptor]) -> [Element] {
|
||||
return (self as NSArray).sortedArray(using: descriptors) as! [Element]
|
||||
}
|
||||
|
||||
func filtered(_ str: String, for keys: [String]) -> [Element] {
|
||||
|
||||
guard str != "", keys.count > 0 else { return self }
|
||||
|
||||
let format = keys.map {
|
||||
$0 + " CONTAINS[c] %@"
|
||||
}.joined(separator: " OR ")
|
||||
|
||||
let arg = str as CVarArg
|
||||
|
||||
let args: [CVarArg] = {
|
||||
let args = NSMutableArray()
|
||||
for _ in 0..<keys.count {
|
||||
args.add(arg)
|
||||
}
|
||||
return args as! [CVarArg]
|
||||
}()
|
||||
|
||||
let predicate = NSPredicate(format: format, args)
|
||||
let re = NSMutableArray(array: self)
|
||||
|
||||
re.filter(using: predicate)
|
||||
return re as! [Element]
|
||||
}
|
||||
}
|
||||
152
ClashX Dashboard/Views/ClashApiDatasStorage.swift
Normal file
152
ClashX Dashboard/Views/ClashApiDatasStorage.swift
Normal file
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// ClashApiDatasStorage.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
import SwiftUI
|
||||
import CocoaLumberjackSwift
|
||||
|
||||
class ClashApiDatasStorage: NSObject, ObservableObject {
|
||||
|
||||
@Published var overviewData = ClashOverviewData()
|
||||
|
||||
@Published var logStorage = ClashLogStorage()
|
||||
@Published var connsStorage = ClashConnsStorage()
|
||||
|
||||
func resetStreamApi() {
|
||||
ApiRequest.shared.delegate = self
|
||||
ApiRequest.shared.resetStreamApis()
|
||||
}
|
||||
}
|
||||
|
||||
extension ClashApiDatasStorage: ApiRequestStreamDelegate {
|
||||
func streamStatusChanged() {
|
||||
print("streamStatusChanged", ConfigManager.shared.isRunning)
|
||||
|
||||
}
|
||||
|
||||
func didUpdateTraffic(up: Int, down: Int) {
|
||||
overviewData.down = down
|
||||
overviewData.up = up
|
||||
}
|
||||
|
||||
func didGetLog(log: String, level: String) {
|
||||
DispatchQueue.main.async {
|
||||
self.logStorage.logs.append(.init(level: level, log: log))
|
||||
|
||||
if self.logStorage.logs.count > 1000 {
|
||||
self.logStorage.logs.removeFirst(100)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate let TrafficHistoryLimit = 120
|
||||
|
||||
class ClashOverviewData: ObservableObject, Identifiable {
|
||||
let id = UUID().uuidString
|
||||
|
||||
@Published var uploadString = "N/A"
|
||||
@Published var downloadString = "N/A"
|
||||
|
||||
@Published var downloadTotal = "N/A"
|
||||
@Published var uploadTotal = "N/A"
|
||||
|
||||
@Published var activeConns = "0"
|
||||
|
||||
@Published var downloadHistories = [CGFloat](repeating: 0, count: TrafficHistoryLimit)
|
||||
@Published var uploadHistories = [CGFloat](repeating: 0, count: TrafficHistoryLimit)
|
||||
|
||||
var down: Int = 0 {
|
||||
didSet {
|
||||
downloadString = getSpeedString(for: down)
|
||||
downloadHistories.append(CGFloat(down))
|
||||
|
||||
if downloadHistories.count > 120 {
|
||||
downloadHistories.removeFirst()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var up: Int = 0 {
|
||||
didSet {
|
||||
uploadString = getSpeedString(for: up)
|
||||
uploadHistories.append(CGFloat(up))
|
||||
|
||||
if uploadHistories.count > 120 {
|
||||
uploadHistories.removeFirst()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var downTotal: Int = 0 {
|
||||
didSet {
|
||||
downloadTotal = getSpeedString(for: downTotal).replacingOccurrences(of: "/s", with: "")
|
||||
}
|
||||
}
|
||||
|
||||
var upTotal: Int = 0 {
|
||||
didSet {
|
||||
uploadTotal = getSpeedString(for: upTotal).replacingOccurrences(of: "/s", with: "")
|
||||
}
|
||||
}
|
||||
|
||||
func getSpeedString(for byte: Int) -> String {
|
||||
let kb = byte / 1024
|
||||
if kb < 1024 {
|
||||
return "\(kb)KB/s"
|
||||
} else {
|
||||
let mb = Double(kb) / 1024.0
|
||||
if mb >= 100 {
|
||||
if mb >= 1000 {
|
||||
return String(format: "%.1fGB/s", mb/1024)
|
||||
}
|
||||
return String(format: "%.1fMB/s", mb)
|
||||
} else {
|
||||
return String(format: "%.2fMB/s", mb)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ClashLogStorage: ObservableObject {
|
||||
@Published var logs = [ClashLog]()
|
||||
|
||||
class ClashLog: NSObject, ObservableObject, Identifiable {
|
||||
let id: String
|
||||
|
||||
let date: Date
|
||||
let level: ClashLogLevel
|
||||
@objc let log: String
|
||||
|
||||
let levelColor: Color
|
||||
@objc let levelString: String
|
||||
|
||||
init(level: String, log: String) {
|
||||
self.date = Date()
|
||||
self.level = .init(rawValue: level) ?? .unknow
|
||||
self.log = log
|
||||
|
||||
id = "\(date)" + log
|
||||
self.levelString = level
|
||||
switch self.level {
|
||||
case .info:
|
||||
levelColor = .blue
|
||||
case .warning:
|
||||
levelColor = .yellow
|
||||
case .error:
|
||||
levelColor = .red
|
||||
case .debug:
|
||||
levelColor = .green
|
||||
default:
|
||||
levelColor = .white
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ClashConnsStorage: ObservableObject {
|
||||
@Published var conns = [ClashConnection]()
|
||||
}
|
||||
16
ClashX Dashboard/Views/ClearBackgroundList.swift
Normal file
16
ClashX Dashboard/Views/ClearBackgroundList.swift
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// ClearBackgroundList.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
extension NSTableView {
|
||||
open override func viewWillMove(toWindow newWindow: NSWindow?) {
|
||||
super.viewDidMoveToWindow()
|
||||
backgroundColor = NSColor.clear
|
||||
enclosingScrollView!.drawsBackground = false
|
||||
}
|
||||
}
|
||||
146
ClashX Dashboard/Views/ContentTabs/Config/ConfigView.swift
Normal file
146
ClashX Dashboard/Views/ContentTabs/Config/ConfigView.swift
Normal file
@@ -0,0 +1,146 @@
|
||||
//
|
||||
// ConfigView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ConfigView: View {
|
||||
|
||||
@State var httpPort: Int = 0
|
||||
@State var socks5Port: Int = 0
|
||||
@State var mixedPort: Int = 0
|
||||
@State var redirPort: Int = 0
|
||||
@State var mode: String = "Rule"
|
||||
@State var logLevel: String = "Debug"
|
||||
@State var allowLAN: Bool = false
|
||||
@State var sniffer: Bool = false
|
||||
|
||||
@State var enableTUNDevice: Bool = false
|
||||
@State var tunIPStack: String = "System"
|
||||
@State var deviceName: String = "utun9"
|
||||
@State var interfaceName: String = "en0"
|
||||
|
||||
@State var disableAll = true
|
||||
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
LazyVGrid(columns: [
|
||||
GridItem(.flexible()),
|
||||
GridItem(.flexible())
|
||||
]) {
|
||||
VStack(alignment: .leading) {
|
||||
Text("Http Port")
|
||||
TextField("0", value: $httpPort, formatter: NumberFormatter())
|
||||
.disabled(disableAll)
|
||||
}
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text("Socks5 Port")
|
||||
TextField("0", value: $socks5Port, formatter: NumberFormatter())
|
||||
.disabled(disableAll)
|
||||
}
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text("Mixed Port")
|
||||
TextField("0", value: $mixedPort, formatter: NumberFormatter())
|
||||
.disabled(disableAll)
|
||||
}
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text("Redir Port")
|
||||
TextField("0", value: $redirPort, formatter: NumberFormatter())
|
||||
.disabled(disableAll)
|
||||
}
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text("Mode")
|
||||
Picker("", selection: $mode) {
|
||||
ForEach(["Direct", "Rule", "Script", "Global"], id: \.self) {
|
||||
Text($0)
|
||||
}
|
||||
}
|
||||
.pickerStyle(.menu)
|
||||
.disabled(disableAll)
|
||||
}
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text("Log Level")
|
||||
Picker("", selection: $logLevel) {
|
||||
ForEach(["Silent", "Error", "Warning", "Info", "Debug"], id: \.self) {
|
||||
Text($0)
|
||||
}
|
||||
}
|
||||
.pickerStyle(.menu)
|
||||
.disabled(disableAll)
|
||||
}
|
||||
Toggle("Allow LAN", isOn: $allowLAN)
|
||||
.disabled(disableAll)
|
||||
Toggle("Sniffer", isOn: $sniffer)
|
||||
.disabled(disableAll)
|
||||
}
|
||||
.padding()
|
||||
|
||||
Divider()
|
||||
.padding()
|
||||
|
||||
LazyVGrid(columns: [
|
||||
GridItem(.flexible()),
|
||||
GridItem(.flexible())
|
||||
]) {
|
||||
Toggle("Enable TUN Device", isOn: $enableTUNDevice)
|
||||
.disabled(disableAll)
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text("TUN IP Stack")
|
||||
Picker("", selection: $tunIPStack) {
|
||||
ForEach(["gVisor", "System", "LWIP"], id: \.self) {
|
||||
Text($0)
|
||||
}
|
||||
}
|
||||
.pickerStyle(.menu)
|
||||
.disabled(disableAll)
|
||||
}
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text("Device Name")
|
||||
TextField("utun9", text: $deviceName)
|
||||
.disabled(disableAll)
|
||||
}
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text("Interface Name")
|
||||
TextField("en0", text: $interfaceName)
|
||||
.disabled(disableAll)
|
||||
}
|
||||
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.onAppear {
|
||||
ApiRequest.requestConfig { config in
|
||||
httpPort = config.port
|
||||
socks5Port = config.socksPort
|
||||
mixedPort = config.mixedPort
|
||||
redirPort = config.redirPort
|
||||
mode = config.mode.rawValue.capitalized
|
||||
logLevel = config.logLevel.rawValue.capitalized
|
||||
|
||||
allowLAN = config.allowLan
|
||||
sniffer = config.sniffing
|
||||
|
||||
enableTUNDevice = config.tun.enable
|
||||
tunIPStack = config.tun.stack
|
||||
deviceName = config.tun.device
|
||||
interfaceName = config.interfaceName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//struct ConfigView_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// ConfigView()
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner"/>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<tableCellView identifier="CollectionTableCellView" id="E1E-Yw-tO2">
|
||||
<rect key="frame" x="0.0" y="0.0" width="100" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="EkO-g0-3Rf">
|
||||
<rect key="frame" x="0.0" y="1" width="100" height="16"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="mZD-CG-RaE">
|
||||
<font key="font" usesAppearanceFont="YES"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="EkO-g0-3Rf" secondAttribute="trailing" constant="2" id="cZb-2s-5cP"/>
|
||||
<constraint firstItem="EkO-g0-3Rf" firstAttribute="centerY" secondItem="E1E-Yw-tO2" secondAttribute="centerY" id="g8v-Gi-bjM"/>
|
||||
<constraint firstItem="EkO-g0-3Rf" firstAttribute="leading" secondItem="E1E-Yw-tO2" secondAttribute="leading" constant="2" id="nDQ-TP-ijK"/>
|
||||
</constraints>
|
||||
<accessibility identifier="CollectionTableCellView"/>
|
||||
<connections>
|
||||
<outlet property="textField" destination="EkO-g0-3Rf" id="Kzu-HK-Onq"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="-108" y="-102"/>
|
||||
</tableCellView>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,271 @@
|
||||
//
|
||||
// CollectionsTableView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
import SwiftUI
|
||||
import AppKit
|
||||
import DifferenceKit
|
||||
|
||||
struct CollectionsTableView<Item: Hashable>: NSViewRepresentable {
|
||||
|
||||
enum TableColumn: String, CaseIterable {
|
||||
case host = "Host"
|
||||
case sniffHost = "Sniff Host"
|
||||
case process = "Process"
|
||||
case dl = "DL"
|
||||
case ul = "UL"
|
||||
case chain = "Chain"
|
||||
case rule = "Rule"
|
||||
case time = "Time"
|
||||
case source = "Source"
|
||||
case destinationIP = "Destination IP"
|
||||
case type = "Type"
|
||||
}
|
||||
|
||||
|
||||
var data: [Item]
|
||||
var filterString: String
|
||||
|
||||
var startFormatter: RelativeDateTimeFormatter = {
|
||||
let startFormatter = RelativeDateTimeFormatter()
|
||||
startFormatter.unitsStyle = .short
|
||||
return startFormatter
|
||||
}()
|
||||
|
||||
var byteCountFormatter = ByteCountFormatter()
|
||||
|
||||
class NonRespondingScrollView: NSScrollView {
|
||||
override var acceptsFirstResponder: Bool { false }
|
||||
}
|
||||
|
||||
class NonRespondingTableView: NSTableView {
|
||||
override var acceptsFirstResponder: Bool { false }
|
||||
}
|
||||
|
||||
func makeNSView(context: Context) -> NSScrollView {
|
||||
|
||||
let scrollView = NonRespondingScrollView()
|
||||
scrollView.hasVerticalScroller = true
|
||||
scrollView.hasHorizontalScroller = true
|
||||
|
||||
let tableView = NonRespondingTableView()
|
||||
tableView.usesAlternatingRowBackgroundColors = true
|
||||
|
||||
tableView.delegate = context.coordinator
|
||||
tableView.dataSource = context.coordinator
|
||||
|
||||
tableView.register(.init(nibNamed: .init("CollectionTableCellView"), bundle: .main), forIdentifier: .init(rawValue: "CollectionTableCellView"))
|
||||
|
||||
TableColumn.allCases.forEach {
|
||||
let tableColumn = NSTableColumn(identifier: .init($0.rawValue))
|
||||
tableColumn.title = $0.rawValue
|
||||
tableColumn.isEditable = false
|
||||
|
||||
tableColumn.minWidth = 50
|
||||
tableColumn.maxWidth = .infinity
|
||||
|
||||
|
||||
tableView.addTableColumn(tableColumn)
|
||||
|
||||
var sort: NSSortDescriptor?
|
||||
|
||||
switch $0 {
|
||||
case .host:
|
||||
sort = .init(keyPath: \ClashConnectionObject.host, ascending: true)
|
||||
case .sniffHost:
|
||||
sort = .init(keyPath: \ClashConnectionObject.sniffHost, ascending: true)
|
||||
case .process:
|
||||
sort = .init(keyPath: \ClashConnectionObject.process, ascending: true)
|
||||
case .dl:
|
||||
sort = .init(keyPath: \ClashConnectionObject.download, ascending: true)
|
||||
case .ul:
|
||||
sort = .init(keyPath: \ClashConnectionObject.upload, ascending: true)
|
||||
case .chain:
|
||||
sort = .init(keyPath: \ClashConnectionObject.chainString, ascending: true)
|
||||
case .rule:
|
||||
sort = .init(keyPath: \ClashConnectionObject.ruleString, ascending: true)
|
||||
case .time:
|
||||
sort = .init(keyPath: \ClashConnectionObject.startDate, ascending: true)
|
||||
case .source:
|
||||
sort = .init(keyPath: \ClashConnectionObject.source, ascending: true)
|
||||
case .destinationIP:
|
||||
sort = .init(keyPath: \ClashConnectionObject.destinationIP, ascending: true)
|
||||
case .type:
|
||||
sort = .init(keyPath: \ClashConnectionObject.type, ascending: true)
|
||||
default:
|
||||
sort = nil
|
||||
}
|
||||
|
||||
tableColumn.sortDescriptorPrototype = sort
|
||||
}
|
||||
|
||||
|
||||
if let sort = tableView.tableColumns.first?.sortDescriptorPrototype {
|
||||
tableView.sortDescriptors = [sort]
|
||||
}
|
||||
|
||||
|
||||
scrollView.documentView = tableView
|
||||
|
||||
return scrollView
|
||||
}
|
||||
|
||||
func updateNSView(_ nsView: NSScrollView, context: Context) {
|
||||
context.coordinator.parent = self
|
||||
guard let tableView = nsView.documentView as? NSTableView,
|
||||
let data = data as? [ClashConnection] else {
|
||||
return
|
||||
}
|
||||
|
||||
let target = updateSorts(data.map(ClashConnectionObject.init), tableView: tableView)
|
||||
|
||||
let source = context.coordinator.conns
|
||||
let changeset = StagedChangeset(source: source, target: target)
|
||||
|
||||
|
||||
tableView.reload(using: changeset) { data in
|
||||
context.coordinator.conns = data
|
||||
}
|
||||
}
|
||||
|
||||
func updateSorts(_ objects: [ClashConnectionObject],
|
||||
tableView: NSTableView) -> [ClashConnectionObject] {
|
||||
var re = objects
|
||||
|
||||
var sortDescriptors = tableView.sortDescriptors
|
||||
sortDescriptors.append(.init(keyPath: \ClashConnectionObject.id, ascending: true))
|
||||
re = re.sorted(descriptors: sortDescriptors)
|
||||
|
||||
let filterKeys = [
|
||||
"host",
|
||||
"process",
|
||||
"chainString",
|
||||
"ruleString",
|
||||
"source",
|
||||
"destinationIP",
|
||||
"type",
|
||||
]
|
||||
|
||||
re = re.filtered(filterString, for: filterKeys)
|
||||
|
||||
return re
|
||||
}
|
||||
|
||||
|
||||
func makeCoordinator() -> Coordinator {
|
||||
Coordinator(parent: self)
|
||||
}
|
||||
|
||||
class Coordinator: NSObject, NSTableViewDelegate, NSTableViewDataSource {
|
||||
|
||||
var parent: CollectionsTableView
|
||||
|
||||
var conns = [ClashConnectionObject]()
|
||||
|
||||
init(parent: CollectionsTableView) {
|
||||
self.parent = parent
|
||||
}
|
||||
|
||||
|
||||
func numberOfRows(in tableView: NSTableView) -> Int {
|
||||
conns.count
|
||||
}
|
||||
|
||||
|
||||
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
|
||||
guard let cell = tableView.makeView(withIdentifier: .init(rawValue: "CollectionTableCellView"), owner: nil) as? NSTableCellView,
|
||||
let s = tableColumn?.identifier.rawValue.split(separator: ".").last,
|
||||
let tc = TableColumn(rawValue: String(s))
|
||||
else { return nil }
|
||||
|
||||
let conn = conns[row]
|
||||
|
||||
cell.textField?.objectValue = {
|
||||
switch tc {
|
||||
case .host:
|
||||
return conn.host
|
||||
case .sniffHost:
|
||||
return conn.sniffHost
|
||||
case .process:
|
||||
return conn.process
|
||||
case .dl:
|
||||
return conn.downloadString
|
||||
case .ul:
|
||||
return conn.uploadString
|
||||
case .chain:
|
||||
return conn.chainString
|
||||
case .rule:
|
||||
return conn.ruleString
|
||||
case .time:
|
||||
return conn.startString
|
||||
case .source:
|
||||
return conn.source
|
||||
case .destinationIP:
|
||||
return conn.destinationIP
|
||||
case .type:
|
||||
return conn.type
|
||||
}
|
||||
}()
|
||||
|
||||
return cell
|
||||
}
|
||||
|
||||
func tableView(_ tableView: NSTableView, sortDescriptorsDidChange oldDescriptors: [NSSortDescriptor]) {
|
||||
conns = parent.updateSorts(conns, tableView: tableView)
|
||||
tableView.reloadData()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extension NSTableView {
|
||||
/// Applies multiple animated updates in stages using `StagedChangeset`.
|
||||
///
|
||||
/// - Note: There are combination of changes that crash when applied simultaneously in `performBatchUpdates`.
|
||||
/// Assumes that `StagedChangeset` has a minimum staged changesets to avoid it.
|
||||
/// The data of the data-source needs to be updated synchronously before `performBatchUpdates` in every stages.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - stagedChangeset: A staged set of changes.
|
||||
/// - interrupt: A closure that takes an changeset as its argument and returns `true` if the animated
|
||||
/// updates should be stopped and performed reloadData. Default is nil.
|
||||
/// - setData: A closure that takes the collection as a parameter.
|
||||
/// The collection should be set to data-source of NSTableView.
|
||||
|
||||
func reload<C>(
|
||||
using stagedChangeset: StagedChangeset<C>,
|
||||
interrupt: ((Changeset<C>) -> Bool)? = nil,
|
||||
setData: (C) -> Void
|
||||
) {
|
||||
if case .none = window, let data = stagedChangeset.last?.data {
|
||||
setData(data)
|
||||
return reloadData()
|
||||
}
|
||||
|
||||
for changeset in stagedChangeset {
|
||||
if let interrupt = interrupt, interrupt(changeset), let data = stagedChangeset.last?.data {
|
||||
setData(data)
|
||||
return reloadData()
|
||||
}
|
||||
|
||||
beginUpdates()
|
||||
setData(changeset.data)
|
||||
|
||||
if !changeset.elementDeleted.isEmpty {
|
||||
removeRows(at: IndexSet(changeset.elementDeleted.map { $0.element }))
|
||||
}
|
||||
|
||||
if !changeset.elementUpdated.isEmpty {
|
||||
reloadData(forRowIndexes: IndexSet(changeset.elementUpdated.map { $0.element }), columnIndexes: IndexSet(0..<tableColumns.count))
|
||||
}
|
||||
|
||||
if !changeset.elementInserted.isEmpty {
|
||||
insertRows(at: IndexSet(changeset.elementInserted.map { $0.element }))
|
||||
}
|
||||
endUpdates()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// Connections.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
class Connections: ObservableObject, Identifiable {
|
||||
let id = UUID()
|
||||
@Published var items: [ConnectionItem]
|
||||
|
||||
init(_ items: [ConnectionItem]) {
|
||||
self.items = items
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ConnectionItem: ObservableObject, Decodable {
|
||||
let id: String
|
||||
|
||||
let host: String
|
||||
let sniffHost: String
|
||||
let process: String
|
||||
let dl: String
|
||||
let ul: String
|
||||
let dlSpeed: String
|
||||
let ulSpeed: String
|
||||
let chains: String
|
||||
let rule: String
|
||||
let time: String
|
||||
let source: String
|
||||
let destinationIP: String
|
||||
let type: String
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// ConnectionsView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ConnectionsView: View {
|
||||
|
||||
@EnvironmentObject var data: ClashConnsStorage
|
||||
|
||||
@State private var searchString: String = ""
|
||||
|
||||
var body: some View {
|
||||
|
||||
CollectionsTableView(data: data.conns,
|
||||
filterString: searchString)
|
||||
.background(.white)
|
||||
.searchable(text: $searchString)
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
struct ConnectionsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ConnectionsView()
|
||||
}
|
||||
}
|
||||
56
ClashX Dashboard/Views/ContentTabs/Logs/LogsView.swift
Normal file
56
ClashX Dashboard/Views/ContentTabs/Logs/LogsView.swift
Normal file
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// LogsView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct LogsView: View {
|
||||
|
||||
@EnvironmentObject var logStorage: ClashLogStorage
|
||||
|
||||
@State var searchString: String = ""
|
||||
|
||||
var logs: [ClashLogStorage.ClashLog] {
|
||||
let logs: [ClashLogStorage.ClashLog] = logStorage.logs.reversed()
|
||||
if searchString.isEmpty {
|
||||
return logs
|
||||
} else {
|
||||
return logs.filtered(searchString, for: ["log", "levelString"])
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Table(logs) {
|
||||
TableColumn("Date") {
|
||||
Text($0.date.formatted(
|
||||
Date.FormatStyle()
|
||||
.year(.twoDigits)
|
||||
.month(.twoDigits)
|
||||
.day(.twoDigits)
|
||||
.hour(.twoDigits(amPM: .omitted))
|
||||
.minute(.twoDigits)
|
||||
.second(.twoDigits)
|
||||
))
|
||||
.foregroundColor(.orange)
|
||||
.truncationMode(.head)
|
||||
}
|
||||
.width(min: 60, max: 130)
|
||||
TableColumn("Level") {
|
||||
Text("[\($0.level.rawValue)]")
|
||||
.foregroundColor($0.levelColor)
|
||||
}
|
||||
.width(min: 40, max: 65)
|
||||
TableColumn("", value: \.log)
|
||||
}
|
||||
.background(.white)
|
||||
.searchable(text: $searchString)
|
||||
}
|
||||
}
|
||||
|
||||
struct LogsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
LogsView()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// OverviewTopItemView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct OverviewTopItemView: View {
|
||||
|
||||
@State var name: String
|
||||
@Binding var value: String
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Text(name)
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.secondary)
|
||||
Spacer()
|
||||
}
|
||||
Spacer()
|
||||
Text(value)
|
||||
.font(.system(size: 16))
|
||||
}
|
||||
.frame(width: 130, height: 45)
|
||||
.padding(EdgeInsets(top: 12, leading: 14, bottom: 12, trailing: 14))
|
||||
.background(.white)
|
||||
.cornerRadius(12)
|
||||
}
|
||||
}
|
||||
|
||||
struct OverviewTopItemView_Previews: PreviewProvider {
|
||||
@State static var value: String = "Value"
|
||||
static var previews: some View {
|
||||
OverviewTopItemView(name: "Name", value: $value)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// OverviewView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import DSFSparkline
|
||||
|
||||
struct OverviewView: View {
|
||||
|
||||
@EnvironmentObject var data: ClashOverviewData
|
||||
|
||||
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 25) {
|
||||
HStack() {
|
||||
OverviewTopItemView(name: "Upload", value: $data.uploadString)
|
||||
OverviewTopItemView(name: "Download", value: $data.downloadString)
|
||||
OverviewTopItemView(name: "Upload Total", value: $data.uploadTotal)
|
||||
OverviewTopItemView(name: "Download Total", value: $data.downloadTotal)
|
||||
OverviewTopItemView(name: "Active Connections", value: $data.activeConns)
|
||||
}
|
||||
|
||||
|
||||
|
||||
TrafficGraphView(values: $data.downloadHistories,
|
||||
graphColor: .systemBlue)
|
||||
|
||||
TrafficGraphView(values: $data.uploadHistories,
|
||||
graphColor: .systemGreen)
|
||||
|
||||
|
||||
}.padding()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//struct OverviewView_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// OverviewView()
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,125 @@
|
||||
//
|
||||
// TrafficGraphView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import DSFSparkline
|
||||
|
||||
fileprivate let labelsCount = 4
|
||||
|
||||
struct TrafficGraphView: View {
|
||||
@Binding var values: [CGFloat]
|
||||
|
||||
@State var graphColor: DSFColor
|
||||
|
||||
init(values: Binding<[CGFloat]>,
|
||||
graphColor: DSFColor) {
|
||||
self._values = values
|
||||
self.graphColor = graphColor
|
||||
|
||||
updateChart(values.wrappedValue)
|
||||
}
|
||||
|
||||
|
||||
@State private var labels = [String]()
|
||||
@State private var dataSource = DSFSparkline.DataSource()
|
||||
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
VStack {
|
||||
ForEach(Array(labels.enumerated()), id: \.offset) {
|
||||
Text($0.element)
|
||||
.font(.system(size: 11, weight: .light))
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
graphView
|
||||
}
|
||||
.onChange(of: values) { newValue in
|
||||
updateChart(newValue)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var graphView: some View {
|
||||
DSFSparklineLineGraphView.SwiftUI(
|
||||
dataSource: dataSource,
|
||||
graphColor: graphColor,
|
||||
interpolated: false,
|
||||
showZeroLine: false
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
func updateChart(_ values: [CGFloat]) {
|
||||
let max = values.max() ?? CGFloat(labelsCount) * 1000
|
||||
|
||||
let byte = Int64(max)
|
||||
let kb = byte / 1000
|
||||
|
||||
var v1: Double = 0
|
||||
var v2 = ""
|
||||
var v3: Double = 1
|
||||
|
||||
switch kb {
|
||||
case 0..<Int64(labelsCount):
|
||||
v1 = Double(labelsCount)
|
||||
v2 = "KB/s"
|
||||
case Int64(labelsCount)..<100:
|
||||
// 0 - 99 KB/s
|
||||
v1 = Double(kb)
|
||||
v2 = "KB/s"
|
||||
case 100..<100_000:
|
||||
// 0.1 - 99MB/s
|
||||
v1 = Double(kb) / 1_000
|
||||
v2 = "MB/s"
|
||||
v3 = 1_000
|
||||
default:
|
||||
// case 10_000..<100_000:
|
||||
// 0.1 - 10GB/s
|
||||
v1 = Double(kb) / 1_000_000
|
||||
v2 = "GB/s"
|
||||
v3 = 1_000_000
|
||||
}
|
||||
|
||||
v1 = (v1 * 10).rounded() / 10
|
||||
|
||||
let vv = v1.truncatingRemainder(dividingBy: 1) == 0 ? Double(labelsCount) : Double(labelsCount) / 10
|
||||
|
||||
if v1.truncatingRemainder(dividingBy: vv) != 0 {
|
||||
v1 = ((v1 / vv).rounded() + 1) * vv
|
||||
}
|
||||
|
||||
|
||||
var re = [String]()
|
||||
|
||||
for i in 0...labelsCount {
|
||||
let s = String(format: "%.1f%@", v1 * Double(i) / Double(labelsCount), v2)
|
||||
re.append(s)
|
||||
}
|
||||
re = re.reversed()
|
||||
let _ = re.removeLast()
|
||||
|
||||
|
||||
self.dataSource.set(values: values)
|
||||
|
||||
let upperBound = CGFloat(v1*v3)
|
||||
if upperBound != 0,
|
||||
let old = self.dataSource.range?.upperBound,
|
||||
old != upperBound {
|
||||
self.dataSource.setRange(lowerBound: 0, upperBound: upperBound)
|
||||
self.dataSource.resetRange()
|
||||
}
|
||||
|
||||
self.labels = re
|
||||
}
|
||||
}
|
||||
|
||||
//struct TrafficGraphView_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// TrafficGraphView()
|
||||
// }
|
||||
//}
|
||||
90
ClashX Dashboard/Views/ContentTabs/Proxies/ProxiesView.swift
Normal file
90
ClashX Dashboard/Views/ContentTabs/Proxies/ProxiesView.swift
Normal file
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// ProxiesView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
class ProxiesSearchString: ObservableObject, Identifiable {
|
||||
let id = UUID().uuidString
|
||||
@Published var string: String = ""
|
||||
}
|
||||
|
||||
struct ProxiesView: View {
|
||||
|
||||
@State var proxyInfo: ClashProxyResp?
|
||||
@State var proxyGroups = [ClashProxy]()
|
||||
|
||||
@State var providerInfo: ClashProviderResp?
|
||||
@State var providers = [ClashProvider]()
|
||||
|
||||
// @State var proxyProviderList
|
||||
|
||||
@State private var searchString = ProxiesSearchString()
|
||||
@State private var isGlobalMode = false
|
||||
@State private var proxyListColumnCount = 3
|
||||
|
||||
var body: some View {
|
||||
List() {
|
||||
Text("Proxies")
|
||||
.font(.title)
|
||||
ForEach(proxyGroups, id: \.id) { group in
|
||||
ProxyGroupView(columnCount: $proxyListColumnCount, proxyGroup: group, proxyInfo: proxyInfo!)
|
||||
}
|
||||
|
||||
Text("Proxy Provider")
|
||||
.font(.title)
|
||||
.padding(.top)
|
||||
|
||||
ForEach($providers, id: \.id) { provider in
|
||||
ProxyProviderGroupView(columnCount: $proxyListColumnCount, providerInfo: provider)
|
||||
}
|
||||
}
|
||||
.background {
|
||||
GeometryReader { geometry in
|
||||
Rectangle()
|
||||
.fill(.clear)
|
||||
.frame(height: 1)
|
||||
.onChange(of: geometry.size.width) { newValue in
|
||||
updateColumnCount(newValue)
|
||||
}
|
||||
.onAppear {
|
||||
updateColumnCount(geometry.size.width)
|
||||
}
|
||||
}.padding()
|
||||
}
|
||||
.searchable(text: $searchString.string)
|
||||
.environmentObject(searchString)
|
||||
.onAppear {
|
||||
|
||||
// self.isGlobalMode = ConfigManager.shared.currentConfig?.mode == .global
|
||||
ApiRequest.getMergedProxyData {
|
||||
proxyInfo = $0
|
||||
proxyGroups = ($0?.proxyGroups ?? []).filter {
|
||||
isGlobalMode ? true : $0.name != "GLOBAL"
|
||||
}
|
||||
|
||||
providerInfo = proxyInfo?.enclosingProviderResp
|
||||
providers = providerInfo?.providers.map {
|
||||
$0.value
|
||||
} ?? []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updateColumnCount(_ width: Double) {
|
||||
let v = Int(Int(width) / 200)
|
||||
let new = v == 0 ? 1 : v
|
||||
|
||||
if new != proxyListColumnCount {
|
||||
proxyListColumnCount = new
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//struct ProxiesView_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// ProxiesView()
|
||||
// }
|
||||
//}
|
||||
143
ClashX Dashboard/Views/ContentTabs/Proxies/ProxyGroupView.swift
Normal file
143
ClashX Dashboard/Views/ContentTabs/Proxies/ProxyGroupView.swift
Normal file
@@ -0,0 +1,143 @@
|
||||
//
|
||||
// ProxyView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ProxyGroupView: View {
|
||||
|
||||
@Binding var columnCount: Int
|
||||
|
||||
@State var proxyGroup: ClashProxy
|
||||
@State var proxyInfo: ClashProxyResp
|
||||
@State private var proxyItems: [ProxyItemData]
|
||||
@State private var currentProxy: ClashProxyName
|
||||
@State private var isUpdatingSelect = false
|
||||
@State private var selectable = false
|
||||
|
||||
@State private var isListExpanded = false
|
||||
@State private var isTesting = false
|
||||
|
||||
@EnvironmentObject var searchString: ProxiesSearchString
|
||||
|
||||
init(columnCount: Binding<Int>,
|
||||
proxyGroup: ClashProxy,
|
||||
proxyInfo: ClashProxyResp) {
|
||||
|
||||
self._columnCount = columnCount
|
||||
self.proxyGroup = proxyGroup
|
||||
self.proxyInfo = proxyInfo
|
||||
self.currentProxy = proxyGroup.now ?? ""
|
||||
self.selectable = [.select, .fallback].contains(proxyGroup.type)
|
||||
|
||||
self.proxyItems = proxyGroup.all?.compactMap { name in
|
||||
proxyInfo.proxiesMap[name]
|
||||
}.map(ProxyItemData.init) ?? []
|
||||
}
|
||||
|
||||
|
||||
var body: some View {
|
||||
Section {
|
||||
proxyListView
|
||||
.background {
|
||||
Rectangle()
|
||||
.frame(width: 2, height: listHeight(columnCount))
|
||||
.foregroundColor(.clear)
|
||||
}
|
||||
.show(isVisible: !isListExpanded)
|
||||
|
||||
} header: {
|
||||
proxyInfoView
|
||||
}
|
||||
}
|
||||
|
||||
var proxyInfoView: some View {
|
||||
HStack() {
|
||||
Text(proxyGroup.name)
|
||||
.font(.title)
|
||||
.fontWeight(.medium)
|
||||
Text(proxyGroup.type.rawValue)
|
||||
Text("\(proxyGroup.all?.count ?? 0)")
|
||||
Button() {
|
||||
isListExpanded = !isListExpanded
|
||||
} label: {
|
||||
Image(systemName: isListExpanded ? "chevron.up" : "chevron.down")
|
||||
}
|
||||
|
||||
Button() {
|
||||
startBenchmark()
|
||||
} label: {
|
||||
Image(systemName: "bolt.fill")
|
||||
}
|
||||
.disabled(isTesting)
|
||||
}
|
||||
}
|
||||
|
||||
var proxyListView: some View {
|
||||
LazyVGrid(columns: Array(repeating: GridItem(.flexible()),
|
||||
count: columnCount)) {
|
||||
ForEach($proxyItems, id: \.id) { item in
|
||||
ProxyItemView(
|
||||
proxy: item,
|
||||
selectable: selectable
|
||||
)
|
||||
.background(currentProxy == item.wrappedValue.name ? Color.teal : Color.white)
|
||||
.cornerRadius(8)
|
||||
.onTapGesture {
|
||||
let item = item.wrappedValue
|
||||
updateSelect(item.name)
|
||||
}
|
||||
.show(isVisible: {
|
||||
if searchString.string.isEmpty {
|
||||
return true
|
||||
} else {
|
||||
return item.wrappedValue.name.lowercased().contains(searchString.string.lowercased())
|
||||
}
|
||||
}())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func listHeight(_ columnCount: Int) -> Double {
|
||||
let lineCount = ceil(Double(proxyItems.count) / Double(columnCount))
|
||||
return lineCount * 60 + (lineCount - 1) * 8
|
||||
}
|
||||
|
||||
|
||||
func startBenchmark() {
|
||||
isTesting = true
|
||||
ApiRequest.getGroupDelay(groupName: proxyGroup.name) { delays in
|
||||
proxyGroup.all?.forEach { proxyName in
|
||||
var delay = 0
|
||||
if let d = delays[proxyName], d != 0 {
|
||||
delay = d
|
||||
}
|
||||
|
||||
proxyItems.first {
|
||||
$0.name == proxyName
|
||||
}?.delay = delay
|
||||
}
|
||||
isTesting = false
|
||||
}
|
||||
}
|
||||
|
||||
func updateSelect(_ name: String) {
|
||||
guard selectable, !isUpdatingSelect else { return }
|
||||
isUpdatingSelect = true
|
||||
ApiRequest.updateProxyGroup(group: proxyGroup.name, selectProxy: name) { success in
|
||||
isUpdatingSelect = false
|
||||
guard success else { return }
|
||||
currentProxy = name
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//struct ProxyView_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// ProxyGroupView()
|
||||
// }
|
||||
//}
|
||||
//
|
||||
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// ProxyItemData.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
import SwiftUI
|
||||
|
||||
class ProxyItemData: NSObject, ObservableObject {
|
||||
let id: String
|
||||
@objc let name: ClashProxyName
|
||||
let type: ClashProxyType
|
||||
let udpString: String
|
||||
let tfo: Bool
|
||||
let all: [ClashProxyName]
|
||||
|
||||
var delay: Int {
|
||||
didSet {
|
||||
switch delay {
|
||||
case 0:
|
||||
delayString = NSLocalizedString("fail", comment: "")
|
||||
default:
|
||||
delayString = "\(delay) ms"
|
||||
}
|
||||
|
||||
let httpsTest = true
|
||||
|
||||
switch delay {
|
||||
case 0:
|
||||
delayColor = .gray
|
||||
case ..<200 where !httpsTest:
|
||||
delayColor = .green
|
||||
case ..<800 where httpsTest:
|
||||
delayColor = .green
|
||||
case 200..<500 where !httpsTest:
|
||||
delayColor = .yellow
|
||||
case 800..<1500 where httpsTest:
|
||||
delayColor = .yellow
|
||||
default:
|
||||
delayColor = .orange
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Published var delayString = ""
|
||||
@Published var delayColor = Color.clear
|
||||
|
||||
init(clashProxy: ClashProxy) {
|
||||
id = clashProxy.id
|
||||
name = clashProxy.name
|
||||
type = clashProxy.type
|
||||
tfo = clashProxy.tfo
|
||||
all = clashProxy.all ?? []
|
||||
|
||||
|
||||
udpString = {
|
||||
if clashProxy.udp {
|
||||
return "UDP"
|
||||
} else if clashProxy.xudp {
|
||||
return "XUDP"
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}()
|
||||
|
||||
delay = 0
|
||||
super.init()
|
||||
defer {
|
||||
delay = clashProxy.history.last?.meanDelay ?? clashProxy.history.last?.delay ?? 0
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// ProxyItemView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ProxyItemView: View {
|
||||
|
||||
@Binding var proxy: ProxyItemData
|
||||
@State var selectable: Bool
|
||||
|
||||
init(proxy: Binding<ProxyItemData>, selectable: Bool) {
|
||||
self._proxy = proxy
|
||||
self.selectable = selectable
|
||||
|
||||
self.isBuiltInProxy = [.pass, .direct, .reject].contains(proxy.wrappedValue.type)
|
||||
}
|
||||
|
||||
@State private var isBuiltInProxy: Bool
|
||||
@State private var mouseOver = false
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
HStack(alignment: .center) {
|
||||
Text(proxy.name)
|
||||
.truncationMode(.tail)
|
||||
.lineLimit(1)
|
||||
Spacer(minLength: 6)
|
||||
|
||||
Text(proxy.udpString)
|
||||
.foregroundColor(.secondary)
|
||||
.font(.system(size: 11))
|
||||
.show(isVisible: !isBuiltInProxy)
|
||||
}
|
||||
|
||||
Spacer(minLength: 6)
|
||||
.show(isVisible: !isBuiltInProxy)
|
||||
HStack(alignment: .center) {
|
||||
Text(proxy.type.rawValue)
|
||||
.foregroundColor(.secondary)
|
||||
.font(.system(size: 12))
|
||||
|
||||
Text("[TFO]")
|
||||
.font(.system(size: 9))
|
||||
.show(isVisible: proxy.tfo)
|
||||
Spacer(minLength: 6)
|
||||
Text(proxy.delayString)
|
||||
.foregroundColor(proxy.delayColor)
|
||||
.font(.system(size: 11))
|
||||
}
|
||||
.show(isVisible: !isBuiltInProxy)
|
||||
}
|
||||
.onHover {
|
||||
guard selectable else { return }
|
||||
mouseOver = $0
|
||||
}
|
||||
.frame(height: 36)
|
||||
.padding(12)
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: 6)
|
||||
.stroke(mouseOver ? .secondary : Color.clear, lineWidth: 2)
|
||||
.padding(1)
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//struct ProxyItemView_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// ProxyItemView()
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// ProxyListView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ProxyListView: View {
|
||||
var body: some View {
|
||||
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||
}
|
||||
}
|
||||
|
||||
struct ProxyListView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ProxyListView()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
//
|
||||
// ProxyProviderGroupView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ProxyProviderGroupView: View {
|
||||
@Binding var columnCount: Int
|
||||
|
||||
@Binding var providerInfo: ClashProvider
|
||||
|
||||
@State private var proxyItems: [ProxyItemData]
|
||||
|
||||
@State private var trafficInfo: String
|
||||
@State private var expireDate: String
|
||||
@State private var updateAt: String
|
||||
|
||||
|
||||
@State private var isListExpanded = false
|
||||
@State private var isTesting = false
|
||||
@State private var isUpdating = false
|
||||
|
||||
@EnvironmentObject var searchString: ProxiesSearchString
|
||||
|
||||
init(columnCount: Binding<Int>,
|
||||
providerInfo: Binding<ClashProvider>) {
|
||||
self._columnCount = columnCount
|
||||
self._providerInfo = providerInfo
|
||||
|
||||
let info = providerInfo.wrappedValue
|
||||
|
||||
self.proxyItems = info.proxies.map(ProxyItemData.init)
|
||||
|
||||
if let info = info.subscriptionInfo {
|
||||
let used = info.download + info.upload
|
||||
let total = info.total
|
||||
|
||||
let formatter = ByteCountFormatter()
|
||||
|
||||
trafficInfo = formatter.string(fromByteCount: used)
|
||||
+ " / "
|
||||
+ formatter.string(fromByteCount: total)
|
||||
+ " ( \(String(format: "%.2f", Double(used)/Double(total/100)))% )"
|
||||
|
||||
|
||||
let expire = info.expire
|
||||
|
||||
expireDate = "Expire: "
|
||||
+ Date(timeIntervalSince1970: TimeInterval(expire))
|
||||
.formatted()
|
||||
} else {
|
||||
trafficInfo = ""
|
||||
expireDate = ""
|
||||
}
|
||||
|
||||
if let updatedAt = info.updatedAt {
|
||||
let formatter = RelativeDateTimeFormatter()
|
||||
self.updateAt = formatter.localizedString(for: updatedAt, relativeTo: .now)
|
||||
} else {
|
||||
self.updateAt = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var body: some View {
|
||||
Section {
|
||||
providerListView
|
||||
.background {
|
||||
Rectangle()
|
||||
.frame(width: 2, height: listHeight(columnCount))
|
||||
.foregroundColor(.clear)
|
||||
}
|
||||
.show(isVisible: !isListExpanded)
|
||||
|
||||
} header: {
|
||||
providerInfoView
|
||||
} footer: {
|
||||
HStack {
|
||||
Button {
|
||||
update()
|
||||
} label: {
|
||||
Label("Update", systemImage: "arrow.clockwise")
|
||||
}
|
||||
|
||||
.disabled(isUpdating)
|
||||
|
||||
Button {
|
||||
startBenchmark()
|
||||
} label: {
|
||||
Label("Benchmark", systemImage: "bolt.fill")
|
||||
}
|
||||
.disabled(isTesting)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var providerInfoView: some View {
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Text(providerInfo.name)
|
||||
.font(.title)
|
||||
.fontWeight(.medium)
|
||||
Text(providerInfo.vehicleType.rawValue)
|
||||
.fontWeight(.regular)
|
||||
Text("\(providerInfo.proxies.count)")
|
||||
Button() {
|
||||
isListExpanded = !isListExpanded
|
||||
} label: {
|
||||
Image(systemName: isListExpanded ? "chevron.up" : "chevron.down")
|
||||
}
|
||||
Button() {
|
||||
update()
|
||||
} label: {
|
||||
Image(systemName: "arrow.clockwise")
|
||||
}
|
||||
.disabled(isUpdating)
|
||||
|
||||
Button() {
|
||||
startBenchmark()
|
||||
} label: {
|
||||
Image(systemName: "bolt.fill")
|
||||
}
|
||||
.disabled(isTesting)
|
||||
}
|
||||
|
||||
HStack {
|
||||
if trafficInfo != "" {
|
||||
Text(trafficInfo)
|
||||
.fontWeight(.regular)
|
||||
}
|
||||
if expireDate != "" {
|
||||
Text(expireDate)
|
||||
.fontWeight(.regular)
|
||||
}
|
||||
}
|
||||
if updateAt != "" {
|
||||
Text("Updated \(updateAt)")
|
||||
.fontWeight(.regular)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var providerListView: some View {
|
||||
LazyVGrid(columns: Array(repeating: GridItem(.flexible()),
|
||||
count: columnCount)) {
|
||||
ForEach($proxyItems, id: \.id) { item in
|
||||
ProxyItemView(
|
||||
proxy: item,
|
||||
selectable: false
|
||||
)
|
||||
.background(.white)
|
||||
.cornerRadius(8)
|
||||
// .onTapGesture {
|
||||
// let item = item.wrappedValue
|
||||
// updateSelect(item.name)
|
||||
// }
|
||||
.show(isVisible: {
|
||||
if searchString.string.isEmpty {
|
||||
return true
|
||||
} else {
|
||||
return item.wrappedValue.name.lowercased().contains(searchString.string.lowercased())
|
||||
}
|
||||
}())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func listHeight(_ columnCount: Int) -> Double {
|
||||
let lineCount = ceil(Double(providerInfo.proxies.count) / Double(columnCount))
|
||||
return lineCount * 60 + (lineCount - 1) * 8
|
||||
}
|
||||
|
||||
func startBenchmark() {
|
||||
isTesting = true
|
||||
let name = providerInfo.name
|
||||
ApiRequest.healthCheck(proxy: name) {
|
||||
ApiRequest.requestProxyProviderList {
|
||||
isTesting = false
|
||||
|
||||
guard let provider = $0.allProviders[name] else { return }
|
||||
self.proxyItems = provider.proxies.map(ProxyItemData.init)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func update() {
|
||||
isUpdating = true
|
||||
let name = providerInfo.name
|
||||
ApiRequest.updateProvider(for: .proxy, name: name) { _ in
|
||||
ApiRequest.requestProxyProviderList {
|
||||
isUpdating = false
|
||||
guard let provider = $0.allProviders[name] else { return }
|
||||
self.providerInfo = provider
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//struct ProviderGroupView_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// ProviderGroupView()
|
||||
// }
|
||||
//}
|
||||
69
ClashX Dashboard/Views/ContentTabs/Rules/RuleItemView.swift
Normal file
69
ClashX Dashboard/Views/ContentTabs/Rules/RuleItemView.swift
Normal file
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// RuleItemView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct RuleItemView: View {
|
||||
@State var index: Int
|
||||
@State var rule: ClashRule
|
||||
|
||||
var body: some View {
|
||||
HStack(alignment: .center, spacing: 12) {
|
||||
Text("\(index)")
|
||||
.font(.system(size: 16))
|
||||
.foregroundColor(.secondary)
|
||||
.frame(width: 30)
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
if let payload = rule.payload,
|
||||
payload != "" {
|
||||
Text(rule.payload!)
|
||||
.font(.system(size: 14))
|
||||
}
|
||||
|
||||
HStack() {
|
||||
Text(rule.type)
|
||||
.foregroundColor(.secondary)
|
||||
.frame(width: 120, alignment: .leading)
|
||||
|
||||
Text(rule.proxy ?? "")
|
||||
.foregroundColor({
|
||||
switch rule.proxy {
|
||||
case "DIRECT":
|
||||
return .orange
|
||||
case "REJECT":
|
||||
return .red
|
||||
default:
|
||||
return .blue
|
||||
}
|
||||
}())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
struct RulesRowView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
RuleItemView(index: 114, rule: .init(type: "DIRECT", payload: "cn", proxy: "GeoSite"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extension HorizontalAlignment {
|
||||
|
||||
private struct RuleItemOBAlignment: AlignmentID {
|
||||
static func defaultValue(in context: ViewDimensions) -> CGFloat {
|
||||
context[.leading]
|
||||
}
|
||||
}
|
||||
|
||||
static let ruleItemOBAlignmentGuide = HorizontalAlignment(
|
||||
RuleItemOBAlignment.self
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// RuleProviderView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct RuleProviderView: View {
|
||||
|
||||
@State var ruleProvider: ClashRuleProvider
|
||||
|
||||
var body: some View {
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Text(ruleProvider.name)
|
||||
.font(.title)
|
||||
.fontWeight(.medium)
|
||||
Text(ruleProvider.type)
|
||||
Text(ruleProvider.behavior)
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("\(ruleProvider.ruleCount) rules")
|
||||
if let date = ruleProvider.updatedAt {
|
||||
Text("Updated \(RelativeDateTimeFormatter().localizedString(for: date, relativeTo: .now))")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//struct RuleProviderView_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// RuleProviderView()
|
||||
// }
|
||||
//}
|
||||
67
ClashX Dashboard/Views/ContentTabs/Rules/RulesView.swift
Normal file
67
ClashX Dashboard/Views/ContentTabs/Rules/RulesView.swift
Normal file
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// RulesView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct RulesView: View {
|
||||
|
||||
@State var ruleProviders = [ClashRuleProvider]()
|
||||
|
||||
@State var ruleItems = [ClashRule]()
|
||||
|
||||
@State private var searchString: String = ""
|
||||
|
||||
|
||||
var providers: [ClashRuleProvider] {
|
||||
if searchString.isEmpty {
|
||||
return ruleProviders
|
||||
} else {
|
||||
return ruleProviders.filtered(searchString, for: ["name", "behavior", "type"])
|
||||
}
|
||||
}
|
||||
|
||||
var rules: [EnumeratedSequence<[ClashRule]>.Element] {
|
||||
if searchString.isEmpty {
|
||||
return Array(ruleItems.enumerated())
|
||||
} else {
|
||||
return Array(ruleItems.filtered(searchString, for: ["type", "payload", "proxy"]).enumerated())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
ForEach(providers, id: \.self) {
|
||||
RuleProviderView(ruleProvider: $0)
|
||||
}
|
||||
|
||||
ForEach(rules, id: \.element.id) {
|
||||
RuleItemView(index: $0.offset, rule: $0.element)
|
||||
}
|
||||
}
|
||||
.searchable(text: $searchString)
|
||||
.onAppear {
|
||||
ruleItems.removeAll()
|
||||
ApiRequest.getRules {
|
||||
ruleItems = $0
|
||||
}
|
||||
|
||||
ApiRequest.requestRuleProviderList {
|
||||
ruleProviders = $0.allProviders.map {
|
||||
$0.value
|
||||
}.sorted {
|
||||
$0.name < $1.name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//struct RulesView_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// RulesView()
|
||||
// }
|
||||
//}
|
||||
49
ClashX Dashboard/Views/ContentView.swift
Normal file
49
ClashX Dashboard/Views/ContentView.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// ContentView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ContentView: View {
|
||||
|
||||
private let runningState = NotificationCenter.default.publisher(for: .init("ClashRunningStateChanged"))
|
||||
@State private var isRunning = false
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
if !isRunning {
|
||||
APISettingView()
|
||||
|
||||
// .presentedWindowToolbarStyle(.expanded)
|
||||
} else {
|
||||
NavigationView {
|
||||
SidebarView()
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
}
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigation) {
|
||||
Button {
|
||||
NSApp.keyWindow?.firstResponder?.tryToPerform(#selector(NSSplitViewController.toggleSidebar(_:)), with: nil)
|
||||
} label: {
|
||||
Image(systemName: "sidebar.left")
|
||||
}
|
||||
.help("Toggle Sidebar")
|
||||
.disabled(!isRunning)
|
||||
}
|
||||
}
|
||||
.onReceive(runningState) { _ in
|
||||
isRunning = ConfigManager.shared.isRunning
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
33
ClashX Dashboard/Views/SidebarView/SidebarItem.swift
Normal file
33
ClashX Dashboard/Views/SidebarView/SidebarItem.swift
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// SidebarItem.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
import SwiftUI
|
||||
|
||||
|
||||
class SidebarItems: ObservableObject, Identifiable {
|
||||
let id = UUID()
|
||||
@Published var items: [SidebarItem]
|
||||
@Published var selectedIndex = 0
|
||||
|
||||
init(_ items: [SidebarItem]) {
|
||||
self.items = items
|
||||
}
|
||||
}
|
||||
|
||||
class SidebarItem: ObservableObject {
|
||||
let id = UUID()
|
||||
let name: String
|
||||
let icon: String
|
||||
let view: AnyView
|
||||
|
||||
|
||||
init(name: String, icon: String, view: AnyView) {
|
||||
self.name = name
|
||||
self.icon = icon
|
||||
self.view = view
|
||||
}
|
||||
}
|
||||
28
ClashX Dashboard/Views/SidebarView/SidebarItemView.swift
Normal file
28
ClashX Dashboard/Views/SidebarView/SidebarItemView.swift
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// SidebarItemView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SidebarItemView: View {
|
||||
|
||||
@State var item: SidebarItem
|
||||
|
||||
@Binding var selectionName: String?
|
||||
|
||||
var body: some View {
|
||||
NavigationLink(destination: item.view, tag: item.name, selection: $selectionName) {
|
||||
Label(item.name, systemImage: item.icon)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//struct SidebarItemView_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// SidebarItemView(item: .init(name: "Overview",
|
||||
// icon: "chart.bar.xaxis",
|
||||
// view: AnyView(OverviewView())))
|
||||
// }
|
||||
//}
|
||||
86
ClashX Dashboard/Views/SidebarView/SidebarView.swift
Normal file
86
ClashX Dashboard/Views/SidebarView/SidebarView.swift
Normal file
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// SidebarView.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SidebarView: View {
|
||||
|
||||
@StateObject var clashApiDatasStorage = ClashApiDatasStorage()
|
||||
|
||||
private let connsQueue = DispatchQueue(label: "thread-safe-connsQueue", attributes: .concurrent)
|
||||
private let timer = Timer.publish(every: 1, on: .main, in: .default).autoconnect()
|
||||
|
||||
@State private var sidebarSelectionName: String? = "Overview"
|
||||
|
||||
@State private var sidebarItems = [
|
||||
SidebarItem(name: "Overview",
|
||||
icon: "chart.bar.xaxis",
|
||||
view: AnyView(OverviewView())),
|
||||
|
||||
SidebarItem(name: "Proxies",
|
||||
icon: "globe.asia.australia",
|
||||
view: AnyView(ProxiesView())),
|
||||
|
||||
SidebarItem(name: "Rules",
|
||||
icon: "waveform.and.magnifyingglass",
|
||||
view: AnyView(RulesView())),
|
||||
|
||||
SidebarItem(name: "Conns",
|
||||
icon: "app.connected.to.app.below.fill",
|
||||
view: AnyView(ConnectionsView())),
|
||||
|
||||
SidebarItem(name: "Config",
|
||||
icon: "slider.horizontal.3",
|
||||
view: AnyView(ConfigView())),
|
||||
|
||||
SidebarItem(name: "Logs",
|
||||
icon: "wand.and.stars.inverse",
|
||||
view: AnyView(LogsView()))
|
||||
]
|
||||
|
||||
var body: some View {
|
||||
ScrollViewReader { scrollViewProxy in
|
||||
List(sidebarItems, id: \.id) { item in
|
||||
SidebarItemView(item: item, selectionName: $sidebarSelectionName)
|
||||
}
|
||||
.listStyle(.sidebar)
|
||||
}
|
||||
.environmentObject(clashApiDatasStorage.overviewData)
|
||||
.environmentObject(clashApiDatasStorage.logStorage)
|
||||
.environmentObject(clashApiDatasStorage.connsStorage)
|
||||
.onAppear {
|
||||
ConfigManager.selectLoggingApiLevel = .debug
|
||||
clashApiDatasStorage.resetStreamApi()
|
||||
|
||||
connsQueue.sync {
|
||||
clashApiDatasStorage.connsStorage.conns
|
||||
.removeAll()
|
||||
}
|
||||
|
||||
updateConnections()
|
||||
}
|
||||
.onReceive(timer, perform: { _ in
|
||||
updateConnections()
|
||||
})
|
||||
}
|
||||
|
||||
func updateConnections() {
|
||||
ApiRequest.getConnections { snap in
|
||||
connsQueue.sync {
|
||||
clashApiDatasStorage.overviewData.upTotal = snap.uploadTotal
|
||||
clashApiDatasStorage.overviewData.downTotal = snap.downloadTotal
|
||||
clashApiDatasStorage.overviewData.activeConns = "\(snap.connections.count)"
|
||||
clashApiDatasStorage.connsStorage.conns = snap.connections
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//struct SidebarView_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// SidebarView()
|
||||
// }
|
||||
//}
|
||||
27
ClashX Dashboard/Views/SwiftUIViewExtensions.swift
Normal file
27
ClashX Dashboard/Views/SwiftUIViewExtensions.swift
Normal file
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// SwiftUIViewExtensions.swift
|
||||
// ClashX Dashboard
|
||||
//
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
struct Show: ViewModifier {
|
||||
let isVisible: Bool
|
||||
|
||||
@ViewBuilder
|
||||
func body(content: Content) -> some View {
|
||||
if isVisible {
|
||||
content
|
||||
} else {
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension View {
|
||||
func show(isVisible: Bool) -> some View {
|
||||
ModifiedContent(content: self, modifier: Show(isVisible: isVisible))
|
||||
}
|
||||
}
|
||||
661
LICENSE
Normal file
661
LICENSE
Normal file
@@ -0,0 +1,661 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
Reference in New Issue
Block a user