blacklist of words for p2p
This commit is contained in:
@ -28,6 +28,7 @@ class p2p {
|
||||
this.version = '0'
|
||||
this.info = {}
|
||||
this.filesRequests = {}
|
||||
this.filesBlacklist = []
|
||||
if(!config.peerId)
|
||||
{
|
||||
logT('p2p', 'generate peerId')
|
||||
@ -146,7 +147,7 @@ class p2p {
|
||||
}
|
||||
|
||||
const filePath = ph.resolve(this.dataDirectory + '/' + path)
|
||||
if(!filePath.includes(this.dataDirectory))
|
||||
if(!filePath.includes(this.dataDirectory) || filePath == this.dataDirectory)
|
||||
{
|
||||
logTE('transfer', 'file get must be from data dir')
|
||||
return
|
||||
@ -158,6 +159,15 @@ class p2p {
|
||||
return
|
||||
}
|
||||
|
||||
for(const blackWord of this.filesBlacklist)
|
||||
{
|
||||
if(filePath.includes(blackWord))
|
||||
{
|
||||
logTE('transfer', 'file in blackwords', filePath, blackWord)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if(fs.lstatSync(filePath).isDirectory())
|
||||
{
|
||||
const filesList = directoryFilesRecursive(filePath).map(file => ph.relative(this.dataDirectory, file).replace(/\\/g, '/'))
|
||||
|
@ -68,6 +68,23 @@ module.exports = function (send, recive, dataDirectory, version, env)
|
||||
p2p.version = version
|
||||
p2p.encryptor = encryptor
|
||||
p2p.dataDirectory = dataDirectory // make file transfer work
|
||||
p2p.filesBlacklist = [
|
||||
'rats.json',
|
||||
'rats.log',
|
||||
'downloads.json',
|
||||
'Cookies',
|
||||
'Cookies-journal',
|
||||
'searchd',
|
||||
'Preferences',
|
||||
'Local Storage',
|
||||
'IndexedDB',
|
||||
'GPUCache',
|
||||
'Cache',
|
||||
'blob_storage',
|
||||
'peers.p2p',
|
||||
'query.log',
|
||||
'sphinx.conf'
|
||||
]
|
||||
p2p.listen()
|
||||
const p2pStore = new P2PStore(p2p, sphinx)
|
||||
|
||||
|
Reference in New Issue
Block a user