added the option to append the last octet of the IP address to the username when configuring

This commit is contained in:
UpstreamData
2022-04-29 15:37:07 -06:00
parent d877ba01a0
commit ce5e1cad40
6 changed files with 27 additions and 26 deletions

View File

@@ -203,7 +203,7 @@ async def restart_miners_backend(ips: list):
await update_ui_with_data("status", "")
async def send_config_generator(miners: list, config):
async def send_config_generator(miners: list, config, last_octet_ip_user: bool = False):
loop = asyncio.get_event_loop()
config_tasks = []
for miner in miners:
@@ -212,14 +212,16 @@ async def send_config_generator(miners: list, config):
config_tasks = []
for sent_config in configured:
yield await sent_config
config_tasks.append(loop.create_task(miner.send_config(config)))
config_tasks.append(
loop.create_task(miner.send_config(config, ip_user=last_octet_ip_user))
)
configured = asyncio.as_completed(config_tasks)
for sent_config in configured:
yield await sent_config
@disable_buttons
async def send_config(ips: list, config):
async def send_config(ips: list, config, last_octet_ip: bool = False):
await update_ui_with_data("status", "Configuring")
await set_progress_bar_len(2 * len(ips))
progress_bar_len = 0
@@ -231,7 +233,9 @@ async def send_config(ips: list, config):
progress_bar_len += 1
asyncio.create_task(update_prog_bar(progress_bar_len))
config_sender_generator = send_config_generator(all_miners, config)
config_sender_generator = send_config_generator(
all_miners, config, last_octet_ip_user=last_octet_ip
)
async for _config_sender in config_sender_generator:
progress_bar_len += 1
asyncio.create_task(update_prog_bar(progress_bar_len))

View File

@@ -95,7 +95,7 @@ layout = [
sg.Button("LIGHT", key="light"),
sg.Button("GENERATE", key="generate_config"),
],
[sg.Text("")],
[sg.Checkbox("Append IP 4th Octet to Username", key="last_octet_user")],
[sg.Multiline(size=(50, 28), key="config", do_not_clear=True)],
]
),

View File

@@ -138,6 +138,7 @@ async def ui():
for item in value["ip_table"]
],
value["config"],
last_octet_ip=value["last_octet_user"],
)
)
if event == "import_file_config":