Private
Public Access
1
0

Embed mach service

This commit is contained in:
2025-08-29 19:45:27 -06:00
parent 54df338ce0
commit 41c5776d98
7 changed files with 110 additions and 5 deletions

View File

@@ -10,13 +10,70 @@
CD41F5D32E62431D00E0027B /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = CD41F5D22E62431D00E0027B /* KeychainAccess */; }; CD41F5D32E62431D00E0027B /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = CD41F5D22E62431D00E0027B /* KeychainAccess */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
CD41F5D92E6284FD00E0027B /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = Contents/Library/LaunchAgents;
dstSubfolderSpec = 1;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
CD41F5DD2E6285E800E0027B /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 6;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
CD41F5972E5B8E7300E0027B /* kordophone2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = kordophone2.app; sourceTree = BUILT_PRODUCTS_DIR; }; CD41F5972E5B8E7300E0027B /* kordophone2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = kordophone2.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */
CD41F5DA2E62850100E0027B /* Exceptions for "kordophone2" folder in "kordophone2" target */ = {
isa = PBXFileSystemSynchronizedBuildFileExceptionSet;
membershipExceptions = (
Daemon/kordophoned,
Daemon/net.buzzert.kordophonecd.plist,
);
target = CD41F5962E5B8E7300E0027B /* kordophone2 */;
};
/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */
/* Begin PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet section */
CD41F5DC2E62853800E0027B /* Exceptions for "kordophone2" folder in "Copy Files" phase from "kordophone2" target */ = {
isa = PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet;
buildPhase = CD41F5D92E6284FD00E0027B /* CopyFiles */;
membershipExceptions = (
Daemon/net.buzzert.kordophonecd.plist,
);
};
CD41F5E12E62860700E0027B /* Exceptions for "kordophone2" folder in "Copy Files" phase from "kordophone2" target */ = {
isa = PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet;
attributesByRelativePath = {
Daemon/kordophoned = (CodeSignOnCopy, );
};
buildPhase = CD41F5DD2E6285E800E0027B /* CopyFiles */;
membershipExceptions = (
Daemon/kordophoned,
);
};
/* End PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet section */
/* Begin PBXFileSystemSynchronizedRootGroup section */ /* Begin PBXFileSystemSynchronizedRootGroup section */
CD41F5992E5B8E7300E0027B /* kordophone2 */ = { CD41F5992E5B8E7300E0027B /* kordophone2 */ = {
isa = PBXFileSystemSynchronizedRootGroup; isa = PBXFileSystemSynchronizedRootGroup;
exceptions = (
CD41F5DA2E62850100E0027B /* Exceptions for "kordophone2" folder in "kordophone2" target */,
CD41F5DC2E62853800E0027B /* Exceptions for "kordophone2" folder in "Copy Files" phase from "kordophone2" target */,
CD41F5E12E62860700E0027B /* Exceptions for "kordophone2" folder in "Copy Files" phase from "kordophone2" target */,
);
path = kordophone2; path = kordophone2;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
@@ -60,6 +117,8 @@
CD41F5932E5B8E7300E0027B /* Sources */, CD41F5932E5B8E7300E0027B /* Sources */,
CD41F5942E5B8E7300E0027B /* Frameworks */, CD41F5942E5B8E7300E0027B /* Frameworks */,
CD41F5952E5B8E7300E0027B /* Resources */, CD41F5952E5B8E7300E0027B /* Resources */,
CD41F5D92E6284FD00E0027B /* CopyFiles */,
CD41F5DD2E6285E800E0027B /* CopyFiles */,
); );
buildRules = ( buildRules = (
); );
@@ -264,7 +323,7 @@
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = DQQH5H6GBD; DEVELOPMENT_TEAM = DQQH5H6GBD;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = NO;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = ""; INFOPLIST_KEY_NSHumanReadableCopyright = "";
@@ -291,7 +350,7 @@
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = DQQH5H6GBD; DEVELOPMENT_TEAM = DQQH5H6GBD;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = NO;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = ""; INFOPLIST_KEY_NSHumanReadableCopyright = "";

BIN
kordophone2/Daemon/kordophoned Executable file

Binary file not shown.

View File

@@ -0,0 +1,26 @@
<?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>Label</key>
<string>net.buzzert.kordophonecd</string>
<key>BundleProgram</key>
<string>Contents/MacOS/kordophoned</string>
<key>EnvironmentVariables</key>
<dict>
<key>RUST_LOG</key>
<string>info</string>
</dict>
<key>MachServices</key>
<dict>
<key>net.buzzert.kordophonecd</key>
<true/>
</dict>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/kordophoned.out.log</string>
<key>StandardErrorPath</key>
<string>/tmp/kordophoned.err.log</string>
</dict>
</plist>

View File

@@ -19,7 +19,7 @@ struct MessageEntryView: View
.frame(height: 1.0) .frame(height: 1.0)
HStack { HStack {
TextField("", text: $viewModel.draftText, axis: .vertical) TextField("iMessage", text: $viewModel.draftText, axis: .vertical)
.focusEffectDisabled(true) .focusEffectDisabled(true)
.textFieldStyle(.plain) .textFieldStyle(.plain)
.lineLimit(nil) .lineLimit(nil)
@@ -30,7 +30,7 @@ struct MessageEntryView: View
.padding(8.0) .padding(8.0)
.disabled(selectedConversation == nil) .disabled(selectedConversation == nil)
.background { .background {
RoundedRectangle(cornerRadius: 6.0) RoundedRectangle(cornerRadius: 8.0)
.stroke(SeparatorShapeStyle()) .stroke(SeparatorShapeStyle())
.fill(.background) .fill(.background)
} }

View File

@@ -6,6 +6,8 @@
<true/> <true/>
<key>com.apple.security.files.user-selected.read-only</key> <key>com.apple.security.files.user-selected.read-only</key>
<true/> <true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.temporary-exception.mach-lookup.global-name</key> <key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
<array> <array>
<string>net.buzzert.kordophonecd</string> <string>net.buzzert.kordophonecd</string>

View File

@@ -29,6 +29,7 @@ struct TranscriptView: View
.padding() .padding()
} }
.scaleEffect(CGSize(width: 1.0, height: -1.0)) .scaleEffect(CGSize(width: 1.0, height: -1.0))
.id(model.displayedConversation)
.task { await watchForMessageListChanges() } .task { await watchForMessageListChanges() }
} }
@@ -103,7 +104,7 @@ struct TranscriptView: View
func attachmentDownloaded(id: String) { func attachmentDownloaded(id: String) {
// TODO: should be smarter here // TODO: should be smarter here
setNeedsReload(animated: true) setNeedsReload(animated: false)
} }
private func observeDisplayedConversation() { private func observeDisplayedConversation() {

View File

@@ -6,18 +6,35 @@
// //
import Foundation import Foundation
import ServiceManagement
import XPC import XPC
private let serviceName = "net.buzzert.kordophonecd" private let serviceName = "net.buzzert.kordophonecd"
final class XPCClient final class XPCClient
{ {
private let connection: xpc_connection_t private let connection: xpc_connection_t
private let signalLock = NSLock() private let signalLock = NSLock()
private var signalSinks: [UUID: (Signal) -> Void] = [:] private var signalSinks: [UUID: (Signal) -> Void] = [:]
private var didSubscribeSignals: Bool = false private var didSubscribeSignals: Bool = false
static let appService: SMAppService = {
do {
let service = SMAppService.agent(plistName: "net.buzzert.kordophonecd.plist")
if service.status != .enabled {
try service.register()
}
return service
} catch {
fatalError("Unable to register agent: \(error)")
}
}()
init() { init() {
_ = Self.appService
self.connection = xpc_connection_create_mach_service(serviceName, nil, 0) self.connection = xpc_connection_create_mach_service(serviceName, nil, 0)
let handler: xpc_handler_t = { [weak self] event in let handler: xpc_handler_t = { [weak self] event in