Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions StikJIT/StikJITApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ public func showAlert(title: String, message: String, showOk: Bool, showTryAgain
message: message,
onDismiss: {
// Called when tapped outside
rootViewController?.presentedViewController?.dismiss(animated: true)
completion(false)
},
showButton: true,
Expand All @@ -529,12 +530,14 @@ public func showAlert(title: String, message: String, showOk: Bool, showTryAgain
message: message,
onDismiss: {
// Called when tapped outside
rootViewController?.presentedViewController?.dismiss(animated: true)
completion(true)
},
showButton: true,
primaryButtonText: "OK",
onPrimaryButtonTap: {
// OK was tapped
rootViewController?.presentedViewController?.dismiss(animated: true)
completion(true)
}
)
Expand All @@ -550,6 +553,7 @@ public func showAlert(title: String, message: String, showOk: Bool, showTryAgain
title: title,
message: message,
onDismiss: {
rootViewController?.presentedViewController?.dismiss(animated: true)
completion(false)
},
showButton: false
Expand Down
35 changes: 35 additions & 0 deletions StikJIT/Utilities/Security.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// Security.swift
// StikJIT
// from MeloNX
// Created by s s on 2025/4/6.
//
import Security


typealias SecTaskRef = OpaquePointer
@_silgen_name("SecTaskCopyValueForEntitlement")
func SecTaskCopyValueForEntitlement(
_ task: SecTaskRef,
_ entitlement: NSString,
_ error: NSErrorPointer
) -> CFTypeRef?

@_silgen_name("SecTaskCreateFromSelf")
func SecTaskCreateFromSelf(
_ allocator: CFAllocator?
) -> SecTaskRef?

func checkAppEntitlement(_ ent: String) -> Bool {
guard let task = SecTaskCreateFromSelf(nil) else {
print("Failed to create SecTask")
return false
}

guard let entitlements = SecTaskCopyValueForEntitlement(task, ent as NSString, nil) else {
print("Failed to get entitlements")
return false
}

return entitlements.boolValue != nil && entitlements.boolValue
}
2 changes: 1 addition & 1 deletion StikJIT/Views/Custom Error View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct CustomErrorView: View {
.padding(.horizontal, 12)

// Message
Text(message)
Text(LocalizedStringKey(message))
.font(.system(size: 15, design: .rounded))
.foregroundColor(colorScheme == .dark ? .white.opacity(0.9) : .black.opacity(0.9))
.multilineTextAlignment(.center)
Expand Down
7 changes: 6 additions & 1 deletion StikJIT/Views/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,12 @@ class InstalledAppsViewModel: ObservableObject {
print(error)
self.apps = [:]
}


if self.apps.count == 0 && !checkAppEntitlement("get-task-allow") && !UserDefaults.standard.bool(forKey: "skipGetTaskAllowCheck") {
showAlert(title: "Warning", message: "StikJIT is not signed with **get-task-allow**. It's OK, but if you also sign the app you want to enable JIT for with the same method, it\n\n ***WILL NOT WORK***.\n\nPlease sign the app you want to enable JIT for using a development certificate. You can disable this alert in settings.", showOk: true) { _ in

}
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions StikJIT/Views/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ struct SettingsView: View {
@AppStorage("customBackgroundColor") private var customBackgroundColorHex: String = ""
@AppStorage("selectedAppIcon") private var selectedAppIcon: String = "AppIcon"
@AppStorage("autoQuitAfterEnablingJIT") private var doAutoQuitAfterEnablingJIT = false
@AppStorage("skipGetTaskAllowCheck") private var doSkipGetTaskAllowCheck = false
@State private var isShowingPairingFilePicker = false
@Environment(\.colorScheme) private var colorScheme

Expand Down Expand Up @@ -183,6 +184,9 @@ struct SettingsView: View {
Toggle("Automatically Quit After Enabling JIT", isOn: $doAutoQuitAfterEnablingJIT)
.foregroundColor(.primary)
.padding(.vertical, 6)
Toggle("Skip get-task-allow Check", isOn: $doSkipGetTaskAllowCheck)
.foregroundColor(.primary)
.padding(.vertical, 6)
}
.padding(.vertical, 20)
.padding(.horizontal, 16)
Expand Down