disable whitelist downloading by default

partially addresses #19
This commit is contained in:
Open Toontown 2022-01-19 23:25:49 -05:00
parent df95510043
commit 3d41e250e3

View file

@ -10,7 +10,7 @@ class TTWhiteList(WhiteList, DistributedObject.DistributedObject):
RedownloadTaskName = 'RedownloadWhitelistTask'
WhitelistBaseDir = ConfigVariableString('whitelist-base-dir', '').value
WhitelistStageDir = ConfigVariableString('whitelist-stage-dir', 'whitelist').value
WhitelistOverHttp = ConfigVariableBool('whitelist-over-http', True).value
WhitelistOverHttp = ConfigVariableBool('whitelist-over-http', False).value
WhitelistFileName = ConfigVariableString('whitelist-filename', 'twhitelist.dat').value
def __init__(self):
@ -30,8 +30,9 @@ class TTWhiteList(WhiteList, DistributedObject.DistributedObject):
data = vfs.readFile(filename, 1)
lines = data.split(b'\n')
WhiteList.__init__(self, lines)
self.redownloadWhitelist()
self.defaultWord = TTLocalizer.ChatGarblerDefault[0]
if self.WhitelistOverHttp:
self.redownloadWhitelist()
self.accept('updateWhitelist', self.handleNewWhitelist)
def unload(self):
@ -108,22 +109,7 @@ class TTWhiteList(WhiteList, DistributedObject.DistributedObject):
def findWhitelistDir(self):
if self.WhitelistOverHttp:
return self.WhitelistStageDir
searchPath = DSearchPath()
if AppRunnerGlobal.appRunner:
searchPath.appendDirectory(Filename.expandFrom('$TT_3_5_ROOT/phase_3.5/models/news'))
else:
basePath = os.path.expandvars('$TTMODELS') or './ttmodels'
searchPath.appendDirectory(Filename.fromOsSpecific(basePath + '/built/' + self.NewsBaseDir))
searchPath.appendDirectory(Filename(self.NewsBaseDir))
pfile = Filename(self.WhitelistFileName)
found = vfs.resolveFilename(pfile, searchPath)
if not found:
self.notify.warning('findWhitelistDir - no path: %s' % self.WhitelistFileName)
self.setErrorMessage(TTLocalizer.NewsPageErrorDownloadingFile % self.WhitelistFileName)
return None
self.notify.debug('found whitelist file %s' % pfile)
realDir = pfile.getDirname()
return realDir
def downloadWhitelistTask(self, task):
if self.ch.run():