mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-22 07:10:09 +01:00
Fixed some issue on autostart
This commit is contained in:
parent
3c74b0b1ef
commit
dfc9eab9d3
@ -440,7 +440,7 @@ class WireguardConfiguration:
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.message
|
return self.message
|
||||||
|
|
||||||
def __init__(self, name: str = None, data: dict = None, backup: dict = None):
|
def __init__(self, name: str = None, data: dict = None, backup: dict = None, startup: bool = False):
|
||||||
|
|
||||||
|
|
||||||
self.__parser: configparser.ConfigParser = configparser.ConfigParser(strict=False)
|
self.__parser: configparser.ConfigParser = configparser.ConfigParser(strict=False)
|
||||||
@ -506,7 +506,7 @@ class WireguardConfiguration:
|
|||||||
self.__initPeersList()
|
self.__initPeersList()
|
||||||
|
|
||||||
print(f"[WGDashboard] Initialized Configuration: {name}")
|
print(f"[WGDashboard] Initialized Configuration: {name}")
|
||||||
if self.getAutostartStatus() and not self.getStatus():
|
if self.getAutostartStatus() and not self.getStatus() and startup:
|
||||||
self.toggleConfiguration()
|
self.toggleConfiguration()
|
||||||
print(f"[WGDashboard] Autostart Configuration: {name}")
|
print(f"[WGDashboard] Autostart Configuration: {name}")
|
||||||
|
|
||||||
@ -1442,7 +1442,7 @@ def _regexMatch(regex, text):
|
|||||||
pattern = re.compile(regex)
|
pattern = re.compile(regex)
|
||||||
return pattern.search(text) is not None
|
return pattern.search(text) is not None
|
||||||
|
|
||||||
def _getConfigurationList():
|
def _getConfigurationList(startup: bool = False):
|
||||||
for i in os.listdir(DashboardConfig.GetConfig("Server", "wg_conf_path")[1]):
|
for i in os.listdir(DashboardConfig.GetConfig("Server", "wg_conf_path")[1]):
|
||||||
if _regexMatch("^(.{1,}).(conf)$", i):
|
if _regexMatch("^(.{1,}).(conf)$", i):
|
||||||
i = i.replace('.conf', '')
|
i = i.replace('.conf', '')
|
||||||
@ -1451,7 +1451,7 @@ def _getConfigurationList():
|
|||||||
if WireguardConfigurations[i].configurationFileChanged():
|
if WireguardConfigurations[i].configurationFileChanged():
|
||||||
WireguardConfigurations[i] = WireguardConfiguration(i)
|
WireguardConfigurations[i] = WireguardConfiguration(i)
|
||||||
else:
|
else:
|
||||||
WireguardConfigurations[i] = WireguardConfiguration(i)
|
WireguardConfigurations[i] = WireguardConfiguration(i, startup=startup)
|
||||||
except WireguardConfiguration.InvalidConfigurationFileException as e:
|
except WireguardConfiguration.InvalidConfigurationFileException as e:
|
||||||
print(f"{i} have an invalid configuration file.")
|
print(f"{i} have an invalid configuration file.")
|
||||||
|
|
||||||
@ -2527,7 +2527,7 @@ _, app_port = DashboardConfig.GetConfig("Server", "app_port")
|
|||||||
_, WG_CONF_PATH = DashboardConfig.GetConfig("Server", "wg_conf_path")
|
_, WG_CONF_PATH = DashboardConfig.GetConfig("Server", "wg_conf_path")
|
||||||
|
|
||||||
WireguardConfigurations: dict[str, WireguardConfiguration] = {}
|
WireguardConfigurations: dict[str, WireguardConfiguration] = {}
|
||||||
_getConfigurationList()
|
_getConfigurationList(startup=True)
|
||||||
|
|
||||||
def startThreads():
|
def startThreads():
|
||||||
bgThread = threading.Thread(target=backGroundThread)
|
bgThread = threading.Thread(target=backGroundThread)
|
||||||
|
2
src/static/app/dist/assets/index.css
vendored
2
src/static/app/dist/assets/index.css
vendored
File diff suppressed because one or more lines are too long
2
src/static/app/dist/assets/index.js
vendored
2
src/static/app/dist/assets/index.js
vendored
File diff suppressed because one or more lines are too long
@ -31,7 +31,7 @@ const toggle = (c) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(data.value, () => {
|
watch(data, () => {
|
||||||
updateAutostart()
|
updateAutostart()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user