mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
not failing on invalid p2p files
This commit is contained in:
parent
e46fed69c3
commit
dbe6272240
4 changed files with 20 additions and 5 deletions
|
@ -435,15 +435,29 @@ function setup(data: SubmoduleData): Submodule {
|
||||||
fname: paths.peersFile,
|
fname: paths.peersFile,
|
||||||
logMsg: 'Peers file updated',
|
logMsg: 'Peers file updated',
|
||||||
action: () => {
|
action: () => {
|
||||||
|
try {
|
||||||
peers = utils.ReadJSON(paths.peersFile)
|
peers = utils.ReadJSON(paths.peersFile)
|
||||||
|
} catch (e) {
|
||||||
|
logger.Log(
|
||||||
|
`Peers file contents are invalid! Check if syntax is correct for ${paths.peersFile}`,
|
||||||
|
'redbg'
|
||||||
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fname: paths.selfInfoFile,
|
fname: paths.selfInfoFile,
|
||||||
logMsg: 'P2P self info file changed',
|
logMsg: 'P2P self info file changed',
|
||||||
action: () => {
|
action: () => {
|
||||||
|
try {
|
||||||
selfInfo = utils.ReadJSON(paths.selfInfoFile)
|
selfInfo = utils.ReadJSON(paths.selfInfoFile)
|
||||||
selfInfo.publicKey = publicKey
|
selfInfo.publicKey = publicKey
|
||||||
|
} catch (e) {
|
||||||
|
logger.Log(
|
||||||
|
`Self info file contents are invalid! Check if syntax is correct for ${paths.selfInfoFile}`,
|
||||||
|
'redbg'
|
||||||
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -24,6 +24,7 @@ export const validateFiles = (): boolean => {
|
||||||
Object.entries(files).forEach(([key, file]: [string, FileDescriptor]) => {
|
Object.entries(files).forEach(([key, file]: [string, FileDescriptor]) => {
|
||||||
let fileExists = utils.FileExists(file.path)
|
let fileExists = utils.FileExists(file.path)
|
||||||
if (file.defaultValue != null && !fileExists) {
|
if (file.defaultValue != null && !fileExists) {
|
||||||
|
// FIXME: create path too
|
||||||
utils.WriteFile(file.defaultValue, file.path)
|
utils.WriteFile(file.defaultValue, file.path)
|
||||||
fileExists = true
|
fileExists = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 39dfd7a0f48d850b543d38d607320236038f54fb
|
Subproject commit 5a665bc766eb81aabd8a844e57329cc3a213d9f4
|
|
@ -1 +1 @@
|
||||||
Subproject commit f82ecaa6d00d4f0625fb678c2c645a6ed3d79c03
|
Subproject commit 7386dcaa68385990c756de67290f511a43cd4110
|
Loading…
Add table
Add a link
Reference in a new issue