Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for partial wildcard in profiles #236

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions AppSigner/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -869,17 +869,21 @@ class MainView: NSView, URLSessionDataDelegate, URLSessionDelegate, URLSessionDo
if shouldSkipGetTaskAllow {
profile.removeGetTaskAllow()
}
let isWildcard = profile.appID == "*" // TODO: support com.example.* wildcard
if !isWildcard && (newApplicationID != "" && newApplicationID != profile.appID) {
setStatus("Unable to change App ID to \(newApplicationID), provisioning profile won't allow it")
cleanup(tempFolder); return
} else if isWildcard {
if newApplicationID != "" {

let hasNewAppID = !newApplicationID.isEmpty
if let wildcardIndex = profile.appID.firstIndex(of: "*") {
let allowedPrefix = profile.appID.prefix(upTo: wildcardIndex)
if hasNewAppID, newApplicationID.starts(with: allowedPrefix) {
profile.update(trueAppID: newApplicationID)
} else if let existingBundleID = bundleID {
profile.update(trueAppID: existingBundleID)
}
} else if hasNewAppID, newApplicationID != profile.appID {
setStatus("Unable to change App ID to \(newApplicationID), provisioning profile won't allow it")
cleanup(tempFolder)
return
}

if let entitlements = profile.getEntitlementsPlist() {
Log.write("–––––––––––––––––––––––\n\(entitlements)")
Log.write("–––––––––––––––––––––––")
Expand Down