bugfix: 读取内置 `domestic-domain-allowlist.txt` 失败的问题修复
parent
3a310eb8e1
commit
1844895318
|
@ -166,7 +166,8 @@ function getDomesticDomainAllowList () {
|
|||
log.info('读取已下载的 domestic-domain-allowlist.txt 文件:', fileAbsolutePath)
|
||||
} else {
|
||||
// 如果临时文件不存在,则使用内置文件
|
||||
fileAbsolutePath = path.join(__dirname, '../../gui/', config.get().proxy.domesticDomainAllowListFilePath)
|
||||
log.info('__dirname:', __dirname)
|
||||
fileAbsolutePath = path.join(__dirname, '../', config.get().proxy.domesticDomainAllowListFilePath)
|
||||
log.info('读取内置的 domestic-domain-allowlist.txt 文件:', fileAbsolutePath)
|
||||
}
|
||||
} else {
|
||||
|
@ -176,7 +177,7 @@ function getDomesticDomainAllowList () {
|
|||
try {
|
||||
return fs.readFileSync(fileAbsolutePath).toString()
|
||||
} catch (e) {
|
||||
log.error('读取 domestic-domain-allowlist.txt 文件失败:', fileAbsolutePath)
|
||||
log.error(`读取 domestic-domain-allowlist.txt 文件失败: ${fileAbsolutePath}, error:`, e)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ function createPacClient (pacFilePath) {
|
|||
function readFile (location) {
|
||||
try {
|
||||
log.info('pac root dir:', path.resolve('./'))
|
||||
log.info('pac location:', location)
|
||||
const filePath = path.resolve(location)
|
||||
log.info('read pac path:', filePath)
|
||||
return fs.readFileSync(location).toString()
|
||||
|
|
|
@ -69,7 +69,9 @@ module.exports = (serverConfig) => {
|
|||
}
|
||||
|
||||
if (!pacConfig.pacFileAbsolutePath) {
|
||||
log.info('setting.rootDir:', setting.rootDir)
|
||||
pacConfig.pacFileAbsolutePath = path.join(setting.rootDir, pacConfig.pacFilePath)
|
||||
log.info('读取内置的 pac.txt 文件:', pacConfig.pacFileAbsolutePath)
|
||||
if (pacConfig.autoUpdate) {
|
||||
log.warn('远程 pac.txt 文件下载失败或还在下载中,现使用内置 pac.txt 文件:', pacConfig.pacFileAbsolutePath)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue