Skip to content

Commit bddc5e8

Browse files
committed
feat: attempt to update system TCC.db if allowed
1 parent f4bd88f commit bddc5e8

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@guidepup/setup",
3-
"version": "0.12.1",
3+
"version": "0.13.0",
44
"description": "Setup your environment for screen-reader automation.",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",

src/macOS/setup.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { disableSplashScreenSystemDefaults } from "./disableSplashScreenSystemDe
44
import { disableDictationInputAutoEnable } from "./disableDictationInputAutoEnable";
55
import { isSipEnabled } from "./isSipEnabled";
66
import { writeDatabaseFile } from "./writeDatabaseFile";
7-
import { updateTccDb } from "./updateTccDb";
7+
import { SYSTEM_PATH, USER_PATH, updateTccDb } from "./updateTccDb";
88
import { isAppleScriptControlEnabled } from "./isAppleScriptControlEnabled";
99
import { askUserToControlUi } from "./askUserToControlUi";
1010
import { setVoiceOverEnabledViaUi } from "./setVoiceOverEnabledViaUi";
@@ -19,13 +19,19 @@ const isRecorded = process.argv.includes("--record");
1919

2020
export async function setup(): Promise<void> {
2121
try {
22-
updateTccDb();
22+
updateTccDb(USER_PATH);
2323
} catch (e) {
2424
if (isCi) {
2525
throw e;
2626
}
2727
}
2828

29+
try {
30+
updateTccDb(SYSTEM_PATH);
31+
} catch {
32+
// Swallow error - most CI don't allow system configuration
33+
}
34+
2935
const stopRecording = isRecorded
3036
? record(`./recordings/macos-setup-${+new Date()}.mov`)
3137
: () => null;

src/macOS/updateTccDb.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,10 @@ const getEntries = (): string[] => {
206206
];
207207
};
208208

209-
const path = "$HOME/Library/Application Support/com.apple.TCC/TCC.db";
209+
export const USER_PATH = "$HOME/Library/Application Support/com.apple.TCC/TCC.db";
210+
export const SYSTEM_PATH = "/Library/Application Support/com.apple.TCC/TCC.db";
210211

211-
export function updateTccDb(): void {
212+
export function updateTccDb(path: string): void {
212213
for (const values of getEntries()) {
213214
const query = `INSERT OR IGNORE INTO access VALUES(${values});`;
214215

0 commit comments

Comments
 (0)