mirror of
https://github.com/xfgryujk/blivechat.git
synced 2026-08-22 11:23:28 +08:00
加载器改成本地文件
This commit is contained in:
11
config.py
11
config.py
@@ -113,6 +113,8 @@ class AppConfig:
|
||||
self.database_url = app_section.get('database_url', self.database_url)
|
||||
self.tornado_xheaders = app_section.getboolean('tornado_xheaders', self.tornado_xheaders)
|
||||
self.loader_url = app_section.get('loader_url', self.loader_url)
|
||||
if self.loader_url == '{local_loader}':
|
||||
self.loader_url = self._get_local_loader_url()
|
||||
self.open_browser_at_startup = app_section.getboolean('open_browser_at_startup', self.open_browser_at_startup)
|
||||
self.enable_upload_file = app_section.getboolean('enable_upload_file', self.enable_upload_file)
|
||||
self.enable_admin_plugins = app_section.getboolean('enable_admin_plugins', self.enable_admin_plugins)
|
||||
@@ -133,6 +135,15 @@ class AppConfig:
|
||||
self.translate_max_queue_size = app_section.getint('translate_max_queue_size', self.translate_max_queue_size)
|
||||
self.translation_cache_size = app_section.getint('translation_cache_size', self.translation_cache_size)
|
||||
|
||||
@staticmethod
|
||||
def _get_local_loader_url():
|
||||
url = os.path.abspath(os.path.join(DATA_PATH, 'loader.html'))
|
||||
url = url.replace('\\', '/')
|
||||
if not url.startswith('/'): # Windows
|
||||
url = '/' + url
|
||||
url = 'file://' + url
|
||||
return url
|
||||
|
||||
def _load_translator_configs(self, config: configparser.ConfigParser):
|
||||
app_section = config['app']
|
||||
section_names = _str_to_list(app_section.get('translator_configs', ''))
|
||||
|
||||
Reference in New Issue
Block a user