Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.
Closed
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 apps/code/build/entitlements.mac.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@
<!-- Enable JIT compilation for V8 -->
<key>com.apple.security.cs.allow-jit</key>
<true/>

<!-- Required for recording custom completion sounds via MediaRecorder -->
<key>com.apple.security.device.audio-input</key>
<true/>
</dict>
</plist>
10 changes: 5 additions & 5 deletions apps/code/forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ const config: ForgeConfig = {
appBundleId: "com.posthog.array",
appCategoryType: "public.app-category.productivity",
extraResource: existsSync("build/Assets.car") ? ["build/Assets.car"] : [],
extendInfo: existsSync("build/Assets.car")
? {
CFBundleIconName: "Icon",
}
: {},
extendInfo: {
NSMicrophoneUsageDescription:
"PostHog Code uses the microphone to let you record a custom completion sound.",
...(existsSync("build/Assets.car") ? { CFBundleIconName: "Icon" } : {}),
},
...(osxSignConfig
? {
osxSign: osxSignConfig,
Expand Down
2 changes: 2 additions & 0 deletions apps/code/src/main/di/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ElectronDialog } from "../platform-adapters/electron-dialog";
import { ElectronFileIcon } from "../platform-adapters/electron-file-icon";
import { ElectronImageProcessor } from "../platform-adapters/electron-image-processor";
import { ElectronMainWindow } from "../platform-adapters/electron-main-window";
import { ElectronMediaAccess } from "../platform-adapters/electron-media-access";
import { ElectronNotifier } from "../platform-adapters/electron-notifier";
import { ElectronPowerManager } from "../platform-adapters/electron-power-manager";
import { ElectronSecureStorage } from "../platform-adapters/electron-secure-storage";
Expand Down Expand Up @@ -86,6 +87,7 @@ container.bind(MAIN_TOKENS.Notifier).to(ElectronNotifier);
container.bind(MAIN_TOKENS.ContextMenu).to(ElectronContextMenu);
container.bind(MAIN_TOKENS.BundledResources).to(ElectronBundledResources);
container.bind(MAIN_TOKENS.ImageProcessor).to(ElectronImageProcessor);
container.bind(MAIN_TOKENS.MediaAccess).to(ElectronMediaAccess);

container.bind(MAIN_TOKENS.DatabaseService).to(DatabaseService);
container
Expand Down
1 change: 1 addition & 0 deletions apps/code/src/main/di/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const MAIN_TOKENS = Object.freeze({
ContextMenu: Symbol.for("Platform.ContextMenu"),
BundledResources: Symbol.for("Platform.BundledResources"),
ImageProcessor: Symbol.for("Platform.ImageProcessor"),
MediaAccess: Symbol.for("Platform.MediaAccess"),

// Stores
SettingsStore: Symbol.for("Main.SettingsStore"),
Expand Down
21 changes: 21 additions & 0 deletions apps/code/src/main/platform-adapters/electron-media-access.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type {
IMediaAccess,
MediaAccessStatus,
} from "@posthog/platform/media-access";
import { systemPreferences } from "electron";
import { injectable } from "inversify";

@injectable()
export class ElectronMediaAccess implements IMediaAccess {
public getMicrophoneStatus(): MediaAccessStatus {
if (process.platform !== "darwin") return "granted";
return systemPreferences.getMediaAccessStatus(
"microphone",
) as MediaAccessStatus;
}

public async requestMicrophoneAccess(): Promise<boolean> {
if (process.platform !== "darwin") return true;
return systemPreferences.askForMediaAccess("microphone");
}
}
26 changes: 26 additions & 0 deletions apps/code/src/main/trpc/routers/os.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import path from "node:path";
import type { IAppMeta } from "@posthog/platform/app-meta";
import type { DialogSeverity, IDialog } from "@posthog/platform/dialog";
import type { IImageProcessor } from "@posthog/platform/image-processor";
import type { IMediaAccess } from "@posthog/platform/media-access";
import type { IUrlLauncher } from "@posthog/platform/url-launcher";
import { IMAGE_MIME_TYPES } from "@shared/constants/image";
import { z } from "zod";
Expand All @@ -20,6 +21,8 @@ const getDialog = () => container.get<IDialog>(MAIN_TOKENS.Dialog);
const getAppMeta = () => container.get<IAppMeta>(MAIN_TOKENS.AppMeta);
const getImageProcessor = () =>
container.get<IImageProcessor>(MAIN_TOKENS.ImageProcessor);
const getMediaAccess = () =>
container.get<IMediaAccess>(MAIN_TOKENS.MediaAccess);

const messageBoxOptionsSchema = z.object({
type: z.enum(["none", "info", "error", "question", "warning"]).optional(),
Expand Down Expand Up @@ -273,6 +276,29 @@ export const osRouter = router({
*/
getWorktreeLocation: publicProcedure.query(() => getWorktreeLocation()),

/**
* Get the user's home directory.
*/
getHomeDir: publicProcedure.output(z.string()).query(() => os.homedir()),

/**
* Get the macOS microphone permission status.
* Returns "not-determined" | "granted" | "denied" | "restricted" | "unknown".
* On non-macOS platforms returns "granted".
*/
getMicrophoneAccessStatus: publicProcedure
.output(z.string())
.query(() => getMediaAccess().getMicrophoneStatus()),

/**
* Trigger the macOS microphone permission prompt (or return existing decision).
* Resolves to true if access is granted, false otherwise.
* On non-macOS platforms always returns true.
*/
requestMicrophoneAccess: publicProcedure
.output(z.boolean())
.mutation(() => getMediaAccess().requestMicrophoneAccess()),

/**
* Read a file and return it as a base64 data URL
* Used for image thumbnails in the editor
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions apps/code/src/renderer/assets/services/asana.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions apps/code/src/renderer/assets/services/gmail.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions apps/code/src/renderer/assets/services/google_calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions apps/code/src/renderer/assets/services/google_drive.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading