MCPcopy Create free account
hub / github.com/Epic0522/Codex-Remote-Contact / prepareIMessageModelImage

Function prepareIMessageModelImage

src/server.js:3087–3101  ·  view source on GitHub ↗
(filePath)

Source from the content-addressed store, hash-verified

3085}
3086
3087async function prepareIMessageModelImage(filePath) {
3088 const sourcePath = String(filePath || "").trim();
3089 if (!sourcePath) return "";
3090 await access(sourcePath);
3091 const extension = extname(sourcePath).toLowerCase();
3092 if (extension === ".png") return sourcePath;
3093
3094 await mkdir(imessageScreenshotsDir, { recursive: true });
3095 const stamp = new Date().toISOString().replace(/[:.]/g, "-");
3096 const outputPath = join(imessageScreenshotsDir, `incoming-${stamp}-${crypto.randomUUID()}.png`);
3097 await runCommand("/usr/bin/sips", ["-s", "format", "png", sourcePath, "--out", outputPath], { timeout: 15000 });
3098 await runCommand("/usr/bin/xattr", ["-c", outputPath], { timeout: 5000, allowFailure: true });
3099 await access(outputPath);
3100 return outputPath;
3101}
3102
3103async function handleIMessageCommand(event) {
3104 const trusted = state.imessage.trustedHandles.includes(event.handle);

Callers 1

pollIMessageFunction · 0.85

Calls 1

runCommandFunction · 0.85

Tested by

no test coverage detected