Files
OmniRoute/open-sse/services/tlsClientDownloadDir.ts
AmirHossein Rezaei eadb28c7f0 refactor(tls): update TLSClient instantiation to use buildNativeTlsClientOptions across multiple services (#8583)
This change modifies the instantiation of TLSClient in chatgptTlsClient, claudeTlsClient, grokTlsClient, lmarenaTlsClient, notionTlsClient, and perplexityTlsClient to utilize the new buildNativeTlsClientOptions function. This refactor enhances consistency and maintainability across the TLS client implementations.
2026-07-27 19:06:59 -03:00

24 lines
675 B
TypeScript

import { join } from "node:path";
import { resolveDataDir } from "@/lib/dataPaths";
/**
* Writable cache directory for tls-client-node's native binary.
*
* Without an explicit `downloadDir`, the library defaults to its own package
* `node_modules/tls-client-node/bin`, which is root-owned on global installs
* and fails with EACCES for normal users (#8579).
*/
export function resolveTlsClientDownloadDir(): string {
return join(resolveDataDir(), "tls-client", "bin");
}
export function buildNativeTlsClientOptions(): {
runtimeMode: "native";
downloadDir: string;
} {
return {
runtimeMode: "native",
downloadDir: resolveTlsClientDownloadDir(),
};
}