Skip to content

Commit

Permalink
Intiial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryStrandJamf committed Apr 19, 2024
1 parent e839ce0 commit f64925a
Show file tree
Hide file tree
Showing 132 changed files with 10,121 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
xcuserdata
build/
*.xccheckout
*.gcno
*.DS_STORE
*.xcuserstate
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.0] - 2024-04-16
### Features
- Added the ability to use the v1/packages endpoint on Jamf Pro version 11.5 and above, which includes the ablity to upload files to any cloud instance that Jamf Pro supports. It shows up as a distribution point called "Cloud", but only for the destination since there isn't a way to download those files at this time.
### Enhancements
- Made the column headers resizable.
- Made it so it will show packages ending with ".app.zip" and if a package is non-flat (right click menu has "Show Package Contents"), it will only show up in the list if it doesn't have a corresponding ".app.zip" file. When a non-flat package is transferred, it will create a corresponding ".app.zip" file in the same directory and just transfer that.
- Updated the About view.
### Bug fixes
- Fixed an issue where files containing a "+" (and possibly other characters) would fail to upload to JCDS2 distribution points.

## [1.1.0] - 2024-03-19
### Features
- Made the package, savable item and the log message list columns sortable by clicking on the column headers.
### Enhancements
- Update AWS signature/header generation to AWS Signature Version 4 format, which improves JCDS 2 support.
- Replaced CommonCrypto with CrytoKit.
### Bug fixes
- Fixed an issue where it could indicate that JCDS2 was available when it was not.
- Fixed an issue where the icons in the source list could be incorrect.

## [1.0.0] - 2024-02-09
- First public release.
- Synchronization between local folders, and file shares and JCDS2 distribution points from Jamf Pro instances.
- Made checksum calculations on-demand instead of automatic.
22 changes: 22 additions & 0 deletions CoreData/DataManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// Copyright 2024, Jamf
//

import CoreData
import Foundation

/// Main data manager for the SavableItems (Jamf Pro or Follder instances)
class DataManager: NSObject, ObservableObject {
@Published var savableItems: [SavableItemData] = []

/// Add the Core Data container with the model name
let container: NSPersistentContainer = NSPersistentContainer(name: "StoredSettings")


/// Default init method. Load the Core Data container
override init() {
super.init()
container.loadPersistentStores { _, _ in }
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="22222" systemVersion="23A344" minimumToolsVersion="Automatic" sourceLanguage="Swift" usedWithSwiftData="YES" userDefinedModelVersionIdentifier="">
<entity name="FolderInstanceData" representedClassName="FolderInstanceData" parentEntity="SavableItemData" syncable="YES" codeGenerationType="class">
<attribute name="filePath" optional="YES" attributeType="String"/>
</entity>
<entity name="JamfProInstanceData" representedClassName="JamfProInstanceData" parentEntity="SavableItemData" syncable="YES" codeGenerationType="class">
<attribute name="url" optional="YES" attributeType="URI"/>
<attribute name="useClientApi" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="usernameOrClientId" optional="YES" attributeType="String"/>
</entity>
<entity name="SavableItemData" representedClassName="SavableItemData" syncable="YES" codeGenerationType="class">
<attribute name="id" optional="YES" attributeType="UUID" usesScalarValueType="NO"/>
<attribute name="name" optional="YES" attributeType="String"/>
</entity>
</model>
1,019 changes: 1,019 additions & 0 deletions Jamf Sync.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"originHash" : "e3f55a0c4b0ad40659ad3d728fe1ffe065c6d7c7a42f5b28fd5b59f970873c53",
"pins" : [
{
"identity" : "haversack",
"kind" : "remoteSourceControl",
"location" : "https://github.com/jamf/Haversack",
"state" : {
"revision" : "4d58a33d989d5ed318cc0ccc88f9ad6d064fbc68",
"version" : "1.1.1"
}
},
{
"identity" : "subprocess",
"kind" : "remoteSourceControl",
"location" : "https://github.com/jamf/Subprocess",
"state" : {
"revision" : "2fdaccadfe68bc80f53cfc2d5d2d2363a8d6a5a6",
"version" : "3.0.2"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections",
"state" : {
"revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb",
"version" : "1.1.0"
}
}
],
"version" : 3
}
131 changes: 131 additions & 0 deletions Jamf Sync.xcodeproj/xcshareddata/xcschemes/Jamf Sync.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "84BC6DEF2AC3122100CF6D39"
BuildableName = "Jamf Sync.app"
BlueprintName = "Jamf Sync"
ReferencedContainer = "container:Jamf Sync.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "84BC6E002AC3122200CF6D39"
BuildableName = "Jamf SyncTests.xctest"
BlueprintName = "Jamf SyncTests"
ReferencedContainer = "container:Jamf Sync.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "84BC6E0A2AC3122200CF6D39"
BuildableName = "Jamf SyncUITests.xctest"
BlueprintName = "Jamf SyncUITests"
ReferencedContainer = "container:Jamf Sync.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "84BC6DEF2AC3122100CF6D39"
BuildableName = "Jamf Sync.app"
BlueprintName = "Jamf Sync"
ReferencedContainer = "container:Jamf Sync.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "-s"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "Folder1"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "-d"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "JCDS:Stage"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "HarryJCDS2-2:JCDS"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "-p"
isEnabled = "NO">
</CommandLineArgument>
<CommandLineArgument
argument = "-r"
isEnabled = "NO">
</CommandLineArgument>
</CommandLineArguments>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "84BC6DEF2AC3122100CF6D39"
BuildableName = "Jamf Sync.app"
BlueprintName = "Jamf Sync"
ReferencedContainer = "container:Jamf Sync.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
5 changes: 5 additions & 0 deletions JamfSync/JamfSync.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?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/>
</plist>
29 changes: 29 additions & 0 deletions JamfSync/Model/Checksum.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// Copyright 2024, Jamf
//

import Foundation

enum ChecksumType: String {
case SHA3_512 = "SHA3-512"
case SHA_512 = "SHA-512"
case SHA_256 = "SHA-256"
case MD5 = "MD5"

static func fromRawValue(_ rawValue: String) -> ChecksumType {
switch rawValue {
case String(describing: ChecksumType.SHA_512):
return .SHA_512
case String(describing: ChecksumType.SHA_256):
return .SHA_256
default:
return .MD5
}
}
}

struct Checksum: Equatable, Identifiable {
let id = UUID()
var type: ChecksumType
var value: String
}
56 changes: 56 additions & 0 deletions JamfSync/Model/Checksums.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// Copyright 2024, Jamf
//

import Foundation

class Checksums: Equatable {
var checksums: [Checksum] = []

func updateChecksum(_ checksumToUpdate: Checksum) {
removeChecksum(type: checksumToUpdate.type)
checksums.append(checksumToUpdate)
}

func hasMatchingChecksumType(checksums: Checksums) -> Bool {
for checksum in self.checksums {
if checksums.findChecksum(type: checksum.type) != nil {
return true
}
}
return false
}

@discardableResult func removeChecksum(type: ChecksumType) -> Bool {
let startingCount = checksums.count
checksums = checksums.filter { $0.type != type }
return (startingCount != checksums.count)
}

func findChecksum(type: ChecksumType) -> Checksum? {
return checksums.first { $0.type == type }
}

func bestChecksum() -> Checksum? {
// NOTE: Technically .SHA3_512 is probably better than .SHA_512, but the binary doesn't support SHA3_512 yet
var checksum = findChecksum(type: .SHA_512)
if checksum == nil {
checksum = findChecksum(type: .SHA_256)
}
if checksum == nil {
checksum = findChecksum(type: .MD5)
}
return checksum
}

static func == (lhs: Checksums, rhs: Checksums) -> Bool {
if let sha512 = lhs.findChecksum(type: .SHA_512), let sha512ToCompare = rhs.findChecksum(type: .SHA_512) {
return sha512.value == sha512ToCompare.value
}
if let md5 = lhs.findChecksum(type: .MD5), let md5ToCompare = rhs.findChecksum(type: .MD5) {
return md5.value == md5ToCompare.value
}

return false
}
}
Loading

0 comments on commit f64925a

Please sign in to comment.