mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 00:28:20 +08:00
Opt: Add an option to disable reload
This commit is contained in:
@@ -64,3 +64,20 @@ class WebuiConfig:
|
||||
if key[0].isupper() and key in self.config:
|
||||
self.config[key] = value
|
||||
self.write()
|
||||
|
||||
@staticmethod
|
||||
def to_bool(value):
|
||||
value = value.lower()
|
||||
if value == 'null' or value == 'false' or value == '':
|
||||
return False
|
||||
return True
|
||||
|
||||
def bool(self, key):
|
||||
"""
|
||||
Args:
|
||||
key (str):
|
||||
|
||||
Returns:
|
||||
bool: Option is ON or OFF.
|
||||
"""
|
||||
return self.to_bool(self.config[key])
|
||||
@@ -39,6 +39,10 @@ class Updater(Config, Installer):
|
||||
self.read()
|
||||
return datetime.time.fromisoformat(self.config['AutoRestartTime'])
|
||||
|
||||
@cached_property
|
||||
def enabled(self):
|
||||
return self.bool('EnableReload')
|
||||
|
||||
@cached_property
|
||||
def repo(self):
|
||||
return self.config['Repository']
|
||||
|
||||
@@ -183,7 +183,6 @@ class TaskHandler:
|
||||
|
||||
def _get_thread(self) -> threading.Thread:
|
||||
thread = Thread(target=self.loop)
|
||||
thread.daemon = True
|
||||
return thread
|
||||
|
||||
def start(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user