Skip to content

Commit

Permalink
fix: sonoma expects extra values in tcc.db (#28)
Browse files Browse the repository at this point in the history
* fix: sonoma expects extra values in tcc.db
* fix: wrong version number for Sonoma
  • Loading branch information
jlp-craigmorten committed Feb 1, 2024
1 parent f62278d commit b47874f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, macos-12, macos-13, windows-2019, windows-2022]
os: [macos-11, macos-12, macos-13, macos-14, windows-2019, windows-2022]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand Down
10 changes: 8 additions & 2 deletions src/macOS/updateTccDb.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { release } from "os";
import { execSync } from "child_process";
import { ERR_MACOS_UNABLE_TO_WRITE_USER_TCC_DB } from "../errors";

Expand Down Expand Up @@ -206,12 +207,17 @@ const getEntries = (): string[] => {
];
};

export const USER_PATH = "$HOME/Library/Application Support/com.apple.TCC/TCC.db";
export const USER_PATH =
"$HOME/Library/Application Support/com.apple.TCC/TCC.db";
export const SYSTEM_PATH = "/Library/Application Support/com.apple.TCC/TCC.db";

export function updateTccDb(path: string): void {
for (const values of getEntries()) {
const query = `INSERT OR IGNORE INTO access VALUES(${values});`;
const osRelease = release();
const isSonomaOrNewer = parseInt(osRelease.split(".").at(0)) >= 23;
const query = `INSERT OR IGNORE INTO access VALUES(${values}${
isSonomaOrNewer ? `,NULL,NULL,'UNUSED',${epoch}` : ""
});`;

try {
execSync(`sqlite3 "${path}" "${query}" >/dev/null 2>&1`);
Expand Down

0 comments on commit b47874f

Please sign in to comment.