/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
shared/desktop/app/dynamic-config.tsx
43 строки
1 KB
chrisnojima-zoom
Version 670 - clean2 (#29122)
08 июн 2026, 19:31
Не верифицирован
08 июн 2026, 19:31
1943197
Код
Авторство
О чём код?
import fs from 'fs' import {serverConfigFileName, jsonDebugFileName} from '@/constants/platform' import KB2 from '@/util/electron' const getConfigOverload = () => { let config: {[key: string]: unknown} = {} // Load overrides from server config if (fs.existsSync(serverConfigFileName)) { try { const serverConfig = JSON.parse(fs.readFileSync(serverConfigFileName, 'utf8')) as | {[key: string]: unknown} | undefined const lastLoggedInUser = serverConfig?.['lastLoggedInUser'] if (typeof lastLoggedInUser === 'string') { if (lastLoggedInUser) { const userConfig = serverConfig[lastLoggedInUser] as {printRPCStats?: boolean} | undefined if (userConfig?.printRPCStats) { config['printRPCStats'] = true } } } } catch { console.warn('Invalid server config') } } // Load overrides from a local json file if (fs.existsSync(jsonDebugFileName)) { try { const pathJson = JSON.parse(fs.readFileSync(jsonDebugFileName, 'utf8')) as {[key: string]: unknown} console.log('Loaded', jsonDebugFileName, pathJson) config = {...config, ...pathJson} } catch { console.warn( 'Invalid local-debug file, parsing error <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<' ) } } return config } export const configOverload = getConfigOverload() KB2.constants.configOverload = configOverload