From 822b20dd87694188273bc9dd07b5e6d165a5baad Mon Sep 17 00:00:00 2001 From: xpamych Date: Wed, 26 Apr 2023 23:31:42 +0300 Subject: [PATCH 001/244] =?UTF-8?q?=D0=B7=D0=B0=D0=B3=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D0=BF=D0=BE=D0=B4=20=D1=81=D0=BE=D0=B7?= =?UTF-8?q?=D0=B4=D0=B0=D0=BD=D0=B8=D0=B5=20systemd=20=D1=8E=D0=BD=D0=B8?= =?UTF-8?q?=D1=82=D0=B0=20=D1=81=D0=B5=D1=80=D0=B2=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 74 ++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 25 deletions(-) diff --git a/hlna.py b/hlna.py index 69942d9..b919ca1 100755 --- a/hlna.py +++ b/hlna.py @@ -59,6 +59,7 @@ def create_dir(directory): os.chdir(f"{home_dir}/.config/hlna/") os.mkdir("maps") + def check_int(number=""): """Проверка на ввод числа""" while True: @@ -231,33 +232,56 @@ def config(list_config=list_config): max_players = check_int("Укажите максимальное количество игроков: \n") if max_players == 0: max_players = 70 - - yaml_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override) + + systemd_unit_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override) + # yaml_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override) -def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override): - settings_hlna = [ - { - 'map' : map_s, - 'Cluster' : cluster_server, - 'SessionName' : name_server, - 'Port' : port_server, - 'QueryPort' : query_port, - 'RCONEnabled' : rcon_enabled, - 'RCONPort' : rcon_port, - 'ServerAdminPassword': adminpassword_server, - 'ServerPassword' : password_server, - 'MaxPlayers' : max_players, - 'ModsId' : mods_id, - 'Listen' : listen_server, - 'ServerPath' : dir_server, - 'clusterid' : cluster_id, - 'clusterdir' : cluster_dir_override - } - ] - with open(dir_config + f"{name_server}", 'w') as yamlfile: - yaml.dump(settings_hlna, yamlfile) - print(colorama.Fore.GREEN + "Конфиг создан" + colorama.Style.RESET_ALL) +def systemd_unit_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override) +unit = f'''[Unit] +Description=ARK: Survival Evolved dedicated server +Wants=network-online.target +After=syslog.target network.target nss-lookup.target network-online.target + +[Service] +ExecStartPre=/home/steam/steamcmd +login anonymous +force_install_dir /home/steam/servers/ark +app_update 376030 +quit +ExecStart=/home/steam/servers/ark/ShooterGame/Binaries/Linux/ShooterGameServer TheIsland?listen?SessionName= -server -log +WorkingDirectory=/home/steam/servers/ark/ShooterGame/Binaries/Linux +LimitNOFILE=100000 +ExecReload=/bin/kill -s HUP $MAINPID +ExecStop=/bin/kill -s INT $MAINPID +User=steam +Group=steam + +[Install] +WantedBy=multi-user.target\ +''' +with open(unit, 'w') as systemd_unit: + systemd_unit.write(unit) +os.system('systemctl daemon-reload') +# def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override): +# settings_hlna = [ +# { +# 'map' : map_s, +# 'Cluster' : cluster_server, +# 'SessionName' : name_server, +# 'Port' : port_server, +# 'QueryPort' : query_port, +# 'RCONEnabled' : rcon_enabled, +# 'RCONPort' : rcon_port, +# 'ServerAdminPassword': adminpassword_server, +# 'ServerPassword' : password_server, +# 'MaxPlayers' : max_players, +# 'ModsId' : mods_id, +# 'Listen' : listen_server, +# 'ServerPath' : dir_server, +# 'clusterid' : cluster_id, +# 'clusterdir' : cluster_dir_override +# } +# ] +# with open(dir_config + f"{name_server}", 'w') as yamlfile: +# yaml.dump(settings_hlna, yamlfile) +# print(colorama.Fore.GREEN + "Конфиг создан" + colorama.Style.RESET_ALL) def test_mod_install(): From 041532f2ce08e92f6e55e4cd6baa04439d35922f Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 6 May 2023 16:46:07 +0300 Subject: [PATCH 002/244] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D0=BE=D0=B3=D0=BE=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8?= =?UTF-8?q?=D0=BE=D0=BD=D0=B0=D0=BB=D0=B0=20=D0=B4=D0=BB=D1=8F=20systemd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 129 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 64 insertions(+), 65 deletions(-) diff --git a/hlna.py b/hlna.py index b919ca1..ad4e78d 100755 --- a/hlna.py +++ b/hlna.py @@ -1,21 +1,22 @@ #!/usr/bin/env python3 import os -import time -import threading -from pathlib import Path -from pprint import pprint +import threading import yaml import click import colorama -import click_completion +from pathlib import Path from rcon.source import Client home_dir = Path.home() dir_server = f"{home_dir}/ARK_Servers/" -dir_config = f"{home_dir}/.config/hlna/maps/" +server_dir = dir_server + "ShooterGame/Binaries/Linux/" +dir_unit = f"{home_dir}/.config/systemd/user/" +dir_config = f"{home_dir}/.config/hlna/" +dir_maps = f"{dir_config}maps/" + mods_id = "" listen_server = True @@ -37,7 +38,7 @@ def find_file(path): return arr -list_config = find_file(dir_config) +list_config = find_file(dir_maps) delist_config = find_file(dir_config+"deactivated") @@ -52,12 +53,6 @@ def create_dir(directory): """Проверка и создание директории""" if not os.path.exists(directory): os.mkdir(directory) - if not os.path.exists(f"{home_dir}/.config/hlna/"): - os.chdir(f"{home_dir}/.config/") - os.mkdir("hlna") - if not os.path.exists(f"{home_dir}/.config/hlna/maps"): - os.chdir(f"{home_dir}/.config/hlna/") - os.mkdir("maps") def check_int(number=""): @@ -74,8 +69,9 @@ def check_int(number=""): create_dir(dir_server) +create_dir(dir_unit) create_dir(dir_config) - +create_dir(dir_maps) @hlna.command(help='Для конфигурирования параметров запускаемого сервера или кластера серверов') def config(list_config=list_config): @@ -83,10 +79,10 @@ def config(list_config=list_config): port_s = [] rcon_p = [] query_p = [] - + cluster_id = "" cluster_dir_override = "" - + count_cluster = check_int("""Укажите требуется ли кластер? 1. Да 2. Нет @@ -105,16 +101,16 @@ def config(list_config=list_config): for i in list_config: data = read_yaml(i) print(f"{i} : {data['map']}") - # id_srv[data['SessionName']] = data['id_server'] + # id_srv[data['SessionName']] = data['id_server'] count_maps = check_int("Укажите количество карт: \n") if count_maps == 0: # 0 возвращает check_int когда, ничего не было введено count_maps = 1 - + for i in range(count_maps): while True: "Проверка на выбор карты из списка" - + # os.system("clear") amount_map = check_int("""Выберите карту из списка указав номер 1. The Island @@ -182,10 +178,10 @@ def config(list_config=list_config): print("Порт уже занят") else: return port - + if list_config: data = read_yaml(list_config[-1]) - + while True: name_server = input("Укажите название Сервера: \n") if name_server == "": @@ -195,7 +191,7 @@ def config(list_config=list_config): while new_name in list_config: new_name = f"{map_s}{str(count)}" count += 1 - + list_config.append(new_name) print(list_config) break @@ -212,12 +208,12 @@ def config(list_config=list_config): port_server = ports(port_s) print("Укажите query порт сервера:\n") query_port = ports(query_p) - + if port_server == 0: port_server = 7777 if query_port == 0: query_port = 27015 - + print("Порт Сервера=", port_server) print("Query Port=", query_port) @@ -234,54 +230,60 @@ def config(list_config=list_config): max_players = 70 systemd_unit_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override) - # yaml_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override) + yaml_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override) -def systemd_unit_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override) -unit = f'''[Unit] -Description=ARK: Survival Evolved dedicated server +def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override): + settings_hlna = [ + { + 'map' : map_s, + 'Cluster' : cluster_server, + 'SessionName' : name_server, + 'Port' : port_server, + 'QueryPort' : query_port, + 'RCONEnabled' : rcon_enabled, + 'RCONPort' : rcon_port, + 'ServerAdminPassword': adminpassword_server, + 'ServerPassword' : password_server, + 'MaxPlayers' : max_players, + 'ModsId' : mods_id, + 'Listen' : listen_server, + 'ServerPath' : dir_server, + 'clusterid' : cluster_id, + 'clusterdir' : cluster_dir_override + } + ] + with open(dir_maps + f"{name_server}", 'w') as yamlfile: + yaml.dump(settings_hlna, yamlfile) + print(colorama.Fore.GREEN + "Конфиг создан" + colorama.Style.RESET_ALL) + + +def systemd_unit_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override): + if not cluster_server: + ntff = "" + else: + ntff = "-NoTransferFromFiltering" + unit_file = f'{dir_unit}ARK_{name_server}.service' + unit_text = f'''[Unit] +Description=ARK: Survival Evolved dedicated server - {map_s} Wants=network-online.target After=syslog.target network.target nss-lookup.target network-online.target [Service] -ExecStartPre=/home/steam/steamcmd +login anonymous +force_install_dir /home/steam/servers/ark +app_update 376030 +quit -ExecStart=/home/steam/servers/ark/ShooterGame/Binaries/Linux/ShooterGameServer TheIsland?listen?SessionName= -server -log -WorkingDirectory=/home/steam/servers/ark/ShooterGame/Binaries/Linux +ExecStartPre=/usr/bin/steamcmd +force_install_dir {dir_server} +login anonymous +app_update 376030 +quit +TimeoutStartSec=60 +ExecStart={server_dir}ShooterGameServer {map_s}?{listen_server}?SessionName={name_server}?Port={port_server}?QueryPort={query_port}?RCONEnabled={rcon_enabled}?RCONPort={rcon_port}?ServerAdminPassword={adminpassword_server}?MaxPlayers={max_players} -clusterid={cluster_id}-ClusterDirOverride={cluster_dir_override} {ntff} +WorkingDirectory={server_dir} LimitNOFILE=100000 ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s INT $MAINPID -User=steam -Group=steam [Install] -WantedBy=multi-user.target\ +WantedBy=multi-user.target ''' -with open(unit, 'w') as systemd_unit: - systemd_unit.write(unit) -os.system('systemctl daemon-reload') -# def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override): -# settings_hlna = [ -# { -# 'map' : map_s, -# 'Cluster' : cluster_server, -# 'SessionName' : name_server, -# 'Port' : port_server, -# 'QueryPort' : query_port, -# 'RCONEnabled' : rcon_enabled, -# 'RCONPort' : rcon_port, -# 'ServerAdminPassword': adminpassword_server, -# 'ServerPassword' : password_server, -# 'MaxPlayers' : max_players, -# 'ModsId' : mods_id, -# 'Listen' : listen_server, -# 'ServerPath' : dir_server, -# 'clusterid' : cluster_id, -# 'clusterdir' : cluster_dir_override -# } -# ] -# with open(dir_config + f"{name_server}", 'w') as yamlfile: -# yaml.dump(settings_hlna, yamlfile) -# print(colorama.Fore.GREEN + "Конфиг создан" + colorama.Style.RESET_ALL) + with open(unit_file, 'w') as systemd_unit: + systemd_unit.write(unit_text) + os.system('systemctl daemon-reload') def test_mod_install(): @@ -420,7 +422,6 @@ def start(m, b, name_server=list_config): else: names_serverstart = choose_map(names_serverstart) - server_dir = dir_server + "ShooterGame/Binaries/Linux/" print_line("Валидация файлов сервера") x = os.system(f"steamcmd +force_install_dir {dir_server} +login anonymous +app_update 376030 +quit") os.chdir(server_dir) @@ -448,12 +449,12 @@ def start(m, b, name_server=list_config): else: print("Ни одной карты не установлено") - + def read_yaml(name_server, flag=True): # Читаем конфиги активных или неактивных карт в зависимости от флага if flag: - dirs = f"{home_dir}/.config/hlna/maps/{name_server}" + dirs = f"{dir_maps}{name_server}" else: dirs = f"{home_dir}/.config/hlna/deactivated/{name_server}" with open(dirs, "r") as yamlfile: @@ -512,7 +513,5 @@ def zero(x=""): return "" -# if __name__ == 'hlna': -# input = zero if __name__ == '__main__': hlna() From 177fc53f1d029ea57085663c06d4df3634e83a92 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 7 May 2023 17:37:31 +0300 Subject: [PATCH 003/244] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B0=D0=BD=20=D0=B7=D0=B0=D0=BF=D1=83=D1=81=D0=BA=20?= =?UTF-8?q?=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20systemd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 61 ++++++++++++++++++++------------------------------------- 1 file changed, 21 insertions(+), 40 deletions(-) diff --git a/hlna.py b/hlna.py index ad4e78d..f8056f2 100755 --- a/hlna.py +++ b/hlna.py @@ -229,7 +229,6 @@ def config(list_config=list_config): if max_players == 0: max_players = 70 - systemd_unit_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override) yaml_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override) @@ -256,34 +255,38 @@ def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rco with open(dir_maps + f"{name_server}", 'w') as yamlfile: yaml.dump(settings_hlna, yamlfile) print(colorama.Fore.GREEN + "Конфиг создан" + colorama.Style.RESET_ALL) + systemd_unit_create() -def systemd_unit_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override): - if not cluster_server: - ntff = "" - else: - ntff = "-NoTransferFromFiltering" - unit_file = f'{dir_unit}ARK_{name_server}.service' - unit_text = f'''[Unit] -Description=ARK: Survival Evolved dedicated server - {map_s} +def systemd_unit_create(name_server=list_config): + for i in name_server: + data = read_yaml(i) + if not data['Cluster']: + ntff = "" + else: + ntff = "-NoTransferFromFiltering" + unit_file = f"{dir_unit}ARK_{data['SessionName']}.service" + unit_text = f'''[Unit] +Description=ARK: Survival Evolved dedicated server - {data['map']} Wants=network-online.target After=syslog.target network.target nss-lookup.target network-online.target [Service] -ExecStartPre=/usr/bin/steamcmd +force_install_dir {dir_server} +login anonymous +app_update 376030 +quit -TimeoutStartSec=60 -ExecStart={server_dir}ShooterGameServer {map_s}?{listen_server}?SessionName={name_server}?Port={port_server}?QueryPort={query_port}?RCONEnabled={rcon_enabled}?RCONPort={rcon_port}?ServerAdminPassword={adminpassword_server}?MaxPlayers={max_players} -clusterid={cluster_id}-ClusterDirOverride={cluster_dir_override} {ntff} -WorkingDirectory={server_dir} +ExecStartPre=/usr/bin/steamcmd +force_install_dir {dir_server} +login anonymous +app_update 376030 +quit +TimeoutStartSec=1200 +ExecStart={server_dir}ShooterGameServer {data['map']}?listen={data['Listen']}?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}?MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff} LimitNOFILE=100000 ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s INT $MAINPID [Install] -WantedBy=multi-user.target +WantedBy=default.target ''' - with open(unit_file, 'w') as systemd_unit: - systemd_unit.write(unit_text) - os.system('systemctl daemon-reload') + with open(unit_file, 'w') as systemd_unit: + systemd_unit.write(unit_text) + os.system(f"systemctl --user unmask ARK_{data['SessionName']}.service") + os.system(f"systemctl --user enable ARK_{data['SessionName']}.service") + os.system('systemctl --user daemon-reload') def test_mod_install(): @@ -422,31 +425,9 @@ def start(m, b, name_server=list_config): else: names_serverstart = choose_map(names_serverstart) - print_line("Валидация файлов сервера") - x = os.system(f"steamcmd +force_install_dir {dir_server} +login anonymous +app_update 376030 +quit") - os.chdir(server_dir) for i in names_serverstart: data = read_yaml(i) - starting_map = dict_mapname[i] - print_line(data['Cluster']) - if not data['Cluster']: - ntff = "" - else: - ntff = "-NoTransferFromFiltering" - - def starting(i): - os.system(f"{server_dir}ShooterGameServer {i}?SessionName={data['SessionName']}?Port={data['Port']}\ - ?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}\ - ?ServerAdminPassword={data['ServerAdminPassword']}?MaxPlayers={data['MaxPlayers']}\ - ?GameModIds={data['ModsId']}?listen={data['Listen']} -clusterid={data['clusterid']}\ - -ClusterDirOverride={data['clusterdir']} {ntff}") - if x == 0: - print_line("Запускаем карту" + i) - threads = threading.Thread(target=starting, args=(starting_map,)) - threads.start() - else: - print(f"Карта не запущена, сервер не установлен") - + os.system(f"systemctl --user start ARK_{data['SessionName']}.service") else: print("Ни одной карты не установлено") From 76903c0360a169b475caf1c7666f238c0ec2b2f0 Mon Sep 17 00:00:00 2001 From: xpamych Date: Mon, 8 May 2023 16:26:46 +0300 Subject: [PATCH 004/244] =?UTF-8?q?=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BA=D0=B0=D1=82=D0=B0=D0=BB=D0=BE=D0=B3=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/hlna.py b/hlna.py index f8056f2..c235622 100755 --- a/hlna.py +++ b/hlna.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 import os -import threading - import yaml import click import colorama @@ -15,7 +13,9 @@ dir_server = f"{home_dir}/ARK_Servers/" server_dir = dir_server + "ShooterGame/Binaries/Linux/" dir_unit = f"{home_dir}/.config/systemd/user/" dir_config = f"{home_dir}/.config/hlna/" +dir_logs = f"{dir_config}logs" dir_maps = f"{dir_config}maps/" +dir_deactivated = f"{dir_maps}deactivated/" mods_id = "" listen_server = True @@ -26,6 +26,20 @@ def hlna(): pass +def create_dir(directory): + """Проверка и создание директории""" + if not os.path.exists(directory): + os.mkdir(directory) + + +create_dir(dir_server) +create_dir(dir_unit) +create_dir(dir_config) +create_dir(dir_logs) +create_dir(dir_maps) +create_dir(dir_deactivated) + + def find_file(path): """Находим все конфиги в зависимости от пути""" arr = next(os.walk(path), (None, None, []))[2] # [] if no file @@ -39,7 +53,7 @@ def find_file(path): list_config = find_file(dir_maps) -delist_config = find_file(dir_config+"deactivated") +delist_config = find_file(dir_deactivated) def print_line(text): @@ -49,12 +63,6 @@ def print_line(text): print(colorama.Fore.YELLOW + "-"*30 + colorama.Style.RESET_ALL) -def create_dir(directory): - """Проверка и создание директории""" - if not os.path.exists(directory): - os.mkdir(directory) - - def check_int(number=""): """Проверка на ввод числа""" while True: @@ -68,13 +76,9 @@ def check_int(number=""): print("Введите число") -create_dir(dir_server) -create_dir(dir_unit) -create_dir(dir_config) -create_dir(dir_maps) - @hlna.command(help='Для конфигурирования параметров запускаемого сервера или кластера серверов') def config(list_config=list_config): + """Сбор данных для конфига""" data = {} port_s = [] rcon_p = [] From 4648ff60fd34c249614f95ca4c6a687238b847c5 Mon Sep 17 00:00:00 2001 From: xpamych Date: Mon, 8 May 2023 17:40:17 +0300 Subject: [PATCH 005/244] =?UTF-8?q?=D1=87=D1=82=D0=BE-=D1=82=D0=BE=20?= =?UTF-8?q?=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 113 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 61 insertions(+), 52 deletions(-) diff --git a/hlna.py b/hlna.py index c235622..88605f6 100755 --- a/hlna.py +++ b/hlna.py @@ -18,7 +18,6 @@ dir_maps = f"{dir_config}maps/" dir_deactivated = f"{dir_maps}deactivated/" mods_id = "" -listen_server = True @click.group() @@ -58,9 +57,9 @@ delist_config = find_file(dir_deactivated) def print_line(text): """Добавление тире вокруг текста, покраска""" - print(colorama.Fore.YELLOW + "-"*30) + print(colorama.Fore.YELLOW + "-" * 30) print(f"{colorama.Fore.GREEN} + {text}") - print(colorama.Fore.YELLOW + "-"*30 + colorama.Style.RESET_ALL) + print(colorama.Fore.YELLOW + "-" * 30 + colorama.Style.RESET_ALL) def check_int(number=""): @@ -73,10 +72,10 @@ def check_int(number=""): x = int(x) return x except ValueError: - print("Введите число") + print_line("Введите число") -@hlna.command(help='Для конфигурирования параметров запускаемого сервера или кластера серверов') +@hlna.command(help='Сбор настроек для сервера или кластера') def config(list_config=list_config): """Сбор данных для конфига""" data = {} @@ -105,7 +104,6 @@ def config(list_config=list_config): for i in list_config: data = read_yaml(i) print(f"{i} : {data['map']}") - # id_srv[data['SessionName']] = data['id_server'] count_maps = check_int("Укажите количество карт: \n") if count_maps == 0: # 0 возвращает check_int когда, ничего не было введено @@ -114,8 +112,6 @@ def config(list_config=list_config): for i in range(count_maps): while True: "Проверка на выбор карты из списка" - - # os.system("clear") amount_map = check_int("""Выберите карту из списка указав номер 1. The Island 2. The Center @@ -181,11 +177,10 @@ def config(list_config=list_config): if port in ports_arr: print("Порт уже занят") else: - return port + return port if list_config: data = read_yaml(list_config[-1]) - while True: name_server = input("Укажите название Сервера: \n") if name_server == "": @@ -195,7 +190,6 @@ def config(list_config=list_config): while new_name in list_config: new_name = f"{map_s}{str(count)}" count += 1 - list_config.append(new_name) print(list_config) break @@ -204,20 +198,19 @@ def config(list_config=list_config): break else: if name_server in list_config: - print("Имя занято") + print_line("Имя занято") else: list_config.append(name_server) # если enter, то ставим последним элементом карту break + print("Укажите порт сервера:\n") port_server = ports(port_s) print("Укажите query порт сервера:\n") query_port = ports(query_p) - if port_server == 0: port_server = 7777 if query_port == 0: query_port = 27015 - print("Порт Сервера=", port_server) print("Query Port=", query_port) @@ -233,27 +226,41 @@ def config(list_config=list_config): if max_players == 0: max_players = 70 - yaml_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override) + print("Передавать сервер в глобальный список серверов steam?") + listen_server_amount = check_int("""\n + 1. Да + 2. Нет + :""") + if listen_server_amount == 1: + listen_server = True + elif listen_server_amount == 2: + listen_server = False + else: + listen_server = True + + yaml_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, + adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server) -def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override): +def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, + adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server): settings_hlna = [ { - 'map' : map_s, - 'Cluster' : cluster_server, - 'SessionName' : name_server, - 'Port' : port_server, - 'QueryPort' : query_port, - 'RCONEnabled' : rcon_enabled, - 'RCONPort' : rcon_port, + 'map': map_s, + 'Cluster': cluster_server, + 'SessionName': name_server, + 'Port': port_server, + 'QueryPort': query_port, + 'RCONEnabled': rcon_enabled, + 'RCONPort': rcon_port, 'ServerAdminPassword': adminpassword_server, - 'ServerPassword' : password_server, - 'MaxPlayers' : max_players, - 'ModsId' : mods_id, - 'Listen' : listen_server, - 'ServerPath' : dir_server, - 'clusterid' : cluster_id, - 'clusterdir' : cluster_dir_override + 'ServerPassword': password_server, + 'MaxPlayers': max_players, + 'ModsId': mods_id, + 'Listen': listen_server, + 'ServerPath': dir_server, + 'clusterid': cluster_id, + 'clusterdir': cluster_dir_override } ] with open(dir_maps + f"{name_server}", 'w') as yamlfile: @@ -297,8 +304,8 @@ def test_mod_install(): pathTest = f"{dir_server}ShooterGame/Saved/Config/LinuxServer/" if os.path.exists(pathTest): os.chdir(pathTest) -# "Добавить файл в Game.ini, если модов несколько добавляем еще строку ModIDS= [ModInstaller] ModIDS=" -# c этим не разобрался + # "Добавить файл в Game.ini, если модов несколько добавляем еще строку ModIDS= [ModInstaller] ModIDS=" + # c этим не разобрался os.system("echo ActiveMods=2943454417 >> GameUserSettings.ini") else: print_line("Сервер не установлен") @@ -310,9 +317,9 @@ test_mod_install() @hlna.command() @click.option("-m", required=True, help="Название Сервера") @click.option("-e/-d", default=True, help="-e активировать карты, -d деактивировать") -def enablemap(m,e): +def enablemap(m, e): """Тут переписать надо""" - m = m.split(",") + m = m.split(",") # m = check_name_map(m, False) create_dir(dir_config + "deactivated") if e == True: @@ -332,7 +339,8 @@ def enablemap(m,e): print("Предлагаем заменить") if data['QueryPort'] in query_p: print("Заменить query port?") - x = os.system(f"mv {dir_config}deactivated/{i} {dir_config + i} 2>> {dir_config}logs") #Добавить текущее время + x = os.system( + f"mv {dir_config}deactivated/{i} {dir_config + i} 2>> {dir_config}logs") # Добавить текущее время if x == 0: print(f"Карта активирована - {i}") else: @@ -347,16 +355,17 @@ def enablemap(m,e): if i in delist_config: print(f"Карта {i} уже есть в деактивированных") continue - x = os.system(f"mv {dir_config + i} {dir_config}deactivated/{i} 2>> {dir_config}logs") #Добавить текущее время + x = os.system( + f"mv {dir_config + i} {dir_config}deactivated/{i} 2>> {dir_config}logs") # Добавить текущее время if x == 0: print(f"Карта деактивирована - {i}") else: print(f"{i} либо деактивирована, либо такой карты нет") except: pass - -@hlna.command() + +@hlna.command() def servers(map_server=list_config): # Добавить сортивку по кластерам и вывод несколько столбиков if map_server == [] and delist_config == []: @@ -382,10 +391,10 @@ def servers(map_server=list_config): Rcon порт : {data['RCONPort']} Максимальное кол-во игроков: {data['MaxPlayers']}""") print("-" * 40) - - if delist_config!=[]: + + if delist_config != []: x = input("Есть неактивные сервера, показать Y/n: ") - if x!="n": + if x != "n": for i in delist_config: data = read_yaml(i, False) print(f""" @@ -401,8 +410,8 @@ def servers(map_server=list_config): Rcon порт : {data['RCONPort']} Максимальное кол-во игроков: {data['MaxPlayers']}""") print("-" * 40) - - + + @hlna.command(help='Для запуска, сконфигурированного сервера или кластера') @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") @click.option('-b', default='', help="") @@ -451,27 +460,27 @@ def choose_map(arr): new_arr = [] arr = sorted(arr) print('Найдены сервера с этой картой') - for i,map in enumerate(arr): - print(f"{i+1}) {map}") + for i, map in enumerate(arr): + print(f"{i + 1}) {map}") while True: try: x = input("Выберите сервер из списка, либо несколько через запятую: ").split(',') - x = [int (i) for i in x] + x = [int(i) for i in x] break except: print("Неправильный ввод") - + for i in x: - new_arr.append(arr[i-1]) + new_arr.append(arr[i - 1]) print('Выбранные сервера:', new_arr) - + return new_arr @hlna.command() -@click.argument('c', nargs=1) +@click.argument('c', nargs=1) @click.option('-m', required=True, help="Название карты для применения rcon команды") -def rcon(m,c): +def rcon(m, c): print_line("Команда: ", c) print_line("Карты: ", m) dict_mapname = {} @@ -482,7 +491,7 @@ def rcon(m,c): dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword'] rcon_ports = [] for ns, v in dict_mapname.items(): - print_line(f"переменные v и m {v} & {m}") # обьединить с таким же блоком в start() + print_line(f"переменные v и m {v} & {m}") # обьединить с таким же блоком в start() if v in m: rcon_ports.append(ns) print_line(f"Карта которая запускается {ns}") From efe26d6f65e305e81aced59951b9edbfed10269f Mon Sep 17 00:00:00 2001 From: xpamych Date: Mon, 8 May 2023 19:05:56 +0300 Subject: [PATCH 006/244] =?UTF-8?q?=D0=B2=D1=8B=D0=B1=D0=BE=D1=80=20=D0=B8?= =?UTF-8?q?=D0=B3=D1=80=D1=8B=20=D0=B4=D0=BB=D1=8F=20=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D1=84=D0=B8=D0=B3=D1=83=D1=80=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 88605f6..01690de 100755 --- a/hlna.py +++ b/hlna.py @@ -76,7 +76,19 @@ def check_int(number=""): @hlna.command(help='Сбор настроек для сервера или кластера') -def config(list_config=list_config): +def config(): + while True: + count_server = check_int("""Выберите игру для конфигурирования + 1. ARK Survival Evolved + : """) + if count_server == 1: + config_ark() + break + else: + print_line("Пока есть только ARK xD") + + +def config_ark(list_config=list_config): """Сбор данных для конфига""" data = {} port_s = [] @@ -90,7 +102,6 @@ def config(list_config=list_config): 1. Да 2. Нет : """) - if count_cluster == 1: cluster_server = True cluster_id = input("Укажите id для кластера, любое сочетание символов: \n") From a355809e5f779645240f95c293e43273f11ebab5 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 9 May 2023 13:01:06 +0300 Subject: [PATCH 007/244] =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=83=D1=82=D0=B5=D0=B9=20=D0=BA?= =?UTF-8?q?=D0=B0=D1=82=D0=B0=D0=BB=D0=BE=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 01690de..c615c91 100755 --- a/hlna.py +++ b/hlna.py @@ -9,7 +9,8 @@ from pathlib import Path from rcon.source import Client home_dir = Path.home() -dir_server = f"{home_dir}/ARK_Servers/" +dir_server = f"{home_dir}/Servers/" +dir_server_ark = f"{dir_server}/ARK" server_dir = dir_server + "ShooterGame/Binaries/Linux/" dir_unit = f"{home_dir}/.config/systemd/user/" dir_config = f"{home_dir}/.config/hlna/" @@ -32,6 +33,7 @@ def create_dir(directory): create_dir(dir_server) +create_dir(dir_server_ark) create_dir(dir_unit) create_dir(dir_config) create_dir(dir_logs) From 6faedaba520ab2f644c9e98c0e3b087002b03f89 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 9 May 2023 16:57:01 +0300 Subject: [PATCH 008/244] =?UTF-8?q?=D0=B5=D1=89=D1=91=20=D1=87=D1=82=D0=BE?= =?UTF-8?q?-=D1=82=D0=BE=20=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/hlna.py b/hlna.py index c615c91..b4b32cd 100755 --- a/hlna.py +++ b/hlna.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import os +import datetime import yaml import click @@ -10,15 +11,18 @@ from rcon.source import Client home_dir = Path.home() dir_server = f"{home_dir}/Servers/" -dir_server_ark = f"{dir_server}/ARK" -server_dir = dir_server + "ShooterGame/Binaries/Linux/" +dir_server_ark = f"{dir_server}/ARK/" +server_dir = f"{dir_server_ark}ShooterGame/Binaries/Linux/" dir_unit = f"{home_dir}/.config/systemd/user/" dir_config = f"{home_dir}/.config/hlna/" -dir_logs = f"{dir_config}logs" +dir_logs = f"{dir_config}logs/" dir_maps = f"{dir_config}maps/" dir_deactivated = f"{dir_maps}deactivated/" mods_id = "" +now = datetime.datetime.now() +date = now.strftime("%Y-%m-%d") +time = now.strftime("%H:%M:%S") @click.group() @@ -38,7 +42,6 @@ create_dir(dir_unit) create_dir(dir_config) create_dir(dir_logs) create_dir(dir_maps) -create_dir(dir_deactivated) def find_file(path): @@ -298,7 +301,7 @@ After=syslog.target network.target nss-lookup.target network-online.target [Service] ExecStartPre=/usr/bin/steamcmd +force_install_dir {dir_server} +login anonymous +app_update 376030 +quit TimeoutStartSec=1200 -ExecStart={server_dir}ShooterGameServer {data['map']}?listen={data['Listen']}?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}?MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff} +ExecStart={dir_server_ark}ShooterGameServer {data['map']}?listen={data['Listen']}?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}?MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff} LimitNOFILE=100000 ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s INT $MAINPID @@ -331,10 +334,11 @@ test_mod_install() @click.option("-m", required=True, help="Название Сервера") @click.option("-e/-d", default=True, help="-e активировать карты, -d деактивировать") def enablemap(m, e): - """Тут переписать надо""" + """Включение/выключение карт""" + m = m.split(",") - # m = check_name_map(m, False) - create_dir(dir_config + "deactivated") + if not os.path.isdir(dir_deactivated): + create_dir(dir_deactivated) if e == True: port_s = [] query_p = [] @@ -350,26 +354,32 @@ def enablemap(m, e): data = read_yaml(i) if data['Port'] in port_s: print("Предлагаем заменить") + continue if data['QueryPort'] in query_p: print("Заменить query port?") - x = os.system( - f"mv {dir_config}deactivated/{i} {dir_config + i} 2>> {dir_config}logs") # Добавить текущее время + continue + x = os.system(f"mv {dir_deactivated}{i} {dir_maps} >> {dir_logs}{date} 2>&1") # Добавить текущее время + with open(f"{dir_logs}{date}.log", "a") as f: + f.write(f"[{time}] File {i} has been moved to {dir_maps}\n") if x == 0: print(f"Карта активирована - {i}") else: print(f"{i} либо уже активирована, либо такой карты нет") - except: - print("ошибка") + finally: pass + # except: + # print("ошибка при активации карты") + # pass else: - for i in m: try: if i in delist_config: print(f"Карта {i} уже есть в деактивированных") continue x = os.system( - f"mv {dir_config + i} {dir_config}deactivated/{i} 2>> {dir_config}logs") # Добавить текущее время + f"mv {dir_maps}{i} {dir_deactivated} >> {dir_logs}{date} 2>&1") # Добавить текущее время + with open(f"{dir_logs}{date}.log", "a") as f: + f.write(f"[{time}] File {i} has been moved to {dir_deactivated}\n") if x == 0: print(f"Карта деактивирована - {i}") else: @@ -458,12 +468,12 @@ def start(m, b, name_server=list_config): print("Ни одной карты не установлено") -def read_yaml(name_server, flag=True): +def read_yaml(list_config, flag=True): # Читаем конфиги активных или неактивных карт в зависимости от флага if flag: - dirs = f"{dir_maps}{name_server}" + dirs = f"{dir_maps}{list_config}" else: - dirs = f"{home_dir}/.config/hlna/deactivated/{name_server}" + dirs = f"{dir_deactivated}{list_config}" with open(dirs, "r") as yamlfile: data = yaml.load(yamlfile, Loader=yaml.FullLoader) return data[0] # возвращаем словарь со всеми значениями From d4eece79e3a7f904a5424a98c68b626c8075ec1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=88=D0=B5=20=D0=98=D0=BC=D1=8F?= Date: Wed, 10 May 2023 11:14:18 +0300 Subject: [PATCH 009/244] change if else and fix function servers --- LICENSE.md | 0 README.md | 0 hlna.py | 276 ++++++++++++++++++-------------------------- hlna_discord_bot.py | 0 logo.png | Bin pytest.py | 0 6 files changed, 115 insertions(+), 161 deletions(-) mode change 100644 => 100755 LICENSE.md mode change 100644 => 100755 README.md mode change 100644 => 100755 hlna_discord_bot.py mode change 100644 => 100755 logo.png mode change 100644 => 100755 pytest.py diff --git a/LICENSE.md b/LICENSE.md old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/hlna.py b/hlna.py index b4b32cd..c1d3c38 100755 --- a/hlna.py +++ b/hlna.py @@ -1,28 +1,23 @@ #!/usr/bin/env python3 import os -import datetime +import time +import threading + +from pathlib import Path +from pprint import pprint import yaml import click import colorama +import click_completion -from pathlib import Path from rcon.source import Client home_dir = Path.home() -dir_server = f"{home_dir}/Servers/" -dir_server_ark = f"{dir_server}/ARK/" -server_dir = f"{dir_server_ark}ShooterGame/Binaries/Linux/" -dir_unit = f"{home_dir}/.config/systemd/user/" -dir_config = f"{home_dir}/.config/hlna/" -dir_logs = f"{dir_config}logs/" -dir_maps = f"{dir_config}maps/" -dir_deactivated = f"{dir_maps}deactivated/" - +dir_server = f"{home_dir}/ARK_Servers/" +dir_config = f"{home_dir}/.config/hlna/maps/" mods_id = "" -now = datetime.datetime.now() -date = now.strftime("%Y-%m-%d") -time = now.strftime("%H:%M:%S") +listen_server = True @click.group() @@ -30,20 +25,6 @@ def hlna(): pass -def create_dir(directory): - """Проверка и создание директории""" - if not os.path.exists(directory): - os.mkdir(directory) - - -create_dir(dir_server) -create_dir(dir_server_ark) -create_dir(dir_unit) -create_dir(dir_config) -create_dir(dir_logs) -create_dir(dir_maps) - - def find_file(path): """Находим все конфиги в зависимости от пути""" arr = next(os.walk(path), (None, None, []))[2] # [] if no file @@ -56,17 +37,28 @@ def find_file(path): return arr -list_config = find_file(dir_maps) -delist_config = find_file(dir_deactivated) +list_config = find_file(dir_config) +delist_config = find_file(dir_config+"deactivated") def print_line(text): """Добавление тире вокруг текста, покраска""" - print(colorama.Fore.YELLOW + "-" * 30) + print(colorama.Fore.YELLOW + "-"*30) print(f"{colorama.Fore.GREEN} + {text}") - print(colorama.Fore.YELLOW + "-" * 30 + colorama.Style.RESET_ALL) + print(colorama.Fore.YELLOW + "-"*30 + colorama.Style.RESET_ALL) +def create_dir(directory): + """Проверка и создание директории""" + if not os.path.exists(directory): + os.mkdir(directory) + if not os.path.exists(f"{home_dir}/.config/hlna/"): + os.chdir(f"{home_dir}/.config/") + os.mkdir("hlna") + if not os.path.exists(f"{home_dir}/.config/hlna/maps"): + os.chdir(f"{home_dir}/.config/hlna/") + os.mkdir("maps") + def check_int(number=""): """Проверка на ввод числа""" while True: @@ -77,36 +69,28 @@ def check_int(number=""): x = int(x) return x except ValueError: - print_line("Введите число") + print("Введите число") -@hlna.command(help='Сбор настроек для сервера или кластера') -def config(): - while True: - count_server = check_int("""Выберите игру для конфигурирования - 1. ARK Survival Evolved - : """) - if count_server == 1: - config_ark() - break - else: - print_line("Пока есть только ARK xD") +create_dir(dir_server) +create_dir(dir_config) -def config_ark(list_config=list_config): - """Сбор данных для конфига""" +@hlna.command(help='Для конфигурирования параметров запускаемого сервера или кластера серверов') +def config(list_config=list_config): data = {} port_s = [] rcon_p = [] query_p = [] - + cluster_id = "" cluster_dir_override = "" - + count_cluster = check_int("""Укажите требуется ли кластер? 1. Да 2. Нет : """) + if count_cluster == 1: cluster_server = True cluster_id = input("Укажите id для кластера, любое сочетание символов: \n") @@ -120,14 +104,17 @@ def config_ark(list_config=list_config): for i in list_config: data = read_yaml(i) print(f"{i} : {data['map']}") + # id_srv[data['SessionName']] = data['id_server'] count_maps = check_int("Укажите количество карт: \n") if count_maps == 0: # 0 возвращает check_int когда, ничего не было введено count_maps = 1 - + for i in range(count_maps): while True: "Проверка на выбор карты из списка" + + # os.system("clear") amount_map = check_int("""Выберите карту из списка указав номер 1. The Island 2. The Center @@ -193,10 +180,11 @@ def config_ark(list_config=list_config): if port in ports_arr: print("Порт уже занят") else: - return port - + return port + if list_config: data = read_yaml(list_config[-1]) + while True: name_server = input("Укажите название Сервера: \n") if name_server == "": @@ -206,6 +194,7 @@ def config_ark(list_config=list_config): while new_name in list_config: new_name = f"{map_s}{str(count)}" count += 1 + list_config.append(new_name) print(list_config) break @@ -214,19 +203,20 @@ def config_ark(list_config=list_config): break else: if name_server in list_config: - print_line("Имя занято") + print("Имя занято") else: list_config.append(name_server) # если enter, то ставим последним элементом карту break - print("Укажите порт сервера:\n") port_server = ports(port_s) print("Укажите query порт сервера:\n") query_port = ports(query_p) + if port_server == 0: port_server = 7777 if query_port == 0: query_port = 27015 + print("Порт Сервера=", port_server) print("Query Port=", query_port) @@ -241,87 +231,41 @@ def config_ark(list_config=list_config): max_players = check_int("Укажите максимальное количество игроков: \n") if max_players == 0: max_players = 70 - - print("Передавать сервер в глобальный список серверов steam?") - listen_server_amount = check_int("""\n - 1. Да - 2. Нет - :""") - if listen_server_amount == 1: - listen_server = True - elif listen_server_amount == 2: - listen_server = False - else: - listen_server = True - - yaml_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, - adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server) + + yaml_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override) -def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, - adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server): +def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override): settings_hlna = [ { - 'map': map_s, - 'Cluster': cluster_server, - 'SessionName': name_server, - 'Port': port_server, - 'QueryPort': query_port, - 'RCONEnabled': rcon_enabled, - 'RCONPort': rcon_port, + 'map' : map_s, + 'Cluster' : cluster_server, + 'SessionName' : name_server, + 'Port' : port_server, + 'QueryPort' : query_port, + 'RCONEnabled' : rcon_enabled, + 'RCONPort' : rcon_port, 'ServerAdminPassword': adminpassword_server, - 'ServerPassword': password_server, - 'MaxPlayers': max_players, - 'ModsId': mods_id, - 'Listen': listen_server, - 'ServerPath': dir_server, - 'clusterid': cluster_id, - 'clusterdir': cluster_dir_override + 'ServerPassword' : password_server, + 'MaxPlayers' : max_players, + 'ModsId' : mods_id, + 'Listen' : listen_server, + 'ServerPath' : dir_server, + 'clusterid' : cluster_id, + 'clusterdir' : cluster_dir_override } ] - with open(dir_maps + f"{name_server}", 'w') as yamlfile: + with open(dir_config + f"{name_server}", 'w') as yamlfile: yaml.dump(settings_hlna, yamlfile) print(colorama.Fore.GREEN + "Конфиг создан" + colorama.Style.RESET_ALL) - systemd_unit_create() - - -def systemd_unit_create(name_server=list_config): - for i in name_server: - data = read_yaml(i) - if not data['Cluster']: - ntff = "" - else: - ntff = "-NoTransferFromFiltering" - unit_file = f"{dir_unit}ARK_{data['SessionName']}.service" - unit_text = f'''[Unit] -Description=ARK: Survival Evolved dedicated server - {data['map']} -Wants=network-online.target -After=syslog.target network.target nss-lookup.target network-online.target - -[Service] -ExecStartPre=/usr/bin/steamcmd +force_install_dir {dir_server} +login anonymous +app_update 376030 +quit -TimeoutStartSec=1200 -ExecStart={dir_server_ark}ShooterGameServer {data['map']}?listen={data['Listen']}?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}?MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff} -LimitNOFILE=100000 -ExecReload=/bin/kill -s HUP $MAINPID -ExecStop=/bin/kill -s INT $MAINPID - -[Install] -WantedBy=default.target -''' - with open(unit_file, 'w') as systemd_unit: - systemd_unit.write(unit_text) - os.system(f"systemctl --user unmask ARK_{data['SessionName']}.service") - os.system(f"systemctl --user enable ARK_{data['SessionName']}.service") - os.system('systemctl --user daemon-reload') def test_mod_install(): pathTest = f"{dir_server}ShooterGame/Saved/Config/LinuxServer/" if os.path.exists(pathTest): os.chdir(pathTest) - # "Добавить файл в Game.ini, если модов несколько добавляем еще строку ModIDS= [ModInstaller] ModIDS=" - # c этим не разобрался +# "Добавить файл в Game.ini, если модов несколько добавляем еще строку ModIDS= [ModInstaller] ModIDS=" +# c этим не разобрался os.system("echo ActiveMods=2943454417 >> GameUserSettings.ini") else: print_line("Сервер не установлен") @@ -333,12 +277,11 @@ test_mod_install() @hlna.command() @click.option("-m", required=True, help="Название Сервера") @click.option("-e/-d", default=True, help="-e активировать карты, -d деактивировать") -def enablemap(m, e): - """Включение/выключение карт""" - - m = m.split(",") - if not os.path.isdir(dir_deactivated): - create_dir(dir_deactivated) +def enablemap(m,e): + """Тут переписать надо""" + m = m.split(",") + # m = check_name_map(m, False) + create_dir(dir_config + "deactivated") if e == True: port_s = [] query_p = [] @@ -354,41 +297,33 @@ def enablemap(m, e): data = read_yaml(i) if data['Port'] in port_s: print("Предлагаем заменить") - continue if data['QueryPort'] in query_p: print("Заменить query port?") - continue - x = os.system(f"mv {dir_deactivated}{i} {dir_maps} >> {dir_logs}{date} 2>&1") # Добавить текущее время - with open(f"{dir_logs}{date}.log", "a") as f: - f.write(f"[{time}] File {i} has been moved to {dir_maps}\n") + x = os.system(f"mv {dir_config}deactivated/{i} {dir_config + i} 2>> {dir_config}logs") #Добавить текущее время if x == 0: print(f"Карта активирована - {i}") else: print(f"{i} либо уже активирована, либо такой карты нет") - finally: + except: + print("ошибка") pass - # except: - # print("ошибка при активации карты") - # pass else: + for i in m: try: if i in delist_config: print(f"Карта {i} уже есть в деактивированных") continue - x = os.system( - f"mv {dir_maps}{i} {dir_deactivated} >> {dir_logs}{date} 2>&1") # Добавить текущее время - with open(f"{dir_logs}{date}.log", "a") as f: - f.write(f"[{time}] File {i} has been moved to {dir_deactivated}\n") + x = os.system(f"mv {dir_config + i} {dir_config}deactivated/{i} 2>> {dir_config}logs") #Добавить текущее время if x == 0: print(f"Карта деактивирована - {i}") else: print(f"{i} либо деактивирована, либо такой карты нет") except: pass + - -@hlna.command() +@hlna.command() def servers(map_server=list_config): # Добавить сортивку по кластерам и вывод несколько столбиков if map_server == [] and delist_config == []: @@ -414,10 +349,10 @@ def servers(map_server=list_config): Rcon порт : {data['RCONPort']} Максимальное кол-во игроков: {data['MaxPlayers']}""") print("-" * 40) - - if delist_config != []: + + if delist_config!=[]: x = input("Есть неактивные сервера, показать Y/n: ") - if x != "n": + if x!="n": for i in delist_config: data = read_yaml(i, False) print(f""" @@ -433,8 +368,8 @@ def servers(map_server=list_config): Rcon порт : {data['RCONPort']} Максимальное кол-во игроков: {data['MaxPlayers']}""") print("-" * 40) - - + + @hlna.command(help='Для запуска, сконфигурированного сервера или кластера') @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") @click.option('-b', default='', help="") @@ -461,19 +396,36 @@ def start(m, b, name_server=list_config): else: names_serverstart = choose_map(names_serverstart) + server_dir = dir_server + "ShooterGame/Binaries/Linux/" + print_line("Валидация файлов сервера") + x = os.system(f"steamcmd +force_install_dir {dir_server} +login anonymous +app_update 376030 +quit") + os.chdir(server_dir) for i in names_serverstart: data = read_yaml(i) - os.system(f"systemctl --user start ARK_{data['SessionName']}.service") + starting_map = dict_mapname[i] + print_line(data['Cluster']) + ntff = '' if not data['Cluster'] else "-NoTransferFromFiltering" + def starting(i): + os.system(f"{server_dir}ShooterGameServer {i}?SessionName={data['SessionName']}?Port={data['Port']}\ + ?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}\ + ?ServerAdminPassword={data['ServerAdminPassword']}?MaxPlayers={data['MaxPlayers']}\ + ?GameModIds={data['ModsId']}?listen={data['Listen']} -clusterid={data['clusterid']}\ + -ClusterDirOverride={data['clusterdir']} {ntff}") + if x == 0: + print_line("Запускаем карту" + i) + threads = threading.Thread(target=starting, args=(starting_map,)) + threads.start() + else: + print(f"Карта не запущена, сервер не установлен") + else: print("Ни одной карты не установлено") + - -def read_yaml(list_config, flag=True): +def read_yaml(name_server, flag=True): # Читаем конфиги активных или неактивных карт в зависимости от флага - if flag: - dirs = f"{dir_maps}{list_config}" - else: - dirs = f"{dir_deactivated}{list_config}" + dirs = f"{dir_config}{name_server}" if flag else f"{dir_config}deactivated/{name_server}" + with open(dirs, "r") as yamlfile: data = yaml.load(yamlfile, Loader=yaml.FullLoader) return data[0] # возвращаем словарь со всеми значениями @@ -483,27 +435,27 @@ def choose_map(arr): new_arr = [] arr = sorted(arr) print('Найдены сервера с этой картой') - for i, map in enumerate(arr): - print(f"{i + 1}) {map}") + for i,map in enumerate(arr): + print(f"{i+1}) {map}") while True: try: x = input("Выберите сервер из списка, либо несколько через запятую: ").split(',') - x = [int(i) for i in x] + x = [int (i) for i in x] break except: print("Неправильный ввод") - + for i in x: - new_arr.append(arr[i - 1]) + new_arr.append(arr[i-1]) print('Выбранные сервера:', new_arr) - + return new_arr @hlna.command() -@click.argument('c', nargs=1) +@click.argument('c', nargs=1) @click.option('-m', required=True, help="Название карты для применения rcon команды") -def rcon(m, c): +def rcon(m,c): print_line("Команда: ", c) print_line("Карты: ", m) dict_mapname = {} @@ -514,7 +466,7 @@ def rcon(m, c): dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword'] rcon_ports = [] for ns, v in dict_mapname.items(): - print_line(f"переменные v и m {v} & {m}") # обьединить с таким же блоком в start() + print_line(f"переменные v и m {v} & {m}") # обьединить с таким же блоком в start() if v in m: rcon_ports.append(ns) print_line(f"Карта которая запускается {ns}") @@ -530,5 +482,7 @@ def zero(x=""): return "" +# if __name__ == 'hlna': +# input = zero if __name__ == '__main__': hlna() diff --git a/hlna_discord_bot.py b/hlna_discord_bot.py old mode 100644 new mode 100755 diff --git a/logo.png b/logo.png old mode 100644 new mode 100755 diff --git a/pytest.py b/pytest.py old mode 100644 new mode 100755 From 354dbf6e37bbb029fb3757a7def7ff04f4e3e40d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D1=88=D0=B5=20=D0=98=D0=BC=D1=8F?= Date: Wed, 10 May 2023 11:31:39 +0300 Subject: [PATCH 010/244] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20enablemap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index c1d3c38..2b8893a 100755 --- a/hlna.py +++ b/hlna.py @@ -294,7 +294,9 @@ def enablemap(m,e): if i in list_config: print(f"Карта {i} уже есть в активных") continue - data = read_yaml(i) + + data = read_yaml(i, False) + if data['Port'] in port_s: print("Предлагаем заменить") if data['QueryPort'] in query_p: @@ -422,7 +424,7 @@ def start(m, b, name_server=list_config): print("Ни одной карты не установлено") -def read_yaml(name_server, flag=True): +def read_yaml(name_server=list_config, flag=True): # Читаем конфиги активных или неактивных карт в зависимости от флага dirs = f"{dir_config}{name_server}" if flag else f"{dir_config}deactivated/{name_server}" From fdccb54b458cf97f7a4dd195ddc2d5f826da1dfc Mon Sep 17 00:00:00 2001 From: xpamych Date: Wed, 10 May 2023 12:23:01 +0300 Subject: [PATCH 011/244] =?UTF-8?q?Revert=20"=D0=BF=D0=BE=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D0=BB=20enablemap"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 354dbf6e37bbb029fb3757a7def7ff04f4e3e40d. --- hlna.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hlna.py b/hlna.py index 2b8893a..c1d3c38 100755 --- a/hlna.py +++ b/hlna.py @@ -294,9 +294,7 @@ def enablemap(m,e): if i in list_config: print(f"Карта {i} уже есть в активных") continue - - data = read_yaml(i, False) - + data = read_yaml(i) if data['Port'] in port_s: print("Предлагаем заменить") if data['QueryPort'] in query_p: @@ -424,7 +422,7 @@ def start(m, b, name_server=list_config): print("Ни одной карты не установлено") -def read_yaml(name_server=list_config, flag=True): +def read_yaml(name_server, flag=True): # Читаем конфиги активных или неактивных карт в зависимости от флага dirs = f"{dir_config}{name_server}" if flag else f"{dir_config}deactivated/{name_server}" From cbecbcecda0cf3a5a0d31c012cd28416bade7b4e Mon Sep 17 00:00:00 2001 From: xpamych Date: Wed, 10 May 2023 12:23:31 +0300 Subject: [PATCH 012/244] Revert "change if else and fix function servers" This reverts commit d4eece79e3a7f904a5424a98c68b626c8075ec1a. --- LICENSE.md | 0 README.md | 0 hlna.py | 276 ++++++++++++++++++++++++++------------------ hlna_discord_bot.py | 0 logo.png | Bin pytest.py | 0 6 files changed, 161 insertions(+), 115 deletions(-) mode change 100755 => 100644 LICENSE.md mode change 100755 => 100644 README.md mode change 100755 => 100644 hlna_discord_bot.py mode change 100755 => 100644 logo.png mode change 100755 => 100644 pytest.py diff --git a/LICENSE.md b/LICENSE.md old mode 100755 new mode 100644 diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/hlna.py b/hlna.py index c1d3c38..b4b32cd 100755 --- a/hlna.py +++ b/hlna.py @@ -1,23 +1,28 @@ #!/usr/bin/env python3 import os -import time -import threading - -from pathlib import Path -from pprint import pprint +import datetime import yaml import click import colorama -import click_completion +from pathlib import Path from rcon.source import Client home_dir = Path.home() -dir_server = f"{home_dir}/ARK_Servers/" -dir_config = f"{home_dir}/.config/hlna/maps/" +dir_server = f"{home_dir}/Servers/" +dir_server_ark = f"{dir_server}/ARK/" +server_dir = f"{dir_server_ark}ShooterGame/Binaries/Linux/" +dir_unit = f"{home_dir}/.config/systemd/user/" +dir_config = f"{home_dir}/.config/hlna/" +dir_logs = f"{dir_config}logs/" +dir_maps = f"{dir_config}maps/" +dir_deactivated = f"{dir_maps}deactivated/" + mods_id = "" -listen_server = True +now = datetime.datetime.now() +date = now.strftime("%Y-%m-%d") +time = now.strftime("%H:%M:%S") @click.group() @@ -25,6 +30,20 @@ def hlna(): pass +def create_dir(directory): + """Проверка и создание директории""" + if not os.path.exists(directory): + os.mkdir(directory) + + +create_dir(dir_server) +create_dir(dir_server_ark) +create_dir(dir_unit) +create_dir(dir_config) +create_dir(dir_logs) +create_dir(dir_maps) + + def find_file(path): """Находим все конфиги в зависимости от пути""" arr = next(os.walk(path), (None, None, []))[2] # [] if no file @@ -37,28 +56,17 @@ def find_file(path): return arr -list_config = find_file(dir_config) -delist_config = find_file(dir_config+"deactivated") +list_config = find_file(dir_maps) +delist_config = find_file(dir_deactivated) def print_line(text): """Добавление тире вокруг текста, покраска""" - print(colorama.Fore.YELLOW + "-"*30) + print(colorama.Fore.YELLOW + "-" * 30) print(f"{colorama.Fore.GREEN} + {text}") - print(colorama.Fore.YELLOW + "-"*30 + colorama.Style.RESET_ALL) + print(colorama.Fore.YELLOW + "-" * 30 + colorama.Style.RESET_ALL) -def create_dir(directory): - """Проверка и создание директории""" - if not os.path.exists(directory): - os.mkdir(directory) - if not os.path.exists(f"{home_dir}/.config/hlna/"): - os.chdir(f"{home_dir}/.config/") - os.mkdir("hlna") - if not os.path.exists(f"{home_dir}/.config/hlna/maps"): - os.chdir(f"{home_dir}/.config/hlna/") - os.mkdir("maps") - def check_int(number=""): """Проверка на ввод числа""" while True: @@ -69,28 +77,36 @@ def check_int(number=""): x = int(x) return x except ValueError: - print("Введите число") + print_line("Введите число") -create_dir(dir_server) -create_dir(dir_config) +@hlna.command(help='Сбор настроек для сервера или кластера') +def config(): + while True: + count_server = check_int("""Выберите игру для конфигурирования + 1. ARK Survival Evolved + : """) + if count_server == 1: + config_ark() + break + else: + print_line("Пока есть только ARK xD") -@hlna.command(help='Для конфигурирования параметров запускаемого сервера или кластера серверов') -def config(list_config=list_config): +def config_ark(list_config=list_config): + """Сбор данных для конфига""" data = {} port_s = [] rcon_p = [] query_p = [] - + cluster_id = "" cluster_dir_override = "" - + count_cluster = check_int("""Укажите требуется ли кластер? 1. Да 2. Нет : """) - if count_cluster == 1: cluster_server = True cluster_id = input("Укажите id для кластера, любое сочетание символов: \n") @@ -104,17 +120,14 @@ def config(list_config=list_config): for i in list_config: data = read_yaml(i) print(f"{i} : {data['map']}") - # id_srv[data['SessionName']] = data['id_server'] count_maps = check_int("Укажите количество карт: \n") if count_maps == 0: # 0 возвращает check_int когда, ничего не было введено count_maps = 1 - + for i in range(count_maps): while True: "Проверка на выбор карты из списка" - - # os.system("clear") amount_map = check_int("""Выберите карту из списка указав номер 1. The Island 2. The Center @@ -180,11 +193,10 @@ def config(list_config=list_config): if port in ports_arr: print("Порт уже занят") else: - return port - + return port + if list_config: data = read_yaml(list_config[-1]) - while True: name_server = input("Укажите название Сервера: \n") if name_server == "": @@ -194,7 +206,6 @@ def config(list_config=list_config): while new_name in list_config: new_name = f"{map_s}{str(count)}" count += 1 - list_config.append(new_name) print(list_config) break @@ -203,20 +214,19 @@ def config(list_config=list_config): break else: if name_server in list_config: - print("Имя занято") + print_line("Имя занято") else: list_config.append(name_server) # если enter, то ставим последним элементом карту break + print("Укажите порт сервера:\n") port_server = ports(port_s) print("Укажите query порт сервера:\n") query_port = ports(query_p) - if port_server == 0: port_server = 7777 if query_port == 0: query_port = 27015 - print("Порт Сервера=", port_server) print("Query Port=", query_port) @@ -231,41 +241,87 @@ def config(list_config=list_config): max_players = check_int("Укажите максимальное количество игроков: \n") if max_players == 0: max_players = 70 - - yaml_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override) + + print("Передавать сервер в глобальный список серверов steam?") + listen_server_amount = check_int("""\n + 1. Да + 2. Нет + :""") + if listen_server_amount == 1: + listen_server = True + elif listen_server_amount == 2: + listen_server = False + else: + listen_server = True + + yaml_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, + adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server) -def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override): +def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, + adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server): settings_hlna = [ { - 'map' : map_s, - 'Cluster' : cluster_server, - 'SessionName' : name_server, - 'Port' : port_server, - 'QueryPort' : query_port, - 'RCONEnabled' : rcon_enabled, - 'RCONPort' : rcon_port, + 'map': map_s, + 'Cluster': cluster_server, + 'SessionName': name_server, + 'Port': port_server, + 'QueryPort': query_port, + 'RCONEnabled': rcon_enabled, + 'RCONPort': rcon_port, 'ServerAdminPassword': adminpassword_server, - 'ServerPassword' : password_server, - 'MaxPlayers' : max_players, - 'ModsId' : mods_id, - 'Listen' : listen_server, - 'ServerPath' : dir_server, - 'clusterid' : cluster_id, - 'clusterdir' : cluster_dir_override + 'ServerPassword': password_server, + 'MaxPlayers': max_players, + 'ModsId': mods_id, + 'Listen': listen_server, + 'ServerPath': dir_server, + 'clusterid': cluster_id, + 'clusterdir': cluster_dir_override } ] - with open(dir_config + f"{name_server}", 'w') as yamlfile: + with open(dir_maps + f"{name_server}", 'w') as yamlfile: yaml.dump(settings_hlna, yamlfile) print(colorama.Fore.GREEN + "Конфиг создан" + colorama.Style.RESET_ALL) + systemd_unit_create() + + +def systemd_unit_create(name_server=list_config): + for i in name_server: + data = read_yaml(i) + if not data['Cluster']: + ntff = "" + else: + ntff = "-NoTransferFromFiltering" + unit_file = f"{dir_unit}ARK_{data['SessionName']}.service" + unit_text = f'''[Unit] +Description=ARK: Survival Evolved dedicated server - {data['map']} +Wants=network-online.target +After=syslog.target network.target nss-lookup.target network-online.target + +[Service] +ExecStartPre=/usr/bin/steamcmd +force_install_dir {dir_server} +login anonymous +app_update 376030 +quit +TimeoutStartSec=1200 +ExecStart={dir_server_ark}ShooterGameServer {data['map']}?listen={data['Listen']}?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}?MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff} +LimitNOFILE=100000 +ExecReload=/bin/kill -s HUP $MAINPID +ExecStop=/bin/kill -s INT $MAINPID + +[Install] +WantedBy=default.target +''' + with open(unit_file, 'w') as systemd_unit: + systemd_unit.write(unit_text) + os.system(f"systemctl --user unmask ARK_{data['SessionName']}.service") + os.system(f"systemctl --user enable ARK_{data['SessionName']}.service") + os.system('systemctl --user daemon-reload') def test_mod_install(): pathTest = f"{dir_server}ShooterGame/Saved/Config/LinuxServer/" if os.path.exists(pathTest): os.chdir(pathTest) -# "Добавить файл в Game.ini, если модов несколько добавляем еще строку ModIDS= [ModInstaller] ModIDS=" -# c этим не разобрался + # "Добавить файл в Game.ini, если модов несколько добавляем еще строку ModIDS= [ModInstaller] ModIDS=" + # c этим не разобрался os.system("echo ActiveMods=2943454417 >> GameUserSettings.ini") else: print_line("Сервер не установлен") @@ -277,11 +333,12 @@ test_mod_install() @hlna.command() @click.option("-m", required=True, help="Название Сервера") @click.option("-e/-d", default=True, help="-e активировать карты, -d деактивировать") -def enablemap(m,e): - """Тут переписать надо""" - m = m.split(",") - # m = check_name_map(m, False) - create_dir(dir_config + "deactivated") +def enablemap(m, e): + """Включение/выключение карт""" + + m = m.split(",") + if not os.path.isdir(dir_deactivated): + create_dir(dir_deactivated) if e == True: port_s = [] query_p = [] @@ -297,33 +354,41 @@ def enablemap(m,e): data = read_yaml(i) if data['Port'] in port_s: print("Предлагаем заменить") + continue if data['QueryPort'] in query_p: print("Заменить query port?") - x = os.system(f"mv {dir_config}deactivated/{i} {dir_config + i} 2>> {dir_config}logs") #Добавить текущее время + continue + x = os.system(f"mv {dir_deactivated}{i} {dir_maps} >> {dir_logs}{date} 2>&1") # Добавить текущее время + with open(f"{dir_logs}{date}.log", "a") as f: + f.write(f"[{time}] File {i} has been moved to {dir_maps}\n") if x == 0: print(f"Карта активирована - {i}") else: print(f"{i} либо уже активирована, либо такой карты нет") - except: - print("ошибка") + finally: pass + # except: + # print("ошибка при активации карты") + # pass else: - for i in m: try: if i in delist_config: print(f"Карта {i} уже есть в деактивированных") continue - x = os.system(f"mv {dir_config + i} {dir_config}deactivated/{i} 2>> {dir_config}logs") #Добавить текущее время + x = os.system( + f"mv {dir_maps}{i} {dir_deactivated} >> {dir_logs}{date} 2>&1") # Добавить текущее время + with open(f"{dir_logs}{date}.log", "a") as f: + f.write(f"[{time}] File {i} has been moved to {dir_deactivated}\n") if x == 0: print(f"Карта деактивирована - {i}") else: print(f"{i} либо деактивирована, либо такой карты нет") except: pass - -@hlna.command() + +@hlna.command() def servers(map_server=list_config): # Добавить сортивку по кластерам и вывод несколько столбиков if map_server == [] and delist_config == []: @@ -349,10 +414,10 @@ def servers(map_server=list_config): Rcon порт : {data['RCONPort']} Максимальное кол-во игроков: {data['MaxPlayers']}""") print("-" * 40) - - if delist_config!=[]: + + if delist_config != []: x = input("Есть неактивные сервера, показать Y/n: ") - if x!="n": + if x != "n": for i in delist_config: data = read_yaml(i, False) print(f""" @@ -368,8 +433,8 @@ def servers(map_server=list_config): Rcon порт : {data['RCONPort']} Максимальное кол-во игроков: {data['MaxPlayers']}""") print("-" * 40) - - + + @hlna.command(help='Для запуска, сконфигурированного сервера или кластера') @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") @click.option('-b', default='', help="") @@ -396,36 +461,19 @@ def start(m, b, name_server=list_config): else: names_serverstart = choose_map(names_serverstart) - server_dir = dir_server + "ShooterGame/Binaries/Linux/" - print_line("Валидация файлов сервера") - x = os.system(f"steamcmd +force_install_dir {dir_server} +login anonymous +app_update 376030 +quit") - os.chdir(server_dir) for i in names_serverstart: data = read_yaml(i) - starting_map = dict_mapname[i] - print_line(data['Cluster']) - ntff = '' if not data['Cluster'] else "-NoTransferFromFiltering" - def starting(i): - os.system(f"{server_dir}ShooterGameServer {i}?SessionName={data['SessionName']}?Port={data['Port']}\ - ?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}\ - ?ServerAdminPassword={data['ServerAdminPassword']}?MaxPlayers={data['MaxPlayers']}\ - ?GameModIds={data['ModsId']}?listen={data['Listen']} -clusterid={data['clusterid']}\ - -ClusterDirOverride={data['clusterdir']} {ntff}") - if x == 0: - print_line("Запускаем карту" + i) - threads = threading.Thread(target=starting, args=(starting_map,)) - threads.start() - else: - print(f"Карта не запущена, сервер не установлен") - + os.system(f"systemctl --user start ARK_{data['SessionName']}.service") else: print("Ни одной карты не установлено") - -def read_yaml(name_server, flag=True): + +def read_yaml(list_config, flag=True): # Читаем конфиги активных или неактивных карт в зависимости от флага - dirs = f"{dir_config}{name_server}" if flag else f"{dir_config}deactivated/{name_server}" - + if flag: + dirs = f"{dir_maps}{list_config}" + else: + dirs = f"{dir_deactivated}{list_config}" with open(dirs, "r") as yamlfile: data = yaml.load(yamlfile, Loader=yaml.FullLoader) return data[0] # возвращаем словарь со всеми значениями @@ -435,27 +483,27 @@ def choose_map(arr): new_arr = [] arr = sorted(arr) print('Найдены сервера с этой картой') - for i,map in enumerate(arr): - print(f"{i+1}) {map}") + for i, map in enumerate(arr): + print(f"{i + 1}) {map}") while True: try: x = input("Выберите сервер из списка, либо несколько через запятую: ").split(',') - x = [int (i) for i in x] + x = [int(i) for i in x] break except: print("Неправильный ввод") - + for i in x: - new_arr.append(arr[i-1]) + new_arr.append(arr[i - 1]) print('Выбранные сервера:', new_arr) - + return new_arr @hlna.command() -@click.argument('c', nargs=1) +@click.argument('c', nargs=1) @click.option('-m', required=True, help="Название карты для применения rcon команды") -def rcon(m,c): +def rcon(m, c): print_line("Команда: ", c) print_line("Карты: ", m) dict_mapname = {} @@ -466,7 +514,7 @@ def rcon(m,c): dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword'] rcon_ports = [] for ns, v in dict_mapname.items(): - print_line(f"переменные v и m {v} & {m}") # обьединить с таким же блоком в start() + print_line(f"переменные v и m {v} & {m}") # обьединить с таким же блоком в start() if v in m: rcon_ports.append(ns) print_line(f"Карта которая запускается {ns}") @@ -482,7 +530,5 @@ def zero(x=""): return "" -# if __name__ == 'hlna': -# input = zero if __name__ == '__main__': hlna() diff --git a/hlna_discord_bot.py b/hlna_discord_bot.py old mode 100755 new mode 100644 diff --git a/logo.png b/logo.png old mode 100755 new mode 100644 diff --git a/pytest.py b/pytest.py old mode 100755 new mode 100644 From 6c68c659ddb838f0991699a0da7898d43b3939d2 Mon Sep 17 00:00:00 2001 From: sitisll Date: Wed, 10 May 2023 12:37:32 +0300 Subject: [PATCH 013/244] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=20enablemap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/hlna.py b/hlna.py index b4b32cd..1ee1f4b 100755 --- a/hlna.py +++ b/hlna.py @@ -288,10 +288,7 @@ def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rco def systemd_unit_create(name_server=list_config): for i in name_server: data = read_yaml(i) - if not data['Cluster']: - ntff = "" - else: - ntff = "-NoTransferFromFiltering" + ntff = "" if not data['Cluster'] else "-NoTransferFromFiltering" unit_file = f"{dir_unit}ARK_{data['SessionName']}.service" unit_text = f'''[Unit] Description=ARK: Survival Evolved dedicated server - {data['map']} @@ -335,7 +332,6 @@ test_mod_install() @click.option("-e/-d", default=True, help="-e активировать карты, -d деактивировать") def enablemap(m, e): """Включение/выключение карт""" - m = m.split(",") if not os.path.isdir(dir_deactivated): create_dir(dir_deactivated) @@ -343,7 +339,7 @@ def enablemap(m, e): port_s = [] query_p = [] for k in list_config: - data = read_yaml(k) + data = read_yaml(k, False) port_s.append(data['Port']) query_p.append(data['QueryPort']) for i in m: @@ -470,10 +466,7 @@ def start(m, b, name_server=list_config): def read_yaml(list_config, flag=True): # Читаем конфиги активных или неактивных карт в зависимости от флага - if flag: - dirs = f"{dir_maps}{list_config}" - else: - dirs = f"{dir_deactivated}{list_config}" + dirs = f"{dir_maps}{list_config}" if flag else f"{dir_deactivated}{list_config}" with open(dirs, "r") as yamlfile: data = yaml.load(yamlfile, Loader=yaml.FullLoader) return data[0] # возвращаем словарь со всеми значениями From ea78347f554775578d88e8cdc31a2f39698ff2ec Mon Sep 17 00:00:00 2001 From: sitisll Date: Wed, 10 May 2023 12:43:51 +0300 Subject: [PATCH 014/244] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8E=20cre?= =?UTF-8?q?ate=5Fdir,=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=B5=D1=82=20?= =?UTF-8?q?=D0=B2=D1=81=D0=B5=20=D0=BF=D0=B0=D0=BF=D0=BA=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D1=83=D0=BA=D0=B0=D0=B7=D0=BD=D0=BD=D0=BE=D0=BC=D1=83?= =?UTF-8?q?=20=D0=BF=D1=83=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 1ee1f4b..148c021 100755 --- a/hlna.py +++ b/hlna.py @@ -33,7 +33,7 @@ def hlna(): def create_dir(directory): """Проверка и создание директории""" if not os.path.exists(directory): - os.mkdir(directory) + os.makedirs(directory) create_dir(dir_server) From 71cef7bc70a2212997f5f6d83d932bcfa4b79d72 Mon Sep 17 00:00:00 2001 From: sitisll Date: Wed, 10 May 2023 22:05:30 +0300 Subject: [PATCH 015/244] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=20enablemap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 148c021..cb64316 100755 --- a/hlna.py +++ b/hlna.py @@ -339,7 +339,7 @@ def enablemap(m, e): port_s = [] query_p = [] for k in list_config: - data = read_yaml(k, False) + data = read_yaml(k) port_s.append(data['Port']) query_p.append(data['QueryPort']) for i in m: @@ -347,7 +347,7 @@ def enablemap(m, e): if i in list_config: print(f"Карта {i} уже есть в активных") continue - data = read_yaml(i) + data = read_yaml(i, False) if data['Port'] in port_s: print("Предлагаем заменить") continue From 32f73457c702cc7ac33f56ba971278cec90caf53 Mon Sep 17 00:00:00 2001 From: xpamych Date: Fri, 12 May 2023 23:07:12 +0300 Subject: [PATCH 016/244] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=207DaystoDie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 109 ++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 75 insertions(+), 34 deletions(-) diff --git a/hlna.py b/hlna.py index cb64316..ac48494 100755 --- a/hlna.py +++ b/hlna.py @@ -10,14 +10,21 @@ from pathlib import Path from rcon.source import Client home_dir = Path.home() -dir_server = f"{home_dir}/Servers/" -dir_server_ark = f"{dir_server}/ARK/" -server_dir = f"{dir_server_ark}ShooterGame/Binaries/Linux/" -dir_unit = f"{home_dir}/.config/systemd/user/" dir_config = f"{home_dir}/.config/hlna/" +dir_unit = f"{home_dir}/.config/systemd/user/" +dir_server = f"{home_dir}/Servers/" dir_logs = f"{dir_config}logs/" -dir_maps = f"{dir_config}maps/" -dir_deactivated = f"{dir_maps}deactivated/" + +dir_server_ark = f"{dir_server}/ARK/" +dir_server_ark = f"{dir_server_ark}ShooterGame/Binaries/Linux/" + + +dir_maps_ark = f"{dir_config}/ARK" +dir_deactivated = f"{dir_maps_ark}deactivated/" + +dir_server_7days = f"{dir_server}/7Days/" + + mods_id = "" now = datetime.datetime.now() @@ -37,11 +44,11 @@ def create_dir(directory): create_dir(dir_server) -create_dir(dir_server_ark) create_dir(dir_unit) create_dir(dir_config) create_dir(dir_logs) -create_dir(dir_maps) + + def find_file(path): @@ -56,7 +63,7 @@ def find_file(path): return arr -list_config = find_file(dir_maps) +list_config = find_file(dir_maps_ark) delist_config = find_file(dir_deactivated) @@ -83,17 +90,23 @@ def check_int(number=""): @hlna.command(help='Сбор настроек для сервера или кластера') def config(): while True: - count_server = check_int("""Выберите игру для конфигурирования + count_game = check_int("""Выберите игру для конфигурирования 1. ARK Survival Evolved + 2. 7 Days to Die : """) - if count_server == 1: + if count_game == 1: config_ark() break + elif count_game == 2: + config_7daystodie() + break else: - print_line("Пока есть только ARK xD") + print_line("Пока есть только ARK и 7Days xD") def config_ark(list_config=list_config): + create_dir(dir_server_ark) + create_dir(dir_maps_ark) """Сбор данных для конфига""" data = {} port_s = [] @@ -254,11 +267,30 @@ def config_ark(list_config=list_config): else: listen_server = True - yaml_create(cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, + yaml_create(game:="ARK", cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server) -def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, +def config_7daystodie(): + list_simvols = "$@-.%{}+/".split() + create_dir(dir_server_7days) + print("Введите имя конфига (serverconfig):\n") + config_7days = input() + if config_7days == "": + config_7days = "serverconfig" + elif config_7days == "serverconfig": + config_7days = "serverconfig" + elif config_7days in list_simvols: + print_line("Запрещённые символы") + else: + xml_parser() + systemd_unit_create(game:="7Days", config_7days) + + +def xml_parser(): + print("Я не умею парсить))") + +def yaml_create(game, cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server): settings_hlna = [ { @@ -279,26 +311,35 @@ def yaml_create(cluster_server, map_s, name_server, port_server, query_port, rco 'clusterdir': cluster_dir_override } ] - with open(dir_maps + f"{name_server}", 'w') as yamlfile: + with open(dir_maps_ark + f"{name_server}", 'w') as yamlfile: yaml.dump(settings_hlna, yamlfile) print(colorama.Fore.GREEN + "Конфиг создан" + colorama.Style.RESET_ALL) - systemd_unit_create() + systemd_unit_create(game) -def systemd_unit_create(name_server=list_config): - for i in name_server: - data = read_yaml(i) - ntff = "" if not data['Cluster'] else "-NoTransferFromFiltering" - unit_file = f"{dir_unit}ARK_{data['SessionName']}.service" - unit_text = f'''[Unit] -Description=ARK: Survival Evolved dedicated server - {data['map']} +def systemd_unit_create(game, config_7days="", name_server=list_config): + if game == "ARK": + id_game = "376030" + for i in name_server: + data = read_yaml(i) + ntff = "" if not data['Cluster'] else "-NoTransferFromFiltering" + systemd_unit_exec = f"{dir_server_ark}ShooterGameServer {data['map']}?listen={data['Listen']}?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}?MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff}" + unit_file = f"{dir_unit}ARK_{data['SessionName']}.service" + elif game == "7Days": + id_game = "294420" + #сюда дописать обращение к xml для получения уникального имени сервера + systemd_unit_exec = f"{dir_server_7days}startserver.sh -configfile={config_7days}.xml" + unit_file = f"{dir_unit}7Days.service" + + unit_text = f'''[Unit] +Description={game}: Server Wants=network-online.target After=syslog.target network.target nss-lookup.target network-online.target [Service] -ExecStartPre=/usr/bin/steamcmd +force_install_dir {dir_server} +login anonymous +app_update 376030 +quit -TimeoutStartSec=1200 -ExecStart={dir_server_ark}ShooterGameServer {data['map']}?listen={data['Listen']}?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}?MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff} +ExecStartPre=/usr/bin/steamcmd +force_install_dir {dir_server} +login anonymous +app_update {id_game} +quit +TimeoutStartSec=99999 +ExecStart={systemd_unit_exec} LimitNOFILE=100000 ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s INT $MAINPID @@ -306,10 +347,10 @@ ExecStop=/bin/kill -s INT $MAINPID [Install] WantedBy=default.target ''' - with open(unit_file, 'w') as systemd_unit: - systemd_unit.write(unit_text) - os.system(f"systemctl --user unmask ARK_{data['SessionName']}.service") - os.system(f"systemctl --user enable ARK_{data['SessionName']}.service") + with open(unit_file, 'w') as systemd_unit: + systemd_unit.write(unit_text) + os.system(f"systemctl --user unmask {unit_file}") + os.system(f"systemctl --user enable {unit_file}") os.system('systemctl --user daemon-reload') @@ -354,9 +395,9 @@ def enablemap(m, e): if data['QueryPort'] in query_p: print("Заменить query port?") continue - x = os.system(f"mv {dir_deactivated}{i} {dir_maps} >> {dir_logs}{date} 2>&1") # Добавить текущее время + x = os.system(f"mv {dir_deactivated}{i} {dir_maps_ark} >> {dir_logs}{date} 2>&1") # Добавить текущее время with open(f"{dir_logs}{date}.log", "a") as f: - f.write(f"[{time}] File {i} has been moved to {dir_maps}\n") + f.write(f"[{time}] File {i} has been moved to {dir_maps_ark}\n") if x == 0: print(f"Карта активирована - {i}") else: @@ -373,7 +414,7 @@ def enablemap(m, e): print(f"Карта {i} уже есть в деактивированных") continue x = os.system( - f"mv {dir_maps}{i} {dir_deactivated} >> {dir_logs}{date} 2>&1") # Добавить текущее время + f"mv {dir_maps_ark}{i} {dir_deactivated} >> {dir_logs}{date} 2>&1") # Добавить текущее время with open(f"{dir_logs}{date}.log", "a") as f: f.write(f"[{time}] File {i} has been moved to {dir_deactivated}\n") if x == 0: @@ -466,7 +507,7 @@ def start(m, b, name_server=list_config): def read_yaml(list_config, flag=True): # Читаем конфиги активных или неактивных карт в зависимости от флага - dirs = f"{dir_maps}{list_config}" if flag else f"{dir_deactivated}{list_config}" + dirs = f"{dir_maps_ark}{list_config}" if flag else f"{dir_deactivated}{list_config}" with open(dirs, "r") as yamlfile: data = yaml.load(yamlfile, Loader=yaml.FullLoader) return data[0] # возвращаем словарь со всеми значениями From ff2d2f16682a668c02db87f845a7b5071d1a7c15 Mon Sep 17 00:00:00 2001 From: sitisll Date: Sat, 13 May 2023 13:13:21 +0300 Subject: [PATCH 017/244] =?UTF-8?q?=D0=BC=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hlna.py b/hlna.py index ac48494..2a75585 100755 --- a/hlna.py +++ b/hlna.py @@ -116,7 +116,7 @@ def config_ark(list_config=list_config): cluster_id = "" cluster_dir_override = "" - count_cluster = check_int("""Укажите требуется ли кластер? + count_cluster = check_int("""Укажите требуется ли кластер? default: Нет 1. Да 2. Нет : """) @@ -198,9 +198,9 @@ def config_ark(list_config=list_config): def ports(ports_arr): while True: port = check_int("") - if port == 0: + if not port: if not ports_arr: - print("Значение по умолчаню") + return 0 else: port = max(ports_arr) + 2 if port in ports_arr: @@ -232,17 +232,18 @@ def config_ark(list_config=list_config): list_config.append(name_server) # если enter, то ставим последним элементом карту break - print("Укажите порт сервера:\n") + print("Укажите порт сервера: ") port_server = ports(port_s) - print("Укажите query порт сервера:\n") - query_port = ports(query_p) if port_server == 0: port_server = 7777 + print("Порт Сервера=", port_server) + print("Укажите query порт сервера: ") + query_port = ports(query_p) if query_port == 0: query_port = 27015 - print("Порт Сервера=", port_server) print("Query Port=", query_port) + rcon_enabled = True if rcon_p == []: rcon_port = 27020 From 9c38ed40e867bb1c23225db2ec1894eb5c181753 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 17:06:51 +0300 Subject: [PATCH 018/244] ark_systemd --- hlna.py | 133 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 86 insertions(+), 47 deletions(-) diff --git a/hlna.py b/hlna.py index 2a75585..a6d7672 100755 --- a/hlna.py +++ b/hlna.py @@ -15,17 +15,14 @@ dir_unit = f"{home_dir}/.config/systemd/user/" dir_server = f"{home_dir}/Servers/" dir_logs = f"{dir_config}logs/" -dir_server_ark = f"{dir_server}/ARK/" -dir_server_ark = f"{dir_server_ark}ShooterGame/Binaries/Linux/" +dir_server_ark = f"{dir_server}ARK/" +dir_server_exec = f"{dir_server_ark}ShooterGame/Binaries/Linux/" - -dir_maps_ark = f"{dir_config}/ARK" +dir_maps_ark = f"{dir_config}/ARK/" dir_deactivated = f"{dir_maps_ark}deactivated/" dir_server_7days = f"{dir_server}/7Days/" - - mods_id = "" now = datetime.datetime.now() date = now.strftime("%Y-%m-%d") @@ -49,8 +46,6 @@ create_dir(dir_config) create_dir(dir_logs) - - def find_file(path): """Находим все конфиги в зависимости от пути""" arr = next(os.walk(path), (None, None, []))[2] # [] if no file @@ -123,8 +118,8 @@ def config_ark(list_config=list_config): if count_cluster == 1: cluster_server = True cluster_id = input("Укажите id для кластера, любое сочетание символов: \n") - create_dir(dir_server + cluster_id) - cluster_dir_override = (dir_server + cluster_id) + create_dir(dir_server_ark + cluster_id) + cluster_dir_override = (dir_server_ark + cluster_id) else: cluster_server = False @@ -243,7 +238,6 @@ def config_ark(list_config=list_config): query_port = 27015 print("Query Port=", query_port) - rcon_enabled = True if rcon_p == []: rcon_port = 27020 @@ -258,9 +252,9 @@ def config_ark(list_config=list_config): print("Передавать сервер в глобальный список серверов steam?") listen_server_amount = check_int("""\n - 1. Да - 2. Нет - :""") +1. Да +2. Нет +:""") if listen_server_amount == 1: listen_server = True elif listen_server_amount == 2: @@ -268,7 +262,8 @@ def config_ark(list_config=list_config): else: listen_server = True - yaml_create(game:="ARK", cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, + yaml_create(game := "ARK", cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, + rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server) @@ -285,12 +280,13 @@ def config_7daystodie(): print_line("Запрещённые символы") else: xml_parser() - systemd_unit_create(game:="7Days", config_7days) + systemd_unit_create(game := "7Days", config_7days) def xml_parser(): print("Я не умею парсить))") + def yaml_create(game, cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server): settings_hlna = [ @@ -307,7 +303,7 @@ def yaml_create(game, cluster_server, map_s, name_server, port_server, query_por 'MaxPlayers': max_players, 'ModsId': mods_id, 'Listen': listen_server, - 'ServerPath': dir_server, + 'ServerPath': dir_server_ark, 'clusterid': cluster_id, 'clusterdir': cluster_dir_override } @@ -324,13 +320,15 @@ def systemd_unit_create(game, config_7days="", name_server=list_config): for i in name_server: data = read_yaml(i) ntff = "" if not data['Cluster'] else "-NoTransferFromFiltering" - systemd_unit_exec = f"{dir_server_ark}ShooterGameServer {data['map']}?listen={data['Listen']}?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}?MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff}" - unit_file = f"{dir_unit}ARK_{data['SessionName']}.service" + unit_dir_server = dir_server_ark + systemd_unit_exec = f"{dir_server_exec}ShooterGameServer {data['map']}?listen={data['Listen']}?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}?MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff}" + unit_file = f"{dir_unit}ark_{data['SessionName']}.service".lower() elif game == "7Days": id_game = "294420" - #сюда дописать обращение к xml для получения уникального имени сервера + # сюда дописать обращение к xml для получения уникального имени сервера + unit_dir_server = dir_server_7days systemd_unit_exec = f"{dir_server_7days}startserver.sh -configfile={config_7days}.xml" - unit_file = f"{dir_unit}7Days.service" + unit_file = f"{dir_config}7days.service".lower() unit_text = f'''[Unit] Description={game}: Server @@ -338,7 +336,7 @@ Wants=network-online.target After=syslog.target network.target nss-lookup.target network-online.target [Service] -ExecStartPre=/usr/bin/steamcmd +force_install_dir {dir_server} +login anonymous +app_update {id_game} +quit +ExecStartPre=/usr/bin/steamcmd +force_install_dir {unit_dir_server} +login anonymous +app_update {id_game} +quit TimeoutStartSec=99999 ExecStart={systemd_unit_exec} LimitNOFILE=100000 @@ -350,23 +348,24 @@ WantedBy=default.target ''' with open(unit_file, 'w') as systemd_unit: systemd_unit.write(unit_text) - os.system(f"systemctl --user unmask {unit_file}") - os.system(f"systemctl --user enable {unit_file}") + unit_name = unit_file.split("/")[-1] + os.system(f"systemctl --user unmask {unit_name}") os.system('systemctl --user daemon-reload') + os.system(f"systemctl --user enable {unit_name}") -def test_mod_install(): - pathTest = f"{dir_server}ShooterGame/Saved/Config/LinuxServer/" - if os.path.exists(pathTest): - os.chdir(pathTest) - # "Добавить файл в Game.ini, если модов несколько добавляем еще строку ModIDS= [ModInstaller] ModIDS=" - # c этим не разобрался - os.system("echo ActiveMods=2943454417 >> GameUserSettings.ini") - else: - print_line("Сервер не установлен") - - -test_mod_install() +# def test_mod_install(): +# pathTest = f"{dir_server_ark}ShooterGame/Saved/Config/LinuxServer/" +# if os.path.exists(pathTest): +# os.chdir(pathTest) +# # "Добавить файл в Game.ini, если модов несколько добавляем еще строку ModIDS= [ModInstaller] ModIDS=" +# # c этим не разобрался +# os.system("echo ActiveMods=2943454417 >> GameUserSettings.ini") +# else: +# print_line("Сервер не установлен") +# +# +# test_mod_install() @hlna.command() @@ -396,7 +395,8 @@ def enablemap(m, e): if data['QueryPort'] in query_p: print("Заменить query port?") continue - x = os.system(f"mv {dir_deactivated}{i} {dir_maps_ark} >> {dir_logs}{date} 2>&1") # Добавить текущее время + x = os.system( + f"mv {dir_deactivated}{i} {dir_maps_ark} >> {dir_logs}{date} 2>&1") # Добавить текущее время with open(f"{dir_logs}{date}.log", "a") as f: f.write(f"[{time}] File {i} has been moved to {dir_maps_ark}\n") if x == 0: @@ -407,7 +407,7 @@ def enablemap(m, e): pass # except: # print("ошибка при активации карты") - # pass + # pass else: for i in m: try: @@ -430,7 +430,7 @@ def enablemap(m, e): def servers(map_server=list_config): # Добавить сортивку по кластерам и вывод несколько столбиков if map_server == [] and delist_config == []: - print("Сервера не установлены") + print("Сервера не сконфигурированы") else: for i in map_server: data = read_yaml(i) @@ -474,10 +474,47 @@ def servers(map_server=list_config): @hlna.command(help='Для запуска, сконфигурированного сервера или кластера') +@click.option('-g', help="Название игры для запуска. (ark, 7days") @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") @click.option('-b', default='', help="") -def start(m, b, name_server=list_config): - dict_mapname = {} +def start(g, m, b, name_server=list_config): + if g == "ark": + dict_mapname = {} + dict_allmapname = [] + for i in name_server: + data = read_yaml(i) + print_line(f"Название сервера: {i} | Карта: {data['map']} | Кластер: {data['clusterid']}") + dict_mapname[data['SessionName']] = data['map'] + dict_allmapname.append(data['SessionName']) + print_line(f"Словарь названия сервера и карты {dict_mapname}") + names_serverstart = [] + for ns, v in dict_mapname.items(): + print_line(f"переменные v и m {v} & {m}") + if v in m: + names_serverstart.append(ns) + print_line(f"Карта которая запускается {ns}") + if name_server != []: + if b == '': + if m == "all": + names_serverstart = dict_allmapname + print(f"Запускаем все активные карты {names_serverstart}") + else: + names_serverstart = choose_map(names_serverstart) + + for i in names_serverstart: + data = read_yaml(i) + x = os.system(f"systemctl --user start ark_{data['SessionName'].lower()}.service") + print_line(x) + else: + print("Ни одной карты не установлено") + +@hlna.command(help='Для остановки серверов') +@click.option('-g', help="Название игры для остановки. (ark, 7days") +@click.option('-m', default='all', help="Название карты для остановки или all для запуска все карт") +@click.option('-b', default='', help="") +def stop(g, m, b, name_server=list_config) + if g == "ark": + dict_mapname = {} dict_allmapname = [] for i in name_server: data = read_yaml(i) @@ -496,19 +533,21 @@ def start(m, b, name_server=list_config): if m == "all": names_serverstart = dict_allmapname print(f"Запускаем все активные карты {names_serverstart}") - else: - names_serverstart = choose_map(names_serverstart) + else: + names_serverstart = choose_map(names_serverstart) for i in names_serverstart: data = read_yaml(i) - os.system(f"systemctl --user start ARK_{data['SessionName']}.service") - else: - print("Ни одной карты не установлено") + rcon(m, "SaveWorld") + x = os.system(f"systemctl --user stop ark_{data['SessionName'].lower()}.service") + print_line(x) + else: + print("Ни одной карты не установлено") def read_yaml(list_config, flag=True): # Читаем конфиги активных или неактивных карт в зависимости от флага - dirs = f"{dir_maps_ark}{list_config}" if flag else f"{dir_deactivated}{list_config}" + dirs = f"{dir_maps_ark}{list_config}" if flag else f"{dir_deactivated}{list_config}" with open(dirs, "r") as yamlfile: data = yaml.load(yamlfile, Loader=yaml.FullLoader) return data[0] # возвращаем словарь со всеми значениями From 8e1993b9ef9f5001fc59289c079c0ed157bad01f Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 17:09:17 +0300 Subject: [PATCH 019/244] : --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index a6d7672..8e280fc 100755 --- a/hlna.py +++ b/hlna.py @@ -512,7 +512,7 @@ def start(g, m, b, name_server=list_config): @click.option('-g', help="Название игры для остановки. (ark, 7days") @click.option('-m', default='all', help="Название карты для остановки или all для запуска все карт") @click.option('-b', default='', help="") -def stop(g, m, b, name_server=list_config) +def stop(g, m, b, name_server=list_config): if g == "ark": dict_mapname = {} dict_allmapname = [] From 3b5b9f6556c20e9a9208fe58dabc04b573d41ac0 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 17:10:59 +0300 Subject: [PATCH 020/244] . --- hlna.py | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/hlna.py b/hlna.py index 8e280fc..5351761 100755 --- a/hlna.py +++ b/hlna.py @@ -515,32 +515,32 @@ def start(g, m, b, name_server=list_config): def stop(g, m, b, name_server=list_config): if g == "ark": dict_mapname = {} - dict_allmapname = [] - for i in name_server: - data = read_yaml(i) - print_line(f"Название сервера: {i} | Карта: {data['map']} | Кластер: {data['clusterid']}") - dict_mapname[data['SessionName']] = data['map'] - dict_allmapname.append(data['SessionName']) - print_line(f"Словарь названия сервера и карты {dict_mapname}") - names_serverstart = [] - for ns, v in dict_mapname.items(): - print_line(f"переменные v и m {v} & {m}") - if v in m: - names_serverstart.append(ns) - print_line(f"Карта которая запускается {ns}") - if name_server != []: - if b == '': - if m == "all": - names_serverstart = dict_allmapname - print(f"Запускаем все активные карты {names_serverstart}") + dict_allmapname = [] + for i in name_server: + data = read_yaml(i) + print_line(f"Название сервера: {i} | Карта: {data['map']} | Кластер: {data['clusterid']}") + dict_mapname[data['SessionName']] = data['map'] + dict_allmapname.append(data['SessionName']) + print_line(f"Словарь названия сервера и карты {dict_mapname}") + names_serverstart = [] + for ns, v in dict_mapname.items(): + print_line(f"переменные v и m {v} & {m}") + if v in m: + names_serverstart.append(ns) + print_line(f"Карта которая запускается {ns}") + if name_server != []: + if b == '': + if m == "all": + names_serverstart = dict_allmapname + print(f"Запускаем все активные карты {names_serverstart}") else: names_serverstart = choose_map(names_serverstart) - for i in names_serverstart: - data = read_yaml(i) - rcon(m, "SaveWorld") - x = os.system(f"systemctl --user stop ark_{data['SessionName'].lower()}.service") - print_line(x) + for i in names_serverstart: + data = read_yaml(i) + rcon(m, "SaveWorld") + x = os.system(f"systemctl --user stop ark_{data['SessionName'].lower()}.service") + print_line(x) else: print("Ни одной карты не установлено") From ad0c701eaca27960a3d89f7c692bafe462d1e4f7 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 17:32:42 +0300 Subject: [PATCH 021/244] rcon --- hlna.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 5351761..9d7536d 100755 --- a/hlna.py +++ b/hlna.py @@ -505,6 +505,8 @@ def start(g, m, b, name_server=list_config): data = read_yaml(i) x = os.system(f"systemctl --user start ark_{data['SessionName'].lower()}.service") print_line(x) + if x == 0: + print_line("Ok") else: print("Ни одной карты не установлено") @@ -538,7 +540,7 @@ def stop(g, m, b, name_server=list_config): for i in names_serverstart: data = read_yaml(i) - rcon(m, "SaveWorld") + os.system(f"~/git/hln-a/hlna.py rcon -m {i} -c SaveWorld") x = os.system(f"systemctl --user stop ark_{data['SessionName'].lower()}.service") print_line(x) else: From c7213dd60d6e9ecb58cf35f2578e57aff6031553 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 17:33:56 +0300 Subject: [PATCH 022/244] rconf --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 9d7536d..3f2f20e 100755 --- a/hlna.py +++ b/hlna.py @@ -540,7 +540,7 @@ def stop(g, m, b, name_server=list_config): for i in names_serverstart: data = read_yaml(i) - os.system(f"~/git/hln-a/hlna.py rcon -m {i} -c SaveWorld") + os.system(f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") x = os.system(f"systemctl --user stop ark_{data['SessionName'].lower()}.service") print_line(x) else: From 6fb871125e01464f2da6e4aa78f21448937322ac Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 17:35:45 +0300 Subject: [PATCH 023/244] pp --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 3f2f20e..7fc9604 100755 --- a/hlna.py +++ b/hlna.py @@ -580,8 +580,8 @@ def choose_map(arr): @click.argument('c', nargs=1) @click.option('-m', required=True, help="Название карты для применения rcon команды") def rcon(m, c): - print_line("Команда: ", c) - print_line("Карты: ", m) + print_line(f"Команда: , {c}") + print_line(f"Карты: , {m}") dict_mapname = {} dict_adminpwd = {} for i in list_config: From 86118e532baa6b25f72051ab25e1f3d233dda718 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 17:51:13 +0300 Subject: [PATCH 024/244] start, stop, restart --- hlna.py | 68 ++++++++++++++++++++++----------------------------------- 1 file changed, 26 insertions(+), 42 deletions(-) diff --git a/hlna.py b/hlna.py index 7fc9604..370fa27 100755 --- a/hlna.py +++ b/hlna.py @@ -477,11 +477,31 @@ def servers(map_server=list_config): @click.option('-g', help="Название игры для запуска. (ark, 7days") @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") @click.option('-b', default='', help="") -def start(g, m, b, name_server=list_config): +def start(g, m, b): + start_stop("start", g, m, b) + + +@hlna.command(help='Для запуска, сконфигурированного сервера или кластера') +@click.option('-g', help="Название игры для запуска. (ark, 7days") +@click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") +@click.option('-b', default='', help="") +def stop(g, m, b): + start_stop("stop", g, m, b) + + +@hlna.command(help='Для запуска, сконфигурированного сервера или кластера') +@click.option('-g', help="Название игры для запуска. (ark, 7days") +@click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") +@click.option('-b', default='', help="") +def stop(g, m, b): + start_stop("restart", g, m, b) + + +def start_stop(action, g, m, b): if g == "ark": dict_mapname = {} dict_allmapname = [] - for i in name_server: + for i in list_config: data = read_yaml(i) print_line(f"Название сервера: {i} | Карта: {data['map']} | Кластер: {data['clusterid']}") dict_mapname[data['SessionName']] = data['map'] @@ -493,7 +513,7 @@ def start(g, m, b, name_server=list_config): if v in m: names_serverstart.append(ns) print_line(f"Карта которая запускается {ns}") - if name_server != []: + if list_config != []: if b == '': if m == "all": names_serverstart = dict_allmapname @@ -503,46 +523,11 @@ def start(g, m, b, name_server=list_config): for i in names_serverstart: data = read_yaml(i) - x = os.system(f"systemctl --user start ark_{data['SessionName'].lower()}.service") + os.system(f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") if action == ("restart", "stop") else "" + x = os.system(f"systemctl --user {action} ark_{data['SessionName'].lower()}.service") print_line(x) if x == 0: - print_line("Ok") - else: - print("Ни одной карты не установлено") - -@hlna.command(help='Для остановки серверов') -@click.option('-g', help="Название игры для остановки. (ark, 7days") -@click.option('-m', default='all', help="Название карты для остановки или all для запуска все карт") -@click.option('-b', default='', help="") -def stop(g, m, b, name_server=list_config): - if g == "ark": - dict_mapname = {} - dict_allmapname = [] - for i in name_server: - data = read_yaml(i) - print_line(f"Название сервера: {i} | Карта: {data['map']} | Кластер: {data['clusterid']}") - dict_mapname[data['SessionName']] = data['map'] - dict_allmapname.append(data['SessionName']) - print_line(f"Словарь названия сервера и карты {dict_mapname}") - names_serverstart = [] - for ns, v in dict_mapname.items(): - print_line(f"переменные v и m {v} & {m}") - if v in m: - names_serverstart.append(ns) - print_line(f"Карта которая запускается {ns}") - if name_server != []: - if b == '': - if m == "all": - names_serverstart = dict_allmapname - print(f"Запускаем все активные карты {names_serverstart}") - else: - names_serverstart = choose_map(names_serverstart) - - for i in names_serverstart: - data = read_yaml(i) - os.system(f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") - x = os.system(f"systemctl --user stop ark_{data['SessionName'].lower()}.service") - print_line(x) + print_line("Сервер запустился") else: print("Ни одной карты не установлено") @@ -595,7 +580,6 @@ def rcon(m, c): rcon_ports.append(ns) print_line(f"Карта которая запускается {ns}") for port in rcon_ports: - print(port) passwd = dict_adminpwd[port] with Client('127.0.0.1', port, passwd=str(passwd)) as client: response = client.run(c) From 73acfb054937c96ad3596b478ee006fd43e6e369 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 17:56:00 +0300 Subject: [PATCH 025/244] 1 --- hlna.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 370fa27..5a26a48 100755 --- a/hlna.py +++ b/hlna.py @@ -493,7 +493,7 @@ def stop(g, m, b): @click.option('-g', help="Название игры для запуска. (ark, 7days") @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") @click.option('-b', default='', help="") -def stop(g, m, b): +def restart(g, m, b): start_stop("restart", g, m, b) @@ -575,6 +575,8 @@ def rcon(m, c): dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword'] rcon_ports = [] for ns, v in dict_mapname.items(): + print("v=",v) + print("ns=",ns) print_line(f"переменные v и m {v} & {m}") # обьединить с таким же блоком в start() if v in m: rcon_ports.append(ns) From cc7b22677b7b73279fe4bc337984d64dd39f0925 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 17:57:15 +0300 Subject: [PATCH 026/244] 1 --- hlna.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 5a26a48..0d161a6 100755 --- a/hlna.py +++ b/hlna.py @@ -574,9 +574,10 @@ def rcon(m, c): dict_mapname[data['RCONPort']] = data['map'] dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword'] rcon_ports = [] + print("dictmapname", dict_mapname) for ns, v in dict_mapname.items(): - print("v=",v) - print("ns=",ns) + print("v=", v) + print("ns=", ns) print_line(f"переменные v и m {v} & {m}") # обьединить с таким же блоком в start() if v in m: rcon_ports.append(ns) From 89a8c30174e40c9c39b5be14eb3d750386029cd5 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 18:00:17 +0300 Subject: [PATCH 027/244] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hlna.py b/hlna.py index 0d161a6..c59ceaf 100755 --- a/hlna.py +++ b/hlna.py @@ -575,13 +575,13 @@ def rcon(m, c): dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword'] rcon_ports = [] print("dictmapname", dict_mapname) - for ns, v in dict_mapname.items(): - print("v=", v) - print("ns=", ns) - print_line(f"переменные v и m {v} & {m}") # обьединить с таким же блоком в start() - if v in m: - rcon_ports.append(ns) - print_line(f"Карта которая запускается {ns}") + for rcon_p, name_map in dict_mapname.items(): + print("name_map=", name_map) + print("name_map=", name_map) + print_line(f"переменные name_map и m {name_map} & {m}") # обьединить с таким же блоком в start() + if name_map in m: + rcon_ports.append(rcon_p) + print_line(f"Карта которая запускается {name_map}") for port in rcon_ports: passwd = dict_adminpwd[port] with Client('127.0.0.1', port, passwd=str(passwd)) as client: From 5b31053a728679f02e5358c9b1b18af30d4c0fa7 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 18:14:22 +0300 Subject: [PATCH 028/244] rcon_p --- hlna.py | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/hlna.py b/hlna.py index c59ceaf..5ef5d16 100755 --- a/hlna.py +++ b/hlna.py @@ -513,7 +513,7 @@ def start_stop(action, g, m, b): if v in m: names_serverstart.append(ns) print_line(f"Карта которая запускается {ns}") - if list_config != []: + if list_config != []: #Перенести выше для проверки наличия конфигов if b == '': if m == "all": names_serverstart = dict_allmapname @@ -569,24 +569,28 @@ def rcon(m, c): print_line(f"Карты: , {m}") dict_mapname = {} dict_adminpwd = {} - for i in list_config: - data = read_yaml(i) - dict_mapname[data['RCONPort']] = data['map'] - dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword'] - rcon_ports = [] - print("dictmapname", dict_mapname) - for rcon_p, name_map in dict_mapname.items(): - print("name_map=", name_map) - print("name_map=", name_map) - print_line(f"переменные name_map и m {name_map} & {m}") # обьединить с таким же блоком в start() - if name_map in m: - rcon_ports.append(rcon_p) - print_line(f"Карта которая запускается {name_map}") - for port in rcon_ports: - passwd = dict_adminpwd[port] - with Client('127.0.0.1', port, passwd=str(passwd)) as client: - response = client.run(c) - print(response) + if list_config: + rcon_ports = [] + for i in list_config: + data = read_yaml(i) + dict_mapname[data['RCONPort']] = data['map'] + dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword'] + if m == all: + for rcon_p in dict_mapname: + print(rcon_p) + else: + for rcon_p, name_map in dict_mapname.items(): + print_line(f"переменные name_map и m {name_map} & {m}") # обьединить с таким же блоком в start() + if name_map in m: + rcon_ports.append(rcon_p) + print_line(f"Карта которая запускается {name_map}") + for port in rcon_ports: + passwd = dict_adminpwd[port] + with Client('127.0.0.1', port, passwd=str(passwd)) as client: + response = client.run(c) + print(response) + else: + pass def zero(x=""): From 253d3d5848cec5691d2967db27260111e14c21cd Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 18:15:10 +0300 Subject: [PATCH 029/244] "all" --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 5ef5d16..64b6999 100755 --- a/hlna.py +++ b/hlna.py @@ -575,7 +575,7 @@ def rcon(m, c): data = read_yaml(i) dict_mapname[data['RCONPort']] = data['map'] dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword'] - if m == all: + if m == "all": for rcon_p in dict_mapname: print(rcon_p) else: From c7a7658ad74e085577ceb552f25468341ddc4353 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 18:18:17 +0300 Subject: [PATCH 030/244] 1 --- hlna.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hlna.py b/hlna.py index 64b6999..29542ac 100755 --- a/hlna.py +++ b/hlna.py @@ -577,18 +577,18 @@ def rcon(m, c): dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword'] if m == "all": for rcon_p in dict_mapname: - print(rcon_p) + rcon_ports.append(rcon_p) else: for rcon_p, name_map in dict_mapname.items(): print_line(f"переменные name_map и m {name_map} & {m}") # обьединить с таким же блоком в start() if name_map in m: rcon_ports.append(rcon_p) print_line(f"Карта которая запускается {name_map}") - for port in rcon_ports: - passwd = dict_adminpwd[port] - with Client('127.0.0.1', port, passwd=str(passwd)) as client: - response = client.run(c) - print(response) + for port in rcon_ports: + passwd = dict_adminpwd[port] + with Client('127.0.0.1', port, passwd=str(passwd)) as client: + response = client.run(c) + print(response) else: pass From 03a4ab25c722d4e5292bd3db23bbd399614d1288 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 18:21:38 +0300 Subject: [PATCH 031/244] =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=BD=D1=82=D1=8B=20?= =?UTF-8?q?-?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/hlna.py b/hlna.py index 29542ac..78f25e6 100755 --- a/hlna.py +++ b/hlna.py @@ -503,31 +503,26 @@ def start_stop(action, g, m, b): dict_allmapname = [] for i in list_config: data = read_yaml(i) - print_line(f"Название сервера: {i} | Карта: {data['map']} | Кластер: {data['clusterid']}") dict_mapname[data['SessionName']] = data['map'] dict_allmapname.append(data['SessionName']) - print_line(f"Словарь названия сервера и карты {dict_mapname}") names_serverstart = [] for ns, v in dict_mapname.items(): - print_line(f"переменные v и m {v} & {m}") if v in m: names_serverstart.append(ns) - print_line(f"Карта которая запускается {ns}") if list_config != []: #Перенести выше для проверки наличия конфигов if b == '': if m == "all": names_serverstart = dict_allmapname - print(f"Запускаем все активные карты {names_serverstart}") + print(f"Выполняется для карт(-ы) {names_serverstart}") else: names_serverstart = choose_map(names_serverstart) - for i in names_serverstart: data = read_yaml(i) os.system(f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") if action == ("restart", "stop") else "" x = os.system(f"systemctl --user {action} ark_{data['SessionName'].lower()}.service") print_line(x) if x == 0: - print_line("Сервер запустился") + print_line("Готово") else: print("Ни одной карты не установлено") From df11274eea75d0ca575092f2703f111ade81a037 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 18:23:09 +0300 Subject: [PATCH 032/244] 1 --- hlna.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hlna.py b/hlna.py index 78f25e6..a1c81a2 100755 --- a/hlna.py +++ b/hlna.py @@ -580,6 +580,7 @@ def rcon(m, c): rcon_ports.append(rcon_p) print_line(f"Карта которая запускается {name_map}") for port in rcon_ports: + print(f"Rcon выполнен для {port}") passwd = dict_adminpwd[port] with Client('127.0.0.1', port, passwd=str(passwd)) as client: response = client.run(c) From ba703b084a6c5df67e401d3298d41be2a7978ff3 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 18:26:19 +0300 Subject: [PATCH 033/244] 1 --- hlna.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hlna.py b/hlna.py index a1c81a2..4f7a224 100755 --- a/hlna.py +++ b/hlna.py @@ -579,6 +579,7 @@ def rcon(m, c): if name_map in m: rcon_ports.append(rcon_p) print_line(f"Карта которая запускается {name_map}") + print(rcon_ports) for port in rcon_ports: print(f"Rcon выполнен для {port}") passwd = dict_adminpwd[port] From 1314da7497f73145d4aec53d399930d9f5a2a70e Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 18:27:29 +0300 Subject: [PATCH 034/244] 1 --- hlna.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hlna.py b/hlna.py index 4f7a224..8460a12 100755 --- a/hlna.py +++ b/hlna.py @@ -564,6 +564,7 @@ def rcon(m, c): print_line(f"Карты: , {m}") dict_mapname = {} dict_adminpwd = {} + print(list_config) if list_config: rcon_ports = [] for i in list_config: From e5e0f23010b67c0a6f9a0dc0211a90432464bb02 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 18:28:57 +0300 Subject: [PATCH 035/244] 1 --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 8460a12..7142e1f 100755 --- a/hlna.py +++ b/hlna.py @@ -518,9 +518,9 @@ def start_stop(action, g, m, b): names_serverstart = choose_map(names_serverstart) for i in names_serverstart: data = read_yaml(i) - os.system(f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") if action == ("restart", "stop") else "" + y = os.system(f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") if action == ("restart", "stop") else "" x = os.system(f"systemctl --user {action} ark_{data['SessionName'].lower()}.service") - print_line(x) + print_line(y) if x == 0: print_line("Готово") else: From e7d7c8cc2ffc9309a0b8261c23350237df8020e6 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 18:31:23 +0300 Subject: [PATCH 036/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 7142e1f..c8bc4c2 100755 --- a/hlna.py +++ b/hlna.py @@ -518,7 +518,7 @@ def start_stop(action, g, m, b): names_serverstart = choose_map(names_serverstart) for i in names_serverstart: data = read_yaml(i) - y = os.system(f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") if action == ("restart", "stop") else "" + y = os.system(f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") if action == "restart" or action == "stop" else "" x = os.system(f"systemctl --user {action} ark_{data['SessionName'].lower()}.service") print_line(y) if x == 0: From cad5cc5bb1e5994f99390ff0eedf5279fee76892 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 18:35:39 +0300 Subject: [PATCH 037/244] 1 --- hlna.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hlna.py b/hlna.py index c8bc4c2..f236a46 100755 --- a/hlna.py +++ b/hlna.py @@ -427,12 +427,12 @@ def enablemap(m, e): @hlna.command() -def servers(map_server=list_config): +def servers(list_config=list_config): # Добавить сортивку по кластерам и вывод несколько столбиков - if map_server == [] and delist_config == []: + if list_config == [] and delist_config == []: print("Сервера не сконфигурированы") else: - for i in map_server: + for i in list_config: data = read_yaml(i) x = os.system(f"lsof -w -i :{data['Port']}") if x == 0: @@ -497,7 +497,7 @@ def restart(g, m, b): start_stop("restart", g, m, b) -def start_stop(action, g, m, b): +def start_stop(action, g, m, b, list_config=list_config): if g == "ark": dict_mapname = {} dict_allmapname = [] @@ -509,7 +509,7 @@ def start_stop(action, g, m, b): for ns, v in dict_mapname.items(): if v in m: names_serverstart.append(ns) - if list_config != []: #Перенести выше для проверки наличия конфигов + if list_config: #Перенести выше для проверки наличия конфигов if b == '': if m == "all": names_serverstart = dict_allmapname From c8dd169d7262f848bfce398a55790c12ffd66697 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 18:41:58 +0300 Subject: [PATCH 038/244] 1 --- hlna.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hlna.py b/hlna.py index f236a46..05fd769 100755 --- a/hlna.py +++ b/hlna.py @@ -509,7 +509,7 @@ def start_stop(action, g, m, b, list_config=list_config): for ns, v in dict_mapname.items(): if v in m: names_serverstart.append(ns) - if list_config: #Перенести выше для проверки наличия конфигов + if list_config != []: #Перенести выше для проверки наличия конфигов if b == '': if m == "all": names_serverstart = dict_allmapname @@ -564,7 +564,6 @@ def rcon(m, c): print_line(f"Карты: , {m}") dict_mapname = {} dict_adminpwd = {} - print(list_config) if list_config: rcon_ports = [] for i in list_config: @@ -577,10 +576,9 @@ def rcon(m, c): else: for rcon_p, name_map in dict_mapname.items(): print_line(f"переменные name_map и m {name_map} & {m}") # обьединить с таким же блоком в start() - if name_map in m: - rcon_ports.append(rcon_p) + if name_map in m: + rcon_ports.append(rcon_p) print_line(f"Карта которая запускается {name_map}") - print(rcon_ports) for port in rcon_ports: print(f"Rcon выполнен для {port}") passwd = dict_adminpwd[port] From 5d81e61036e6ce5e0e08c22389ec71d87525c25e Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 18:46:21 +0300 Subject: [PATCH 039/244] 1 --- hlna.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hlna.py b/hlna.py index 05fd769..ad1aee6 100755 --- a/hlna.py +++ b/hlna.py @@ -525,6 +525,10 @@ def start_stop(action, g, m, b, list_config=list_config): print_line("Готово") else: print("Ни одной карты не установлено") + elif g == "7days": + x = os.system(f"systemctl --user {action} 7days.service") + if x == 0: + print_line("Готово") def read_yaml(list_config, flag=True): From 8452a0c3c3a13dbc347c2ecca2993856f751a920 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 18:49:54 +0300 Subject: [PATCH 040/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index ad1aee6..2fac1da 100755 --- a/hlna.py +++ b/hlna.py @@ -328,7 +328,7 @@ def systemd_unit_create(game, config_7days="", name_server=list_config): # сюда дописать обращение к xml для получения уникального имени сервера unit_dir_server = dir_server_7days systemd_unit_exec = f"{dir_server_7days}startserver.sh -configfile={config_7days}.xml" - unit_file = f"{dir_config}7days.service".lower() + unit_file = f"{dir_unit}7days.service".lower() unit_text = f'''[Unit] Description={game}: Server From 08117b85083464489b8bb9e1fe136db3b7ea9125 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 23:13:01 +0300 Subject: [PATCH 041/244] 1 --- hlna.py | 234 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 130 insertions(+), 104 deletions(-) diff --git a/hlna.py b/hlna.py index 2fac1da..e93f11a 100755 --- a/hlna.py +++ b/hlna.py @@ -10,40 +10,6 @@ from pathlib import Path from rcon.source import Client home_dir = Path.home() -dir_config = f"{home_dir}/.config/hlna/" -dir_unit = f"{home_dir}/.config/systemd/user/" -dir_server = f"{home_dir}/Servers/" -dir_logs = f"{dir_config}logs/" - -dir_server_ark = f"{dir_server}ARK/" -dir_server_exec = f"{dir_server_ark}ShooterGame/Binaries/Linux/" - -dir_maps_ark = f"{dir_config}/ARK/" -dir_deactivated = f"{dir_maps_ark}deactivated/" - -dir_server_7days = f"{dir_server}/7Days/" - -mods_id = "" -now = datetime.datetime.now() -date = now.strftime("%Y-%m-%d") -time = now.strftime("%H:%M:%S") - - -@click.group() -def hlna(): - pass - - -def create_dir(directory): - """Проверка и создание директории""" - if not os.path.exists(directory): - os.makedirs(directory) - - -create_dir(dir_server) -create_dir(dir_unit) -create_dir(dir_config) -create_dir(dir_logs) def find_file(path): @@ -58,10 +24,32 @@ def find_file(path): return arr +dir_config = f"{home_dir}/.config/hlna/" +dir_maps_ark = f"{dir_config}/ARK/" +dir_deactivated = f"{dir_maps_ark}deactivated/" list_config = find_file(dir_maps_ark) delist_config = find_file(dir_deactivated) +def path_server(): + dir_server = input(f"""Укажите путь до каталога, где будут храниться файлы сервера. По-умолчанию {home_dir}/Servers/ + :""") + if dir_server == "": + dir_server = f"{home_dir}/Servers/" + yaml_create(game := "path_server", dir_server) + return dir_server + +@click.group() +def hlna(): + pass + + +def create_dir(directory): + """Проверка и создание директории""" + if not os.path.exists(directory): + os.makedirs(directory) + + def print_line(text): """Добавление тире вокруг текста, покраска""" print(colorama.Fore.YELLOW + "-" * 30) @@ -126,7 +114,7 @@ def config_ark(list_config=list_config): if list_config: print("Уже установленные карты: ") for i in list_config: - data = read_yaml(i) + data = read_yaml(i, game="ARK") print(f"{i} : {data['map']}") count_maps = check_int("Укажите количество карт: \n") @@ -157,7 +145,7 @@ def config_ark(list_config=list_config): if list_config: for i in list_config: - data = read_yaml(i) + data = read_yaml(i, game="ARK") port_s.append(data['Port']) rcon_p.append(data['RCONPort']) query_p.append(data['QueryPort']) @@ -204,7 +192,7 @@ def config_ark(list_config=list_config): return port if list_config: - data = read_yaml(list_config[-1]) + data = read_yaml(list_config[-1], game="ARK") while True: name_server = input("Укажите название Сервера: \n") if name_server == "": @@ -262,9 +250,7 @@ def config_ark(list_config=list_config): else: listen_server = True - yaml_create(game := "ARK", cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, - rcon_port, - adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server) + yaml_create(game := "ARK", dir_server := "", cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server) def config_7daystodie(): @@ -287,38 +273,49 @@ def xml_parser(): print("Я не умею парсить))") -def yaml_create(game, cluster_server, map_s, name_server, port_server, query_port, rcon_enabled, rcon_port, - adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server): - settings_hlna = [ - { - 'map': map_s, - 'Cluster': cluster_server, - 'SessionName': name_server, - 'Port': port_server, - 'QueryPort': query_port, - 'RCONEnabled': rcon_enabled, - 'RCONPort': rcon_port, - 'ServerAdminPassword': adminpassword_server, - 'ServerPassword': password_server, - 'MaxPlayers': max_players, - 'ModsId': mods_id, - 'Listen': listen_server, - 'ServerPath': dir_server_ark, - 'clusterid': cluster_id, - 'clusterdir': cluster_dir_override - } - ] - with open(dir_maps_ark + f"{name_server}", 'w') as yamlfile: - yaml.dump(settings_hlna, yamlfile) +def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="", port_server="", query_port="", rcon_enabled="", rcon_port="", + adminpassword_server="", password_server="", max_players="", id_mods_ark="", cluster_id="", cluster_dir_override="", listen_server=""): + if game == "ARK": + print_line(dir_maps_ark) + print_line(name_server) + path_yaml = dir_maps_ark + name_server + settings = [ + { + 'map': map_s, + 'Cluster': cluster_server, + 'SessionName': name_server, + 'Port': port_server, + 'QueryPort': query_port, + 'RCONEnabled': rcon_enabled, + 'RCONPort': rcon_port, + 'ServerAdminPassword': adminpassword_server, + 'ServerPassword': password_server, + 'MaxPlayers': max_players, + 'ModsId': id_mods_ark, + 'Listen': listen_server, + 'ServerPath': dir_server_ark, + 'clusterid': cluster_id, + 'clusterdir': cluster_dir_override + } + ] + elif game == "path_server": + path_yaml = dir_config + "config" + settings = [ + { + 'path_server': dir_server + } + ] + elif game != "": + systemd_unit_create(game) + with open(path_yaml, 'w') as yamlfile: + yaml.dump(settings, yamlfile) print(colorama.Fore.GREEN + "Конфиг создан" + colorama.Style.RESET_ALL) - systemd_unit_create(game) - def systemd_unit_create(game, config_7days="", name_server=list_config): if game == "ARK": id_game = "376030" for i in name_server: - data = read_yaml(i) + data = read_yaml(i, game="ARK") ntff = "" if not data['Cluster'] else "-NoTransferFromFiltering" unit_dir_server = dir_server_ark systemd_unit_exec = f"{dir_server_exec}ShooterGameServer {data['map']}?listen={data['Listen']}?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}?MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff}" @@ -354,19 +351,18 @@ WantedBy=default.target os.system(f"systemctl --user enable {unit_name}") -# def test_mod_install(): -# pathTest = f"{dir_server_ark}ShooterGame/Saved/Config/LinuxServer/" -# if os.path.exists(pathTest): -# os.chdir(pathTest) -# # "Добавить файл в Game.ini, если модов несколько добавляем еще строку ModIDS= [ModInstaller] ModIDS=" -# # c этим не разобрался -# os.system("echo ActiveMods=2943454417 >> GameUserSettings.ini") -# else: -# print_line("Сервер не установлен") -# -# -# test_mod_install() - +@hlna.command(help='Для скачивания и установки модов') +@click.option('-g', help="Название игры для запуска. (ark, 7days") +@click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") +def modinstall(g, m): + if g == "ark": + id_game = "346110" + if not os.path.isdir(dir_workshop_ark): + create_dir(dir_workshop_ark) + id_mods_ark = input("""Укажите id модов через запятую +:""") + os.environ.get('mod_branch', 'Windows') + os.system(f"steamcmd +login anonymous +workshop_download_item {id_game} {id_mods_ark} +quit") @hlna.command() @click.option("-m", required=True, help="Название Сервера") @@ -433,7 +429,7 @@ def servers(list_config=list_config): print("Сервера не сконфигурированы") else: for i in list_config: - data = read_yaml(i) + data = read_yaml(i, game="ARK") x = os.system(f"lsof -w -i :{data['Port']}") if x == 0: print(colorama.Fore.GREEN + "Сервер запущен" + colorama.Style.RESET_ALL) @@ -476,33 +472,30 @@ def servers(list_config=list_config): @hlna.command(help='Для запуска, сконфигурированного сервера или кластера') @click.option('-g', help="Название игры для запуска. (ark, 7days") @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") -@click.option('-b', default='', help="") -def start(g, m, b): - start_stop("start", g, m, b) +def start(g, m): + start_stop("start", g, m) -@hlna.command(help='Для запуска, сконфигурированного сервера или кластера') +@hlna.command(help='Для остановки, сконфигурированного сервера или кластера') @click.option('-g', help="Название игры для запуска. (ark, 7days") @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") -@click.option('-b', default='', help="") -def stop(g, m, b): - start_stop("stop", g, m, b) +def stop(g, m): + start_stop("stop", g, m) -@hlna.command(help='Для запуска, сконфигурированного сервера или кластера') +@hlna.command(help='Для перезапуска, сконфигурированного сервера или кластера') @click.option('-g', help="Название игры для запуска. (ark, 7days") @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") -@click.option('-b', default='', help="") -def restart(g, m, b): - start_stop("restart", g, m, b) +def restart(g, m): + start_stop("restart", g, m) -def start_stop(action, g, m, b, list_config=list_config): +def start_stop(action, g, m, list_config=list_config): if g == "ark": dict_mapname = {} dict_allmapname = [] for i in list_config: - data = read_yaml(i) + data = read_yaml(i, game="ARK") dict_mapname[data['SessionName']] = data['map'] dict_allmapname.append(data['SessionName']) names_serverstart = [] @@ -510,14 +503,13 @@ def start_stop(action, g, m, b, list_config=list_config): if v in m: names_serverstart.append(ns) if list_config != []: #Перенести выше для проверки наличия конфигов - if b == '': - if m == "all": - names_serverstart = dict_allmapname - print(f"Выполняется для карт(-ы) {names_serverstart}") - else: - names_serverstart = choose_map(names_serverstart) + if m == "all": + names_serverstart = dict_allmapname + print(f"Выполняется для карт(-ы) {names_serverstart}") + else: + names_serverstart = choose_map(names_serverstart) for i in names_serverstart: - data = read_yaml(i) + data = read_yaml(i, game="ARK") y = os.system(f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") if action == "restart" or action == "stop" else "" x = os.system(f"systemctl --user {action} ark_{data['SessionName'].lower()}.service") print_line(y) @@ -531,10 +523,13 @@ def start_stop(action, g, m, b, list_config=list_config): print_line("Готово") -def read_yaml(list_config, flag=True): +def read_yaml(list_config=list_config, flag=True, game=""): # Читаем конфиги активных или неактивных карт в зависимости от флага - dirs = f"{dir_maps_ark}{list_config}" if flag else f"{dir_deactivated}{list_config}" - with open(dirs, "r") as yamlfile: + if game == "ARK": + path_yaml = f"{dir_maps_ark}{list_config}" if flag else f"{dir_deactivated}{list_config}" + elif game == "path_server": + path_yaml = dir_config + "config" + with open(path_yaml, "r") as yamlfile: data = yaml.load(yamlfile, Loader=yaml.FullLoader) return data[0] # возвращаем словарь со всеми значениями @@ -571,7 +566,7 @@ def rcon(m, c): if list_config: rcon_ports = [] for i in list_config: - data = read_yaml(i) + data = read_yaml(i, game="ARK") dict_mapname[data['RCONPort']] = data['map'] dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword'] if m == "all": @@ -597,5 +592,36 @@ def zero(x=""): return "" +if not os.path.exists(dir_config + "config"): + dir_server = path_server() +else: + print_line("else") + data = read_yaml(game="path_server") + if data['path_server'] == "": + path_server() + else: + print_line(data['path_server']) + dir_server = data['path_server'] + + +dir_unit = f"{home_dir}/.config/systemd/user/" +dir_logs = f"{dir_config}logs/" + +dir_server_ark = f"{dir_server}ARK/" +dir_workshop_ark = f"{dir_server_ark}steamapps/workshop/" +dir_server_exec = f"{dir_server_ark}ShooterGame/Binaries/Linux/" + +dir_server_7days = f"{dir_server}/7Days/" + +now = datetime.datetime.now() +date = now.strftime("%Y-%m-%d") +time = now.strftime("%H:%M:%S") +create_dir(dir_server) +create_dir(dir_unit) +create_dir(dir_config) +create_dir(dir_logs) + + + if __name__ == '__main__': hlna() From 10376b2e7f8d59962df4cf518c4fa1dc32307410 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 23:29:57 +0300 Subject: [PATCH 042/244] 1 --- hlna.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hlna.py b/hlna.py index e93f11a..dc7a4ea 100755 --- a/hlna.py +++ b/hlna.py @@ -363,6 +363,7 @@ def modinstall(g, m): :""") os.environ.get('mod_branch', 'Windows') os.system(f"steamcmd +login anonymous +workshop_download_item {id_game} {id_mods_ark} +quit") + os.system(f"mv {home_dir}.local/share/Steam/steamapps/workshop/content/{id_game}/{id_mods_ark} {dir_server_ark}ShooterGame/Content/Mods/{id_mods_ark}") @hlna.command() @click.option("-m", required=True, help="Название Сервера") From 70d216f5f266d570a5dcc4a5e21064abb4977777 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 23:31:16 +0300 Subject: [PATCH 043/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index dc7a4ea..e06d387 100755 --- a/hlna.py +++ b/hlna.py @@ -363,7 +363,7 @@ def modinstall(g, m): :""") os.environ.get('mod_branch', 'Windows') os.system(f"steamcmd +login anonymous +workshop_download_item {id_game} {id_mods_ark} +quit") - os.system(f"mv {home_dir}.local/share/Steam/steamapps/workshop/content/{id_game}/{id_mods_ark} {dir_server_ark}ShooterGame/Content/Mods/{id_mods_ark}") + os.system(f"mv {home_dir}.local/share/Steam/steamapps/workshop/content/{id_game}/{id_mods_ark} {dir_server_ark}ShooterGame/Content/Mods/{id_mods_ark}/") @hlna.command() @click.option("-m", required=True, help="Название Сервера") From 2f32066860017cf88029343d05c9db41b3a3883c Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 23:33:00 +0300 Subject: [PATCH 044/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index e06d387..abf386e 100755 --- a/hlna.py +++ b/hlna.py @@ -363,7 +363,7 @@ def modinstall(g, m): :""") os.environ.get('mod_branch', 'Windows') os.system(f"steamcmd +login anonymous +workshop_download_item {id_game} {id_mods_ark} +quit") - os.system(f"mv {home_dir}.local/share/Steam/steamapps/workshop/content/{id_game}/{id_mods_ark} {dir_server_ark}ShooterGame/Content/Mods/{id_mods_ark}/") + os.system(f"mv {home_dir}.local/share/Steam/steamapps/workshop/content/{id_game}/{id_mods_ark}/ {dir_server_ark}ShooterGame/Content/Mods/{id_mods_ark}/") @hlna.command() @click.option("-m", required=True, help="Название Сервера") From c3bf1392a828bb4716aa72ca648291f1ad5bdd0f Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 13 May 2023 23:37:01 +0300 Subject: [PATCH 045/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index abf386e..38508c6 100755 --- a/hlna.py +++ b/hlna.py @@ -363,7 +363,7 @@ def modinstall(g, m): :""") os.environ.get('mod_branch', 'Windows') os.system(f"steamcmd +login anonymous +workshop_download_item {id_game} {id_mods_ark} +quit") - os.system(f"mv {home_dir}.local/share/Steam/steamapps/workshop/content/{id_game}/{id_mods_ark}/ {dir_server_ark}ShooterGame/Content/Mods/{id_mods_ark}/") + os.system(f"mv {home_dir}/.local/share/Steam/steamapps/workshop/content/{id_game}/{id_mods_ark}/ {dir_server_ark}ShooterGame/Content/Mods/{id_mods_ark}/") @hlna.command() @click.option("-m", required=True, help="Название Сервера") From 1888d7626524fc0e15e4d886281dad546c6ef50d Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 00:12:54 +0300 Subject: [PATCH 046/244] 1 --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 38508c6..9bd15c6 100755 --- a/hlna.py +++ b/hlna.py @@ -318,7 +318,7 @@ def systemd_unit_create(game, config_7days="", name_server=list_config): data = read_yaml(i, game="ARK") ntff = "" if not data['Cluster'] else "-NoTransferFromFiltering" unit_dir_server = dir_server_ark - systemd_unit_exec = f"{dir_server_exec}ShooterGameServer {data['map']}?listen={data['Listen']}?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}?MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff}" + systemd_unit_exec = f"{dir_server_exec}ShooterGameServer {data['map']}?listen={data['Listen']}?GameModIds={}?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}??MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff}" unit_file = f"{dir_unit}ark_{data['SessionName']}.service".lower() elif game == "7Days": id_game = "294420" @@ -363,7 +363,7 @@ def modinstall(g, m): :""") os.environ.get('mod_branch', 'Windows') os.system(f"steamcmd +login anonymous +workshop_download_item {id_game} {id_mods_ark} +quit") - os.system(f"mv {home_dir}/.local/share/Steam/steamapps/workshop/content/{id_game}/{id_mods_ark}/ {dir_server_ark}ShooterGame/Content/Mods/{id_mods_ark}/") + os.system(f"mv {home_dir}/.local/share/Steam/steamapps/workshop/content/{id_game}/{id_mods_ark}/ {dir_server_ark}ShooterGame/Content/Mods/{id_mods_ark}") @hlna.command() @click.option("-m", required=True, help="Название Сервера") From 666ca3dd71b519a25c0531adc8d65386e12417bd Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 00:13:18 +0300 Subject: [PATCH 047/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 9bd15c6..f73b854 100755 --- a/hlna.py +++ b/hlna.py @@ -363,7 +363,7 @@ def modinstall(g, m): :""") os.environ.get('mod_branch', 'Windows') os.system(f"steamcmd +login anonymous +workshop_download_item {id_game} {id_mods_ark} +quit") - os.system(f"mv {home_dir}/.local/share/Steam/steamapps/workshop/content/{id_game}/{id_mods_ark}/ {dir_server_ark}ShooterGame/Content/Mods/{id_mods_ark}") + os.system(f"mv {home_dir}/.local/share/Steam/steamapps/workshop/content/{id_game}/{id_mods_ark}/ {dir_server_ark}ShooterGame/Content/Mods/") @hlna.command() @click.option("-m", required=True, help="Название Сервера") From da95d2353cea1068e532a0ea24a92feb94d0de8d Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 00:14:26 +0300 Subject: [PATCH 048/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index f73b854..08cd4e6 100755 --- a/hlna.py +++ b/hlna.py @@ -318,7 +318,7 @@ def systemd_unit_create(game, config_7days="", name_server=list_config): data = read_yaml(i, game="ARK") ntff = "" if not data['Cluster'] else "-NoTransferFromFiltering" unit_dir_server = dir_server_ark - systemd_unit_exec = f"{dir_server_exec}ShooterGameServer {data['map']}?listen={data['Listen']}?GameModIds={}?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}??MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff}" + systemd_unit_exec = f"{dir_server_exec}ShooterGameServer {data['map']}?listen={data['Listen']}?GameModIds=2967069515?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}??MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff}" unit_file = f"{dir_unit}ark_{data['SessionName']}.service".lower() elif game == "7Days": id_game = "294420" From e275ce2c6534021d82756dd68135a258ec370f44 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 00:30:38 +0300 Subject: [PATCH 049/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 08cd4e6..87fffca 100755 --- a/hlna.py +++ b/hlna.py @@ -424,7 +424,7 @@ def enablemap(m, e): @hlna.command() -def servers(list_config=list_config): +def status(list_config=list_config): # Добавить сортивку по кластерам и вывод несколько столбиков if list_config == [] and delist_config == []: print("Сервера не сконфигурированы") From 3f5495ff388ad3447b833c5ccd3bc03ca789fd84 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 01:12:59 +0300 Subject: [PATCH 050/244] =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f0931b..a49dcac 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![](https://gitflic.ru/project/xpamych/hln-a/blob/raw?file=logo.png&commit=cd31f5b44ee0cafa0ee7c0e683d48f2c70ad4b90) +![](https://gitflic.ru/project/plemyakh/hln-a/blob/raw?file=logo.png&commit=cd31f5b44ee0cafa0ee7c0e683d48f2c70ad4b90) # Описание Этот инструмент позволяет управлять выделенным сервером (dedicated server) ARK Survival Evolved на Linux. Он предоставляет множество функций, чтобы получить полный список, ознакомьтесь с разделом использования. (находится в разработке и может содержать ошибки) From 4956e04d184a2fe1fa29068ef0a02b9a80b45ab5 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 01:18:44 +0300 Subject: [PATCH 051/244] 7days to die --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a49dcac..9be62de 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](https://gitflic.ru/project/plemyakh/hln-a/blob/raw?file=logo.png&commit=cd31f5b44ee0cafa0ee7c0e683d48f2c70ad4b90) # Описание -Этот инструмент позволяет управлять выделенным сервером (dedicated server) ARK Survival Evolved на Linux. +Этот инструмент позволяет управлять выделенным сервером (dedicated server) ARK Survival Evolved и\или 7Days to Die на Linux. Он предоставляет множество функций, чтобы получить полный список, ознакомьтесь с разделом использования. (находится в разработке и может содержать ошибки) # Установка From 69026487960e61aa951f55041b8cf730edc5e75b Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 12:30:46 +0300 Subject: [PATCH 052/244] 1 --- hlna.py | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 89 insertions(+), 7 deletions(-) diff --git a/hlna.py b/hlna.py index 87fffca..97e3acc 100755 --- a/hlna.py +++ b/hlna.py @@ -1,6 +1,10 @@ #!/usr/bin/env python3 import os +import re +import struct +import shutil import datetime +import subprocess import yaml import click @@ -356,18 +360,93 @@ WantedBy=default.target @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") def modinstall(g, m): if g == "ark": - id_game = "346110" + id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): create_dir(dir_workshop_ark) id_mods_ark = input("""Укажите id модов через запятую :""") os.environ.get('mod_branch', 'Windows') - os.system(f"steamcmd +login anonymous +workshop_download_item {id_game} {id_mods_ark} +quit") - os.system(f"mv {home_dir}/.local/share/Steam/steamapps/workshop/content/{id_game}/{id_mods_ark}/ {dir_server_ark}ShooterGame/Content/Mods/") + os.system(f"steamcmd +login anonymous +workshop_download_item {id_game_workshop} {id_mods_ark} +quit") + modextract(id_mods_ark, id_game_workshop) -@hlna.command() -@click.option("-m", required=True, help="Название Сервера") -@click.option("-e/-d", default=True, help="-e активировать карты, -d деактивировать") +def modextract(id_mods_ark, id_game_workshop): + mod_steam_workshop = "{}/content/{}/{}".format(dir_workshop_ark, id_game_workshop, id_mods_ark) + mod_ark_mods = "{}{}".format(dir_mods_ark, id_mods_ark) + modextractdir = mod_ark_mods + + if id_mods_ark == "111111111": + return + + if os.path.isfile("{}/WindowsNoEditor/mod.info".format(mod_steam_workshop)): + mod_steam_workshop = "{}/WindowsNoEditor".format(mod_steam_workshop) + + for dirpath, dirnames, filenames in os.walk(mod_steam_workshop): + for dname in dirnames: + os.makedirs(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop)), exist_ok=True) + + for fname in filenames: + if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): + os.unlink(os.path.join(modextractdir, fname)) + + for dname in dirnames: + if not os.path.isdir(os.path.join(mod_steam_workshop, dname)): + shutil.rmtree(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop))) + + for root, dirs, files in os.walk(mod_steam_workshop): + for name in files: + if not (name.endswith(".z") or name.endswith(".z.uncompressed_size")): + srcfile = os.path.join(root, name) + dstfile = os.path.join(modextractdir, os.path.relpath(srcfile, mod_steam_workshop)) + if not os.path.isfile(dstfile) or os.path.getmtime(srcfile) > os.path.getmtime(dstfile): + shutil.copy2(srcfile, dstfile) + + modname = subprocess.check_output(['curl', '-s', 'http://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mods_ark)]).decode('utf-8') + modname = re.search(r'
(.+)
', modname) + mod_name = modname and modname.group(1) + + if os.path.isfile("{}/.mod".format(modextractdir)): + os.remove("{}/.mod".format(modextractdir)) + + modfile_bytes = b'' + with open(os.path.join(modextractdir, 'mod.info'), 'rb') as f: + data = f.read() + mapnamelen = struct.unpack_from(' Date: Sun, 14 May 2023 12:33:26 +0300 Subject: [PATCH 053/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 97e3acc..9673aef 100755 --- a/hlna.py +++ b/hlna.py @@ -403,7 +403,7 @@ def modextract(id_mods_ark, id_game_workshop): modname = subprocess.check_output(['curl', '-s', 'http://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mods_ark)]).decode('utf-8') modname = re.search(r'
(.+)
', modname) mod_name = modname and modname.group(1) - + print_line(f"{mod_name" mod_name) if os.path.isfile("{}/.mod".format(modextractdir)): os.remove("{}/.mod".format(modextractdir)) From 50cf1d664cad47d9f3456d59f6ae5049c148a0f2 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 12:33:57 +0300 Subject: [PATCH 054/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 9673aef..d9fa8bd 100755 --- a/hlna.py +++ b/hlna.py @@ -403,7 +403,7 @@ def modextract(id_mods_ark, id_game_workshop): modname = subprocess.check_output(['curl', '-s', 'http://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mods_ark)]).decode('utf-8') modname = re.search(r'
(.+)
', modname) mod_name = modname and modname.group(1) - print_line(f"{mod_name" mod_name) + print_line(f"{mod_name} mod_name") if os.path.isfile("{}/.mod".format(modextractdir)): os.remove("{}/.mod".format(modextractdir)) From 2de12c326a74b5afa6eeda85cbe43e0271facf4a Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 12:35:26 +0300 Subject: [PATCH 055/244] 1 --- hlna.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index d9fa8bd..c43c3b3 100755 --- a/hlna.py +++ b/hlna.py @@ -402,8 +402,8 @@ def modextract(id_mods_ark, id_game_workshop): modname = subprocess.check_output(['curl', '-s', 'http://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mods_ark)]).decode('utf-8') modname = re.search(r'
(.+)
', modname) - mod_name = modname and modname.group(1) - print_line(f"{mod_name} mod_name") + modname = modname and modname.group(1) + print_line(f"{modname} mod_name") if os.path.isfile("{}/.mod".format(modextractdir)): os.remove("{}/.mod".format(modextractdir)) @@ -416,7 +416,7 @@ def modextract(id_mods_ark, id_game_workshop): nummaps = struct.unpack_from(' Date: Sun, 14 May 2023 12:36:11 +0300 Subject: [PATCH 056/244] 1 --- hlna.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hlna.py b/hlna.py index c43c3b3..3aa6ec6 100755 --- a/hlna.py +++ b/hlna.py @@ -401,7 +401,9 @@ def modextract(id_mods_ark, id_game_workshop): shutil.copy2(srcfile, dstfile) modname = subprocess.check_output(['curl', '-s', 'http://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mods_ark)]).decode('utf-8') + print_line(f"{modname} mod_name") modname = re.search(r'
(.+)
', modname) + print_line(f"{modname} mod_name") modname = modname and modname.group(1) print_line(f"{modname} mod_name") if os.path.isfile("{}/.mod".format(modextractdir)): From 14686cdec355b52ade30224e04d49f245e2c404d Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 12:39:10 +0300 Subject: [PATCH 057/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 3aa6ec6..0f2fc8a 100755 --- a/hlna.py +++ b/hlna.py @@ -400,7 +400,7 @@ def modextract(id_mods_ark, id_game_workshop): if not os.path.isfile(dstfile) or os.path.getmtime(srcfile) > os.path.getmtime(dstfile): shutil.copy2(srcfile, dstfile) - modname = subprocess.check_output(['curl', '-s', 'http://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mods_ark)]).decode('utf-8') + modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mods_ark)]).decode('utf-8') print_line(f"{modname} mod_name") modname = re.search(r'
(.+)
', modname) print_line(f"{modname} mod_name") From af449bf4104abae589b8d61d7c0879baa6fa97f4 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 12:40:53 +0300 Subject: [PATCH 058/244] 1 --- hlna.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 0f2fc8a..aa09e48 100755 --- a/hlna.py +++ b/hlna.py @@ -422,8 +422,7 @@ def modextract(id_mods_ark, id_game_workshop): modnamelen = len(modname) modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8') modpathlen = len(modpath) - modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 12:41:28 +0300 Subject: [PATCH 059/244] 1 --- hlna.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index aa09e48..7c2bdeb 100755 --- a/hlna.py +++ b/hlna.py @@ -401,11 +401,9 @@ def modextract(id_mods_ark, id_game_workshop): shutil.copy2(srcfile, dstfile) modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mods_ark)]).decode('utf-8') - print_line(f"{modname} mod_name") modname = re.search(r'
(.+)
', modname) - print_line(f"{modname} mod_name") modname = modname and modname.group(1) - print_line(f"{modname} mod_name") + if os.path.isfile("{}/.mod".format(modextractdir)): os.remove("{}/.mod".format(modextractdir)) From 1b8203ad59d9629d424847b5905b08431648cfbd Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 12:52:49 +0300 Subject: [PATCH 060/244] 1 --- hlna.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 7c2bdeb..f26b044 100755 --- a/hlna.py +++ b/hlna.py @@ -420,7 +420,8 @@ def modextract(id_mods_ark, id_game_workshop): modnamelen = len(modname) modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8') modpathlen = len(modpath) - modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 12:54:12 +0300 Subject: [PATCH 061/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index f26b044..42e195d 100755 --- a/hlna.py +++ b/hlna.py @@ -420,7 +420,7 @@ def modextract(id_mods_ark, id_game_workshop): modnamelen = len(modname) modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8') modpathlen = len(modpath) - modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 12:55:40 +0300 Subject: [PATCH 062/244] decode --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 42e195d..aedf174 100755 --- a/hlna.py +++ b/hlna.py @@ -420,7 +420,7 @@ def modextract(id_mods_ark, id_game_workshop): modnamelen = len(modname) modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8') modpathlen = len(modpath) - modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 13:20:47 +0300 Subject: [PATCH 063/244] 1 --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index aedf174..29d7627 100755 --- a/hlna.py +++ b/hlna.py @@ -420,8 +420,8 @@ def modextract(id_mods_ark, id_game_workshop): modnamelen = len(modname) modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8') modpathlen = len(modpath) - modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 13:24:34 +0300 Subject: [PATCH 064/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 29d7627..5bdf22e 100755 --- a/hlna.py +++ b/hlna.py @@ -420,7 +420,7 @@ def modextract(id_mods_ark, id_game_workshop): modnamelen = len(modname) modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8') modpathlen = len(modpath) - + print(modnamelen, modpathlen, id_mods_ark, nummaps) modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 13:25:45 +0300 Subject: [PATCH 065/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 5bdf22e..625f2f2 100755 --- a/hlna.py +++ b/hlna.py @@ -421,7 +421,7 @@ def modextract(id_mods_ark, id_game_workshop): modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8') modpathlen = len(modpath) print(modnamelen, modpathlen, id_mods_ark, nummaps) - modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 13:27:17 +0300 Subject: [PATCH 066/244] 1 --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 625f2f2..6c0270b 100755 --- a/hlna.py +++ b/hlna.py @@ -420,8 +420,8 @@ def modextract(id_mods_ark, id_game_workshop): modnamelen = len(modname) modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8') modpathlen = len(modpath) - print(modnamelen, modpathlen, id_mods_ark, nummaps) - modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 13:42:19 +0300 Subject: [PATCH 067/244] 1 --- hlna.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 6c0270b..c680d3a 100755 --- a/hlna.py +++ b/hlna.py @@ -420,8 +420,7 @@ def modextract(id_mods_ark, id_game_workshop): modnamelen = len(modname) modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8') modpathlen = len(modpath) - - modfile_bytes += struct.pack(id_mods_ark, 0, modnamelen, 1, modpathlen, 1, 1) + modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 13:56:29 +0300 Subject: [PATCH 068/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index c680d3a..342480e 100755 --- a/hlna.py +++ b/hlna.py @@ -420,7 +420,7 @@ def modextract(id_mods_ark, id_game_workshop): modnamelen = len(modname) modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8') modpathlen = len(modpath) - modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 13:58:18 +0300 Subject: [PATCH 069/244] 1 --- hlna.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hlna.py b/hlna.py index 342480e..1e19700 100755 --- a/hlna.py +++ b/hlna.py @@ -420,6 +420,7 @@ def modextract(id_mods_ark, id_game_workshop): modnamelen = len(modname) modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8') modpathlen = len(modpath) + print(id_mods_ark, 0, modnamelen, modname, modpathlen, modpath) modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 13:59:53 +0300 Subject: [PATCH 070/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 1e19700..36ae837 100755 --- a/hlna.py +++ b/hlna.py @@ -421,7 +421,7 @@ def modextract(id_mods_ark, id_game_workshop): modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8') modpathlen = len(modpath) print(id_mods_ark, 0, modnamelen, modname, modpathlen, modpath) - modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 14:00:49 +0300 Subject: [PATCH 071/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 36ae837..29e01e0 100755 --- a/hlna.py +++ b/hlna.py @@ -421,7 +421,7 @@ def modextract(id_mods_ark, id_game_workshop): modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8') modpathlen = len(modpath) print(id_mods_ark, 0, modnamelen, modname, modpathlen, modpath) - modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 14:02:34 +0300 Subject: [PATCH 072/244] 1 --- hlna.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hlna.py b/hlna.py index 29e01e0..0fd9e45 100755 --- a/hlna.py +++ b/hlna.py @@ -421,6 +421,7 @@ def modextract(id_mods_ark, id_game_workshop): modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8') modpathlen = len(modpath) print(id_mods_ark, 0, modnamelen, modname, modpathlen, modpath) + print(type(id_mods_ark)) modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 14:07:48 +0300 Subject: [PATCH 073/244] 1 --- hlna.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/hlna.py b/hlna.py index 0fd9e45..a6d1a2f 100755 --- a/hlna.py +++ b/hlna.py @@ -364,17 +364,17 @@ def modinstall(g, m): if not os.path.isdir(dir_workshop_ark): create_dir(dir_workshop_ark) id_mods_ark = input("""Укажите id модов через запятую -:""") - os.environ.get('mod_branch', 'Windows') - os.system(f"steamcmd +login anonymous +workshop_download_item {id_game_workshop} {id_mods_ark} +quit") - modextract(id_mods_ark, id_game_workshop) +:""").split(",") + for id_mod in id_mods_ark: + os.system(f"steamcmd +login anonymous +workshop_download_item {id_game_workshop} {id_mod} +quit") + modextract(int(id_mod), id_game_workshop) -def modextract(id_mods_ark, id_game_workshop): - mod_steam_workshop = "{}/content/{}/{}".format(dir_workshop_ark, id_game_workshop, id_mods_ark) - mod_ark_mods = "{}{}".format(dir_mods_ark, id_mods_ark) +def modextract(id_mod, id_game_workshop): + mod_steam_workshop = "{}/content/{}/{}".format(dir_workshop_ark, id_game_workshop, id_mod) + mod_ark_mods = "{}{}".format(dir_mods_ark, id_mod) modextractdir = mod_ark_mods - if id_mods_ark == "111111111": + if id_mod == "111111111": return if os.path.isfile("{}/WindowsNoEditor/mod.info".format(mod_steam_workshop)): @@ -400,7 +400,7 @@ def modextract(id_mods_ark, id_game_workshop): if not os.path.isfile(dstfile) or os.path.getmtime(srcfile) > os.path.getmtime(dstfile): shutil.copy2(srcfile, dstfile) - modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mods_ark)]).decode('utf-8') + modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mod)]).decode('utf-8') modname = re.search(r'
(.+)
', modname) modname = modname and modname.group(1) @@ -418,11 +418,11 @@ def modextract(id_mods_ark, id_game_workshop): pos = mapnamelen + 8 modname = (modname + mapname + "\x00").encode('utf-8') modnamelen = len(modname) - modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mods_ark + "\x00").encode('utf-8') + modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mod + "\x00").encode('utf-8') modpathlen = len(modpath) - print(id_mods_ark, 0, modnamelen, modname, modpathlen, modpath) - print(type(id_mods_ark)) - modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 14:09:11 +0300 Subject: [PATCH 074/244] 1 --- hlna.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index a6d1a2f..8e349f9 100755 --- a/hlna.py +++ b/hlna.py @@ -367,7 +367,7 @@ def modinstall(g, m): :""").split(",") for id_mod in id_mods_ark: os.system(f"steamcmd +login anonymous +workshop_download_item {id_game_workshop} {id_mod} +quit") - modextract(int(id_mod), id_game_workshop) + modextract(id_mod, id_game_workshop) def modextract(id_mod, id_game_workshop): mod_steam_workshop = "{}/content/{}/{}".format(dir_workshop_ark, id_game_workshop, id_mod) @@ -421,8 +421,8 @@ def modextract(id_mod, id_game_workshop): modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mod + "\x00").encode('utf-8') modpathlen = len(modpath) print(id_mod, 0, modnamelen, modname, modpathlen, modpath) - print(type(id_mod)) - modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 14:11:44 +0300 Subject: [PATCH 075/244] 1 --- hlna.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 8e349f9..0244c1e 100755 --- a/hlna.py +++ b/hlna.py @@ -422,7 +422,8 @@ def modextract(id_mod, id_game_workshop): modpathlen = len(modpath) print(id_mod, 0, modnamelen, modname, modpathlen, modpath) type(id_mod) - modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 14:32:39 +0300 Subject: [PATCH 076/244] 1 --- hlna.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hlna.py b/hlna.py index 0244c1e..65a84e0 100755 --- a/hlna.py +++ b/hlna.py @@ -369,17 +369,15 @@ def modinstall(g, m): os.system(f"steamcmd +login anonymous +workshop_download_item {id_game_workshop} {id_mod} +quit") modextract(id_mod, id_game_workshop) + def modextract(id_mod, id_game_workshop): - mod_steam_workshop = "{}/content/{}/{}".format(dir_workshop_ark, id_game_workshop, id_mod) - mod_ark_mods = "{}{}".format(dir_mods_ark, id_mod) - modextractdir = mod_ark_mods + mod_steam_workshop = f"{dir_workshop_ark}/content/{id_game_workshop}/{id_mod}/WindowsNoEditor/" + mod_ark_mods = f"{dir_mods_ark}{id_mod}" + modextractdir = f"{dir_workshop_ark}tmp" if id_mod == "111111111": return - if os.path.isfile("{}/WindowsNoEditor/mod.info".format(mod_steam_workshop)): - mod_steam_workshop = "{}/WindowsNoEditor".format(mod_steam_workshop) - for dirpath, dirnames, filenames in os.walk(mod_steam_workshop): for dname in dirnames: os.makedirs(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop)), exist_ok=True) From 341bf371a108c9456b982520d534d9953a521b45 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 14:33:42 +0300 Subject: [PATCH 077/244] =?UTF-8?q?=E2=84=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index 65a84e0..c615956 100755 --- a/hlna.py +++ b/hlna.py @@ -382,9 +382,9 @@ def modextract(id_mod, id_game_workshop): for dname in dirnames: os.makedirs(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop)), exist_ok=True) - for fname in filenames: - if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): - os.unlink(os.path.join(modextractdir, fname)) + # for fname in filenames: + # if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): + # os.unlink(os.path.join(modextractdir, fname)) for dname in dirnames: if not os.path.isdir(os.path.join(mod_steam_workshop, dname)): From d5647ee05ce0ec733887ea5a0b7ab22d05c75758 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 14:38:16 +0300 Subject: [PATCH 078/244] 1 --- hlna.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hlna.py b/hlna.py index c615956..fc5d370 100755 --- a/hlna.py +++ b/hlna.py @@ -382,9 +382,10 @@ def modextract(id_mod, id_game_workshop): for dname in dirnames: os.makedirs(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop)), exist_ok=True) - # for fname in filenames: - # if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): - # os.unlink(os.path.join(modextractdir, fname)) + for fname in filenames: + print_line(fname) + if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): + os.unlink(os.path.join(modextractdir, fname)) for dname in dirnames: if not os.path.isdir(os.path.join(mod_steam_workshop, dname)): @@ -418,8 +419,6 @@ def modextract(id_mod, id_game_workshop): modnamelen = len(modname) modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mod + "\x00").encode('utf-8') modpathlen = len(modpath) - print(id_mod, 0, modnamelen, modname, modpathlen, modpath) - type(id_mod) modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 14:49:31 +0300 Subject: [PATCH 079/244] 1 --- hlna.py | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/hlna.py b/hlna.py index fc5d370..e58ee76 100755 --- a/hlna.py +++ b/hlna.py @@ -381,23 +381,22 @@ def modextract(id_mod, id_game_workshop): for dirpath, dirnames, filenames in os.walk(mod_steam_workshop): for dname in dirnames: os.makedirs(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop)), exist_ok=True) + print_line(filenames) + for fname in filenames: + if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): + os.unlink(os.path.join(modextractdir, fname)) + print_line(dirnames) + for dname in dirnames: + if not os.path.isdir(os.path.join(mod_steam_workshop, dname)): + shutil.rmtree(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop))) - for fname in filenames: - print_line(fname) - if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): - os.unlink(os.path.join(modextractdir, fname)) - - for dname in dirnames: - if not os.path.isdir(os.path.join(mod_steam_workshop, dname)): - shutil.rmtree(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop))) - - for root, dirs, files in os.walk(mod_steam_workshop): - for name in files: - if not (name.endswith(".z") or name.endswith(".z.uncompressed_size")): - srcfile = os.path.join(root, name) - dstfile = os.path.join(modextractdir, os.path.relpath(srcfile, mod_steam_workshop)) - if not os.path.isfile(dstfile) or os.path.getmtime(srcfile) > os.path.getmtime(dstfile): - shutil.copy2(srcfile, dstfile) + for root, dirs, files in os.walk(mod_steam_workshop): + for name in files: + if not (name.endswith(".z") or name.endswith(".z.uncompressed_size")): + srcfile = os.path.join(root, name) + dstfile = os.path.join(modextractdir, os.path.relpath(srcfile, mod_steam_workshop)) + if not os.path.isfile(dstfile) or os.path.getmtime(srcfile) > os.path.getmtime(dstfile): + shutil.copy2(srcfile, dstfile) modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mod)]).decode('utf-8') modname = re.search(r'
(.+)
', modname) From dea8d657b7e283eddd4bd4ac96011b9e15d60125 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 14:52:58 +0300 Subject: [PATCH 080/244] 1 --- hlna.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index e58ee76..3343b4f 100755 --- a/hlna.py +++ b/hlna.py @@ -379,13 +379,14 @@ def modextract(id_mod, id_game_workshop): return for dirpath, dirnames, filenames in os.walk(mod_steam_workshop): + print_line(dirnames) for dname in dirnames: os.makedirs(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop)), exist_ok=True) print_line(filenames) + print_line(dirnames) for fname in filenames: if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): os.unlink(os.path.join(modextractdir, fname)) - print_line(dirnames) for dname in dirnames: if not os.path.isdir(os.path.join(mod_steam_workshop, dname)): shutil.rmtree(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop))) From b11da8d1d0bb3d1e9900bdcb268e9f9ccdacb79e Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 14:54:35 +0300 Subject: [PATCH 081/244] 1 --- hlna.py | 96 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 47 insertions(+), 49 deletions(-) diff --git a/hlna.py b/hlna.py index 3343b4f..d3b2530 100755 --- a/hlna.py +++ b/hlna.py @@ -382,61 +382,59 @@ def modextract(id_mod, id_game_workshop): print_line(dirnames) for dname in dirnames: os.makedirs(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop)), exist_ok=True) - print_line(filenames) - print_line(dirnames) - for fname in filenames: - if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): - os.unlink(os.path.join(modextractdir, fname)) - for dname in dirnames: - if not os.path.isdir(os.path.join(mod_steam_workshop, dname)): - shutil.rmtree(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop))) + for fname in filenames: + if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): + os.unlink(os.path.join(modextractdir, fname)) + for dname in dirnames: + if not os.path.isdir(os.path.join(mod_steam_workshop, dname)): + shutil.rmtree(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop))) - for root, dirs, files in os.walk(mod_steam_workshop): - for name in files: - if not (name.endswith(".z") or name.endswith(".z.uncompressed_size")): - srcfile = os.path.join(root, name) - dstfile = os.path.join(modextractdir, os.path.relpath(srcfile, mod_steam_workshop)) - if not os.path.isfile(dstfile) or os.path.getmtime(srcfile) > os.path.getmtime(dstfile): - shutil.copy2(srcfile, dstfile) + for root, dirs, files in os.walk(mod_steam_workshop): + for name in files: + if not (name.endswith(".z") or name.endswith(".z.uncompressed_size")): + srcfile = os.path.join(root, name) + dstfile = os.path.join(modextractdir, os.path.relpath(srcfile, mod_steam_workshop)) + if not os.path.isfile(dstfile) or os.path.getmtime(srcfile) > os.path.getmtime(dstfile): + shutil.copy2(srcfile, dstfile) - modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mod)]).decode('utf-8') - modname = re.search(r'
(.+)
', modname) - modname = modname and modname.group(1) + modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mod)]).decode('utf-8') + modname = re.search(r'
(.+)
', modname) + modname = modname and modname.group(1) - if os.path.isfile("{}/.mod".format(modextractdir)): - os.remove("{}/.mod".format(modextractdir)) + if os.path.isfile("{}/.mod".format(modextractdir)): + os.remove("{}/.mod".format(modextractdir)) - modfile_bytes = b'' - with open(os.path.join(modextractdir, 'mod.info'), 'rb') as f: - data = f.read() - mapnamelen = struct.unpack_from(' Date: Sun, 14 May 2023 14:58:34 +0300 Subject: [PATCH 082/244] 1 --- hlna.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index d3b2530..bd22762 100755 --- a/hlna.py +++ b/hlna.py @@ -382,9 +382,9 @@ def modextract(id_mod, id_game_workshop): print_line(dirnames) for dname in dirnames: os.makedirs(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop)), exist_ok=True) - for fname in filenames: - if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): - os.unlink(os.path.join(modextractdir, fname)) + # for fname in filenames: + # if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): + # os.unlink(os.path.join(modextractdir, fname)) for dname in dirnames: if not os.path.isdir(os.path.join(mod_steam_workshop, dname)): shutil.rmtree(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop))) From 294187ec932c7db9dbff5caa827d9c246d1cb23e Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 15:04:13 +0300 Subject: [PATCH 083/244] 1 --- hlna.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index bd22762..caa06bb 100755 --- a/hlna.py +++ b/hlna.py @@ -427,9 +427,10 @@ def modextract(id_mod, id_game_workshop): pos = pos + 4 + mapfilelen modfile_bytes += b'\x33\xFF\x22\xFF\x02\x00\x00\x00\x01' - with open("{}/modmeta.info".format(modextractdir), 'ab') as f: - if os.path.isfile("{}/modmeta.info".format(modextractdir)): - f.write(open("{}/modmeta.info".format(modextractdir), 'rb').read()) + with open(f"{modextractdir}/modmeta.info", 'ab') as f: + if os.path.isfile(f"{modextractdir}/modmeta.info"): + f.write(open(f"{modextractdir}/modmeta.mod", 'rb').read()) + f.close() else: f.write(b'\x01\x00\x00\x00\x08\x00\x00\x00ModType\x00\x02\x00\x00\x001\x00') From f9068a659c78856d76e637d23c93a5dea1461f87 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 15:10:12 +0300 Subject: [PATCH 084/244] 1 --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index caa06bb..188c394 100755 --- a/hlna.py +++ b/hlna.py @@ -373,7 +373,7 @@ def modinstall(g, m): def modextract(id_mod, id_game_workshop): mod_steam_workshop = f"{dir_workshop_ark}/content/{id_game_workshop}/{id_mod}/WindowsNoEditor/" mod_ark_mods = f"{dir_mods_ark}{id_mod}" - modextractdir = f"{dir_workshop_ark}tmp" + modextractdir = mod_ark_mods if id_mod == "111111111": return @@ -429,7 +429,7 @@ def modextract(id_mod, id_game_workshop): with open(f"{modextractdir}/modmeta.info", 'ab') as f: if os.path.isfile(f"{modextractdir}/modmeta.info"): - f.write(open(f"{modextractdir}/modmeta.mod", 'rb').read()) + f.write(open(f"{modextractdir}/{id_mod}.mod", 'rb').read()) f.close() else: f.write(b'\x01\x00\x00\x00\x08\x00\x00\x00ModType\x00\x02\x00\x00\x001\x00') From 2424088dd1449492628cd3dc0ec9885e02827180 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 15:18:39 +0300 Subject: [PATCH 085/244] 1 --- hlna.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hlna.py b/hlna.py index 188c394..e768cc4 100755 --- a/hlna.py +++ b/hlna.py @@ -427,12 +427,13 @@ def modextract(id_mod, id_game_workshop): pos = pos + 4 + mapfilelen modfile_bytes += b'\x33\xFF\x22\xFF\x02\x00\x00\x00\x01' - with open(f"{modextractdir}/modmeta.info", 'ab') as f: - if os.path.isfile(f"{modextractdir}/modmeta.info"): - f.write(open(f"{modextractdir}/{id_mod}.mod", 'rb').read()) - f.close() - else: - f.write(b'\x01\x00\x00\x00\x08\x00\x00\x00ModType\x00\x02\x00\x00\x001\x00') + if os.path.isfile(os.path.join(modextractdir, "modmeta.info")): + with open(os.path.join(modextractdir, "modmeta.info"), "rb") as f: + with open(f"{modextractdir}.mod", "ab") as f_out: + f_out.write(f.read()) + else: + with open(f"{modextractdir}.mod", "wb") as f_out: + f_out.write(b'\x01\x00\x00\x00\x08\x00\x00\x00ModType\x00\x02\x00\x00\x001\x00') with open(modextractdir + '.mod', 'wb') as f: f.write(modfile_bytes) From fdd98f0152440edb99cf6b379eac9833108e81c8 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 15:23:13 +0300 Subject: [PATCH 086/244] 1 --- hlna.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index e768cc4..fd4f3a2 100755 --- a/hlna.py +++ b/hlna.py @@ -379,7 +379,6 @@ def modextract(id_mod, id_game_workshop): return for dirpath, dirnames, filenames in os.walk(mod_steam_workshop): - print_line(dirnames) for dname in dirnames: os.makedirs(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop)), exist_ok=True) # for fname in filenames: @@ -395,6 +394,7 @@ def modextract(id_mod, id_game_workshop): srcfile = os.path.join(root, name) dstfile = os.path.join(modextractdir, os.path.relpath(srcfile, mod_steam_workshop)) if not os.path.isfile(dstfile) or os.path.getmtime(srcfile) > os.path.getmtime(dstfile): + print_line(dstfile) shutil.copy2(srcfile, dstfile) modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mod)]).decode('utf-8') @@ -418,7 +418,8 @@ def modextract(id_mod, id_game_workshop): modpath = ("../../../" + "ShooterGame" + "/Content/Mods/" + id_mod + "\x00").encode('utf-8') modpathlen = len(modpath) modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 15:24:38 +0300 Subject: [PATCH 087/244] 1 --- hlna.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hlna.py b/hlna.py index fd4f3a2..f521a9c 100755 --- a/hlna.py +++ b/hlna.py @@ -381,14 +381,17 @@ def modextract(id_mod, id_game_workshop): for dirpath, dirnames, filenames in os.walk(mod_steam_workshop): for dname in dirnames: os.makedirs(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop)), exist_ok=True) + # for fname in filenames: # if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): # os.unlink(os.path.join(modextractdir, fname)) + for dname in dirnames: if not os.path.isdir(os.path.join(mod_steam_workshop, dname)): shutil.rmtree(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop))) for root, dirs, files in os.walk(mod_steam_workshop): + print_line(files) for name in files: if not (name.endswith(".z") or name.endswith(".z.uncompressed_size")): srcfile = os.path.join(root, name) From fdabffb1e2106d729944963bf28658c9c80f65ab Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 15:32:06 +0300 Subject: [PATCH 088/244] 1 --- hlna.py | 81 ++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 27 deletions(-) diff --git a/hlna.py b/hlna.py index f521a9c..09b82a4 100755 --- a/hlna.py +++ b/hlna.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import os import re +import zlib import struct import shutil import datetime @@ -371,44 +372,70 @@ def modinstall(g, m): def modextract(id_mod, id_game_workshop): - mod_steam_workshop = f"{dir_workshop_ark}/content/{id_game_workshop}/{id_mod}/WindowsNoEditor/" - mod_ark_mods = f"{dir_mods_ark}{id_mod}" - modextractdir = mod_ark_mods + dir_steam_workshop = f"{dir_workshop_ark}/content/{id_game_workshop}/{id_mod}/WindowsNoEditor/" + dir_ark_mods = f"{dir_mods_ark}{id_mod}" + dir_extract = dir_ark_mods if id_mod == "111111111": return - for dirpath, dirnames, filenames in os.walk(mod_steam_workshop): + for dirpath, dirnames, filenames in os.walk(dir_steam_workshop): for dname in dirnames: - os.makedirs(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop)), exist_ok=True) + os.makedirs(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop)), exist_ok=True) # for fname in filenames: # if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): # os.unlink(os.path.join(modextractdir, fname)) for dname in dirnames: - if not os.path.isdir(os.path.join(mod_steam_workshop, dname)): - shutil.rmtree(os.path.join(modextractdir, os.path.relpath(os.path.join(dirpath, dname), mod_steam_workshop))) + if not os.path.isdir(os.path.join(dir_steam_workshop, dname)): + shutil.rmtree(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop))) - for root, dirs, files in os.walk(mod_steam_workshop): - print_line(files) - for name in files: - if not (name.endswith(".z") or name.endswith(".z.uncompressed_size")): - srcfile = os.path.join(root, name) - dstfile = os.path.join(modextractdir, os.path.relpath(srcfile, mod_steam_workshop)) - if not os.path.isfile(dstfile) or os.path.getmtime(srcfile) > os.path.getmtime(dstfile): - print_line(dstfile) - shutil.copy2(srcfile, dstfile) + # for root, dirs, files in os.walk(mod_steam_workshop): + # for name in files: + # if not (name.endswith(".z") or name.endswith(".z.uncompressed_size")): + # srcfile = os.path.join(root, name) + # dstfile = os.path.join(modextractdir, os.path.relpath(srcfile, mod_steam_workshop)) + # if not os.path.isfile(dstfile) or os.path.getmtime(srcfile) > os.path.getmtime(dstfile): + # print_line(dstfile) + # shutil.copy2(srcfile, dstfile) + for root, dirs, files in os.walk(dir_steam_workshop): + for file in files: + if file.endswith('.z'): + filepath = os.path.join(root, file) + extract_path = os.path.join(dir_extract, os.path.splitext(file)[0]) + + if not os.path.isfile(extract_path) or os.path.getmtime(filepath) > os.path.getmtime(extract_path): + print(f"{os.path.getsize(filepath):<10} {file:<20} ", end="") + with open(filepath, "rb") as zfile: + data = zfile.read() + if data[0:8] != b"\xC1\x83\x2A\x9E\x00\x00\x00\x00": + raise ValueError("Bad file magic") + chunk_size, compressed_size, uncompressed_size = struct.unpack("(.+)', modname) modname = modname and modname.group(1) - if os.path.isfile("{}/.mod".format(modextractdir)): - os.remove("{}/.mod".format(modextractdir)) + if os.path.isfile("{}/.mod".format(dir_extract)): + os.remove("{}/.mod".format(dir_extract)) modfile_bytes = b'' - with open(os.path.join(modextractdir, 'mod.info'), 'rb') as f: + with open(os.path.join(dir_extract, 'mod.info'), 'rb') as f: data = f.read() mapnamelen = struct.unpack_from(' Date: Sun, 14 May 2023 16:13:33 +0300 Subject: [PATCH 089/244] 1 --- hlna.py | 126 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 99 insertions(+), 27 deletions(-) diff --git a/hlna.py b/hlna.py index 09b82a4..4fa9eb3 100755 --- a/hlna.py +++ b/hlna.py @@ -1,9 +1,11 @@ #!/usr/bin/env python3 import os import re +import sys import zlib import struct import shutil +import logging import datetime import subprocess @@ -399,33 +401,22 @@ def modextract(id_mod, id_game_workshop): # if not os.path.isfile(dstfile) or os.path.getmtime(srcfile) > os.path.getmtime(dstfile): # print_line(dstfile) # shutil.copy2(srcfile, dstfile) - for root, dirs, files in os.walk(dir_steam_workshop): - for file in files: - if file.endswith('.z'): - filepath = os.path.join(root, file) - extract_path = os.path.join(dir_extract, os.path.splitext(file)[0]) - - if not os.path.isfile(extract_path) or os.path.getmtime(filepath) > os.path.getmtime(extract_path): - print(f"{os.path.getsize(filepath):<10} {file:<20} ", end="") - with open(filepath, "rb") as zfile: - data = zfile.read() - if data[0:8] != b"\xC1\x83\x2A\x9E\x00\x00\x00\x00": - raise ValueError("Bad file magic") - chunk_size, compressed_size, uncompressed_size = struct.unpack("(.+)', modname) @@ -474,6 +465,87 @@ def modextract(id_mod, id_game_workshop): os.makedirs(dir_ark_mods) +logging.basicConfig(stream=sys.stderr, level=logging.CRITICAL) + +class UnpackException(Exception): + pass + +class SignatureUnpackException(UnpackException): + pass + +class CorruptUnpackException(UnpackException): + pass + + +def arkit(src, dst): + with open(src, 'rb') as f: + sigver = struct.unpack('q', f.read(8))[0] + unpacked_chunk = f.read(8) + packed = f.read(8) + unpacked = f.read(8) + size_unpacked_chunk = struct.unpack('q', unpacked_chunk)[0] + size_packed = struct.unpack('q', packed)[0] + size_unpacked = struct.unpack('q', unpacked)[0] + + #Verify the integrity of the Archive Header + if sigver == 2653586369: + if isinstance(size_unpacked_chunk, int) and isinstance(size_packed , int) and isinstance(size_unpacked , int): + logging.info("Archive is valid.") + logging.debug(f"Archive header size information. Unpacked Chunk: {size_unpacked_chunk}({unpacked_chunk}) Full Packed: {size_packed}({packed}) Full Unpacked: {size_unpacked}({unpacked})") + + #Obtain the Archive Compression Index + compression_index = [] + size_indexed = 0 + while size_indexed < size_unpacked: + raw_compressed = f.read(8) + raw_uncompressed = f.read(8) + compressed = struct.unpack('q', raw_compressed)[0] + uncompressed = struct.unpack('q', raw_uncompressed)[0] + compression_index.append((compressed, uncompressed)) + size_indexed += uncompressed + logging.debug(f"{len(compression_index)}: {size_indexed}/{size_unpacked} ({compressed}/{uncompressed}) - {raw_compressed} - {raw_uncompressed}") + + if size_unpacked != size_indexed: + msg = f"Header-Index mismatch. Header indicates it should only have {size_unpacked} bytes when uncompressed but the index indicates {size_indexed} bytes." + logging.critical(msg) + raise CorruptUnpackException(msg) + + #Read the actual archive data + data = b'' + read_data = 0 + for compressed, uncompressed in compression_index: + compressed_data = f.read(compressed) + uncompressed_data = zlib.decompress(compressed_data) + + #Verify the size of the data is consistent with the archives index + if len(uncompressed_data) == uncompressed: + data += uncompressed_data + read_data += 1 + + #Verify there is only one partial chunk + if len(uncompressed_data) != size_unpacked_chunk and read_data != len(compression_index): + msg = f"Index contains more than one partial chunk: was {len(uncompressed_data)} when the full chunk size is {size_unpacked_chunk}, chunk {read_data}/{len(compression_index)}" + logging.critical(msg) + raise CorruptUnpackException(msg) + else: + msg = f"Uncompressed chunk size is not the same as in the index: was {len(uncompressed_data)} but should be {uncompressed}." + logging.critical(msg) + raise CorruptUnpackException(msg) + else: + msg = f"Data types in the headers should be int's. Size Types: unpacked_chunk({type(size_unpacked_chunk)}), packed({type(size_packed)}), unpacked({type(size_unpacked)})" + logging.critical(msg) + raise CorruptUnpackException(msg) + else: + msg = "The signature and format version is incorrect. Signature was {} should be 2653586369.".format(sigver) + logging.critical(msg) + raise SignatureUnpackException(msg) + + #Write the extracted data to disk + with open(dst, 'wb') as f: + f.write(data) + logging.info("Archive has been extracted.") + + @ hlna.command() @ click.option("-m", required=True, help="Название Сервера") @ click.option("-e/-d", default=True, help="-e активировать карты, -d деактивировать") From 9c861b2e134d328c422e8c76a6a3a9aab74b17a5 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 16:20:36 +0300 Subject: [PATCH 090/244] 1 --- hlna.py | 164 +++++++++++++++++++++++++++----------------------------- 1 file changed, 80 insertions(+), 84 deletions(-) diff --git a/hlna.py b/hlna.py index 4fa9eb3..d191582 100755 --- a/hlna.py +++ b/hlna.py @@ -19,6 +19,18 @@ from rcon.source import Client home_dir = Path.home() +logging.basicConfig(stream=sys.stderr, level=logging.CRITICAL) + +class UnpackException(Exception): + pass + +class SignatureUnpackException(UnpackException): + pass + +class CorruptUnpackException(UnpackException): + pass + + def find_file(path): """Находим все конфиги в зависимости от пути""" arr = next(os.walk(path), (None, None, []))[2] # [] if no file @@ -50,6 +62,74 @@ def path_server(): def hlna(): pass +def arkit(src, dst): + with open(src, 'rb') as f: + sigver = struct.unpack('q', f.read(8))[0] + unpacked_chunk = f.read(8) + packed = f.read(8) + unpacked = f.read(8) + size_unpacked_chunk = struct.unpack('q', unpacked_chunk)[0] + size_packed = struct.unpack('q', packed)[0] + size_unpacked = struct.unpack('q', unpacked)[0] + + #Verify the integrity of the Archive Header + if sigver == 2653586369: + if isinstance(size_unpacked_chunk, int) and isinstance(size_packed , int) and isinstance(size_unpacked , int): + logging.info("Archive is valid.") + logging.debug(f"Archive header size information. Unpacked Chunk: {size_unpacked_chunk}({unpacked_chunk}) Full Packed: {size_packed}({packed}) Full Unpacked: {size_unpacked}({unpacked})") + + #Obtain the Archive Compression Index + compression_index = [] + size_indexed = 0 + while size_indexed < size_unpacked: + raw_compressed = f.read(8) + raw_uncompressed = f.read(8) + compressed = struct.unpack('q', raw_compressed)[0] + uncompressed = struct.unpack('q', raw_uncompressed)[0] + compression_index.append((compressed, uncompressed)) + size_indexed += uncompressed + logging.debug(f"{len(compression_index)}: {size_indexed}/{size_unpacked} ({compressed}/{uncompressed}) - {raw_compressed} - {raw_uncompressed}") + + if size_unpacked != size_indexed: + msg = f"Header-Index mismatch. Header indicates it should only have {size_unpacked} bytes when uncompressed but the index indicates {size_indexed} bytes." + logging.critical(msg) + raise CorruptUnpackException(msg) + + #Read the actual archive data + data = b'' + read_data = 0 + for compressed, uncompressed in compression_index: + compressed_data = f.read(compressed) + uncompressed_data = zlib.decompress(compressed_data) + + #Verify the size of the data is consistent with the archives index + if len(uncompressed_data) == uncompressed: + data += uncompressed_data + read_data += 1 + + #Verify there is only one partial chunk + if len(uncompressed_data) != size_unpacked_chunk and read_data != len(compression_index): + msg = f"Index contains more than one partial chunk: was {len(uncompressed_data)} when the full chunk size is {size_unpacked_chunk}, chunk {read_data}/{len(compression_index)}" + logging.critical(msg) + raise CorruptUnpackException(msg) + else: + msg = f"Uncompressed chunk size is not the same as in the index: was {len(uncompressed_data)} but should be {uncompressed}." + logging.critical(msg) + raise CorruptUnpackException(msg) + else: + msg = f"Data types in the headers should be int's. Size Types: unpacked_chunk({type(size_unpacked_chunk)}), packed({type(size_packed)}), unpacked({type(size_unpacked)})" + logging.critical(msg) + raise CorruptUnpackException(msg) + else: + msg = "The signature and format version is incorrect. Signature was {} should be 2653586369.".format(sigver) + logging.critical(msg) + raise SignatureUnpackException(msg) + + #Write the extracted data to disk + with open(dst, 'wb') as f: + f.write(data) + logging.info("Archive has been extracted.") + def create_dir(directory): """Проверка и создание директории""" @@ -465,87 +545,6 @@ def modextract(id_mod, id_game_workshop): os.makedirs(dir_ark_mods) -logging.basicConfig(stream=sys.stderr, level=logging.CRITICAL) - -class UnpackException(Exception): - pass - -class SignatureUnpackException(UnpackException): - pass - -class CorruptUnpackException(UnpackException): - pass - - -def arkit(src, dst): - with open(src, 'rb') as f: - sigver = struct.unpack('q', f.read(8))[0] - unpacked_chunk = f.read(8) - packed = f.read(8) - unpacked = f.read(8) - size_unpacked_chunk = struct.unpack('q', unpacked_chunk)[0] - size_packed = struct.unpack('q', packed)[0] - size_unpacked = struct.unpack('q', unpacked)[0] - - #Verify the integrity of the Archive Header - if sigver == 2653586369: - if isinstance(size_unpacked_chunk, int) and isinstance(size_packed , int) and isinstance(size_unpacked , int): - logging.info("Archive is valid.") - logging.debug(f"Archive header size information. Unpacked Chunk: {size_unpacked_chunk}({unpacked_chunk}) Full Packed: {size_packed}({packed}) Full Unpacked: {size_unpacked}({unpacked})") - - #Obtain the Archive Compression Index - compression_index = [] - size_indexed = 0 - while size_indexed < size_unpacked: - raw_compressed = f.read(8) - raw_uncompressed = f.read(8) - compressed = struct.unpack('q', raw_compressed)[0] - uncompressed = struct.unpack('q', raw_uncompressed)[0] - compression_index.append((compressed, uncompressed)) - size_indexed += uncompressed - logging.debug(f"{len(compression_index)}: {size_indexed}/{size_unpacked} ({compressed}/{uncompressed}) - {raw_compressed} - {raw_uncompressed}") - - if size_unpacked != size_indexed: - msg = f"Header-Index mismatch. Header indicates it should only have {size_unpacked} bytes when uncompressed but the index indicates {size_indexed} bytes." - logging.critical(msg) - raise CorruptUnpackException(msg) - - #Read the actual archive data - data = b'' - read_data = 0 - for compressed, uncompressed in compression_index: - compressed_data = f.read(compressed) - uncompressed_data = zlib.decompress(compressed_data) - - #Verify the size of the data is consistent with the archives index - if len(uncompressed_data) == uncompressed: - data += uncompressed_data - read_data += 1 - - #Verify there is only one partial chunk - if len(uncompressed_data) != size_unpacked_chunk and read_data != len(compression_index): - msg = f"Index contains more than one partial chunk: was {len(uncompressed_data)} when the full chunk size is {size_unpacked_chunk}, chunk {read_data}/{len(compression_index)}" - logging.critical(msg) - raise CorruptUnpackException(msg) - else: - msg = f"Uncompressed chunk size is not the same as in the index: was {len(uncompressed_data)} but should be {uncompressed}." - logging.critical(msg) - raise CorruptUnpackException(msg) - else: - msg = f"Data types in the headers should be int's. Size Types: unpacked_chunk({type(size_unpacked_chunk)}), packed({type(size_packed)}), unpacked({type(size_unpacked)})" - logging.critical(msg) - raise CorruptUnpackException(msg) - else: - msg = "The signature and format version is incorrect. Signature was {} should be 2653586369.".format(sigver) - logging.critical(msg) - raise SignatureUnpackException(msg) - - #Write the extracted data to disk - with open(dst, 'wb') as f: - f.write(data) - logging.info("Archive has been extracted.") - - @ hlna.command() @ click.option("-m", required=True, help="Название Сервера") @ click.option("-e/-d", default=True, help="-e активировать карты, -d деактивировать") @@ -805,8 +804,5 @@ create_dir(dir_config) create_dir(dir_logs) - if __name__ == '__main__': hlna() - - From 71c377ccb981e6eeebf9f61a0a24f26d0f242190 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 16:22:39 +0300 Subject: [PATCH 091/244] 1 --- hlna.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/hlna.py b/hlna.py index d191582..62cbc71 100755 --- a/hlna.py +++ b/hlna.py @@ -24,9 +24,11 @@ logging.basicConfig(stream=sys.stderr, level=logging.CRITICAL) class UnpackException(Exception): pass + class SignatureUnpackException(UnpackException): pass + class CorruptUnpackException(UnpackException): pass @@ -62,7 +64,7 @@ def path_server(): def hlna(): pass -def arkit(src, dst): +def unpack(src, dst): with open(src, 'rb') as f: sigver = struct.unpack('q', f.read(8))[0] unpacked_chunk = f.read(8) @@ -116,14 +118,14 @@ def arkit(src, dst): msg = f"Uncompressed chunk size is not the same as in the index: was {len(uncompressed_data)} but should be {uncompressed}." logging.critical(msg) raise CorruptUnpackException(msg) - else: - msg = f"Data types in the headers should be int's. Size Types: unpacked_chunk({type(size_unpacked_chunk)}), packed({type(size_packed)}), unpacked({type(size_unpacked)})" - logging.critical(msg) - raise CorruptUnpackException(msg) else: - msg = "The signature and format version is incorrect. Signature was {} should be 2653586369.".format(sigver) + msg = f"Data types in the headers should be int's. Size Types: unpacked_chunk({type(size_unpacked_chunk)}), packed({type(size_packed)}), unpacked({type(size_unpacked)})" logging.critical(msg) - raise SignatureUnpackException(msg) + raise CorruptUnpackException(msg) + else: + msg = "The signature and format version is incorrect. Signature was {} should be 2653586369.".format(sigver) + logging.critical(msg) + raise SignatureUnpackException(msg) #Write the extracted data to disk with open(dst, 'wb') as f: @@ -489,12 +491,12 @@ def modextract(id_mod, id_game_workshop): src = os.path.join(curdir, file) dst = os.path.join(curdir, name) uncompressed = os.path.join(curdir, file + ".uncompressed_size") - arkit.unpack(src, dst) + unpack(src, dst) #print("[+] Extracted " + file) os.remove(src) if os.path.isfile(uncompressed): os.remove(uncompressed) - except (arkit.UnpackException, arkit.SignatureUnpackException, arkit.CorruptUnpackException) as e: + except (UnpackException, SignatureUnpackException, CorruptUnpackException) as e: print("[x] Unpacking .z files failed, aborting mod install") return False From 7efc8db744938494fba992deaae96d703eeb8769 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 16:26:57 +0300 Subject: [PATCH 092/244] 1 --- hlna.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/hlna.py b/hlna.py index 62cbc71..c2b96ba 100755 --- a/hlna.py +++ b/hlna.py @@ -467,22 +467,14 @@ def modextract(id_mod, id_game_workshop): for dname in dirnames: os.makedirs(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop)), exist_ok=True) - # for fname in filenames: - # if not os.path.isfile(os.path.join(mod_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): - # os.unlink(os.path.join(modextractdir, fname)) + for fname in filenames: + if not os.path.isfile(os.path.join(dir_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): + os.unlink(os.path.join(dir_extract, fname)) for dname in dirnames: if not os.path.isdir(os.path.join(dir_steam_workshop, dname)): shutil.rmtree(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop))) - # for root, dirs, files in os.walk(mod_steam_workshop): - # for name in files: - # if not (name.endswith(".z") or name.endswith(".z.uncompressed_size")): - # srcfile = os.path.join(root, name) - # dstfile = os.path.join(modextractdir, os.path.relpath(srcfile, mod_steam_workshop)) - # if not os.path.isfile(dstfile) or os.path.getmtime(srcfile) > os.path.getmtime(dstfile): - # print_line(dstfile) - # shutil.copy2(srcfile, dstfile) try: for curdir, subdirs, files in os.walk(os.path.join(dir_steam_workshop)): for file in files: @@ -504,11 +496,11 @@ def modextract(id_mod, id_game_workshop): modname = re.search(r'
(.+)
', modname) modname = modname and modname.group(1) - if os.path.isfile("{}/.mod".format(dir_extract)): - os.remove("{}/.mod".format(dir_extract)) + if os.path.isfile(f"{dir_extract}/.mod"): + os.remove(f"{dir_extract}/.mod") modfile_bytes = b'' - with open(os.path.join(dir_extract, 'mod.info'), 'rb') as f: + with open(os.path.join(dir_steam_workshop, 'mod.info'), 'rb') as f: data = f.read() mapnamelen = struct.unpack_from(' Date: Sun, 14 May 2023 16:28:45 +0300 Subject: [PATCH 093/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index c2b96ba..40d1bfc 100755 --- a/hlna.py +++ b/hlna.py @@ -468,7 +468,7 @@ def modextract(id_mod, id_game_workshop): os.makedirs(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop)), exist_ok=True) for fname in filenames: - if not os.path.isfile(os.path.join(dir_steam_workshop, fname)) and not os.path.isfile(os.path.join(mod_steam_workshop, fname + ".z")): + if not os.path.isfile(os.path.join(dir_steam_workshop, fname)) and not os.path.isfile(os.path.join(dir_steam_workshop, fname + ".z")): os.unlink(os.path.join(dir_extract, fname)) for dname in dirnames: From 37b12c8e44f33810082286546f42b127e3ae0fbd Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 16:32:35 +0300 Subject: [PATCH 094/244] 1 --- hlna.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index 40d1bfc..0d99440 100755 --- a/hlna.py +++ b/hlna.py @@ -467,9 +467,9 @@ def modextract(id_mod, id_game_workshop): for dname in dirnames: os.makedirs(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop)), exist_ok=True) - for fname in filenames: - if not os.path.isfile(os.path.join(dir_steam_workshop, fname)) and not os.path.isfile(os.path.join(dir_steam_workshop, fname + ".z")): - os.unlink(os.path.join(dir_extract, fname)) + # for fname in filenames: + # if not os.path.isfile(os.path.join(dir_steam_workshop, fname)) and not os.path.isfile(os.path.join(dir_steam_workshop, fname + ".z")): + # os.unlink(os.path.join(dir_extract, fname)) for dname in dirnames: if not os.path.isdir(os.path.join(dir_steam_workshop, dname)): From 57bc701ccd94d28ecdeceea8eef3c36b5a5031df Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 16:36:21 +0300 Subject: [PATCH 095/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 0d99440..75eeda9 100755 --- a/hlna.py +++ b/hlna.py @@ -484,7 +484,7 @@ def modextract(id_mod, id_game_workshop): dst = os.path.join(curdir, name) uncompressed = os.path.join(curdir, file + ".uncompressed_size") unpack(src, dst) - #print("[+] Extracted " + file) + print("[+] Extracted " + file) os.remove(src) if os.path.isfile(uncompressed): os.remove(uncompressed) From 8254436923ef060262a6a35f2e0bc7e8983e1c63 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 16:42:37 +0300 Subject: [PATCH 096/244] 1 --- hlna.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/hlna.py b/hlna.py index 75eeda9..644762d 100755 --- a/hlna.py +++ b/hlna.py @@ -466,22 +466,16 @@ def modextract(id_mod, id_game_workshop): for dirpath, dirnames, filenames in os.walk(dir_steam_workshop): for dname in dirnames: os.makedirs(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop)), exist_ok=True) - - # for fname in filenames: - # if not os.path.isfile(os.path.join(dir_steam_workshop, fname)) and not os.path.isfile(os.path.join(dir_steam_workshop, fname + ".z")): - # os.unlink(os.path.join(dir_extract, fname)) - - for dname in dirnames: if not os.path.isdir(os.path.join(dir_steam_workshop, dname)): shutil.rmtree(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop))) try: for curdir, subdirs, files in os.walk(os.path.join(dir_steam_workshop)): - for file in files: + for i, file in enumerate(files): name, ext = os.path.splitext(file) if ext == ".z": src = os.path.join(curdir, file) - dst = os.path.join(curdir, name) + dst = os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, subdirs[i]), dir_steam_workshop)) uncompressed = os.path.join(curdir, file + ".uncompressed_size") unpack(src, dst) print("[+] Extracted " + file) From 75b459f7cc415be5273a5b27e64c99c182b5acb5 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 16:45:45 +0300 Subject: [PATCH 097/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 644762d..8465996 100755 --- a/hlna.py +++ b/hlna.py @@ -475,7 +475,7 @@ def modextract(id_mod, id_game_workshop): name, ext = os.path.splitext(file) if ext == ".z": src = os.path.join(curdir, file) - dst = os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, subdirs[i]), dir_steam_workshop)) + dst = os.path.join(dir_extract, os.path.relpath(os.path.join(f"{dirpath}, {subdirs[i]}/"), dir_steam_workshop)) uncompressed = os.path.join(curdir, file + ".uncompressed_size") unpack(src, dst) print("[+] Extracted " + file) From 7aac1c8d59cc2e313527b34030dd8369ae6b5deb Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 16:46:18 +0300 Subject: [PATCH 098/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 8465996..e34792a 100755 --- a/hlna.py +++ b/hlna.py @@ -475,7 +475,7 @@ def modextract(id_mod, id_game_workshop): name, ext = os.path.splitext(file) if ext == ".z": src = os.path.join(curdir, file) - dst = os.path.join(dir_extract, os.path.relpath(os.path.join(f"{dirpath}, {subdirs[i]}/"), dir_steam_workshop)) + dst = os.path.join(dir_extract, os.path.relpath(os.path.join(f"{dirpath}, {subdirs[i]}, /"), dir_steam_workshop)) uncompressed = os.path.join(curdir, file + ".uncompressed_size") unpack(src, dst) print("[+] Extracted " + file) From 3492a34f45d7ab9a533f6edd54d2b6a51ff63e3e Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 16:47:26 +0300 Subject: [PATCH 099/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index e34792a..5056950 100755 --- a/hlna.py +++ b/hlna.py @@ -475,7 +475,7 @@ def modextract(id_mod, id_game_workshop): name, ext = os.path.splitext(file) if ext == ".z": src = os.path.join(curdir, file) - dst = os.path.join(dir_extract, os.path.relpath(os.path.join(f"{dirpath}, {subdirs[i]}, /"), dir_steam_workshop)) + dst = os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, subdirs[i], "/"), dir_steam_workshop)) uncompressed = os.path.join(curdir, file + ".uncompressed_size") unpack(src, dst) print("[+] Extracted " + file) From 54930c8368a737a9752f55a088f700d9b928cdab Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 16:48:39 +0300 Subject: [PATCH 100/244] 1 --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 5056950..1a26e96 100755 --- a/hlna.py +++ b/hlna.py @@ -128,7 +128,7 @@ def unpack(src, dst): raise SignatureUnpackException(msg) #Write the extracted data to disk - with open(dst, 'wb') as f: + with open(f"{dst}/, 'wb'") as f: f.write(data) logging.info("Archive has been extracted.") @@ -475,7 +475,7 @@ def modextract(id_mod, id_game_workshop): name, ext = os.path.splitext(file) if ext == ".z": src = os.path.join(curdir, file) - dst = os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, subdirs[i], "/"), dir_steam_workshop)) + dst = os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, subdirs[i]), dir_steam_workshop)) uncompressed = os.path.join(curdir, file + ".uncompressed_size") unpack(src, dst) print("[+] Extracted " + file) From afacfd5c5152d3368a70768fc8877bf2bb99595f Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 16:49:05 +0300 Subject: [PATCH 101/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 1a26e96..11483ed 100755 --- a/hlna.py +++ b/hlna.py @@ -128,7 +128,7 @@ def unpack(src, dst): raise SignatureUnpackException(msg) #Write the extracted data to disk - with open(f"{dst}/, 'wb'") as f: + with open(f"{dst}/", 'wb') as f: f.write(data) logging.info("Archive has been extracted.") From 878ab8dbe6aa9d1d1b9915c290f9fc1c4b08a64c Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 16:52:07 +0300 Subject: [PATCH 102/244] 1 --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 11483ed..f7f2db4 100755 --- a/hlna.py +++ b/hlna.py @@ -128,7 +128,7 @@ def unpack(src, dst): raise SignatureUnpackException(msg) #Write the extracted data to disk - with open(f"{dst}/", 'wb') as f: + with open(dst, 'wb') as f: f.write(data) logging.info("Archive has been extracted.") @@ -475,7 +475,7 @@ def modextract(id_mod, id_game_workshop): name, ext = os.path.splitext(file) if ext == ".z": src = os.path.join(curdir, file) - dst = os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, subdirs[i]), dir_steam_workshop)) + dst = os.path.join(dir_extract, os.path.relpath(os.path.join(dir_steam_workshop, subdirs[i]), file)) uncompressed = os.path.join(curdir, file + ".uncompressed_size") unpack(src, dst) print("[+] Extracted " + file) From bea0d9e76eafce552b3a544475698ccc54f2995a Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 16:53:07 +0300 Subject: [PATCH 103/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index f7f2db4..071d2b9 100755 --- a/hlna.py +++ b/hlna.py @@ -475,7 +475,7 @@ def modextract(id_mod, id_game_workshop): name, ext = os.path.splitext(file) if ext == ".z": src = os.path.join(curdir, file) - dst = os.path.join(dir_extract, os.path.relpath(os.path.join(dir_steam_workshop, subdirs[i]), file)) + dst = os.path.join(dir_extract, os.path.relpath(os.path.join(dir_steam_workshop, subdirs[i]), name)) uncompressed = os.path.join(curdir, file + ".uncompressed_size") unpack(src, dst) print("[+] Extracted " + file) From c356f812d8f063a6f62a007b96a8a37a39264352 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 16:56:09 +0300 Subject: [PATCH 104/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 071d2b9..fc99aba 100755 --- a/hlna.py +++ b/hlna.py @@ -475,7 +475,7 @@ def modextract(id_mod, id_game_workshop): name, ext = os.path.splitext(file) if ext == ".z": src = os.path.join(curdir, file) - dst = os.path.join(dir_extract, os.path.relpath(os.path.join(dir_steam_workshop, subdirs[i]), name)) + dst = os.path.join(dir_extract, os.path.relpath(name)) uncompressed = os.path.join(curdir, file + ".uncompressed_size") unpack(src, dst) print("[+] Extracted " + file) From e1ee0871bfd06312a1ec7fc0d21b731c5f96236e Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 16:57:27 +0300 Subject: [PATCH 105/244] subdirs[i] --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index fc99aba..5b655df 100755 --- a/hlna.py +++ b/hlna.py @@ -475,7 +475,7 @@ def modextract(id_mod, id_game_workshop): name, ext = os.path.splitext(file) if ext == ".z": src = os.path.join(curdir, file) - dst = os.path.join(dir_extract, os.path.relpath(name)) + dst = os.path.join(dir_extract, os.path.relpath(subdirs[i], name)) uncompressed = os.path.join(curdir, file + ".uncompressed_size") unpack(src, dst) print("[+] Extracted " + file) From add187acb0d7318820f84946997a1d254db10196 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 17:03:36 +0300 Subject: [PATCH 106/244] 1 --- hlna.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 5b655df..cf7e49c 100755 --- a/hlna.py +++ b/hlna.py @@ -471,11 +471,12 @@ def modextract(id_mod, id_game_workshop): try: for curdir, subdirs, files in os.walk(os.path.join(dir_steam_workshop)): - for i, file in enumerate(files): + for file in files: name, ext = os.path.splitext(file) if ext == ".z": src = os.path.join(curdir, file) - dst = os.path.join(dir_extract, os.path.relpath(subdirs[i], name)) + curdir = dir_extract + dst = os.path.join(curdir, name) uncompressed = os.path.join(curdir, file + ".uncompressed_size") unpack(src, dst) print("[+] Extracted " + file) From 67b1ca0e6ac5f710b6db5f7c0d46e1352a248a10 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 17:04:53 +0300 Subject: [PATCH 107/244] 1 --- hlna.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index cf7e49c..efa4976 100755 --- a/hlna.py +++ b/hlna.py @@ -475,8 +475,7 @@ def modextract(id_mod, id_game_workshop): name, ext = os.path.splitext(file) if ext == ".z": src = os.path.join(curdir, file) - curdir = dir_extract - dst = os.path.join(curdir, name) + dst = os.path.join(dir_extract, name) uncompressed = os.path.join(curdir, file + ".uncompressed_size") unpack(src, dst) print("[+] Extracted " + file) From 7fa6a765186627e1160cbc9ed3e074a7e463f35f Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 17:05:34 +0300 Subject: [PATCH 108/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index efa4976..dc3618a 100755 --- a/hlna.py +++ b/hlna.py @@ -475,7 +475,7 @@ def modextract(id_mod, id_game_workshop): name, ext = os.path.splitext(file) if ext == ".z": src = os.path.join(curdir, file) - dst = os.path.join(dir_extract, name) + dst = os.path.join(dir_extract, subdirs, name) uncompressed = os.path.join(curdir, file + ".uncompressed_size") unpack(src, dst) print("[+] Extracted " + file) From 7de792d8b06f489de30779808306c536e8cbcf3c Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 17:18:13 +0300 Subject: [PATCH 109/244] 1 --- hlna.py | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/hlna.py b/hlna.py index dc3618a..0c0aff1 100755 --- a/hlna.py +++ b/hlna.py @@ -456,35 +456,31 @@ def modinstall(g, m): def modextract(id_mod, id_game_workshop): - dir_steam_workshop = f"{dir_workshop_ark}/content/{id_game_workshop}/{id_mod}/WindowsNoEditor/" - dir_ark_mods = f"{dir_mods_ark}{id_mod}" + dir_steam_workshop = f"{dir_workshop_ark}/content/{id_game_workshop}/{id_mod}/WindowsNoEditor" + dir_ark_mods = f"{dir_mods_ark}/{id_mod}" dir_extract = dir_ark_mods if id_mod == "111111111": return - for dirpath, dirnames, filenames in os.walk(dir_steam_workshop): - for dname in dirnames: - os.makedirs(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop)), exist_ok=True) - if not os.path.isdir(os.path.join(dir_steam_workshop, dname)): - shutil.rmtree(os.path.join(dir_extract, os.path.relpath(os.path.join(dirpath, dname), dir_steam_workshop))) + try: + for curdir, subdirs, files in os.walk(os.path.join(dir_steam_workshop)): + for file in files: + name, ext = os.path.splitext(file) + if ext == ".z": + src = os.path.join(curdir, file) + dst = os.path.join(curdir, name) + uncompressed = os.path.join(curdir, file + ".uncompressed_size") + unpack(src, dst) + print("[+] Extracted " + file) + os.remove(src) + if os.path.isfile(uncompressed): + os.remove(uncompressed) + except (UnpackException, SignatureUnpackException, CorruptUnpackException) as e: + print("[x] Unpacking .z files failed, aborting mod install") + return False - try: - for curdir, subdirs, files in os.walk(os.path.join(dir_steam_workshop)): - for file in files: - name, ext = os.path.splitext(file) - if ext == ".z": - src = os.path.join(curdir, file) - dst = os.path.join(dir_extract, subdirs, name) - uncompressed = os.path.join(curdir, file + ".uncompressed_size") - unpack(src, dst) - print("[+] Extracted " + file) - os.remove(src) - if os.path.isfile(uncompressed): - os.remove(uncompressed) - except (UnpackException, SignatureUnpackException, CorruptUnpackException) as e: - print("[x] Unpacking .z files failed, aborting mod install") - return False + os.system(f"mv {dir_steam_workshop} {dir_mods_ark}") modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mod)]).decode('utf-8') modname = re.search(r'
(.+)
', modname) @@ -779,7 +775,7 @@ dir_logs = f"{dir_config}logs/" dir_server_ark = f"{dir_server}ARK/" dir_server_exec = f"{dir_server_ark}ShooterGame/Binaries/Linux/" dir_workshop_ark = f"{home_dir}/.local/share/Steam/steamapps/workshop/" -dir_mods_ark = f"{dir_server_ark}ShooterGame/Content/Mods/" +dir_mods_ark = f"{dir_server_ark}ShooterGame/Content/Mods" dir_server_7days = f"{dir_server}/7Days/" From f57d20cf4134edc4fa70f369f03658f4b3e7f33a Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 17:21:19 +0300 Subject: [PATCH 110/244] 1 --- hlna.py | 1 - 1 file changed, 1 deletion(-) diff --git a/hlna.py b/hlna.py index 0c0aff1..6acee97 100755 --- a/hlna.py +++ b/hlna.py @@ -4,7 +4,6 @@ import re import sys import zlib import struct -import shutil import logging import datetime import subprocess From 8e57135ccfcf42654baf414c4eaf588696cde371 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 17:22:36 +0300 Subject: [PATCH 111/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 6acee97..cedfdd2 100755 --- a/hlna.py +++ b/hlna.py @@ -773,7 +773,7 @@ dir_logs = f"{dir_config}logs/" dir_server_ark = f"{dir_server}ARK/" dir_server_exec = f"{dir_server_ark}ShooterGame/Binaries/Linux/" -dir_workshop_ark = f"{home_dir}/.local/share/Steam/steamapps/workshop/" +dir_workshop_ark = f"{home_dir}/.local/share/Steam/steamapps/workshop" dir_mods_ark = f"{dir_server_ark}ShooterGame/Content/Mods" dir_server_7days = f"{dir_server}/7Days/" From e9c34f6419a6158539a92e4b36e4ce72be978015 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 17:24:15 +0300 Subject: [PATCH 112/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index cedfdd2..89798dc 100755 --- a/hlna.py +++ b/hlna.py @@ -479,7 +479,7 @@ def modextract(id_mod, id_game_workshop): print("[x] Unpacking .z files failed, aborting mod install") return False - os.system(f"mv {dir_steam_workshop} {dir_mods_ark}") + os.system(f"mv -f {dir_steam_workshop} {dir_ark_mods}") modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mod)]).decode('utf-8') modname = re.search(r'
(.+)
', modname) From 95464e9702f1e1d5a5596f48e1f1e77ce9269c88 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 17:26:09 +0300 Subject: [PATCH 113/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 89798dc..61740d0 100755 --- a/hlna.py +++ b/hlna.py @@ -489,7 +489,7 @@ def modextract(id_mod, id_game_workshop): os.remove(f"{dir_extract}/.mod") modfile_bytes = b'' - with open(os.path.join(dir_steam_workshop, 'mod.info'), 'rb') as f: + with open(os.path.join(dir_ark_mods, 'mod.info'), 'rb') as f: data = f.read() mapnamelen = struct.unpack_from(' Date: Sun, 14 May 2023 17:36:39 +0300 Subject: [PATCH 114/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 61740d0..3b9ecbd 100755 --- a/hlna.py +++ b/hlna.py @@ -517,7 +517,7 @@ def modextract(id_mod, id_game_workshop): with open(f"{dir_extract}.mod", "ab") as f_out: f_out.write(f.read()) else: - with open(f"{dir_extract}.mod", "wb") as f_out: + with open(f"{dir_mods_ark}.mod", "wb") as f_out: f_out.write(b'\x01\x00\x00\x00\x08\x00\x00\x00ModType\x00\x02\x00\x00\x001\x00') with open(dir_extract + '.mod', 'wb') as f: From 72e39bc58005f21402dea3894ef73f6a8fd65bd7 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 17:38:28 +0300 Subject: [PATCH 115/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 3b9ecbd..f713b32 100755 --- a/hlna.py +++ b/hlna.py @@ -520,7 +520,7 @@ def modextract(id_mod, id_game_workshop): with open(f"{dir_mods_ark}.mod", "wb") as f_out: f_out.write(b'\x01\x00\x00\x00\x08\x00\x00\x00ModType\x00\x02\x00\x00\x001\x00') - with open(dir_extract + '.mod', 'wb') as f: + with open(dir_extract + f'{id_mod}.mod', 'wb') as f: f.write(modfile_bytes) if dir_extract != dir_ark_mods: From 55b967f3d769e41eb336defc6ec07e87e3a3d3e9 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 17:39:26 +0300 Subject: [PATCH 116/244] 1 --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index f713b32..97f3131 100755 --- a/hlna.py +++ b/hlna.py @@ -485,8 +485,8 @@ def modextract(id_mod, id_game_workshop): modname = re.search(r'
(.+)
', modname) modname = modname and modname.group(1) - if os.path.isfile(f"{dir_extract}/.mod"): - os.remove(f"{dir_extract}/.mod") + if os.path.isfile(f"{dir_ark_mods}/{id_mod}.mod"): + os.remove(f"{dir_ark_mods}/{id_mod}.mod") modfile_bytes = b'' with open(os.path.join(dir_ark_mods, 'mod.info'), 'rb') as f: From eb5a0017ba95d0e8a352486f0680f3c6760ebfaf Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 17:42:27 +0300 Subject: [PATCH 117/244] 1 --- hlna.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index 97f3131..f1f7363 100755 --- a/hlna.py +++ b/hlna.py @@ -485,8 +485,8 @@ def modextract(id_mod, id_game_workshop): modname = re.search(r'
(.+)
', modname) modname = modname and modname.group(1) - if os.path.isfile(f"{dir_ark_mods}/{id_mod}.mod"): - os.remove(f"{dir_ark_mods}/{id_mod}.mod") + if os.path.isfile(f"{dir_ark_mods}/.mod"): + os.remove(f"{dir_ark_mods}/.mod") modfile_bytes = b'' with open(os.path.join(dir_ark_mods, 'mod.info'), 'rb') as f: @@ -520,7 +520,7 @@ def modextract(id_mod, id_game_workshop): with open(f"{dir_mods_ark}.mod", "wb") as f_out: f_out.write(b'\x01\x00\x00\x00\x08\x00\x00\x00ModType\x00\x02\x00\x00\x001\x00') - with open(dir_extract + f'{id_mod}.mod', 'wb') as f: + with open(f"{dir_extract}.mod", 'wb') as f: f.write(modfile_bytes) if dir_extract != dir_ark_mods: From a0d5b7f7dfa6a57a95bd31ec43d1aec08a6e04e4 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 17:44:58 +0300 Subject: [PATCH 118/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index f1f7363..c72723b 100755 --- a/hlna.py +++ b/hlna.py @@ -478,7 +478,7 @@ def modextract(id_mod, id_game_workshop): except (UnpackException, SignatureUnpackException, CorruptUnpackException) as e: print("[x] Unpacking .z files failed, aborting mod install") return False - + os.system(f"rm -rf {dir_ark_mods}") os.system(f"mv -f {dir_steam_workshop} {dir_ark_mods}") modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mod)]).decode('utf-8') From ea7b80e0d5d547240b19afd2e055a6d3263cfec4 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 17:45:45 +0300 Subject: [PATCH 119/244] 1 --- hlna.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/hlna.py b/hlna.py index c72723b..7e3e65f 100755 --- a/hlna.py +++ b/hlna.py @@ -520,9 +520,6 @@ def modextract(id_mod, id_game_workshop): with open(f"{dir_mods_ark}.mod", "wb") as f_out: f_out.write(b'\x01\x00\x00\x00\x08\x00\x00\x00ModType\x00\x02\x00\x00\x001\x00') - with open(f"{dir_extract}.mod", 'wb') as f: - f.write(modfile_bytes) - if dir_extract != dir_ark_mods: if not os.path.isdir(dir_ark_mods): os.makedirs(dir_ark_mods) From 73481a7cd67d4f08995c67cd2ac071835ce12025 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 17:52:53 +0300 Subject: [PATCH 120/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 7e3e65f..3670e29 100755 --- a/hlna.py +++ b/hlna.py @@ -406,7 +406,7 @@ def systemd_unit_create(game, config_7days="", name_server=list_config): data = read_yaml(i, game="ARK") ntff = "" if not data['Cluster'] else "-NoTransferFromFiltering" unit_dir_server = dir_server_ark - systemd_unit_exec = f"{dir_server_exec}ShooterGameServer {data['map']}?listen={data['Listen']}?GameModIds=2967069515?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}??MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff}" + systemd_unit_exec = f"{dir_server_exec}ShooterGameServer {data['map']}?listen={data['Listen']}?GameModIds=2112724006?SessionName={data['SessionName']}?Port={data['Port']}?QueryPort={data['QueryPort']}?RCONEnabled={data['RCONEnabled']}?RCONPort={data['RCONPort']}?ServerAdminPassword={data['ServerAdminPassword']}??MaxPlayers={data['MaxPlayers']} -clusterid={data['clusterid']} -ClusterDirOverride={data['clusterdir']} {ntff}" unit_file = f"{dir_unit}ark_{data['SessionName']}.service".lower() elif game == "7Days": id_game = "294420" From 4967bbb97ddcee9e9c445f8b6d84857608b9637d Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 17:59:19 +0300 Subject: [PATCH 121/244] 1 --- hlna.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hlna.py b/hlna.py index 3670e29..dee22e5 100755 --- a/hlna.py +++ b/hlna.py @@ -400,6 +400,7 @@ def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="" print(colorama.Fore.GREEN + "Конфиг создан" + colorama.Style.RESET_ALL) def systemd_unit_create(game, config_7days="", name_server=list_config): + print_line(systemd_unit_create) if game == "ARK": id_game = "376030" for i in name_server: From 7c13bfa218e35f9c176184bd970cbc1f68e583c9 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 18:01:21 +0300 Subject: [PATCH 122/244] 1 --- hlna.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hlna.py b/hlna.py index dee22e5..1a29a58 100755 --- a/hlna.py +++ b/hlna.py @@ -394,6 +394,7 @@ def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="" } ] elif game != "": + print_line("elif game !=") systemd_unit_create(game) with open(path_yaml, 'w') as yamlfile: yaml.dump(settings, yamlfile) From bf1158b7e0758bd3a90c8ec4aa155a5fe053195b Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 18:25:39 +0300 Subject: [PATCH 123/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 1a29a58..baa6294 100755 --- a/hlna.py +++ b/hlna.py @@ -393,7 +393,7 @@ def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="" 'path_server': dir_server } ] - elif game != "": + if game != "": print_line("elif game !=") systemd_unit_create(game) with open(path_yaml, 'w') as yamlfile: From 505f8f41594bc88b17f4d698c6ba6735e49bb5f9 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 18:29:56 +0300 Subject: [PATCH 124/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index baa6294..63c6ea5 100755 --- a/hlna.py +++ b/hlna.py @@ -56,7 +56,7 @@ def path_server(): :""") if dir_server == "": dir_server = f"{home_dir}/Servers/" - yaml_create(game := "path_server", dir_server) + yaml_create(game := "path_server", dir_server) return dir_server @click.group() From c39911e7925cae00874f0fdd8b2e4c2af39ac43b Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 18:32:27 +0300 Subject: [PATCH 125/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 63c6ea5..519d90e 100755 --- a/hlna.py +++ b/hlna.py @@ -393,7 +393,7 @@ def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="" 'path_server': dir_server } ] - if game != "": + if game != "path_server": print_line("elif game !=") systemd_unit_create(game) with open(path_yaml, 'w') as yamlfile: From 566f29c13e2ca1ebf0d5ac8da67d6f14c8315535 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 18:37:14 +0300 Subject: [PATCH 126/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 519d90e..b37359f 100755 --- a/hlna.py +++ b/hlna.py @@ -45,7 +45,7 @@ def find_file(path): dir_config = f"{home_dir}/.config/hlna/" -dir_maps_ark = f"{dir_config}/ARK/" +dir_maps_ark = f"{dir_config}ARK/" dir_deactivated = f"{dir_maps_ark}deactivated/" list_config = find_file(dir_maps_ark) delist_config = find_file(dir_deactivated) From b45b8de1ee191b31a9c909ca82b9ffd88b0bfa45 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 18:40:17 +0300 Subject: [PATCH 127/244] 1 --- hlna.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index b37359f..44f1089 100755 --- a/hlna.py +++ b/hlna.py @@ -393,9 +393,9 @@ def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="" 'path_server': dir_server } ] - if game != "path_server": - print_line("elif game !=") - systemd_unit_create(game) + + systemd_unit_create(game) + with open(path_yaml, 'w') as yamlfile: yaml.dump(settings, yamlfile) print(colorama.Fore.GREEN + "Конфиг создан" + colorama.Style.RESET_ALL) From 4e50ae7673ad7a77034db7f3ed7985a05889d8e1 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 18:41:33 +0300 Subject: [PATCH 128/244] 1 --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 44f1089..53433e2 100755 --- a/hlna.py +++ b/hlna.py @@ -394,11 +394,11 @@ def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="" } ] - systemd_unit_create(game) - with open(path_yaml, 'w') as yamlfile: yaml.dump(settings, yamlfile) print(colorama.Fore.GREEN + "Конфиг создан" + colorama.Style.RESET_ALL) + systemd_unit_create(game) + def systemd_unit_create(game, config_7days="", name_server=list_config): print_line(systemd_unit_create) From 9728466fa6778481116d811c2d39f42f4da193a6 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 19:44:29 +0300 Subject: [PATCH 129/244] 1 --- hlna.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index 53433e2..72a4693 100755 --- a/hlna.py +++ b/hlna.py @@ -487,8 +487,8 @@ def modextract(id_mod, id_game_workshop): modname = re.search(r'
(.+)
', modname) modname = modname and modname.group(1) - if os.path.isfile(f"{dir_ark_mods}/.mod"): - os.remove(f"{dir_ark_mods}/.mod") + if os.path.isfile(f"{dir_ark_mods}.mod"): + os.remove(f"{dir_ark_mods}.mod") modfile_bytes = b'' with open(os.path.join(dir_ark_mods, 'mod.info'), 'rb') as f: @@ -513,6 +513,7 @@ def modextract(id_mod, id_game_workshop): modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 19:46:08 +0300 Subject: [PATCH 130/244] 1 --- hlna.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hlna.py b/hlna.py index 72a4693..fe163e7 100755 --- a/hlna.py +++ b/hlna.py @@ -488,6 +488,7 @@ def modextract(id_mod, id_game_workshop): modname = modname and modname.group(1) if os.path.isfile(f"{dir_ark_mods}.mod"): + print_line(id_mod) os.remove(f"{dir_ark_mods}.mod") modfile_bytes = b'' From 43fd43c3273e9bce5edd1f1eec0285eec7ae75ae Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 19:46:56 +0300 Subject: [PATCH 131/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index fe163e7..748aa5c 100755 --- a/hlna.py +++ b/hlna.py @@ -514,7 +514,7 @@ def modextract(id_mod, id_game_workshop): modfile_bytes += struct.pack(' Date: Sun, 14 May 2023 20:45:43 +0300 Subject: [PATCH 132/244] 1 --- hlna.py | 61 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/hlna.py b/hlna.py index 748aa5c..78869db 100755 --- a/hlna.py +++ b/hlna.py @@ -491,30 +491,48 @@ def modextract(id_mod, id_game_workshop): print_line(id_mod) os.remove(f"{dir_ark_mods}.mod") - modfile_bytes = b'' - with open(os.path.join(dir_ark_mods, 'mod.info'), 'rb') as f: - data = f.read() - mapnamelen = struct.unpack_from(' Date: Sun, 14 May 2023 20:47:31 +0300 Subject: [PATCH 133/244] str({dir_shooter}) --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 78869db..a334e84 100755 --- a/hlna.py +++ b/hlna.py @@ -499,7 +499,7 @@ def modextract(id_mod, id_game_workshop): pos = mapnamelen + 8 modname = (modname or mapname) modnamelen = len(modname) - modpath = f"../../../" + {dir_shooter} + "/Content/Mods/" + id_mod + modpath = f"../../../" + str({dir_shooter}) + "/Content/Mods/" + id_mod modpathlen = len(modpath) with open(f"{dir_ark_mods}.mod", "wb") as mod: mod.write(struct.pack(' Date: Sun, 14 May 2023 20:49:39 +0300 Subject: [PATCH 134/244] 1 --- hlna.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index a334e84..a96f6be 100755 --- a/hlna.py +++ b/hlna.py @@ -502,7 +502,8 @@ def modextract(id_mod, id_game_workshop): modpath = f"../../../" + str({dir_shooter}) + "/Content/Mods/" + id_mod modpathlen = len(modpath) with open(f"{dir_ark_mods}.mod", "wb") as mod: - mod.write(struct.pack(' Date: Sun, 14 May 2023 20:50:23 +0300 Subject: [PATCH 135/244] id_mod --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index a96f6be..c296624 100755 --- a/hlna.py +++ b/hlna.py @@ -503,7 +503,7 @@ def modextract(id_mod, id_game_workshop): modpathlen = len(modpath) with open(f"{dir_ark_mods}.mod", "wb") as mod: mod.write(struct.pack(" Date: Sun, 14 May 2023 20:52:48 +0300 Subject: [PATCH 136/244] 1 --- hlna.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index c296624..d40cf85 100755 --- a/hlna.py +++ b/hlna.py @@ -502,8 +502,9 @@ def modextract(id_mod, id_game_workshop): modpath = f"../../../" + str({dir_shooter}) + "/Content/Mods/" + id_mod modpathlen = len(modpath) with open(f"{dir_ark_mods}.mod", "wb") as mod: - mod.write(struct.pack(" Date: Sun, 14 May 2023 20:57:22 +0300 Subject: [PATCH 137/244] 1 --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index d40cf85..24ef97b 100755 --- a/hlna.py +++ b/hlna.py @@ -497,9 +497,9 @@ def modextract(id_mod, id_game_workshop): mapname = data[4:mapnamelen+3] nummaps = struct.unpack_from(" Date: Sun, 14 May 2023 20:58:19 +0300 Subject: [PATCH 138/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 24ef97b..56c9f27 100755 --- a/hlna.py +++ b/hlna.py @@ -499,7 +499,7 @@ def modextract(id_mod, id_game_workshop): pos = mapnamelen + 8 modname = (modname.encode() or mapname.decode()) + b'\x00' modnamelen = len(modname) - modpath = b"../../../" + str(dir_shooter).encode() + b"/Content/Mods/" + id_mod + b'\x00' + modpath = b"../../../" + dir_shooter.encode() + b"/Content/Mods/" + modid.encode() + b'\x00' modpathlen = len(modpath) with open(f"{dir_ark_mods}.mod", "wb") as mod: print(type(modnamelen)) From addcc6f72d921b0279423466bf4c0ded7c15f0b4 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 20:58:59 +0300 Subject: [PATCH 139/244] 1 --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 56c9f27..6f56b77 100755 --- a/hlna.py +++ b/hlna.py @@ -499,12 +499,12 @@ def modextract(id_mod, id_game_workshop): pos = mapnamelen + 8 modname = (modname.encode() or mapname.decode()) + b'\x00' modnamelen = len(modname) - modpath = b"../../../" + dir_shooter.encode() + b"/Content/Mods/" + modid.encode() + b'\x00' + modpath = b"../../../" + dir_shooter.encode() + b"/Content/Mods/" + id_mod.encode() + b'\x00' modpathlen = len(modpath) with open(f"{dir_ark_mods}.mod", "wb") as mod: print(type(modnamelen)) print(type(modpathlen)) - mod.write(struct.pack(' Date: Sun, 14 May 2023 20:59:02 +0300 Subject: [PATCH 140/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 6f56b77..33d8f27 100755 --- a/hlna.py +++ b/hlna.py @@ -504,7 +504,7 @@ def modextract(id_mod, id_game_workshop): with open(f"{dir_ark_mods}.mod", "wb") as mod: print(type(modnamelen)) print(type(modpathlen)) - mod.write(struct.pack(' Date: Sun, 14 May 2023 20:59:16 +0300 Subject: [PATCH 141/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 33d8f27..6f56b77 100755 --- a/hlna.py +++ b/hlna.py @@ -504,7 +504,7 @@ def modextract(id_mod, id_game_workshop): with open(f"{dir_ark_mods}.mod", "wb") as mod: print(type(modnamelen)) print(type(modpathlen)) - mod.write(struct.pack(' Date: Sun, 14 May 2023 21:01:07 +0300 Subject: [PATCH 142/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 6f56b77..afec16a 100755 --- a/hlna.py +++ b/hlna.py @@ -504,7 +504,7 @@ def modextract(id_mod, id_game_workshop): with open(f"{dir_ark_mods}.mod", "wb") as mod: print(type(modnamelen)) print(type(modpathlen)) - mod.write(struct.pack(' Date: Sun, 14 May 2023 21:08:37 +0300 Subject: [PATCH 143/244] 1 --- hlna.py | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/hlna.py b/hlna.py index afec16a..41a8557 100755 --- a/hlna.py +++ b/hlna.py @@ -512,30 +512,6 @@ def modextract(id_mod, id_game_workshop): pos = pos + 4 + mapfilelen mod.write(b"\x33\xFF\x22\xFF\x02\x00\x00\x00\x01") - # modfile_bytes = b'' - # with open(os.path.join(dir_ark_mods, 'mod.info'), 'rb') as f: - # data = f.read() - # mapnamelen = struct.unpack_from(' Date: Sun, 14 May 2023 21:57:51 +0300 Subject: [PATCH 144/244] =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BC=D0=BE=D0=B4=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 75 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/hlna.py b/hlna.py index 41a8557..13ce1c0 100755 --- a/hlna.py +++ b/hlna.py @@ -17,9 +17,9 @@ from rcon.source import Client home_dir = Path.home() - logging.basicConfig(stream=sys.stderr, level=logging.CRITICAL) + class UnpackException(Exception): pass @@ -59,10 +59,12 @@ def path_server(): yaml_create(game := "path_server", dir_server) return dir_server + @click.group() def hlna(): pass + def unpack(src, dst): with open(src, 'rb') as f: sigver = struct.unpack('q', f.read(8))[0] @@ -73,13 +75,14 @@ def unpack(src, dst): size_packed = struct.unpack('q', packed)[0] size_unpacked = struct.unpack('q', unpacked)[0] - #Verify the integrity of the Archive Header + # Verify the integrity of the Archive Header if sigver == 2653586369: - if isinstance(size_unpacked_chunk, int) and isinstance(size_packed , int) and isinstance(size_unpacked , int): + if isinstance(size_unpacked_chunk, int) and isinstance(size_packed, int) and isinstance(size_unpacked, int): logging.info("Archive is valid.") - logging.debug(f"Archive header size information. Unpacked Chunk: {size_unpacked_chunk}({unpacked_chunk}) Full Packed: {size_packed}({packed}) Full Unpacked: {size_unpacked}({unpacked})") + logging.debug( + f"Archive header size information. Unpacked Chunk: {size_unpacked_chunk}({unpacked_chunk}) Full Packed: {size_packed}({packed}) Full Unpacked: {size_unpacked}({unpacked})") - #Obtain the Archive Compression Index + # Obtain the Archive Compression Index compression_index = [] size_indexed = 0 while size_indexed < size_unpacked: @@ -89,26 +92,27 @@ def unpack(src, dst): uncompressed = struct.unpack('q', raw_uncompressed)[0] compression_index.append((compressed, uncompressed)) size_indexed += uncompressed - logging.debug(f"{len(compression_index)}: {size_indexed}/{size_unpacked} ({compressed}/{uncompressed}) - {raw_compressed} - {raw_uncompressed}") + logging.debug( + f"{len(compression_index)}: {size_indexed}/{size_unpacked} ({compressed}/{uncompressed}) - {raw_compressed} - {raw_uncompressed}") if size_unpacked != size_indexed: msg = f"Header-Index mismatch. Header indicates it should only have {size_unpacked} bytes when uncompressed but the index indicates {size_indexed} bytes." logging.critical(msg) raise CorruptUnpackException(msg) - #Read the actual archive data + # Read the actual archive data data = b'' read_data = 0 for compressed, uncompressed in compression_index: compressed_data = f.read(compressed) uncompressed_data = zlib.decompress(compressed_data) - #Verify the size of the data is consistent with the archives index + # Verify the size of the data is consistent with the archives index if len(uncompressed_data) == uncompressed: data += uncompressed_data read_data += 1 - #Verify there is only one partial chunk + # Verify there is only one partial chunk if len(uncompressed_data) != size_unpacked_chunk and read_data != len(compression_index): msg = f"Index contains more than one partial chunk: was {len(uncompressed_data)} when the full chunk size is {size_unpacked_chunk}, chunk {read_data}/{len(compression_index)}" logging.critical(msg) @@ -126,7 +130,7 @@ def unpack(src, dst): logging.critical(msg) raise SignatureUnpackException(msg) - #Write the extracted data to disk + # Write the extracted data to disk with open(dst, 'wb') as f: f.write(data) logging.info("Archive has been extracted.") @@ -338,7 +342,9 @@ def config_ark(list_config=list_config): else: listen_server = True - yaml_create(game := "ARK", dir_server := "", cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server) + yaml_create(game := "ARK", dir_server := "", cluster_server, map_s, list_config[-1], port_server, query_port, + rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, + cluster_dir_override, listen_server) def config_7daystodie(): @@ -361,8 +367,10 @@ def xml_parser(): print("Я не умею парсить))") -def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="", port_server="", query_port="", rcon_enabled="", rcon_port="", - adminpassword_server="", password_server="", max_players="", id_mods_ark="", cluster_id="", cluster_dir_override="", listen_server=""): +def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="", port_server="", query_port="", + rcon_enabled="", rcon_port="", + adminpassword_server="", password_server="", max_players="", id_mods_ark="", cluster_id="", + cluster_dir_override="", listen_server=""): if game == "ARK": print_line(dir_maps_ark) print_line(name_server) @@ -444,7 +452,8 @@ WantedBy=default.target @hlna.command(help='Для скачивания и установки модов') @click.option('-g', help="Название игры для запуска. (ark, 7days") @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") -def modinstall(g, m): +@click.option("-i/-u", default=True, help="-i установить моды, -u удалить моды") +def mod(g, m, i): if g == "ark": id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): @@ -452,15 +461,18 @@ def modinstall(g, m): id_mods_ark = input("""Укажите id модов через запятую :""").split(",") for id_mod in id_mods_ark: - os.system(f"steamcmd +login anonymous +workshop_download_item {id_game_workshop} {id_mod} +quit") - modextract(id_mod, id_game_workshop) + dir_ark_mods = f"{dir_mods_ark}/{id_mod}" + if i: + os.system(f"steamcmd +login anonymous +workshop_download_item {id_game_workshop} {id_mod} +quit") + modextract(id_mod, id_game_workshop, dir_ark_mods) + else: + os.system(f"rm -rf {dir_ark_mods}") + os.system(f"rm {dir_mods_ark}/{id_mod}.mod") -def modextract(id_mod, id_game_workshop): +def modextract(id_mod, id_game_workshop, dir_ark_mods): dir_steam_workshop = f"{dir_workshop_ark}/content/{id_game_workshop}/{id_mod}/WindowsNoEditor" - dir_ark_mods = f"{dir_mods_ark}/{id_mod}" dir_extract = dir_ark_mods - if id_mod == "111111111": return @@ -483,7 +495,8 @@ def modextract(id_mod, id_game_workshop): os.system(f"rm -rf {dir_ark_mods}") os.system(f"mv -f {dir_steam_workshop} {dir_ark_mods}") - modname = subprocess.check_output(['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mod)]).decode('utf-8') + modname = subprocess.check_output( + ['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mod)]).decode('utf-8') modname = re.search(r'
(.+)
', modname) modname = modname and modname.group(1) @@ -494,8 +507,8 @@ def modextract(id_mod, id_game_workshop): with open(f"{dir_extract}/mod.info", "rb") as modinfo: data = modinfo.read() mapnamelen = struct.unpack_from(" Date: Sun, 14 May 2023 22:31:24 +0300 Subject: [PATCH 145/244] 1 --- hlna.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hlna.py b/hlna.py index 13ce1c0..2e15fb1 100755 --- a/hlna.py +++ b/hlna.py @@ -449,11 +449,11 @@ WantedBy=default.target os.system(f"systemctl --user enable {unit_name}") -@hlna.command(help='Для скачивания и установки модов') -@click.option('-g', help="Название игры для запуска. (ark, 7days") -@click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") -@click.option("-i/-u", default=True, help="-i установить моды, -u удалить моды") -def mod(g, m, i): +@click.command(help='Для скачивания и установки модов') +@click.argument('g', nargs=1, help="Для выбора игры") +@click.option('-m', nargs=-1, default='all', help="Название карты для запуска или all для запуска всех карт") +@click.option("-iu", "install", flag_value=True, default=True, help="-i установить моды, -u удалить моды") +def mod_install(g, m, i, id_mods_ark): if g == "ark": id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): From cbb4b05b52af8c918f97cfb4a54afeae25144d12 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 22:33:02 +0300 Subject: [PATCH 146/244] 1 --- hlna.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 2e15fb1..96d9cdb 100755 --- a/hlna.py +++ b/hlna.py @@ -451,8 +451,9 @@ WantedBy=default.target @click.command(help='Для скачивания и установки модов') @click.argument('g', nargs=1, help="Для выбора игры") -@click.option('-m', nargs=-1, default='all', help="Название карты для запуска или all для запуска всех карт") +@click.option('-m', default='all', help="Название карты для запуска или all для запуска всех карт") @click.option("-iu", "install", flag_value=True, default=True, help="-i установить моды, -u удалить моды") +@click.argument("id_mods_ark", nargs=-1) def mod_install(g, m, i, id_mods_ark): if g == "ark": id_game_workshop = "346110" From 13c168650f70b9d0c40e58e46496727a730cbe67 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 22:34:53 +0300 Subject: [PATCH 147/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 96d9cdb..be02a86 100755 --- a/hlna.py +++ b/hlna.py @@ -450,7 +450,7 @@ WantedBy=default.target @click.command(help='Для скачивания и установки модов') -@click.argument('g', nargs=1, help="Для выбора игры") +@click.argument('g', nargs=1) @click.option('-m', default='all', help="Название карты для запуска или all для запуска всех карт") @click.option("-iu", "install", flag_value=True, default=True, help="-i установить моды, -u удалить моды") @click.argument("id_mods_ark", nargs=-1) From 1d0d1bc1c7b37e39d403fd2abee92c88e9e65c6b Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 22:35:14 +0300 Subject: [PATCH 148/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index be02a86..0c7add9 100755 --- a/hlna.py +++ b/hlna.py @@ -454,7 +454,7 @@ WantedBy=default.target @click.option('-m', default='all', help="Название карты для запуска или all для запуска всех карт") @click.option("-iu", "install", flag_value=True, default=True, help="-i установить моды, -u удалить моды") @click.argument("id_mods_ark", nargs=-1) -def mod_install(g, m, i, id_mods_ark): +def mod(g, m, i, id_mods_ark): if g == "ark": id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): From 04abea2e189797d5fdca7327e16c4f24a7714575 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 22:36:27 +0300 Subject: [PATCH 149/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 0c7add9..94a047b 100755 --- a/hlna.py +++ b/hlna.py @@ -453,7 +453,7 @@ WantedBy=default.target @click.argument('g', nargs=1) @click.option('-m', default='all', help="Название карты для запуска или all для запуска всех карт") @click.option("-iu", "install", flag_value=True, default=True, help="-i установить моды, -u удалить моды") -@click.argument("id_mods_ark", nargs=-1) +# @click.argument("id_mods_ark", nargs=-1) def mod(g, m, i, id_mods_ark): if g == "ark": id_game_workshop = "346110" From 7c8438ea25e830efccd5d6de088e98367ba331b7 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 22:37:03 +0300 Subject: [PATCH 150/244] 1 --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 94a047b..83ed498 100755 --- a/hlna.py +++ b/hlna.py @@ -449,11 +449,11 @@ WantedBy=default.target os.system(f"systemctl --user enable {unit_name}") -@click.command(help='Для скачивания и установки модов') +@hlna.command(help='Для скачивания и установки модов') @click.argument('g', nargs=1) @click.option('-m', default='all', help="Название карты для запуска или all для запуска всех карт") @click.option("-iu", "install", flag_value=True, default=True, help="-i установить моды, -u удалить моды") -# @click.argument("id_mods_ark", nargs=-1) +@click.argument("id_mods_ark", nargs=-1) def mod(g, m, i, id_mods_ark): if g == "ark": id_game_workshop = "346110" From a8011670ff1dc82a7f3fa9320ab6d477783167d4 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 22:38:20 +0300 Subject: [PATCH 151/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 83ed498..18c4a4c 100755 --- a/hlna.py +++ b/hlna.py @@ -452,7 +452,7 @@ WantedBy=default.target @hlna.command(help='Для скачивания и установки модов') @click.argument('g', nargs=1) @click.option('-m', default='all', help="Название карты для запуска или all для запуска всех карт") -@click.option("-iu", "install", flag_value=True, default=True, help="-i установить моды, -u удалить моды") +@click.option("-iu", flag_value=True, default=True, help="-i установить моды, -u удалить моды") @click.argument("id_mods_ark", nargs=-1) def mod(g, m, i, id_mods_ark): if g == "ark": From 51f392c4e559583c2a9c0ef665c2faf6150bacbb Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 22:39:44 +0300 Subject: [PATCH 152/244] 1 --- hlna.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index 18c4a4c..ae88dd3 100755 --- a/hlna.py +++ b/hlna.py @@ -452,9 +452,8 @@ WantedBy=default.target @hlna.command(help='Для скачивания и установки модов') @click.argument('g', nargs=1) @click.option('-m', default='all', help="Название карты для запуска или all для запуска всех карт") -@click.option("-iu", flag_value=True, default=True, help="-i установить моды, -u удалить моды") -@click.argument("id_mods_ark", nargs=-1) -def mod(g, m, i, id_mods_ark): +@click.option("-iu", "id_mods_ark", flag_value=True, default=True, help="-i установить моды, -u удалить моды") +def mod(g, m, i): if g == "ark": id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): From a5869ebc1998e6c1b982ee2fef570774eadcea98 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 22:42:19 +0300 Subject: [PATCH 153/244] 1 --- hlna.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index ae88dd3..56c2aec 100755 --- a/hlna.py +++ b/hlna.py @@ -452,8 +452,9 @@ WantedBy=default.target @hlna.command(help='Для скачивания и установки модов') @click.argument('g', nargs=1) @click.option('-m', default='all', help="Название карты для запуска или all для запуска всех карт") -@click.option("-iu", "id_mods_ark", flag_value=True, default=True, help="-i установить моды, -u удалить моды") -def mod(g, m, i): +@click.option("-i/-u", default=True, help="-i установить моды, -u удалить моды") +@click.argument('id_mods_ark', nargs=-1) +def mod(g, m, i, id_mods_ark): if g == "ark": id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): From 7b15c4f32f8e48ec9e4531ae4942ff99f60e3e05 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 22:43:08 +0300 Subject: [PATCH 154/244] 1 --- hlna.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/hlna.py b/hlna.py index 56c2aec..f4a278c 100755 --- a/hlna.py +++ b/hlna.py @@ -459,8 +459,6 @@ def mod(g, m, i, id_mods_ark): id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): create_dir(dir_workshop_ark) - id_mods_ark = input("""Укажите id модов через запятую -:""").split(",") for id_mod in id_mods_ark: dir_ark_mods = f"{dir_mods_ark}/{id_mod}" if i: From 7c5c966c830972214fda535d0a86e113dbdae268 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 22:44:45 +0300 Subject: [PATCH 155/244] 1 --- hlna.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index f4a278c..e2f1bbf 100755 --- a/hlna.py +++ b/hlna.py @@ -466,8 +466,9 @@ def mod(g, m, i, id_mods_ark): modextract(id_mod, id_game_workshop, dir_ark_mods) else: os.system(f"rm -rf {dir_ark_mods}") + print_line(f"{dir_ark_mods} удалён") os.system(f"rm {dir_mods_ark}/{id_mod}.mod") - + print_line(f"{dir_mods_ark}/{id_mod}.mod удалён") def modextract(id_mod, id_game_workshop, dir_ark_mods): dir_steam_workshop = f"{dir_workshop_ark}/content/{id_game_workshop}/{id_mod}/WindowsNoEditor" From 335faca5a2f31b6e6275620339c7b914cca31055 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 22:45:49 +0300 Subject: [PATCH 156/244] 1 --- hlna.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/hlna.py b/hlna.py index e2f1bbf..0a4a7d3 100755 --- a/hlna.py +++ b/hlna.py @@ -515,8 +515,6 @@ def modextract(id_mod, id_game_workshop, dir_ark_mods): modpath = b"../../../" + dir_shooter.encode() + b"/Content/Mods/" + id_mod.encode() + b'\x00' modpathlen = len(modpath) with open(f"{dir_ark_mods}.mod", "wb") as mod: - print(type(modnamelen)) - print(type(modpathlen)) mod.write(struct.pack(' Date: Sun, 14 May 2023 22:54:17 +0300 Subject: [PATCH 157/244] =?UTF-8?q?=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D0=B8=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=BE=D0=B4=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 0a4a7d3..6824dfc 100755 --- a/hlna.py +++ b/hlna.py @@ -496,7 +496,7 @@ def modextract(id_mod, id_game_workshop, dir_ark_mods): os.system(f"mv -f {dir_steam_workshop} {dir_ark_mods}") modname = subprocess.check_output( - ['curl', '-s', 'https://steamcommunity.com/sharedfiles/filedetails/?id={}'.format(id_mod)]).decode('utf-8') + ['curl', '-s', f'https://steamcommunity.com/sharedfiles/filedetails/?id={id_mod}']).decode('utf-8') modname = re.search(r'
(.+)
', modname) modname = modname and modname.group(1) @@ -515,7 +515,7 @@ def modextract(id_mod, id_game_workshop, dir_ark_mods): modpath = b"../../../" + dir_shooter.encode() + b"/Content/Mods/" + id_mod.encode() + b'\x00' modpathlen = len(modpath) with open(f"{dir_ark_mods}.mod", "wb") as mod: - mod.write(struct.pack(' Date: Sun, 14 May 2023 22:59:17 +0300 Subject: [PATCH 158/244] 1 --- hlna.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 6824dfc..a532584 100755 --- a/hlna.py +++ b/hlna.py @@ -471,6 +471,7 @@ def mod(g, m, i, id_mods_ark): print_line(f"{dir_mods_ark}/{id_mod}.mod удалён") def modextract(id_mod, id_game_workshop, dir_ark_mods): + print_line(id_mod) dir_steam_workshop = f"{dir_workshop_ark}/content/{id_game_workshop}/{id_mod}/WindowsNoEditor" dir_extract = dir_ark_mods if id_mod == "111111111": @@ -515,7 +516,7 @@ def modextract(id_mod, id_game_workshop, dir_ark_mods): modpath = b"../../../" + dir_shooter.encode() + b"/Content/Mods/" + id_mod.encode() + b'\x00' modpathlen = len(modpath) with open(f"{dir_ark_mods}.mod", "wb") as mod: - mod.write(struct.pack(f' Date: Sun, 14 May 2023 23:00:44 +0300 Subject: [PATCH 159/244] 1 --- hlna.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hlna.py b/hlna.py index a532584..051ce98 100755 --- a/hlna.py +++ b/hlna.py @@ -463,6 +463,7 @@ def mod(g, m, i, id_mods_ark): dir_ark_mods = f"{dir_mods_ark}/{id_mod}" if i: os.system(f"steamcmd +login anonymous +workshop_download_item {id_game_workshop} {id_mod} +quit") + print_line("вызов экстракт") modextract(id_mod, id_game_workshop, dir_ark_mods) else: os.system(f"rm -rf {dir_ark_mods}") @@ -470,6 +471,7 @@ def mod(g, m, i, id_mods_ark): os.system(f"rm {dir_mods_ark}/{id_mod}.mod") print_line(f"{dir_mods_ark}/{id_mod}.mod удалён") + def modextract(id_mod, id_game_workshop, dir_ark_mods): print_line(id_mod) dir_steam_workshop = f"{dir_workshop_ark}/content/{id_game_workshop}/{id_mod}/WindowsNoEditor" From 39d28b05c7f8d9c08f05824387ae59b22c258a35 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 23:02:21 +0300 Subject: [PATCH 160/244] 1 --- hlna.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hlna.py b/hlna.py index 051ce98..a14607f 100755 --- a/hlna.py +++ b/hlna.py @@ -459,6 +459,7 @@ def mod(g, m, i, id_mods_ark): id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): create_dir(dir_workshop_ark) + print_line(id_mods_ark) for id_mod in id_mods_ark: dir_ark_mods = f"{dir_mods_ark}/{id_mod}" if i: From 2a58e4ec4a600bca9a984fcb9b5bdddcc63d5899 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 23:03:45 +0300 Subject: [PATCH 161/244] 1 --- hlna.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hlna.py b/hlna.py index a14607f..202a965 100755 --- a/hlna.py +++ b/hlna.py @@ -459,6 +459,7 @@ def mod(g, m, i, id_mods_ark): id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): create_dir(dir_workshop_ark) + id_mods_ark.split(",") print_line(id_mods_ark) for id_mod in id_mods_ark: dir_ark_mods = f"{dir_mods_ark}/{id_mod}" From 856483510f93509059e29a841f82b084bd17fc97 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 23:04:35 +0300 Subject: [PATCH 162/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 202a965..7427d15 100755 --- a/hlna.py +++ b/hlna.py @@ -459,7 +459,7 @@ def mod(g, m, i, id_mods_ark): id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): create_dir(dir_workshop_ark) - id_mods_ark.split(",") + list(id_mods_ark) print_line(id_mods_ark) for id_mod in id_mods_ark: dir_ark_mods = f"{dir_mods_ark}/{id_mod}" From 28ef9eb9b16df5f4c95d254e7ad03dc7334b0a12 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 23:05:39 +0300 Subject: [PATCH 163/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 7427d15..aa72985 100755 --- a/hlna.py +++ b/hlna.py @@ -459,7 +459,7 @@ def mod(g, m, i, id_mods_ark): id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): create_dir(dir_workshop_ark) - list(id_mods_ark) + id_mods_ark = list(id_mods_ark) print_line(id_mods_ark) for id_mod in id_mods_ark: dir_ark_mods = f"{dir_mods_ark}/{id_mod}" From bd71ee756f02bb6d43cad08b3cb61ef80841f372 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 23:09:09 +0300 Subject: [PATCH 164/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index aa72985..f45dd50 100755 --- a/hlna.py +++ b/hlna.py @@ -459,7 +459,7 @@ def mod(g, m, i, id_mods_ark): id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): create_dir(dir_workshop_ark) - id_mods_ark = list(id_mods_ark) + id_mods_ark = dir_mods_ark[0].split(',') print_line(id_mods_ark) for id_mod in id_mods_ark: dir_ark_mods = f"{dir_mods_ark}/{id_mod}" From d6e456d25962bf3bc3f20aa5f4772731ccfb68d1 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 23:10:13 +0300 Subject: [PATCH 165/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index f45dd50..c129903 100755 --- a/hlna.py +++ b/hlna.py @@ -459,7 +459,7 @@ def mod(g, m, i, id_mods_ark): id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): create_dir(dir_workshop_ark) - id_mods_ark = dir_mods_ark[0].split(',') + id_mods_ark = dir_mods_ark[0] print_line(id_mods_ark) for id_mod in id_mods_ark: dir_ark_mods = f"{dir_mods_ark}/{id_mod}" From ba695cfaf63a277e95eb3de46ad3616299cf6b82 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 23:10:40 +0300 Subject: [PATCH 166/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index c129903..f0ac4c8 100755 --- a/hlna.py +++ b/hlna.py @@ -459,7 +459,7 @@ def mod(g, m, i, id_mods_ark): id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): create_dir(dir_workshop_ark) - id_mods_ark = dir_mods_ark[0] + id_mods_ark = id_mods_ark[0] print_line(id_mods_ark) for id_mod in id_mods_ark: dir_ark_mods = f"{dir_mods_ark}/{id_mod}" From 2d61d5cfac61054b9df2d8a20d38ceaa2c61bf08 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 23:10:50 +0300 Subject: [PATCH 167/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index f0ac4c8..32f8c46 100755 --- a/hlna.py +++ b/hlna.py @@ -459,7 +459,7 @@ def mod(g, m, i, id_mods_ark): id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): create_dir(dir_workshop_ark) - id_mods_ark = id_mods_ark[0] + id_mods_ark = id_mods_ark[0].split(',') print_line(id_mods_ark) for id_mod in id_mods_ark: dir_ark_mods = f"{dir_mods_ark}/{id_mod}" From 230794d0e3fad89b02c146186b2c115d276014e7 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 14 May 2023 23:14:02 +0300 Subject: [PATCH 168/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 32f8c46..9222523 100755 --- a/hlna.py +++ b/hlna.py @@ -520,7 +520,7 @@ def modextract(id_mod, id_game_workshop, dir_ark_mods): modpath = b"../../../" + dir_shooter.encode() + b"/Content/Mods/" + id_mod.encode() + b'\x00' modpathlen = len(modpath) with open(f"{dir_ark_mods}.mod", "wb") as mod: - mod.write(struct.pack(f' Date: Mon, 15 May 2023 15:56:55 +0300 Subject: [PATCH 169/244] =?UTF-8?q?=D1=87=D0=B8=D1=81=D1=82=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=BD=D1=82=D0=BE=D0=B2=20=D0=B8=20=D1=83?= =?UTF-8?q?=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BB=D0=B8=D1=88?= =?UTF-8?q?=D0=BD=D0=B5=D0=B3=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/hlna.py b/hlna.py index 9222523..00ab10d 100755 --- a/hlna.py +++ b/hlna.py @@ -20,27 +20,11 @@ home_dir = Path.home() logging.basicConfig(stream=sys.stderr, level=logging.CRITICAL) -class UnpackException(Exception): - pass - - -class SignatureUnpackException(UnpackException): - pass - - -class CorruptUnpackException(UnpackException): - pass - - def find_file(path): """Находим все конфиги в зависимости от пути""" arr = next(os.walk(path), (None, None, []))[2] # [] if no file - x = arr.count('.directory') - y = arr.count('logs') - if x > 0: + if '.directory' in arr: arr.remove('.directory') - if y > 0: - arr.remove('logs') return arr @@ -52,11 +36,12 @@ delist_config = find_file(dir_deactivated) def path_server(): + 'Получение пути для хранения файлов серверов, записываем путь в yaml файл' dir_server = input(f"""Укажите путь до каталога, где будут храниться файлы сервера. По-умолчанию {home_dir}/Servers/ :""") - if dir_server == "": + if not dir_server: dir_server = f"{home_dir}/Servers/" - yaml_create(game := "path_server", dir_server) + yaml_create("path_server", dir_server) return dir_server @@ -66,6 +51,7 @@ def hlna(): def unpack(src, dst): + 'Добавить документацию' with open(src, 'rb') as f: sigver = struct.unpack('q', f.read(8))[0] unpacked_chunk = f.read(8) @@ -98,7 +84,8 @@ def unpack(src, dst): if size_unpacked != size_indexed: msg = f"Header-Index mismatch. Header indicates it should only have {size_unpacked} bytes when uncompressed but the index indicates {size_indexed} bytes." logging.critical(msg) - raise CorruptUnpackException(msg) + return print(msg) + # Read the actual archive data data = b'' @@ -116,19 +103,19 @@ def unpack(src, dst): if len(uncompressed_data) != size_unpacked_chunk and read_data != len(compression_index): msg = f"Index contains more than one partial chunk: was {len(uncompressed_data)} when the full chunk size is {size_unpacked_chunk}, chunk {read_data}/{len(compression_index)}" logging.critical(msg) - raise CorruptUnpackException(msg) + return print(msg) else: msg = f"Uncompressed chunk size is not the same as in the index: was {len(uncompressed_data)} but should be {uncompressed}." logging.critical(msg) - raise CorruptUnpackException(msg) + return print(msg) else: msg = f"Data types in the headers should be int's. Size Types: unpacked_chunk({type(size_unpacked_chunk)}), packed({type(size_packed)}), unpacked({type(size_unpacked)})" logging.critical(msg) - raise CorruptUnpackException(msg) + return print(msg) else: msg = "The signature and format version is incorrect. Signature was {} should be 2653586369.".format(sigver) logging.critical(msg) - raise SignatureUnpackException(msg) + return print(msg) # Write the extracted data to disk with open(dst, 'wb') as f: @@ -142,7 +129,7 @@ def create_dir(directory): os.makedirs(directory) -def print_line(text): +def print_line(*text): """Добавление тире вокруг текста, покраска""" print(colorama.Fore.YELLOW + "-" * 30) print(f"{colorama.Fore.GREEN} + {text}") @@ -425,6 +412,7 @@ def systemd_unit_create(game, config_7days="", name_server=list_config): systemd_unit_exec = f"{dir_server_7days}startserver.sh -configfile={config_7days}.xml" unit_file = f"{dir_unit}7days.service".lower() + unit_text = f'''[Unit] Description={game}: Server Wants=network-online.target From bf2df5238caa27e671499ea39c270ae948c6004e Mon Sep 17 00:00:00 2001 From: sitisll Date: Mon, 15 May 2023 16:05:40 +0300 Subject: [PATCH 170/244] path server --- hlna.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 00ab10d..02d7580 100755 --- a/hlna.py +++ b/hlna.py @@ -392,7 +392,8 @@ def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="" with open(path_yaml, 'w') as yamlfile: yaml.dump(settings, yamlfile) print(colorama.Fore.GREEN + "Конфиг создан" + colorama.Style.RESET_ALL) - systemd_unit_create(game) + if game != "path_server": + systemd_unit_create(game) def systemd_unit_create(game, config_7days="", name_server=list_config): From ffd37bad3c8787e9275b07278851856859694129 Mon Sep 17 00:00:00 2001 From: sitisll Date: Mon, 15 May 2023 17:12:51 +0300 Subject: [PATCH 171/244] =?UTF-8?q?=D1=87=D0=B8=D1=81=D1=82=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 97 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 52 insertions(+), 45 deletions(-) diff --git a/hlna.py b/hlna.py index 02d7580..0adcedb 100755 --- a/hlna.py +++ b/hlna.py @@ -132,7 +132,7 @@ def create_dir(directory): def print_line(*text): """Добавление тире вокруг текста, покраска""" print(colorama.Fore.YELLOW + "-" * 30) - print(f"{colorama.Fore.GREEN} + {text}") + print(colorama.Fore.GREEN, *text) print(colorama.Fore.YELLOW + "-" * 30 + colorama.Style.RESET_ALL) @@ -151,6 +151,7 @@ def check_int(number=""): @hlna.command(help='Сбор настроек для сервера или кластера') def config(): + "Выбор игры для создания сервера" while True: count_game = check_int("""Выберите игру для конфигурирования 1. ARK Survival Evolved @@ -158,19 +159,17 @@ def config(): : """) if count_game == 1: config_ark() - break elif count_game == 2: config_7daystodie() - break else: print_line("Пока есть только ARK и 7Days xD") def config_ark(list_config=list_config): + "конфигурирование сервера арк" create_dir(dir_server_ark) create_dir(dir_maps_ark) """Сбор данных для конфига""" - data = {} port_s = [] rcon_p = [] query_p = [] @@ -184,9 +183,14 @@ def config_ark(list_config=list_config): : """) if count_cluster == 1: cluster_server = True - cluster_id = input("Укажите id для кластера, любое сочетание символов: \n") - create_dir(dir_server_ark + cluster_id) - cluster_dir_override = (dir_server_ark + cluster_id) + while True: + cluster_id = input("Укажите id для кластера, любое сочетание символов: \n") + if cluster_id == '': + print("Введите символы: ") + else: + create_dir(dir_server_ark + cluster_id) + cluster_dir_override = (dir_server_ark + cluster_id) + break else: cluster_server = False @@ -223,11 +227,11 @@ def config_ark(list_config=list_config): break if list_config: - for i in list_config: - data = read_yaml(i, game="ARK") - port_s.append(data['Port']) - rcon_p.append(data['RCONPort']) - query_p.append(data['QueryPort']) + for k in list_config: + data_port = read_yaml(k, game="ARK") + port_s.append(data_port['Port']) + rcon_p.append(data_port['RCONPort']) + query_p.append(data_port['QueryPort']) if amount_map == 1: map_s = "TheIsland" @@ -329,16 +333,16 @@ def config_ark(list_config=list_config): else: listen_server = True - yaml_create(game := "ARK", dir_server := "", cluster_server, map_s, list_config[-1], port_server, query_port, + yaml_create("ARK", "", cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server) def config_7daystodie(): - list_simvols = "$@-.%{}+/".split() + "конфигурирование сервера 7 days to die" + list_simvols = ("$","@","-",".","%","{","}","+","/") create_dir(dir_server_7days) - print("Введите имя конфига (serverconfig):\n") - config_7days = input() + config_7days = input("Введите имя конфига (serverconfig):\n") if config_7days == "": config_7days = "serverconfig" elif config_7days == "serverconfig": @@ -347,10 +351,11 @@ def config_7daystodie(): print_line("Запрещённые символы") else: xml_parser() - systemd_unit_create(game := "7Days", config_7days) + systemd_unit_create("7Days", config_7days) def xml_parser(): + "добавить документацию" print("Я не умею парсить))") @@ -358,9 +363,8 @@ def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="" rcon_enabled="", rcon_port="", adminpassword_server="", password_server="", max_players="", id_mods_ark="", cluster_id="", cluster_dir_override="", listen_server=""): + "добавить документацию" if game == "ARK": - print_line(dir_maps_ark) - print_line(name_server) path_yaml = dir_maps_ark + name_server settings = [ { @@ -397,7 +401,7 @@ def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="" def systemd_unit_create(game, config_7days="", name_server=list_config): - print_line(systemd_unit_create) + "добавить документацию" if game == "ARK": id_game = "376030" for i in name_server: @@ -444,17 +448,16 @@ WantedBy=default.target @click.option("-i/-u", default=True, help="-i установить моды, -u удалить моды") @click.argument('id_mods_ark', nargs=-1) def mod(g, m, i, id_mods_ark): + "добавить документацию" if g == "ark": id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): create_dir(dir_workshop_ark) id_mods_ark = id_mods_ark[0].split(',') - print_line(id_mods_ark) for id_mod in id_mods_ark: dir_ark_mods = f"{dir_mods_ark}/{id_mod}" if i: os.system(f"steamcmd +login anonymous +workshop_download_item {id_game_workshop} {id_mod} +quit") - print_line("вызов экстракт") modextract(id_mod, id_game_workshop, dir_ark_mods) else: os.system(f"rm -rf {dir_ark_mods}") @@ -464,12 +467,11 @@ def mod(g, m, i, id_mods_ark): def modextract(id_mod, id_game_workshop, dir_ark_mods): - print_line(id_mod) + "добавить документацию" dir_steam_workshop = f"{dir_workshop_ark}/content/{id_game_workshop}/{id_mod}/WindowsNoEditor" dir_extract = dir_ark_mods if id_mod == "111111111": return - try: for curdir, subdirs, files in os.walk(os.path.join(dir_steam_workshop)): for file in files: @@ -483,19 +485,19 @@ def modextract(id_mod, id_game_workshop, dir_ark_mods): os.remove(src) if os.path.isfile(uncompressed): os.remove(uncompressed) - except (UnpackException, SignatureUnpackException, CorruptUnpackException) as e: + except Exception as e: + print(e) print("[x] Unpacking .z files failed, aborting mod install") return False + os.system(f"rm -rf {dir_ark_mods}") os.system(f"mv -f {dir_steam_workshop} {dir_ark_mods}") - modname = subprocess.check_output( - ['curl', '-s', f'https://steamcommunity.com/sharedfiles/filedetails/?id={id_mod}']).decode('utf-8') + modname = subprocess.check_output(['curl', '-s', f'https://steamcommunity.com/sharedfiles/filedetails/?id={id_mod}']).decode('utf-8') modname = re.search(r'
(.+)
', modname) modname = modname and modname.group(1) if os.path.isfile(f"{dir_ark_mods}.mod"): - print_line(id_mod) os.remove(f"{dir_ark_mods}.mod") with open(f"{dir_extract}/mod.info", "rb") as modinfo: @@ -539,7 +541,7 @@ def enablemap(m, e): m = m.split(",") if not os.path.isdir(dir_deactivated): create_dir(dir_deactivated) - if e == True: + if e: port_s = [] query_p = [] for k in list_config: @@ -566,11 +568,8 @@ def enablemap(m, e): print(f"Карта активирована - {i}") else: print(f"{i} либо уже активирована, либо такой карты нет") - finally: - pass - # except: - # print("ошибка при активации карты") - # pass + except: + print("ошибка при активации карты") else: for i in m: try: @@ -586,14 +585,15 @@ def enablemap(m, e): else: print(f"{i} либо деактивирована, либо такой карты нет") except: - pass + print("ошибка при деактивации карты") @hlna.command() def status(list_config=list_config): + "добавить документацию" # Добавить сортивку по кластерам и вывод несколько столбиков if list_config == [] and delist_config == []: - print("Сервера не сконфигурированы") + print_line("Сервера не сконфигурированы") else: for i in list_config: data = read_yaml(i, game="ARK") @@ -606,7 +606,7 @@ def status(list_config=list_config): Имя сервера: {i} Карта: {data['map']} Моды: {data['ModsId']} - Пароль: {data['ServerPassword']} + Пароль: {data['ServerPassword']}S Кластер: {data['Cluster']} Кластер id: {data['clusterid']} Query порт: {data['QueryPort']} @@ -637,27 +637,35 @@ def status(list_config=list_config): @hlna.command(help='Для запуска, сконфигурированного сервера или кластера') -@click.option('-g', help="Название игры для запуска. (ark, 7days") +@click.option('-g', required=True, help="Название игры для запуска. (ark, 7days") @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") def start(g, m): + "добавить документацию" + #добавить проверку на ввод аргумента ark/7day если else: давать подсказку + #если нет конфигов, то выводим что серверов нет start_stop("start", g, m) @hlna.command(help='Для остановки, сконфигурированного сервера или кластера') -@click.option('-g', help="Название игры для запуска. (ark, 7days") +@click.option('-g', required=True, help="Название игры для запуска. (ark, 7days") @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") def stop(g, m): + "добавить документацию" + #добавить проверку на ввод аргумента ark/7day если else: давать подсказку + #если нет конфигов, то выводим что серверов нет start_stop("stop", g, m) @hlna.command(help='Для перезапуска, сконфигурированного сервера или кластера') -@click.option('-g', help="Название игры для запуска. (ark, 7days") +@click.option('-g', required=True, help="Название игры для запуска. (ark, 7days") @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") def restart(g, m): + "добавить документацию" start_stop("restart", g, m) def start_stop(action, g, m, list_config=list_config): + "добавить документацию" if g == "ark": dict_mapname = {} dict_allmapname = [] @@ -680,7 +688,6 @@ def start_stop(action, g, m, list_config=list_config): y = os.system( f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") if action == "restart" or action == "stop" else "" x = os.system(f"systemctl --user {action} ark_{data['SessionName'].lower()}.service") - print_line(y) if x == 0: print_line("Готово") else: @@ -692,6 +699,7 @@ def start_stop(action, g, m, list_config=list_config): def read_yaml(list_config=list_config, flag=True, game=""): + "добавить документацию" # Читаем конфиги активных или неактивных карт в зависимости от флага if game == "ARK": path_yaml = f"{dir_maps_ark}{list_config}" if flag else f"{dir_deactivated}{list_config}" @@ -703,6 +711,7 @@ def read_yaml(list_config=list_config, flag=True, game=""): def choose_map(arr): + "добавить документацию" new_arr = [] arr = sorted(arr) print('Найдены сервера с этой картой') @@ -727,8 +736,7 @@ def choose_map(arr): @click.argument('c', nargs=1) @click.option('-m', required=True, help="Название карты для применения rcon команды") def rcon(m, c): - print_line(f"Команда: , {c}") - print_line(f"Карты: , {m}") + "добавить документацию" dict_mapname = {} dict_adminpwd = {} if list_config: @@ -742,7 +750,6 @@ def rcon(m, c): rcon_ports.append(rcon_p) else: for rcon_p, name_map in dict_mapname.items(): - print_line(f"переменные name_map и m {name_map} & {m}") # обьединить с таким же блоком в start() if name_map in m: rcon_ports.append(rcon_p) print_line(f"Карта которая запускается {name_map}") @@ -757,6 +764,7 @@ def rcon(m, c): def zero(x=""): + "Потом пригодится" return "" @@ -767,7 +775,6 @@ else: if data['path_server'] == "": path_server() else: - print_line(data['path_server']) dir_server = data['path_server'] dir_unit = f"{home_dir}/.config/systemd/user/" From 7ac346f0612587cf9a365f3905c79e4206fb33ea Mon Sep 17 00:00:00 2001 From: xpamych Date: Mon, 15 May 2023 20:36:52 +0300 Subject: [PATCH 172/244] =?UTF-8?q?=D0=9E=D0=BA=D0=BE=D0=BD=D1=87=D0=B0?= =?UTF-8?q?=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=B0=D1=8F=20=D1=87=D0=B8=D1=81?= =?UTF-8?q?=D1=82=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 93 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 40 deletions(-) diff --git a/hlna.py b/hlna.py index 0adcedb..a69cce8 100755 --- a/hlna.py +++ b/hlna.py @@ -36,7 +36,7 @@ delist_config = find_file(dir_deactivated) def path_server(): - 'Получение пути для хранения файлов серверов, записываем путь в yaml файл' + """Получение пути для хранения файлов серверов, записываем путь в yaml файл""" dir_server = input(f"""Укажите путь до каталога, где будут храниться файлы сервера. По-умолчанию {home_dir}/Servers/ :""") if not dir_server: @@ -51,7 +51,7 @@ def hlna(): def unpack(src, dst): - 'Добавить документацию' + """Добавить документацию""" with open(src, 'rb') as f: sigver = struct.unpack('q', f.read(8))[0] unpacked_chunk = f.read(8) @@ -149,9 +149,9 @@ def check_int(number=""): print_line("Введите число") -@hlna.command(help='Сбор настроек для сервера или кластера') +@hlna.command(help='Выбор игры и сбор настроек для сервера(-ов)') def config(): - "Выбор игры для создания сервера" + """Выбор игры для создания сервера""" while True: count_game = check_int("""Выберите игру для конфигурирования 1. ARK Survival Evolved @@ -166,9 +166,10 @@ def config(): def config_ark(list_config=list_config): - "конфигурирование сервера арк" + """конфигурирование сервера арк""" create_dir(dir_server_ark) create_dir(dir_maps_ark) + path_server() """Сбор данных для конфига""" port_s = [] rcon_p = [] @@ -206,7 +207,7 @@ def config_ark(list_config=list_config): for i in range(count_maps): while True: - "Проверка на выбор карты из списка" + """Проверка на выбор карты из списка""" amount_map = check_int("""Выберите карту из списка указав номер 1. The Island 2. The Center @@ -332,14 +333,14 @@ def config_ark(list_config=list_config): listen_server = False else: listen_server = True - + """Вызов создания конфига""" yaml_create("ARK", "", cluster_server, map_s, list_config[-1], port_server, query_port, - rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, - cluster_dir_override, listen_server) + rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, + cluster_id, cluster_dir_override, listen_server) def config_7daystodie(): - "конфигурирование сервера 7 days to die" + """конфигурирование сервера 7 days to die""" list_simvols = ("$","@","-",".","%","{","}","+","/") create_dir(dir_server_7days) config_7days = input("Введите имя конфига (serverconfig):\n") @@ -355,15 +356,14 @@ def config_7daystodie(): def xml_parser(): - "добавить документацию" - print("Я не умею парсить))") + """добавить документацию""" + print("Я пока не умею парсить xml))") def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="", port_server="", query_port="", - rcon_enabled="", rcon_port="", - adminpassword_server="", password_server="", max_players="", id_mods_ark="", cluster_id="", - cluster_dir_override="", listen_server=""): - "добавить документацию" + rcon_enabled="", rcon_port="", adminpassword_server="", password_server="", max_players="", + id_mods_ark="", cluster_id="", cluster_dir_override="", listen_server=""): + """Создаёт на основании собранных данных yaml конфиг""" if game == "ARK": path_yaml = dir_maps_ark + name_server settings = [ @@ -401,7 +401,7 @@ def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="" def systemd_unit_create(game, config_7days="", name_server=list_config): - "добавить документацию" + """Создаёт на основании yaml конфига systemd юнит""" if game == "ARK": id_game = "376030" for i in name_server: @@ -412,12 +412,11 @@ def systemd_unit_create(game, config_7days="", name_server=list_config): unit_file = f"{dir_unit}ark_{data['SessionName']}.service".lower() elif game == "7Days": id_game = "294420" - # сюда дописать обращение к xml для получения уникального имени сервера + # сюда дописать обращение к xml_parser для получения уникального имени сервера unit_dir_server = dir_server_7days systemd_unit_exec = f"{dir_server_7days}startserver.sh -configfile={config_7days}.xml" unit_file = f"{dir_unit}7days.service".lower() - unit_text = f'''[Unit] Description={game}: Server Wants=network-online.target @@ -442,13 +441,13 @@ WantedBy=default.target os.system(f"systemctl --user enable {unit_name}") -@hlna.command(help='Для скачивания и установки модов') +@hlna.command(help='Для скачивания и установки модов ') @click.argument('g', nargs=1) @click.option('-m', default='all', help="Название карты для запуска или all для запуска всех карт") @click.option("-i/-u", default=True, help="-i установить моды, -u удалить моды") @click.argument('id_mods_ark', nargs=-1) def mod(g, m, i, id_mods_ark): - "добавить документацию" + """Проводит операции на модами""" if g == "ark": id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): @@ -467,7 +466,7 @@ def mod(g, m, i, id_mods_ark): def modextract(id_mod, id_game_workshop, dir_ark_mods): - "добавить документацию" + """Распаковывает файлы мода и создаёт .mod файл для него""" dir_steam_workshop = f"{dir_workshop_ark}/content/{id_game_workshop}/{id_mod}/WindowsNoEditor" dir_extract = dir_ark_mods if id_mod == "111111111": @@ -561,7 +560,9 @@ def enablemap(m, e): print("Заменить query port?") continue x = os.system( - f"mv {dir_deactivated}{i} {dir_maps_ark} >> {dir_logs}{date} 2>&1") # Добавить текущее время + f"mv {dir_deactivated}{i} {dir_maps_ark} >> {dir_logs}{date} 2>&1") + os.system(f"systemctl --user stop ari_{i}") + os.system(f"systemctl --user disable ari_{i}") with open(f"{dir_logs}{date}.log", "a") as f: f.write(f"[{time}] File {i} has been moved to {dir_maps_ark}\n") if x == 0: @@ -577,7 +578,9 @@ def enablemap(m, e): print(f"Карта {i} уже есть в деактивированных") continue x = os.system( - f"mv {dir_maps_ark}{i} {dir_deactivated} >> {dir_logs}{date} 2>&1") # Добавить текущее время + f"mv {dir_maps_ark}{i} {dir_deactivated} >> {dir_logs}{date} 2>&1") + os.system(f"systemctl --user enable ari_{i}") + os.system(f"systemctl --user start ari_{i}") with open(f"{dir_logs}{date}.log", "a") as f: f.write(f"[{time}] File {i} has been moved to {dir_deactivated}\n") if x == 0: @@ -590,7 +593,7 @@ def enablemap(m, e): @hlna.command() def status(list_config=list_config): - "добавить документацию" + """Выводит статус настроеных серверов""" # Добавить сортивку по кластерам и вывод несколько столбиков if list_config == [] and delist_config == []: print_line("Сервера не сконфигурированы") @@ -640,9 +643,9 @@ def status(list_config=list_config): @click.option('-g', required=True, help="Название игры для запуска. (ark, 7days") @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") def start(g, m): - "добавить документацию" - #добавить проверку на ввод аргумента ark/7day если else: давать подсказку - #если нет конфигов, то выводим что серверов нет + """Запускает сервер выбранной игры""" + # добавить проверку на ввод аргумента ark/7day если else: давать подсказку + # если нет конфигов, то выводим что серверов нет start_stop("start", g, m) @@ -650,9 +653,7 @@ def start(g, m): @click.option('-g', required=True, help="Название игры для запуска. (ark, 7days") @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") def stop(g, m): - "добавить документацию" - #добавить проверку на ввод аргумента ark/7day если else: давать подсказку - #если нет конфигов, то выводим что серверов нет + """Останавливает сервер""" start_stop("stop", g, m) @@ -660,13 +661,27 @@ def stop(g, m): @click.option('-g', required=True, help="Название игры для запуска. (ark, 7days") @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") def restart(g, m): - "добавить документацию" + """Перезагружает сервер""" start_stop("restart", g, m) -def start_stop(action, g, m, list_config=list_config): - "добавить документацию" +def check_exist_servers(g): + """Проверяет наличие конфигов для активных карт""" if g == "ark": + if not os.path.exists(f"{dir_mods_ark}"): + print_line("Нет сконфигурированных серверов") # добавить отсюда вилку на вопрос с конфигурацией + else: + return + elif g == "7days": + print_line("7Days") + + +def start_stop(action, g, m, list_config=list_config): + """Функция изменения статусов сервера""" + if g != "ark" or "7days": + return + elif g == "ark": + check_exist_servers(g) dict_mapname = {} dict_allmapname = [] for i in list_config: @@ -690,8 +705,6 @@ def start_stop(action, g, m, list_config=list_config): x = os.system(f"systemctl --user {action} ark_{data['SessionName'].lower()}.service") if x == 0: print_line("Готово") - else: - print("Ни одной карты не установлено") elif g == "7days": x = os.system(f"systemctl --user {action} 7days.service") if x == 0: @@ -699,7 +712,7 @@ def start_stop(action, g, m, list_config=list_config): def read_yaml(list_config=list_config, flag=True, game=""): - "добавить документацию" + """Читает конфиги и отдаёт данные туда где их запросили""" # Читаем конфиги активных или неактивных карт в зависимости от флага if game == "ARK": path_yaml = f"{dir_maps_ark}{list_config}" if flag else f"{dir_deactivated}{list_config}" @@ -711,7 +724,7 @@ def read_yaml(list_config=list_config, flag=True, game=""): def choose_map(arr): - "добавить документацию" + """Функция выбора карт""" new_arr = [] arr = sorted(arr) print('Найдены сервера с этой картой') @@ -736,7 +749,7 @@ def choose_map(arr): @click.argument('c', nargs=1) @click.option('-m', required=True, help="Название карты для применения rcon команды") def rcon(m, c): - "добавить документацию" + """Функция обеспечивающая отправку команд на игровой сервер через rcon""" dict_mapname = {} dict_adminpwd = {} if list_config: @@ -764,7 +777,7 @@ def rcon(m, c): def zero(x=""): - "Потом пригодится" + """Потом пригодится""" return "" From b6470c1a73ebd2d1a04b1016804cac9cae97bc16 Mon Sep 17 00:00:00 2001 From: xpamych Date: Mon, 15 May 2023 20:44:50 +0300 Subject: [PATCH 173/244] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BF=D1=80=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B2=D0=BE?= =?UTF-8?q?=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE=D0=BC=20=D1=81?= =?UTF-8?q?=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D0=B8=20=D0=BA=D0=B0=D1=82?= =?UTF-8?q?=D0=B0=D0=BB=D0=BE=D0=B3=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hlna.py b/hlna.py index a69cce8..ac131f6 100755 --- a/hlna.py +++ b/hlna.py @@ -35,6 +35,15 @@ list_config = find_file(dir_maps_ark) delist_config = find_file(dir_deactivated) +def create_dir(directory): + """Проверка и создание директории""" + if not os.path.exists(directory): + os.makedirs(directory) + + +create_dir(dir_config) + + def path_server(): """Получение пути для хранения файлов серверов, записываем путь в yaml файл""" dir_server = input(f"""Укажите путь до каталога, где будут храниться файлы сервера. По-умолчанию {home_dir}/Servers/ @@ -123,10 +132,7 @@ def unpack(src, dst): logging.info("Archive has been extracted.") -def create_dir(directory): - """Проверка и создание директории""" - if not os.path.exists(directory): - os.makedirs(directory) + def print_line(*text): @@ -806,7 +812,6 @@ date = now.strftime("%Y-%m-%d") time = now.strftime("%H:%M:%S") create_dir(dir_server) create_dir(dir_unit) -create_dir(dir_config) create_dir(dir_logs) if __name__ == '__main__': From 90fe4faf39bdf6483b97d4ea2203a1f58c31961a Mon Sep 17 00:00:00 2001 From: xpamych Date: Mon, 15 May 2023 20:56:03 +0300 Subject: [PATCH 174/244] help --- hlna.py | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/hlna.py b/hlna.py index ac131f6..4a35b9c 100755 --- a/hlna.py +++ b/hlna.py @@ -447,13 +447,12 @@ WantedBy=default.target os.system(f"systemctl --user enable {unit_name}") -@hlna.command(help='Для скачивания и установки модов ') +@hlna.command(help='Скачивание и установка модов ') @click.argument('g', nargs=1) @click.option('-m', default='all', help="Название карты для запуска или all для запуска всех карт") @click.option("-i/-u", default=True, help="-i установить моды, -u удалить моды") @click.argument('id_mods_ark', nargs=-1) def mod(g, m, i, id_mods_ark): - """Проводит операции на модами""" if g == "ark": id_game_workshop = "346110" if not os.path.isdir(dir_workshop_ark): @@ -538,11 +537,10 @@ def modextract(id_mod, id_game_workshop, dir_ark_mods): os.makedirs(dir_ark_mods) -@hlna.command() -@click.option("-m", required=True, help="Название Сервера") +@hlna.command(help='Выключение/включение серверов (без удаления) Date: Mon, 15 May 2023 21:05:26 +0300 Subject: [PATCH 175/244] while - --- hlna.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/hlna.py b/hlna.py index 4a35b9c..2ec9da6 100755 --- a/hlna.py +++ b/hlna.py @@ -157,18 +157,16 @@ def check_int(number=""): @hlna.command(help='Выбор игры и сбор настроек для сервера(-ов)') def config(): - """Выбор игры для создания сервера""" - while True: - count_game = check_int("""Выберите игру для конфигурирования - 1. ARK Survival Evolved - 2. 7 Days to Die - : """) - if count_game == 1: - config_ark() - elif count_game == 2: - config_7daystodie() - else: - print_line("Пока есть только ARK и 7Days xD") + count_game = check_int("""Выберите игру для конфигурирования + 1. ARK Survival Evolved + 2. 7 Days to Die + : """) + if count_game == 1: + config_ark() + elif count_game == 2: + config_7daystodie() + else: + print_line("Пока есть только ARK и 7Days xD") def config_ark(list_config=list_config): From d22ef7762ff109c24e9444836256418db49ba37e Mon Sep 17 00:00:00 2001 From: xpamych Date: Mon, 15 May 2023 21:12:20 +0300 Subject: [PATCH 176/244] =?UTF-8?q?=D0=BA=D0=B0=D1=82=D0=B0=D0=BB=D0=BE?= =?UTF-8?q?=D0=B3=20=D0=B4=D0=BB=D1=8F=20=D0=BC=D0=BE=D0=B4=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index 2ec9da6..b48be9c 100755 --- a/hlna.py +++ b/hlna.py @@ -453,8 +453,8 @@ WantedBy=default.target def mod(g, m, i, id_mods_ark): if g == "ark": id_game_workshop = "346110" - if not os.path.isdir(dir_workshop_ark): - create_dir(dir_workshop_ark) + if not os.path.isdir(dir_mods_ark): + create_dir(dir_mods_ark) id_mods_ark = id_mods_ark[0].split(',') for id_mod in id_mods_ark: dir_ark_mods = f"{dir_mods_ark}/{id_mod}" From 9e58fa4907d539d20310dfbaecaeeae068a9fb1a Mon Sep 17 00:00:00 2001 From: xpamych Date: Mon, 15 May 2023 21:33:29 +0300 Subject: [PATCH 177/244] 1 --- hlna.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hlna.py b/hlna.py index b48be9c..85746ce 100755 --- a/hlna.py +++ b/hlna.py @@ -563,8 +563,8 @@ def switch(m, e): continue x = os.system( f"mv {dir_deactivated}{i} {dir_maps_ark} >> {dir_logs}{date} 2>&1") - os.system(f"systemctl --user stop ari_{i}") - os.system(f"systemctl --user disable ari_{i}") + os.system(f"systemctl --user stop ark_{i}") + os.system(f"systemctl --user disable ark_{i}") with open(f"{dir_logs}{date}.log", "a") as f: f.write(f"[{time}] File {i} has been moved to {dir_maps_ark}\n") if x == 0: @@ -581,8 +581,8 @@ def switch(m, e): continue x = os.system( f"mv {dir_maps_ark}{i} {dir_deactivated} >> {dir_logs}{date} 2>&1") - os.system(f"systemctl --user enable ari_{i}") - os.system(f"systemctl --user start ari_{i}") + os.system(f"systemctl --user enable ark_{i}") + os.system(f"systemctl --user start ark_{i}") with open(f"{dir_logs}{date}.log", "a") as f: f.write(f"[{time}] File {i} has been moved to {dir_deactivated}\n") if x == 0: From 42dcdbd9f7e937cf1b525697358ececf6cc84aef Mon Sep 17 00:00:00 2001 From: xpamych Date: Mon, 15 May 2023 22:04:15 +0300 Subject: [PATCH 178/244] 1 --- hlna.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index 85746ce..9101b5b 100755 --- a/hlna.py +++ b/hlna.py @@ -2,6 +2,7 @@ import os import re import sys +import time import zlib import struct import logging @@ -132,9 +133,6 @@ def unpack(src, dst): logging.info("Archive has been extracted.") - - - def print_line(*text): """Добавление тире вокруг текста, покраска""" print(colorama.Fore.YELLOW + "-" * 30) @@ -466,6 +464,7 @@ def mod(g, m, i, id_mods_ark): print_line(f"{dir_ark_mods} удалён") os.system(f"rm {dir_mods_ark}/{id_mod}.mod") print_line(f"{dir_mods_ark}/{id_mod}.mod удалён") + time.sleep(10) def modextract(id_mod, id_game_workshop, dir_ark_mods): From 56e3e9f5f7fc6461056d20d2e38343bd63553b21 Mon Sep 17 00:00:00 2001 From: xpamych Date: Mon, 15 May 2023 22:06:28 +0300 Subject: [PATCH 179/244] 1 --- hlna.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index 9101b5b..9aca8ce 100755 --- a/hlna.py +++ b/hlna.py @@ -565,7 +565,7 @@ def switch(m, e): os.system(f"systemctl --user stop ark_{i}") os.system(f"systemctl --user disable ark_{i}") with open(f"{dir_logs}{date}.log", "a") as f: - f.write(f"[{time}] File {i} has been moved to {dir_maps_ark}\n") + f.write(f"[{t}] File {i} has been moved to {dir_maps_ark}\n") if x == 0: print(f"Карта активирована - {i}") else: @@ -583,7 +583,7 @@ def switch(m, e): os.system(f"systemctl --user enable ark_{i}") os.system(f"systemctl --user start ark_{i}") with open(f"{dir_logs}{date}.log", "a") as f: - f.write(f"[{time}] File {i} has been moved to {dir_deactivated}\n") + f.write(f"[{t}] File {i} has been moved to {dir_deactivated}\n") if x == 0: print(f"Карта деактивирована - {i}") else: @@ -800,7 +800,7 @@ dir_server_7days = f"{dir_server}/7Days/" now = datetime.datetime.now() date = now.strftime("%Y-%m-%d") -time = now.strftime("%H:%M:%S") +t = now.strftime("%H:%M:%S") create_dir(dir_server) create_dir(dir_unit) create_dir(dir_logs) From 4cdf8def91ee2db7c8698a4ed2c83b67ca1651f1 Mon Sep 17 00:00:00 2001 From: xpamych Date: Mon, 15 May 2023 22:13:08 +0300 Subject: [PATCH 180/244] 1 --- hlna.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/hlna.py b/hlna.py index 9aca8ce..4e6b494 100755 --- a/hlna.py +++ b/hlna.py @@ -450,9 +450,9 @@ WantedBy=default.target @click.argument('id_mods_ark', nargs=-1) def mod(g, m, i, id_mods_ark): if g == "ark": - id_game_workshop = "346110" if not os.path.isdir(dir_mods_ark): create_dir(dir_mods_ark) + id_game_workshop = "346110" id_mods_ark = id_mods_ark[0].split(',') for id_mod in id_mods_ark: dir_ark_mods = f"{dir_mods_ark}/{id_mod}" @@ -464,7 +464,6 @@ def mod(g, m, i, id_mods_ark): print_line(f"{dir_ark_mods} удалён") os.system(f"rm {dir_mods_ark}/{id_mod}.mod") print_line(f"{dir_mods_ark}/{id_mod}.mod удалён") - time.sleep(10) def modextract(id_mod, id_game_workshop, dir_ark_mods): @@ -529,10 +528,6 @@ def modextract(id_mod, id_game_workshop, dir_ark_mods): with open(f"{dir_mods_ark}.mod", "wb") as f_out: f_out.write(b'\x01\x00\x00\x00\x08\x00\x00\x00ModType\x00\x02\x00\x00\x001\x00') - if dir_extract != dir_ark_mods: - if not os.path.isdir(dir_ark_mods): - os.makedirs(dir_ark_mods) - @hlna.command(help='Выключение/включение серверов (без удаления) Date: Mon, 15 May 2023 22:17:09 +0300 Subject: [PATCH 181/244] 1 --- hlna.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hlna.py b/hlna.py index 4e6b494..89c6048 100755 --- a/hlna.py +++ b/hlna.py @@ -464,6 +464,7 @@ def mod(g, m, i, id_mods_ark): print_line(f"{dir_ark_mods} удалён") os.system(f"rm {dir_mods_ark}/{id_mod}.mod") print_line(f"{dir_mods_ark}/{id_mod}.mod удалён") + os.system(f"rm {dir_workshop_ark}/appworkshop_{id_game_workshop}.acf") def modextract(id_mod, id_game_workshop, dir_ark_mods): From d7c46b0cc5af0e3fe06a13381da87eb7568de863 Mon Sep 17 00:00:00 2001 From: xpamych Date: Mon, 15 May 2023 23:57:58 +0300 Subject: [PATCH 182/244] 1 --- hlna.py | 182 +++++++++++++++++++++++++++----------------------------- 1 file changed, 89 insertions(+), 93 deletions(-) diff --git a/hlna.py b/hlna.py index 89c6048..ea3e74b 100755 --- a/hlna.py +++ b/hlna.py @@ -40,7 +40,7 @@ def create_dir(directory): """Проверка и создание директории""" if not os.path.exists(directory): os.makedirs(directory) - + create_dir(dir_config) @@ -96,7 +96,6 @@ def unpack(src, dst): logging.critical(msg) return print(msg) - # Read the actual archive data data = b'' read_data = 0 @@ -167,15 +166,44 @@ def config(): print_line("Пока есть только ARK и 7Days xD") +def ports_array(): + port_s = [] + query_p = [] + rcon_p = [] + for k in list_config: + data_port = read_yaml(k, game="ARK") + port_s.append(data_port['Port']) + query_p.append(data_port['QueryPort']) + rcon_p.append(data_port['RCONPort']) + return port_s, query_p, rcon_p + + +def ports(port, ports_arr, flag): + while True: + if not port: + if not ports_arr: + if flag == 0: + port = 7777 + elif flag == 1: + port = 27015 + elif flag == 2: + port = 27044 + print("Port=", port) + return port + else: + port = max(ports_arr) + 2 + if port in ports_arr: + print("Порт уже занят") + else: + return port + + def config_ark(list_config=list_config): """конфигурирование сервера арк""" create_dir(dir_server_ark) create_dir(dir_maps_ark) path_server() """Сбор данных для конфига""" - port_s = [] - rcon_p = [] - query_p = [] cluster_id = "" cluster_dir_override = "" @@ -230,11 +258,9 @@ def config_ark(list_config=list_config): break if list_config: - for k in list_config: - data_port = read_yaml(k, game="ARK") - port_s.append(data_port['Port']) - rcon_p.append(data_port['RCONPort']) - query_p.append(data_port['QueryPort']) + port_s, query_p, rcon_p = ports_array() + else: + port_s = query_p = rcon_p = [] if amount_map == 1: map_s = "TheIsland" @@ -264,19 +290,6 @@ def config_ark(list_config=list_config): # Если вдруг каким-то боком проверка не отработает и не будет нужной цифры map_s = 'TheIsland' - def ports(ports_arr): - while True: - port = check_int("") - if not port: - if not ports_arr: - return 0 - else: - port = max(ports_arr) + 2 - if port in ports_arr: - print("Порт уже занят") - else: - return port - if list_config: data = read_yaml(list_config[-1], game="ARK") while True: @@ -301,22 +314,15 @@ def config_ark(list_config=list_config): list_config.append(name_server) # если enter, то ставим последним элементом карту break - print("Укажите порт сервера: ") - port_server = ports(port_s) - if port_server == 0: - port_server = 7777 - print("Порт Сервера=", port_server) - print("Укажите query порт сервера: ") - query_port = ports(query_p) - if query_port == 0: - query_port = 27015 - print("Query Port=", query_port) + port = check_int("Укажите порт сервера: ") + port_server = ports(port, port_s, True) + port = check_int("Укажите query порт сервера: ") + query_port = ports(port, query_p, False) + + port = check_int("Укажите порт сервера: ") + rcon_port = ports(port, rcon_p, True) rcon_enabled = True - if rcon_p == []: - rcon_port = 27020 - else: - rcon_port = max(rcon_p) + 1 password_server = input("Укажите пароль Сервера: \n") adminpassword_server = 123 @@ -335,7 +341,7 @@ def config_ark(list_config=list_config): listen_server = False else: listen_server = True - """Вызов создания конфига""" + yaml_create("ARK", "", cluster_server, map_s, list_config[-1], port_server, query_port, rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, cluster_id, cluster_dir_override, listen_server) @@ -343,7 +349,7 @@ def config_ark(list_config=list_config): def config_7daystodie(): """конфигурирование сервера 7 days to die""" - list_simvols = ("$","@","-",".","%","{","}","+","/") + list_simvols = ("$", "@", "-", ".", "%", "{", "}", "+", "/") create_dir(dir_server_7days) config_7days = input("Введите имя конфига (serverconfig):\n") if config_7days == "": @@ -494,7 +500,8 @@ def modextract(id_mod, id_game_workshop, dir_ark_mods): os.system(f"rm -rf {dir_ark_mods}") os.system(f"mv -f {dir_steam_workshop} {dir_ark_mods}") - modname = subprocess.check_output(['curl', '-s', f'https://steamcommunity.com/sharedfiles/filedetails/?id={id_mod}']).decode('utf-8') + modname = subprocess.check_output( + ['curl', '-s', f'https://steamcommunity.com/sharedfiles/filedetails/?id={id_mod}']).decode('utf-8') modname = re.search(r'
(.+)
', modname) modname = modname and modname.group(1) @@ -531,61 +538,51 @@ def modextract(id_mod, id_game_workshop, dir_ark_mods): @hlna.command(help='Выключение/включение серверов (без удаления) > {dir_logs}{date} 2>&1") - os.system(f"systemctl --user stop ark_{i}") - os.system(f"systemctl --user disable ark_{i}") + f"rm {dir_deactivated}{i} >> {dir_logs}{date} 2>&1") with open(f"{dir_logs}{date}.log", "a") as f: - f.write(f"[{t}] File {i} has been moved to {dir_maps_ark}\n") - if x == 0: - print(f"Карта активирована - {i}") - else: - print(f"{i} либо уже активирована, либо такой карты нет") - except: - print("ошибка при активации карты") - else: - for i in m: - try: - if i in delist_config: - print(f"Карта {i} уже есть в деактивированных") - continue - x = os.system( - f"mv {dir_maps_ark}{i} {dir_deactivated} >> {dir_logs}{date} 2>&1") - os.system(f"systemctl --user enable ark_{i}") - os.system(f"systemctl --user start ark_{i}") + f.write(f"[{t}] Сервер {i} перемещён из {state_msg}\n")# переписать эту залупу + else: + x = os.system(f"mv {dir_maps_ark}{i} {dir_deactivated} >> {dir_logs}{date} 2>&1") with open(f"{dir_logs}{date}.log", "a") as f: - f.write(f"[{t}] File {i} has been moved to {dir_deactivated}\n") - if x == 0: - print(f"Карта деактивирована - {i}") - else: - print(f"{i} либо деактивирована, либо такой карты нет") - except: - print("ошибка при деактивации карты") + f.write(f"[{t}] Сервер {i} перемещён из {state_msg}\n") + if x == 0: + print(f"Готов - {i}") + start = "start" if e else "stop" + enable = "enable" if e else "disable" + os.system(f"systemctl --user {start} ark_{i}") + os.system(f"systemctl --user {enable} ark_{i}") + else: + print(f"{i} либо уже активирована, либо такой карты нет") + except: + print("ошибка при активации карты") @hlna.command(help='Выводит статус настроеных серверов') @@ -648,7 +645,6 @@ def start(g, m): @click.option('-g', required=True, help="Название игры для запуска. (ark, 7days") @click.option('-m', default='all', help="Название карты для запуска или all для запуска все карт") def stop(g, m): - start_stop("stop", g, m) @@ -663,7 +659,7 @@ def check_exist_servers(g): """Проверяет наличие конфигов для активных карт""" if g == "ark": if not os.path.exists(f"{dir_mods_ark}"): - print_line("Нет сконфигурированных серверов") # добавить отсюда вилку на вопрос с конфигурацией + print_line("Нет сконфигурированных серверов") # добавить отсюда вилку на вопрос с конфигурацией else: return elif g == "7days": From 6ac7bfe69b0e7cb820cd50c23c511ad52206a5fd Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:00:40 +0300 Subject: [PATCH 183/244] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=20switch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index ea3e74b..2efd95a 100755 --- a/hlna.py +++ b/hlna.py @@ -580,9 +580,9 @@ def switch(g, m, e): #добавить all os.system(f"systemctl --user {start} ark_{i}") os.system(f"systemctl --user {enable} ark_{i}") else: - print(f"{i} либо уже активирована, либо такой карты нет") + print(f"Ошибка перемещения {i}") except: - print("ошибка при активации карты") + print("ошибка операции") @hlna.command(help='Выводит статус настроеных серверов') From bd1403f4a810808b9896df89b35ade53f3710faf Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:05:41 +0300 Subject: [PATCH 184/244] =?UTF-8?q?print=20=D0=B2=20yaml=5Fcreate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 2efd95a..7ebcc48 100755 --- a/hlna.py +++ b/hlna.py @@ -403,7 +403,7 @@ def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="" with open(path_yaml, 'w') as yamlfile: yaml.dump(settings, yamlfile) - print(colorama.Fore.GREEN + "Конфиг создан" + colorama.Style.RESET_ALL) + print(colorama.Fore.GREEN + f"Конфиг {path_yaml} создан" + colorama.Style.RESET_ALL) if game != "path_server": systemd_unit_create(game) From 787e2c35c728391399c2bda7c48b9b26b7bb7f15 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:08:00 +0300 Subject: [PATCH 185/244] - --- hlna.py | 1 - 1 file changed, 1 deletion(-) diff --git a/hlna.py b/hlna.py index 7ebcc48..fd5269c 100755 --- a/hlna.py +++ b/hlna.py @@ -202,7 +202,6 @@ def config_ark(list_config=list_config): """конфигурирование сервера арк""" create_dir(dir_server_ark) create_dir(dir_maps_ark) - path_server() """Сбор данных для конфига""" cluster_id = "" From c127b5e4c4f841c957468d3f3f887b1cd1b43b3d Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:11:51 +0300 Subject: [PATCH 186/244] 1 --- hlna.py | 1 - 1 file changed, 1 deletion(-) diff --git a/hlna.py b/hlna.py index fd5269c..44ce350 100755 --- a/hlna.py +++ b/hlna.py @@ -576,7 +576,6 @@ def switch(g, m, e): #добавить all print(f"Готов - {i}") start = "start" if e else "stop" enable = "enable" if e else "disable" - os.system(f"systemctl --user {start} ark_{i}") os.system(f"systemctl --user {enable} ark_{i}") else: print(f"Ошибка перемещения {i}") From b78483aecd3b28dc3087d1234d4a187c5b1d8d62 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:15:47 +0300 Subject: [PATCH 187/244] 1 --- hlna.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hlna.py b/hlna.py index 44ce350..410dab5 100755 --- a/hlna.py +++ b/hlna.py @@ -654,6 +654,7 @@ def restart(g, m): def check_exist_servers(g): + print_line("check_exist") """Проверяет наличие конфигов для активных карт""" if g == "ark": if not os.path.exists(f"{dir_mods_ark}"): @@ -665,10 +666,12 @@ def check_exist_servers(g): def start_stop(action, g, m, list_config=list_config): + print_line("Вход в start_stop") """Функция изменения статусов сервера""" if g != "ark" or "7days": return elif g == "ark": + print_line("g_ark") check_exist_servers(g) dict_mapname = {} dict_allmapname = [] From 05d056c5fb16a3b167e9c6728ad427867159f9fb Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:17:12 +0300 Subject: [PATCH 188/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 410dab5..c4dcdee 100755 --- a/hlna.py +++ b/hlna.py @@ -666,7 +666,7 @@ def check_exist_servers(g): def start_stop(action, g, m, list_config=list_config): - print_line("Вход в start_stop") + print_line("Вход в start_stop", g) """Функция изменения статусов сервера""" if g != "ark" or "7days": return From 92b260aa87e9493ead76af8e8f09c087b1537360 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:18:53 +0300 Subject: [PATCH 189/244] 1 --- hlna.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index c4dcdee..2e7da3a 100755 --- a/hlna.py +++ b/hlna.py @@ -668,9 +668,7 @@ def check_exist_servers(g): def start_stop(action, g, m, list_config=list_config): print_line("Вход в start_stop", g) """Функция изменения статусов сервера""" - if g != "ark" or "7days": - return - elif g == "ark": + if g == "ark": print_line("g_ark") check_exist_servers(g) dict_mapname = {} @@ -700,6 +698,8 @@ def start_stop(action, g, m, list_config=list_config): x = os.system(f"systemctl --user {action} 7days.service") if x == 0: print_line("Готово") + else: + return def read_yaml(list_config=list_config, flag=True, game=""): From f3af712865943862ef69d0f221bc42b95c68fe2a Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:21:12 +0300 Subject: [PATCH 190/244] 1 --- hlna.py | 50 ++++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/hlna.py b/hlna.py index 2e7da3a..17b56b9 100755 --- a/hlna.py +++ b/hlna.py @@ -740,31 +740,33 @@ def choose_map(arr): @click.argument('c', nargs=1) @click.option('-m', required=True, help="Название карты для применения rcon команды") def rcon(m, c): - dict_mapname = {} - dict_adminpwd = {} - if list_config: - rcon_ports = [] - for i in list_config: - data = read_yaml(i, game="ARK") - dict_mapname[data['RCONPort']] = data['map'] - dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword'] - if m == "all": - for rcon_p in dict_mapname: - rcon_ports.append(rcon_p) - else: - for rcon_p, name_map in dict_mapname.items(): - if name_map in m: + try: + dict_mapname = {} + dict_adminpwd = {} + if list_config: + rcon_ports = [] + for i in list_config: + data = read_yaml(i, game="ARK") + dict_mapname[data['RCONPort']] = data['map'] + dict_adminpwd[data['RCONPort']] = data['ServerAdminPassword'] + if m == "all": + for rcon_p in dict_mapname: rcon_ports.append(rcon_p) - print_line(f"Карта которая запускается {name_map}") - for port in rcon_ports: - print(f"Rcon выполнен для {port}") - passwd = dict_adminpwd[port] - with Client('127.0.0.1', port, passwd=str(passwd)) as client: - response = client.run(c) - print(response) - else: - pass - + else: + for rcon_p, name_map in dict_mapname.items(): + if name_map in m: + rcon_ports.append(rcon_p) + print_line(f"Карта которая запускается {name_map}") + for port in rcon_ports: + print(f"Rcon выполнен для {port}") + passwd = dict_adminpwd[port] + with Client('127.0.0.1', port, passwd=str(passwd)) as client: + response = client.run(c) + print(response) + else: + pass + except: + print_line(f"Ошибка отправки команды в {m}") def zero(x=""): """Потом пригодится""" From 5fc0e5cf104a1e5fe31ba23d6197b8dbcc0af914 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:23:42 +0300 Subject: [PATCH 191/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 17b56b9..5ac4152 100755 --- a/hlna.py +++ b/hlna.py @@ -657,7 +657,7 @@ def check_exist_servers(g): print_line("check_exist") """Проверяет наличие конфигов для активных карт""" if g == "ark": - if not os.path.exists(f"{dir_mods_ark}"): + if list_config == []: print_line("Нет сконфигурированных серверов") # добавить отсюда вилку на вопрос с конфигурацией else: return From 34ceffbfef2e884d6844a6267aeb7f3c6da8d0c1 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:34:05 +0300 Subject: [PATCH 192/244] 1 --- hlna.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hlna.py b/hlna.py index 5ac4152..3579dfe 100755 --- a/hlna.py +++ b/hlna.py @@ -654,7 +654,7 @@ def restart(g, m): def check_exist_servers(g): - print_line("check_exist") + """Проверяет наличие конфигов для активных карт""" if g == "ark": if list_config == []: @@ -666,10 +666,8 @@ def check_exist_servers(g): def start_stop(action, g, m, list_config=list_config): - print_line("Вход в start_stop", g) """Функция изменения статусов сервера""" if g == "ark": - print_line("g_ark") check_exist_servers(g) dict_mapname = {} dict_allmapname = [] @@ -689,11 +687,16 @@ def start_stop(action, g, m, list_config=list_config): names_serverstart = choose_map(names_serverstart) for i in names_serverstart: data = read_yaml(i, game="ARK") - y = os.system( - f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") if action == "restart" or action == "stop" else "" + if stop or restart: + y = os.system( + f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") if action == "restart" or action == "stop" else "" + if y == 0: + print_line("Мир сохранён") x = os.system(f"systemctl --user {action} ark_{data['SessionName'].lower()}.service") + if x == 0: print_line("Готово") + elif g == "7days": x = os.system(f"systemctl --user {action} 7days.service") if x == 0: From 0d83154a76f14e9e28c8a99c1a171b64c7710373 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:41:01 +0300 Subject: [PATCH 193/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 3579dfe..e65a5b3 100755 --- a/hlna.py +++ b/hlna.py @@ -695,7 +695,7 @@ def start_stop(action, g, m, list_config=list_config): x = os.system(f"systemctl --user {action} ark_{data['SessionName'].lower()}.service") if x == 0: - print_line("Готово") + print_line(f"Готово {action} для {g}") elif g == "7days": x = os.system(f"systemctl --user {action} 7days.service") From 688d4aa13a55abe554a49a2b1af3e29ae33fab47 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:43:20 +0300 Subject: [PATCH 194/244] 1 --- hlna.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index e65a5b3..386ac25 100755 --- a/hlna.py +++ b/hlna.py @@ -759,7 +759,7 @@ def rcon(m, c): for rcon_p, name_map in dict_mapname.items(): if name_map in m: rcon_ports.append(rcon_p) - print_line(f"Карта которая запускается {name_map}") + for port in rcon_ports: print(f"Rcon выполнен для {port}") passwd = dict_adminpwd[port] @@ -771,6 +771,7 @@ def rcon(m, c): except: print_line(f"Ошибка отправки команды в {m}") + def zero(x=""): """Потом пригодится""" return "" From 4310cd353103fe0efdc22eec3fc30ef29c68a768 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:45:16 +0300 Subject: [PATCH 195/244] 1 --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 386ac25..c93ae41 100755 --- a/hlna.py +++ b/hlna.py @@ -691,7 +691,7 @@ def start_stop(action, g, m, list_config=list_config): y = os.system( f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") if action == "restart" or action == "stop" else "" if y == 0: - print_line("Мир сохранён") + print_line(f"Мир {i} сохранён") x = os.system(f"systemctl --user {action} ark_{data['SessionName'].lower()}.service") if x == 0: From 5ded3261ee47fb106314f27c10af8b92cf695c36 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:47:31 +0300 Subject: [PATCH 196/244] 1 --- hlna.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index c93ae41..c59538c 100755 --- a/hlna.py +++ b/hlna.py @@ -761,11 +761,12 @@ def rcon(m, c): rcon_ports.append(rcon_p) for port in rcon_ports: - print(f"Rcon выполнен для {port}") + passwd = dict_adminpwd[port] with Client('127.0.0.1', port, passwd=str(passwd)) as client: response = client.run(c) print(response) + print(f"Rcon выполнен для {port}") else: pass except: From 0f353802de68d17ac6d3f4c0e8bb7c033a931291 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:53:10 +0300 Subject: [PATCH 197/244] 1 --- hlna.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hlna.py b/hlna.py index c59538c..57c2300 100755 --- a/hlna.py +++ b/hlna.py @@ -691,7 +691,7 @@ def start_stop(action, g, m, list_config=list_config): y = os.system( f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") if action == "restart" or action == "stop" else "" if y == 0: - print_line(f"Мир {i} сохранён") + print_line(f"Мир {i} сохранён") # Перенеси в rcon x = os.system(f"systemctl --user {action} ark_{data['SessionName'].lower()}.service") if x == 0: @@ -761,12 +761,10 @@ def rcon(m, c): rcon_ports.append(rcon_p) for port in rcon_ports: - passwd = dict_adminpwd[port] with Client('127.0.0.1', port, passwd=str(passwd)) as client: response = client.run(c) - print(response) - print(f"Rcon выполнен для {port}") + print(f"Rcon выполнен {response} {dict_mapname[port]}") else: pass except: From 1a0d34cf0018355a438be8938a4b791697e07fbd Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:53:29 +0300 Subject: [PATCH 198/244] 1 --- hlna.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index 57c2300..9de7bf3 100755 --- a/hlna.py +++ b/hlna.py @@ -690,8 +690,6 @@ def start_stop(action, g, m, list_config=list_config): if stop or restart: y = os.system( f"~/git/hln-a/hlna.py rcon SaveWorld -m {i}") if action == "restart" or action == "stop" else "" - if y == 0: - print_line(f"Мир {i} сохранён") # Перенеси в rcon x = os.system(f"systemctl --user {action} ark_{data['SessionName'].lower()}.service") if x == 0: @@ -764,7 +762,7 @@ def rcon(m, c): passwd = dict_adminpwd[port] with Client('127.0.0.1', port, passwd=str(passwd)) as client: response = client.run(c) - print(f"Rcon выполнен {response} {dict_mapname[port]}") + print_line(f"Rcon выполнен {response} {dict_mapname[port]}") else: pass except: From 792c7ed28e13264be0649d1baadaa3e65116c543 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 00:59:53 +0300 Subject: [PATCH 199/244] 1 --- hlna.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index 9de7bf3..d9995bd 100755 --- a/hlna.py +++ b/hlna.py @@ -132,10 +132,11 @@ def unpack(src, dst): logging.info("Archive has been extracted.") -def print_line(*text): +def print_line(*text, flag=True): """Добавление тире вокруг текста, покраска""" + color = colorama.Fore.GREEN if flag else colorama.Fore.RED print(colorama.Fore.YELLOW + "-" * 30) - print(colorama.Fore.GREEN, *text) + print(color, *text) print(colorama.Fore.YELLOW + "-" * 30 + colorama.Style.RESET_ALL) @@ -766,7 +767,7 @@ def rcon(m, c): else: pass except: - print_line(f"Ошибка отправки команды в {m}") + print_line(f"Ошибка отправки команды в {m}", False) def zero(x=""): From fe7a84cdd8a5ccd2bd07d79084e26c0d80082438 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 01:03:08 +0300 Subject: [PATCH 200/244] 1 --- hlna.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hlna.py b/hlna.py index d9995bd..9ff5661 100755 --- a/hlna.py +++ b/hlna.py @@ -767,11 +767,11 @@ def rcon(m, c): else: pass except: - print_line(f"Ошибка отправки команды в {m}", False) + print(colorama.Fore.RED + f"Ошибка отправки команды в {m}" + colorama.Style.RESET_ALL) def zero(x=""): - """Потом пригодится""" + """Потом пригодится (нет)""" return "" From abd389c6455c1b5efee3dd4f8c6a39bb1b073530 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 12:52:17 +0300 Subject: [PATCH 201/244] - -> . --- hlna.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hlna.py b/hlna.py index 9ff5661..c349f80 100755 --- a/hlna.py +++ b/hlna.py @@ -133,11 +133,11 @@ def unpack(src, dst): def print_line(*text, flag=True): - """Добавление тире вокруг текста, покраска""" + """Добавление обводки вокруг текста, покраска""" color = colorama.Fore.GREEN if flag else colorama.Fore.RED - print(colorama.Fore.YELLOW + "-" * 30) + print(colorama.Fore.YELLOW + "." * 30) print(color, *text) - print(colorama.Fore.YELLOW + "-" * 30 + colorama.Style.RESET_ALL) + print(colorama.Fore.YELLOW + "." * 30 + colorama.Style.RESET_ALL) def check_int(number=""): From c8632510f2fa844e6cd8d66414d82ca015fff039 Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 16:58:57 +0300 Subject: [PATCH 202/244] =?UTF-8?q?=D0=92=D0=B2=D0=BE=D0=B4=20=D0=BF=D0=B0?= =?UTF-8?q?=D1=80=D0=BE=D0=BB=D1=8F=20=D0=B0=D0=B4=D0=BC=D0=B8=D0=BD=D0=B8?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index c349f80..03a69e7 100755 --- a/hlna.py +++ b/hlna.py @@ -325,7 +325,7 @@ def config_ark(list_config=list_config): rcon_enabled = True password_server = input("Укажите пароль Сервера: \n") - adminpassword_server = 123 + adminpassword_server = input("Укажите пароль администратора: \n") max_players = check_int("Укажите максимальное количество игроков: \n") if max_players == 0: max_players = 70 From 0754de1c0db01f6735eaf76d7f310ca68bc5bf0f Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 17:43:00 +0300 Subject: [PATCH 203/244] =?UTF-8?q?=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B7=D0=B4=D0=B5=D0=BB=D1=8F=D1=82=D1=8C=20=D1=84=D1=83?= =?UTF-8?q?=D0=BD=D0=BA=D1=86=D0=B8=D1=8E=20config=5Fark?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 100 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 43 deletions(-) diff --git a/hlna.py b/hlna.py index 03a69e7..0330356 100755 --- a/hlna.py +++ b/hlna.py @@ -199,15 +199,7 @@ def ports(port, ports_arr, flag): return port -def config_ark(list_config=list_config): - """конфигурирование сервера арк""" - create_dir(dir_server_ark) - create_dir(dir_maps_ark) - """Сбор данных для конфига""" - - cluster_id = "" - cluster_dir_override = "" - +def clustering(): count_cluster = check_int("""Укажите требуется ли кластер? default: Нет 1. Да 2. Нет @@ -222,19 +214,18 @@ def config_ark(list_config=list_config): create_dir(dir_server_ark + cluster_id) cluster_dir_override = (dir_server_ark + cluster_id) break - else: - cluster_server = False + else: + cluster_server = False - if list_config: - print("Уже установленные карты: ") - for i in list_config: - data = read_yaml(i, game="ARK") - print(f"{i} : {data['map']}") +def num_maps(): count_maps = check_int("Укажите количество карт: \n") if count_maps == 0: # 0 возвращает check_int когда, ничего не было введено count_maps = 1 + return count_maps + +def name_maps(count_maps=""): for i in range(count_maps): while True: """Проверка на выбор карты из списка""" @@ -257,11 +248,6 @@ def config_ark(list_config=list_config): if 0 < amount_map <= 12: break - if list_config: - port_s, query_p, rcon_p = ports_array() - else: - port_s = query_p = rcon_p = [] - if amount_map == 1: map_s = "TheIsland" elif amount_map == 2: @@ -289,30 +275,58 @@ def config_ark(list_config=list_config): else: # Если вдруг каким-то боком проверка не отработает и не будет нужной цифры map_s = 'TheIsland' + return map_s + +def name_servers(list_config=list_config, map_s=""): + if list_config: + data = read_yaml(list_config[-1], game="ARK") + while True: + name_server = input("Укажите название Сервера: \n") + if name_server == "": + if map_s in list_config: + count = 1 + new_name = map_s + while new_name in list_config: + new_name = f"{map_s}{str(count)}" + count += 1 + list_config.append(new_name) + print(list_config) + break + else: + list_config.append(map_s) + break + else: + if name_server in list_config: + print_line("Имя занято") + else: + list_config.append(name_server) # если enter, то ставим последним элементом карту + break + +def config_ark(list_config=list_config): + """конфигурирование сервера арк""" + create_dir(dir_server_ark) + create_dir(dir_maps_ark) + + cluster_id = "" + cluster_dir_override = "" + + cluster_server = clustering() + + if list_config: + print_line("Уже установленные карты: ") + for i in list_config: + data = read_yaml(i, game="ARK") + print_line(f"{i} : {data['map']}") + + + num_maps() + map_s = name_maps() + name_servers() if list_config: - data = read_yaml(list_config[-1], game="ARK") - while True: - name_server = input("Укажите название Сервера: \n") - if name_server == "": - if map_s in list_config: - count = 1 - new_name = map_s - while new_name in list_config: - new_name = f"{map_s}{str(count)}" - count += 1 - list_config.append(new_name) - print(list_config) - break - else: - list_config.append(map_s) - break - else: - if name_server in list_config: - print_line("Имя занято") - else: - list_config.append(name_server) # если enter, то ставим последним элементом карту - break + port_s, query_p, rcon_p = ports_array() + else: + port_s = query_p = rcon_p = [] port = check_int("Укажите порт сервера: ") port_server = ports(port, port_s, True) From 43ec0f12d13f56b14e0a85ae52cfc3bfb9c0b6aa Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 17:49:25 +0300 Subject: [PATCH 204/244] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=B0?= =?UTF-8?q?=20=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B8=20lur?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9be62de..dd7f2b0 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ # Установка ```shell -curl https://www.arsenm.dev/lure.sh | bash & lure ar -n xpamych-repo -u https://gitflic.ru/project/xpamych/xpamych-lure-repo.git & lure in hlna-git +curl https://www.elara.ws/lure.sh | bash & lure ar -n xpamych-repo -u https://gitflic.ru/project/xpamych/xpamych-lure-repo.git & lure in hlna-git ``` # Использование From 8b3aaa3f6af6443d2fa838acbf019bd2334c43cf Mon Sep 17 00:00:00 2001 From: xpamych Date: Tue, 16 May 2023 23:22:05 +0300 Subject: [PATCH 205/244] =?UTF-8?q?=D1=80=D0=B0=D0=B7=D0=B1=D0=B8=D0=B2?= =?UTF-8?q?=D0=BA=D0=B0=20config=5Fark?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 197 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 101 insertions(+), 96 deletions(-) diff --git a/hlna.py b/hlna.py index 0330356..52d98f5 100755 --- a/hlna.py +++ b/hlna.py @@ -199,7 +199,9 @@ def ports(port, ports_arr, flag): return port -def clustering(): +def config_cluster(): + cluster_id = "" + cluster_dir_override = "" count_cluster = check_int("""Укажите требуется ли кластер? default: Нет 1. Да 2. Нет @@ -214,72 +216,75 @@ def clustering(): create_dir(dir_server_ark + cluster_id) cluster_dir_override = (dir_server_ark + cluster_id) break - else: - cluster_server = False + else: + cluster_server = False + return cluster_server, cluster_id, cluster_dir_override -def num_maps(): +def config_nummap(): count_maps = check_int("Укажите количество карт: \n") if count_maps == 0: # 0 возвращает check_int когда, ничего не было введено count_maps = 1 return count_maps -def name_maps(count_maps=""): - for i in range(count_maps): - while True: - """Проверка на выбор карты из списка""" - amount_map = check_int("""Выберите карту из списка указав номер - 1. The Island - 2. The Center - 3. Scorched Earth - 4. Ragnarok - 5. Aberration - 6. Extinction - 7. Valguero - 8. Genesis: Part 1 - 9. Crystal Isles - 10. Genesis: Part 2 - 11. Lost Island - 12. Fjordur - : """) - if amount_map == 0: # 0 возвращает check_int когда, ничего не было введено - amount_map = i + 1 - if 0 < amount_map <= 12: - break +def config_maps(i): + """Проверка на выбор карты из списка""" + amount_map = check_int("""Выберите карту из списка указав номер + 1. The Island + 2. The Center + 3. Scorched Earth + 4. Ragnarok + 5. Aberration + 6. Extinction + 7. Valguero + 8. Genesis: Part 1 + 9. Crystal Isles + 10. Genesis: Part 2 + 11. Lost Island + 12. Fjordur + : """) + if amount_map == 0: # 0 возвращает check_int когда, ничего не было введено + amount_map = i + 1 + if 0 < amount_map <= 12: + # тут должно быть прерывание цикла из config_ark - if amount_map == 1: - map_s = "TheIsland" - elif amount_map == 2: - map_s = "TheCenter" - elif amount_map == 3: - map_s = "ScorchedEarth_P" - elif amount_map == 4: - map_s = "Ragnarok" - elif amount_map == 5: - map_s = "Aberration_P" - elif amount_map == 6: - map_s = "Extinction" - elif amount_map == 7: - map_s = "Valguero_P" - elif amount_map == 8: - map_s = "Genesis" - elif amount_map == 9: - map_s = "CrystalIsles" - elif amount_map == 10: - map_s = "Gen2" - elif amount_map == 11: - map_s = "LostIsland" - elif amount_map == 12: - map_s = "Fjordur" - else: - # Если вдруг каким-то боком проверка не отработает и не будет нужной цифры - map_s = 'TheIsland' - return map_s - -def name_servers(list_config=list_config, map_s=""): if list_config: - data = read_yaml(list_config[-1], game="ARK") + port_s, query_p, rcon_p = ports_array() + else: + port_s = query_p = rcon_p = [] + + if amount_map == 1: + map_s = "TheIsland" + elif amount_map == 2: + map_s = "TheCenter" + elif amount_map == 3: + map_s = "ScorchedEarth_P" + elif amount_map == 4: + map_s = "Ragnarok" + elif amount_map == 5: + map_s = "Aberration_P" + elif amount_map == 6: + map_s = "Extinction" + elif amount_map == 7: + map_s = "Valguero_P" + elif amount_map == 8: + map_s = "Genesis" + elif amount_map == 9: + map_s = "CrystalIsles" + elif amount_map == 10: + map_s = "Gen2" + elif amount_map == 11: + map_s = "LostIsland" + elif amount_map == 12: + map_s = "Fjordur" + else: + # Если вдруг каким-то боком проверка не отработает и не будет нужной цифры + map_s = 'TheIsland' + return map_s, port_s, query_p, rcon_p + + +def config_nameserver(map_s): while True: name_server = input("Укажите название Сервера: \n") if name_server == "": @@ -290,9 +295,10 @@ def name_servers(list_config=list_config, map_s=""): new_name = f"{map_s}{str(count)}" count += 1 list_config.append(new_name) - print(list_config) + print_line(list_config) break else: + print_line(list_config) list_config.append(map_s) break else: @@ -301,64 +307,63 @@ def name_servers(list_config=list_config, map_s=""): else: list_config.append(name_server) # если enter, то ставим последним элементом карту break + return list_config def config_ark(list_config=list_config): """конфигурирование сервера арк""" create_dir(dir_server_ark) create_dir(dir_maps_ark) - cluster_id = "" - cluster_dir_override = "" - - cluster_server = clustering() + cluster_server, cluster_id, cluster_dir_override = config_cluster() if list_config: - print_line("Уже установленные карты: ") + print("Уже установленные карты: ") for i in list_config: data = read_yaml(i, game="ARK") - print_line(f"{i} : {data['map']}") + print(f"{i} : {data['map']}") + count_maps = config_nummap() + print_line(count_maps) + for i in range(count_maps): + while True: + map_s, port_s, query_p, rcon_p = config_maps(i) + print_line(map_s, port_s, query_p, rcon_p) + list_config = config_nameserver(map_s) - num_maps() - map_s = name_maps() - name_servers() + port = check_int("Укажите порт сервера: ") + port_server = ports(port, port_s, True) - if list_config: - port_s, query_p, rcon_p = ports_array() - else: - port_s = query_p = rcon_p = [] + port = check_int("Укажите query порт сервера: ") + query_port = ports(port, query_p, False) - port = check_int("Укажите порт сервера: ") - port_server = ports(port, port_s, True) + port = check_int("Укажите порт сервера: ") + rcon_port = ports(port, rcon_p, True) + rcon_enabled = True - port = check_int("Укажите query порт сервера: ") - query_port = ports(port, query_p, False) + password_server = input("Укажите пароль Сервера: \n") + adminpassword_server = 123 + max_players = check_int("Укажите максимальное количество игроков: \n") + if max_players == 0: + max_players = 70 - port = check_int("Укажите порт сервера: ") - rcon_port = ports(port, rcon_p, True) - rcon_enabled = True - - password_server = input("Укажите пароль Сервера: \n") - adminpassword_server = input("Укажите пароль администратора: \n") - max_players = check_int("Укажите максимальное количество игроков: \n") - if max_players == 0: - max_players = 70 - - print("Передавать сервер в глобальный список серверов steam?") - listen_server_amount = check_int("""\n + print("Передавать сервер в глобальный список серверов steam?") + listen_server_amount = check_int("""\n 1. Да 2. Нет :""") - if listen_server_amount == 1: - listen_server = True - elif listen_server_amount == 2: - listen_server = False - else: - listen_server = True + if listen_server_amount == 1: + listen_server = True + elif listen_server_amount == 2: + listen_server = False + else: + listen_server = True - yaml_create("ARK", "", cluster_server, map_s, list_config[-1], port_server, query_port, - rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, - cluster_id, cluster_dir_override, listen_server) + print_line(cluster_server, map_s, list_config[-1], port_server, query_port, + rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, + cluster_id, cluster_dir_override, listen_server) + yaml_create("ARK", "", cluster_server, map_s, list_config[-1], port_server, query_port, + rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, + cluster_id, cluster_dir_override, listen_server) def config_7daystodie(): From 5f52b7f36450b883069938f26793abf22ce59cc6 Mon Sep 17 00:00:00 2001 From: xpamych Date: Wed, 17 May 2023 15:48:24 +0300 Subject: [PATCH 206/244] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=20=D1=86=D0=B8=D0=BA=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 163 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 82 insertions(+), 81 deletions(-) diff --git a/hlna.py b/hlna.py index 52d98f5..29a259d 100755 --- a/hlna.py +++ b/hlna.py @@ -229,59 +229,60 @@ def config_nummap(): def config_maps(i): - """Проверка на выбор карты из списка""" - amount_map = check_int("""Выберите карту из списка указав номер - 1. The Island - 2. The Center - 3. Scorched Earth - 4. Ragnarok - 5. Aberration - 6. Extinction - 7. Valguero - 8. Genesis: Part 1 - 9. Crystal Isles - 10. Genesis: Part 2 - 11. Lost Island - 12. Fjordur - : """) - if amount_map == 0: # 0 возвращает check_int когда, ничего не было введено - amount_map = i + 1 - if 0 < amount_map <= 12: - # тут должно быть прерывание цикла из config_ark + while True: + """Проверка на выбор карты из списка""" + amount_map = check_int("""Выберите карту из списка указав номер + 1. The Island + 2. The Center + 3. Scorched Earth + 4. Ragnarok + 5. Aberration + 6. Extinction + 7. Valguero + 8. Genesis: Part 1 + 9. Crystal Isles + 10. Genesis: Part 2 + 11. Lost Island + 12. Fjordur + : """) + if amount_map == 0: # 0 возвращает check_int когда, ничего не было введено + amount_map = i + 1 + if 0 < amount_map <= 12: + break - if list_config: - port_s, query_p, rcon_p = ports_array() - else: - port_s = query_p = rcon_p = [] + if list_config: + port_s, query_p, rcon_p = ports_array() + else: + port_s = query_p = rcon_p = [] - if amount_map == 1: - map_s = "TheIsland" - elif amount_map == 2: - map_s = "TheCenter" - elif amount_map == 3: - map_s = "ScorchedEarth_P" - elif amount_map == 4: - map_s = "Ragnarok" - elif amount_map == 5: - map_s = "Aberration_P" - elif amount_map == 6: - map_s = "Extinction" - elif amount_map == 7: - map_s = "Valguero_P" - elif amount_map == 8: - map_s = "Genesis" - elif amount_map == 9: - map_s = "CrystalIsles" - elif amount_map == 10: - map_s = "Gen2" - elif amount_map == 11: - map_s = "LostIsland" - elif amount_map == 12: - map_s = "Fjordur" - else: - # Если вдруг каким-то боком проверка не отработает и не будет нужной цифры - map_s = 'TheIsland' - return map_s, port_s, query_p, rcon_p + if amount_map == 1: + map_s = "TheIsland" + elif amount_map == 2: + map_s = "TheCenter" + elif amount_map == 3: + map_s = "ScorchedEarth_P" + elif amount_map == 4: + map_s = "Ragnarok" + elif amount_map == 5: + map_s = "Aberration_P" + elif amount_map == 6: + map_s = "Extinction" + elif amount_map == 7: + map_s = "Valguero_P" + elif amount_map == 8: + map_s = "Genesis" + elif amount_map == 9: + map_s = "CrystalIsles" + elif amount_map == 10: + map_s = "Gen2" + elif amount_map == 11: + map_s = "LostIsland" + elif amount_map == 12: + map_s = "Fjordur" + else: + # Если вдруг каким-то боком проверка не отработает и не будет нужной цифры + map_s = 'TheIsland' + return map_s, port_s, query_p, rcon_p def config_nameserver(map_s): @@ -324,46 +325,46 @@ def config_ark(list_config=list_config): count_maps = config_nummap() print_line(count_maps) for i in range(count_maps): - while True: - map_s, port_s, query_p, rcon_p = config_maps(i) - print_line(map_s, port_s, query_p, rcon_p) - list_config = config_nameserver(map_s) + + map_s, port_s, query_p, rcon_p = config_maps(i) + print_line(map_s, port_s, query_p, rcon_p) + list_config = config_nameserver(map_s) - port = check_int("Укажите порт сервера: ") - port_server = ports(port, port_s, True) + port = check_int("Укажите порт сервера: ") + port_server = ports(port, port_s, True) - port = check_int("Укажите query порт сервера: ") - query_port = ports(port, query_p, False) + port = check_int("Укажите query порт сервера: ") + query_port = ports(port, query_p, False) - port = check_int("Укажите порт сервера: ") - rcon_port = ports(port, rcon_p, True) - rcon_enabled = True + port = check_int("Укажите порт сервера: ") + rcon_port = ports(port, rcon_p, True) + rcon_enabled = True - password_server = input("Укажите пароль Сервера: \n") - adminpassword_server = 123 - max_players = check_int("Укажите максимальное количество игроков: \n") - if max_players == 0: - max_players = 70 + password_server = input("Укажите пароль Сервера: \n") + adminpassword_server = 123 + max_players = check_int("Укажите максимальное количество игроков: \n") + if max_players == 0: + max_players = 70 - print("Передавать сервер в глобальный список серверов steam?") - listen_server_amount = check_int("""\n + print("Передавать сервер в глобальный список серверов steam?") + listen_server_amount = check_int("""\n 1. Да 2. Нет :""") - if listen_server_amount == 1: - listen_server = True - elif listen_server_amount == 2: - listen_server = False - else: - listen_server = True + if listen_server_amount == 1: + listen_server = True + elif listen_server_amount == 2: + listen_server = False + else: + listen_server = True - print_line(cluster_server, map_s, list_config[-1], port_server, query_port, - rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, - cluster_id, cluster_dir_override, listen_server) - yaml_create("ARK", "", cluster_server, map_s, list_config[-1], port_server, query_port, - rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, - cluster_id, cluster_dir_override, listen_server) + print_line(cluster_server, map_s, list_config[-1], port_server, query_port, + rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, + cluster_id, cluster_dir_override, listen_server) + yaml_create("ARK", "", cluster_server, map_s, list_config[-1], port_server, query_port, + rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, + cluster_id, cluster_dir_override, listen_server) def config_7daystodie(): From 7ca4f6bf87f2f16415d6326a6b2240c5a70dbc58 Mon Sep 17 00:00:00 2001 From: xpamych Date: Wed, 17 May 2023 15:48:37 +0300 Subject: [PATCH 207/244] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=20=D1=86=D0=B8=D0=BA=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 64 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/hlna.py b/hlna.py index 29a259d..cf28f4c 100755 --- a/hlna.py +++ b/hlna.py @@ -250,39 +250,39 @@ def config_maps(i): if 0 < amount_map <= 12: break - if list_config: - port_s, query_p, rcon_p = ports_array() - else: - port_s = query_p = rcon_p = [] + if list_config: + port_s, query_p, rcon_p = ports_array() + else: + port_s = query_p = rcon_p = [] - if amount_map == 1: - map_s = "TheIsland" - elif amount_map == 2: - map_s = "TheCenter" - elif amount_map == 3: - map_s = "ScorchedEarth_P" - elif amount_map == 4: - map_s = "Ragnarok" - elif amount_map == 5: - map_s = "Aberration_P" - elif amount_map == 6: - map_s = "Extinction" - elif amount_map == 7: - map_s = "Valguero_P" - elif amount_map == 8: - map_s = "Genesis" - elif amount_map == 9: - map_s = "CrystalIsles" - elif amount_map == 10: - map_s = "Gen2" - elif amount_map == 11: - map_s = "LostIsland" - elif amount_map == 12: - map_s = "Fjordur" - else: - # Если вдруг каким-то боком проверка не отработает и не будет нужной цифры - map_s = 'TheIsland' - return map_s, port_s, query_p, rcon_p + if amount_map == 1: + map_s = "TheIsland" + elif amount_map == 2: + map_s = "TheCenter" + elif amount_map == 3: + map_s = "ScorchedEarth_P" + elif amount_map == 4: + map_s = "Ragnarok" + elif amount_map == 5: + map_s = "Aberration_P" + elif amount_map == 6: + map_s = "Extinction" + elif amount_map == 7: + map_s = "Valguero_P" + elif amount_map == 8: + map_s = "Genesis" + elif amount_map == 9: + map_s = "CrystalIsles" + elif amount_map == 10: + map_s = "Gen2" + elif amount_map == 11: + map_s = "LostIsland" + elif amount_map == 12: + map_s = "Fjordur" + else: + # Если вдруг каким-то боком проверка не отработает и не будет нужной цифры + map_s = 'TheIsland' + return map_s, port_s, query_p, rcon_p def config_nameserver(map_s): From ea9f303c89ccccad7083ef91f2903d479332613c Mon Sep 17 00:00:00 2001 From: xpamych Date: Wed, 17 May 2023 15:49:37 +0300 Subject: [PATCH 208/244] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dd7f2b0..79bf4c8 100644 --- a/README.md +++ b/README.md @@ -21,4 +21,7 @@ hlna start Подробнее в [WIKI](https://gitflic.ru/project/xpamych/hln-a/wiki) # Спасибы -Сей софт написан при активном участии Sitisll, Xpamych, Vano, а так же при моральной поддержке Nezrimka и Vajka)) \ No newline at end of file +Сей софт написан при активном участии Sitisll, Xpamych, Vano, ChatGPT, а так же при моральной поддержке Nezrimka и Vajka)) + +# Поддержка проекта +https://boosty.to/xpamych/donate From 6e7714f97bd25260c3535a9abe9306f03d558b17 Mon Sep 17 00:00:00 2001 From: xpamych Date: Wed, 17 May 2023 19:48:57 +0300 Subject: [PATCH 209/244] =?UTF-8?q?=D1=80=D0=B0=D0=B7=D0=B1=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8E=20config=5Fark?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 98 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 63 insertions(+), 35 deletions(-) diff --git a/hlna.py b/hlna.py index cf28f4c..62eea88 100755 --- a/hlna.py +++ b/hlna.py @@ -310,6 +310,56 @@ def config_nameserver(map_s): break return list_config + +def config_ports(port_s): + port = check_int("Укажите порт сервера: ") + port_server = ports(port, port_s, True) + return port_server + + +def config_query(query_p): + port = check_int("Укажите query порт сервера: ") + query_port = ports(port, query_p, False) + return query_port + + +def config_rcon(rcon_p): + port = check_int("Укажите порт сервера: ") + rcon_port = ports(port, rcon_p, True) + return rcon_port + + +def config_password(): + password_server = input("Укажите пароль Сервера: \n") + return password_server + +def config_adminpassword(): + adminpassword_server = input("Укажите пароль Сервера: \n") + return adminpassword_server + + +def config_players(): + max_players = check_int("Укажите максимальное количество игроков: \n") + if max_players == 0: + max_players = 70 + return max_players + + +def config_listen(): + print("Передавать сервер в глобальный список серверов steam?") + listen_server_amount = check_int("""\n +1. Да +2. Нет +:""") + if listen_server_amount == 1: + listen_server = True + elif listen_server_amount == 2: + listen_server = False + else: + listen_server = True + return listen_server + + def config_ark(list_config=list_config): """конфигурирование сервера арк""" create_dir(dir_server_ark) @@ -325,46 +375,24 @@ def config_ark(list_config=list_config): count_maps = config_nummap() print_line(count_maps) for i in range(count_maps): - map_s, port_s, query_p, rcon_p = config_maps(i) print_line(map_s, port_s, query_p, rcon_p) list_config = config_nameserver(map_s) - - - port = check_int("Укажите порт сервера: ") - port_server = ports(port, port_s, True) - - port = check_int("Укажите query порт сервера: ") - query_port = ports(port, query_p, False) - - port = check_int("Укажите порт сервера: ") - rcon_port = ports(port, rcon_p, True) + port_server = config_ports(port_s) + query_port = config_query(query_p) + rcon_port = config_rcon(rcon_p) rcon_enabled = True + password_server = config_password() + adminpassword_server = config_adminpassword() + max_players = config_players() + listen_server = config_listen() - password_server = input("Укажите пароль Сервера: \n") - adminpassword_server = 123 - max_players = check_int("Укажите максимальное количество игроков: \n") - if max_players == 0: - max_players = 70 - - print("Передавать сервер в глобальный список серверов steam?") - listen_server_amount = check_int("""\n -1. Да -2. Нет -:""") - if listen_server_amount == 1: - listen_server = True - elif listen_server_amount == 2: - listen_server = False - else: - listen_server = True - - print_line(cluster_server, map_s, list_config[-1], port_server, query_port, - rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, - cluster_id, cluster_dir_override, listen_server) - yaml_create("ARK", "", cluster_server, map_s, list_config[-1], port_server, query_port, - rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, - cluster_id, cluster_dir_override, listen_server) + print_line(cluster_server, map_s, list_config[-1], port_server, query_port, + rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, + cluster_id, cluster_dir_override, listen_server) + yaml_create("ARK", "", cluster_server, map_s, list_config[-1], port_server, query_port, + rcon_enabled, rcon_port, adminpassword_server, password_server, max_players, + cluster_id, cluster_dir_override, listen_server) def config_7daystodie(): From ad6bcff7bba3eb35ce3921f8567b591dcabcb1eb Mon Sep 17 00:00:00 2001 From: sitisll Date: Fri, 19 May 2023 15:44:26 +0300 Subject: [PATCH 210/244] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20print=5Fline,=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B0=D0=B5=D0=BC=20=D0=B0=D1=80=D0=B3=D1=83=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=20flag=3DFalse,=20=D0=B4=D0=BB=D1=8F=20=D0=BA=D1=80?= =?UTF-8?q?=D0=B0=D1=81=D0=BD=D0=BE=D0=B3=D0=BE=20=D1=82=D0=B5=D0=BA=D1=81?= =?UTF-8?q?=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/hlna.py b/hlna.py index 62eea88..e1641de 100755 --- a/hlna.py +++ b/hlna.py @@ -94,7 +94,7 @@ def unpack(src, dst): if size_unpacked != size_indexed: msg = f"Header-Index mismatch. Header indicates it should only have {size_unpacked} bytes when uncompressed but the index indicates {size_indexed} bytes." logging.critical(msg) - return print(msg) + return print_line(msg, flag=False) # Read the actual archive data data = b'' @@ -112,19 +112,19 @@ def unpack(src, dst): if len(uncompressed_data) != size_unpacked_chunk and read_data != len(compression_index): msg = f"Index contains more than one partial chunk: was {len(uncompressed_data)} when the full chunk size is {size_unpacked_chunk}, chunk {read_data}/{len(compression_index)}" logging.critical(msg) - return print(msg) + return print_line(msg, flag=False) else: msg = f"Uncompressed chunk size is not the same as in the index: was {len(uncompressed_data)} but should be {uncompressed}." logging.critical(msg) - return print(msg) + return print_line(msg, flag=False) else: msg = f"Data types in the headers should be int's. Size Types: unpacked_chunk({type(size_unpacked_chunk)}), packed({type(size_packed)}), unpacked({type(size_unpacked)})" logging.critical(msg) - return print(msg) + return print_line(msg, flag=False) else: msg = "The signature and format version is incorrect. Signature was {} should be 2653586369.".format(sigver) logging.critical(msg) - return print(msg) + return print_line(msg,flag=False) # Write the extracted data to disk with open(dst, 'wb') as f: @@ -304,7 +304,7 @@ def config_nameserver(map_s): break else: if name_server in list_config: - print_line("Имя занято") + print_line("Имя занято", flag=False) else: list_config.append(name_server) # если enter, то ставим последним элементом карту break @@ -405,7 +405,7 @@ def config_7daystodie(): elif config_7days == "serverconfig": config_7days = "serverconfig" elif config_7days in list_simvols: - print_line("Запрещённые символы") + print_line("Запрещённые символы", flag=False) else: xml_parser() systemd_unit_create("7Days", config_7days) @@ -413,7 +413,7 @@ def config_7daystodie(): def xml_parser(): """добавить документацию""" - print("Я пока не умею парсить xml))") + print("Я пока не умею парсить xml))", flag=False) def yaml_create(game, dir_server="", cluster_server="", map_s="", name_server="", port_server="", query_port="", @@ -623,27 +623,30 @@ def switch(g, m, e): #добавить all f.write(f"[{t}] Сервер {i} перемещён из {state_msg}\n") if x == 0: print(f"Готов - {i}") - start = "start" if e else "stop" + #start = "start" if e else "stop" enable = "enable" if e else "disable" os.system(f"systemctl --user {enable} ark_{i}") else: - print(f"Ошибка перемещения {i}") + print_line(f"Ошибка перемещения {i}", flag=False) except: - print("ошибка операции") + print_line("ошибка операции", flag=False) @hlna.command(help='Выводит статус настроеных серверов') def status(list_config=list_config): if list_config == [] and delist_config == []: - print_line("Сервера не сконфигурированы") + print_line("Сервера не сконфигурированы", flag=False) else: for i in list_config: data = read_yaml(i, game="ARK") x = os.system(f"lsof -w -i :{data['Port']}") if x == 0: - print(colorama.Fore.GREEN + "Сервер запущен" + colorama.Style.RESET_ALL) + print_line("Сервер запущен") else: - print(colorama.Fore.RED + "Сервер не запущен" + colorama.Style.RESET_ALL) + print_line("Сервер не запущен", flag=False) + + # этот принт надо отдельной функцией сделать, чтобы убрать дублирование текста + print(f""" Имя сервера: {i} Карта: {data['map']} @@ -707,7 +710,7 @@ def check_exist_servers(g): """Проверяет наличие конфигов для активных карт""" if g == "ark": if list_config == []: - print_line("Нет сконфигурированных серверов") # добавить отсюда вилку на вопрос с конфигурацией + print_line("Нет сконфигурированных серверов", flag=False) # добавить отсюда вилку на вопрос с конфигурацией else: return elif g == "7days": @@ -777,7 +780,7 @@ def choose_map(arr): x = [int(i) for i in x] break except: - print("Неправильный ввод") + print_line("Неправильный ввод",flag=False) for i in x: new_arr.append(arr[i - 1]) @@ -815,7 +818,7 @@ def rcon(m, c): else: pass except: - print(colorama.Fore.RED + f"Ошибка отправки команды в {m}" + colorama.Style.RESET_ALL) + print(f"Ошибка отправки команды в {m}", flag=False) def zero(x=""): From f2adab40364f01592aa3790679a4fcc566231f7f Mon Sep 17 00:00:00 2001 From: xpamych Date: Fri, 19 May 2023 21:50:39 +0300 Subject: [PATCH 211/244] =?UTF-8?q?=D0=97=D0=B0=D1=87=D0=B0=D1=82=D0=BA?= =?UTF-8?q?=D0=B8=20ui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 81 ++++++++++++- hlna.py | 30 ++++- hlna.ui | 332 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 437 insertions(+), 6 deletions(-) create mode 100644 hlna.ui diff --git a/.gitignore b/.gitignore index 2c7e2d8..4527af5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,77 @@ -__pycache__ -# Ignore dynaconf secret files -.secrets.* -.idea +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + +#pyproject +.pyproject +.pyproject.user diff --git a/hlna.py b/hlna.py index e1641de..46f35a6 100755 --- a/hlna.py +++ b/hlna.py @@ -2,7 +2,6 @@ import os import re import sys -import time import zlib import struct import logging @@ -15,6 +14,7 @@ import colorama from pathlib import Path from rcon.source import Client +from PyQt6.QtWidgets import QApplication, QWidget, QMainWindow, QLabel, QPushButton home_dir = Path.home() @@ -333,6 +333,7 @@ def config_password(): password_server = input("Укажите пароль Сервера: \n") return password_server + def config_adminpassword(): adminpassword_server = input("Укажите пароль Сервера: \n") return adminpassword_server @@ -853,5 +854,30 @@ create_dir(dir_server) create_dir(dir_unit) create_dir(dir_logs) + +class MainWindow(QMainWindow): + def __init__(self): + super().__init__() + + self.setWindowTitle("HLN-A") + button = QPushButton("Выход") + button.setCheckable(True) + button.clicked.connect(self.button_click) + self.setCentralWidget(button) + + def button_click(self): + exit() + + +def hlnag(): + if len(sys.argv) > 1: + hlna() + else: + app = QApplication(sys.argv) + hlnag_gui_window = MainWindow() + hlnag_gui_window.show() + sys.exit(app.exec()) + + if __name__ == '__main__': - hlna() + hlnag() diff --git a/hlna.ui b/hlna.ui new file mode 100644 index 0000000..a9eb0c4 --- /dev/null +++ b/hlna.ui @@ -0,0 +1,332 @@ + + + MainWindow + + + + 0 + 0 + 1553 + 1000 + + + + MainWindow + + + + + + 0 + 0 + 1551 + 941 + + + + + 1551 + 941 + + + + 0 + + + + ARK + + + + + 0 + 0 + 1551 + 911 + + + + 0 + + + true + + + true + + + + Tab 1 + + + + + 0 + 0 + 471 + 871 + + + + + + + + + 10 + 30 + 441 + 31 + + + + + + + 10 + 10 + 81 + 18 + + + + Имя сессии + + + true + + + + + + 10 + 80 + 131 + 31 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">7777</p></body></html> + + + + + + 10 + 60 + 81 + 18 + + + + Порт + + + true + + + + + + 170 + 60 + 81 + 18 + + + + Querry порт + + + true + + + + + + 170 + 80 + 131 + 31 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">27015</p></body></html> + + + + + + 330 + 80 + 121 + 31 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">27042</p></body></html> + + + + + + 330 + 60 + 81 + 18 + + + + Rcon порт + + + true + + + + + + 10 + 140 + 221 + 31 + + + + + + + 10 + 120 + 101 + 18 + + + + Пароль сессии + + + true + + + + + + 240 + 120 + 161 + 18 + + + + Пароль администратора + + + true + + + + + + 230 + 140 + 221 + 31 + + + + + + + 10 + 200 + 71 + 31 + + + + + + + 10 + 180 + 131 + 18 + + + + Количество игроков + + + true + + + + + + 140 + 200 + 301 + 31 + + + + Передавать в глобальный список серверов + + + + + + + 470 + 0 + 1071 + 871 + + + + ini + + + + + + Tab 2 + + + + + + + 7 Days to Die + + + + + + + + 0 + 0 + 1553 + 30 + + + + + + + + From d100f6acad266fe09bd918c9eda50d7ff5802003 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 20 May 2023 18:06:16 +0300 Subject: [PATCH 212/244] 7days --- hlna.ui | 165 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 164 insertions(+), 1 deletion(-) diff --git a/hlna.ui b/hlna.ui index a9eb0c4..67e5b19 100644 --- a/hlna.ui +++ b/hlna.ui @@ -46,7 +46,7 @@ - 0 + 1 true @@ -312,6 +312,169 @@ p, li { white-space: pre-wrap; } 7 Days to Die + + + + 0 + 0 + 471 + 901 + + + + + + + + + 10 + 30 + 441 + 31 + + + + + + + 10 + 10 + 81 + 18 + + + + Имя сессии + + + true + + + + + + 10 + 80 + 131 + 31 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> + + + + + + 10 + 60 + 81 + 18 + + + + Порт + + + true + + + + + + 10 + 140 + 221 + 31 + + + + + + + 10 + 120 + 101 + 18 + + + + Пароль сессии + + + true + + + + + + 240 + 120 + 161 + 18 + + + + Пароль администратора + + + true + + + + + + 230 + 140 + 221 + 31 + + + + + + + 10 + 200 + 71 + 31 + + + + + + + 10 + 180 + 131 + 18 + + + + Количество игроков + + + true + + + + + + + 470 + 0 + 1071 + 901 + + + + xml + + From f2ccc11c726ffd887f462953d7b0accb23da7334 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 20 May 2023 18:38:04 +0300 Subject: [PATCH 213/244] 1 --- hlna.ui | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hlna.ui b/hlna.ui index 67e5b19..b071243 100644 --- a/hlna.ui +++ b/hlna.ui @@ -6,7 +6,7 @@ 0 0 - 1553 + 1552 1000 @@ -30,7 +30,7 @@ - 0 + 1 @@ -41,8 +41,8 @@ 0 0 - 1551 - 911 + 1541 + 901 @@ -483,7 +483,7 @@ p, li { white-space: pre-wrap; } 0 0 - 1553 + 1552 30 From 08d0a0dc0db99912efad603e7f39db83a83e3ae2 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sat, 20 May 2023 22:12:13 +0300 Subject: [PATCH 214/244] 1 --- hlna.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hlna.py b/hlna.py index 46f35a6..0e259a0 100755 --- a/hlna.py +++ b/hlna.py @@ -519,7 +519,12 @@ def mod(g, m, i, id_mods_ark): print_line(f"{dir_ark_mods} удалён") os.system(f"rm {dir_mods_ark}/{id_mod}.mod") print_line(f"{dir_mods_ark}/{id_mod}.mod удалён") - os.system(f"rm {dir_workshop_ark}/appworkshop_{id_game_workshop}.acf") + os.system(f"mv {dir_workshop_ark}/appworkshop_{id_game_workshop}.acf {dir_ark_mods}") + + +def modupdate(dir_ark_mods, id_game_workshop): + if os.path.exists(f"{dir_ark_mods}/appworkshop_{id_game_workshop}.acf"): + # тут будет проверка необходимости обновления def modextract(id_mod, id_game_workshop, dir_ark_mods): From f3466c29c5711b578358e225995f303b9fcbce0d Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 12:02:37 +0300 Subject: [PATCH 215/244] =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20gui?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.ui | 844 ++++++++++++++++++++++++++---------------------------- hlnaui.py | 203 +++++++++++++ 2 files changed, 611 insertions(+), 436 deletions(-) create mode 100644 hlnaui.py diff --git a/hlna.ui b/hlna.ui index b071243..157cdac 100644 --- a/hlna.ui +++ b/hlna.ui @@ -14,469 +14,441 @@ MainWindow - - - - 0 - 0 - 1551 - 941 - - - - - 1551 - 941 - - - - 1 - - - - ARK - - - - - 0 - 0 - 1541 - 901 - + + + + + + 1551 + 941 + 1 - - true - - - true - - + - Tab 1 + ARK - - - - 0 - 0 - 471 - 871 - - - - - - - - - 10 - 30 - 441 - 31 - - - - - - - 10 - 10 - 81 - 18 - - - - Имя сессии - - - true - - - - - - 10 - 80 - 131 - 31 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + + + + 0 + + + true + + + true + + + + Tab 1 + + + + + + + + + + + 10 + 30 + 441 + 31 + + + + + + + 10 + 10 + 81 + 18 + + + + Имя сессии + + + true + + + + + + 10 + 80 + 131 + 31 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">7777</p></body></html> - - - - - - 10 - 60 - 81 - 18 - - - - Порт - - - true - - - - - - 170 - 60 - 81 - 18 - - - - Querry порт - - - true - - - - - - 170 - 80 - 131 - 31 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + + + + + 10 + 60 + 81 + 18 + + + + Порт + + + true + + + + + + 170 + 60 + 81 + 18 + + + + Querry порт + + + true + + + + + + 170 + 80 + 131 + 31 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">27015</p></body></html> - - - - - - 330 - 80 - 121 - 31 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + + + + + 330 + 80 + 121 + 31 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">27042</p></body></html> - - - - - - 330 - 60 - 81 - 18 - - - - Rcon порт - - - true - - - - - - 10 - 140 - 221 - 31 - - - - - - - 10 - 120 - 101 - 18 - - - - Пароль сессии - - - true - - - - - - 240 - 120 - 161 - 18 - - - - Пароль администратора - - - true - - - - - - 230 - 140 - 221 - 31 - - - - - - - 10 - 200 - 71 - 31 - - - - - - - 10 - 180 - 131 - 18 - - - - Количество игроков - - - true - - - - - - 140 - 200 - 301 - 31 - - - - Передавать в глобальный список серверов - - - - - - - 470 - 0 - 1071 - 871 - - - - ini - - + + + + + + 330 + 60 + 81 + 18 + + + + Rcon порт + + + true + + + + + + 10 + 140 + 221 + 31 + + + + + + + 10 + 120 + 101 + 18 + + + + Пароль сессии + + + true + + + + + + 240 + 120 + 161 + 18 + + + + Пароль администратора + + + true + + + + + + 230 + 140 + 221 + 31 + + + + + + + 10 + 200 + 71 + 31 + + + + + + + 10 + 180 + 131 + 18 + + + + Количество игроков + + + true + + + + + + 140 + 200 + 301 + 31 + + + + Передавать в глобальный список серверов + + + + + + + + ini + + + + + + + + Tab 2 + + + + + - + - Tab 2 + 7 Days to Die - - - - - - 7 Days to Die - - - - - 0 - 0 - 471 - 901 - - - - - - - - - 10 - 30 - 441 - 31 - - - - - - - 10 - 10 - 81 - 18 - - - - Имя сессии - - - true - - - - - - 10 - 80 - 131 - 31 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + + + + + + + + + 10 + 30 + 441 + 31 + + + + + + + 10 + 10 + 81 + 18 + + + + Имя сессии + + + true + + + + + + 10 + 80 + 131 + 31 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> - - - - - - 10 - 60 - 81 - 18 - - - - Порт - - - true - - - - - - 10 - 140 - 221 - 31 - - - - - - - 10 - 120 - 101 - 18 - - - - Пароль сессии - - - true - - - - - - 240 - 120 - 161 - 18 - - - - Пароль администратора - - - true - - - - - - 230 - 140 - 221 - 31 - - - - - - - 10 - 200 - 71 - 31 - - - - - - - 10 - 180 - 131 - 18 - - - - Количество игроков - - - true - + + + + + + 10 + 60 + 81 + 18 + + + + Порт + + + true + + + + + + 10 + 140 + 221 + 31 + + + + + + + 10 + 120 + 101 + 18 + + + + Пароль сессии + + + true + + + + + + 240 + 120 + 161 + 18 + + + + Пароль администратора + + + true + + + + + + 230 + 140 + 221 + 31 + + + + + + + 10 + 200 + 71 + 31 + + + + + + + 10 + 180 + 131 + 18 + + + + Количество игроков + + + true + + + + + + + + xml + + + + - - - - 470 - 0 - 1071 - 901 - - - - xml - - - - + + diff --git a/hlnaui.py b/hlnaui.py new file mode 100644 index 0000000..7abe76d --- /dev/null +++ b/hlnaui.py @@ -0,0 +1,203 @@ +# Form implementation generated from reading ui file './hlna.ui' +# +# Created by: PyQt6 UI code generator 6.5.0 +# +# WARNING: Any manual changes made to this file will be lost when pyuic6 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt6 import QtCore, QtGui, QtWidgets + + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(1552, 1000) + self.centralwidget = QtWidgets.QWidget(parent=MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget) + self.horizontalLayout.setObjectName("horizontalLayout") + self.tabWidget = QtWidgets.QTabWidget(parent=self.centralwidget) + self.tabWidget.setMaximumSize(QtCore.QSize(1551, 941)) + self.tabWidget.setObjectName("tabWidget") + self.tab = QtWidgets.QWidget() + self.tab.setObjectName("tab") + self.gridLayout_2 = QtWidgets.QGridLayout(self.tab) + self.gridLayout_2.setObjectName("gridLayout_2") + self.tabWidget_2 = QtWidgets.QTabWidget(parent=self.tab) + self.tabWidget_2.setTabsClosable(True) + self.tabWidget_2.setTabBarAutoHide(True) + self.tabWidget_2.setObjectName("tabWidget_2") + self.tab_5 = QtWidgets.QWidget() + self.tab_5.setObjectName("tab_5") + self.gridLayout_3 = QtWidgets.QGridLayout(self.tab_5) + self.gridLayout_3.setObjectName("gridLayout_3") + self.groupBox = QtWidgets.QGroupBox(parent=self.tab_5) + self.groupBox.setTitle("") + self.groupBox.setObjectName("groupBox") + self.textEdit = QtWidgets.QTextEdit(parent=self.groupBox) + self.textEdit.setGeometry(QtCore.QRect(10, 30, 441, 31)) + self.textEdit.setObjectName("textEdit") + self.label = QtWidgets.QLabel(parent=self.groupBox) + self.label.setGeometry(QtCore.QRect(10, 10, 81, 18)) + self.label.setScaledContents(True) + self.label.setObjectName("label") + self.textEdit_2 = QtWidgets.QTextEdit(parent=self.groupBox) + self.textEdit_2.setGeometry(QtCore.QRect(10, 80, 131, 31)) + self.textEdit_2.setObjectName("textEdit_2") + self.label_2 = QtWidgets.QLabel(parent=self.groupBox) + self.label_2.setGeometry(QtCore.QRect(10, 60, 81, 18)) + self.label_2.setScaledContents(True) + self.label_2.setObjectName("label_2") + self.label_3 = QtWidgets.QLabel(parent=self.groupBox) + self.label_3.setGeometry(QtCore.QRect(170, 60, 81, 18)) + self.label_3.setScaledContents(True) + self.label_3.setObjectName("label_3") + self.textEdit_3 = QtWidgets.QTextEdit(parent=self.groupBox) + self.textEdit_3.setGeometry(QtCore.QRect(170, 80, 131, 31)) + self.textEdit_3.setObjectName("textEdit_3") + self.textEdit_4 = QtWidgets.QTextEdit(parent=self.groupBox) + self.textEdit_4.setGeometry(QtCore.QRect(330, 80, 121, 31)) + self.textEdit_4.setObjectName("textEdit_4") + self.label_4 = QtWidgets.QLabel(parent=self.groupBox) + self.label_4.setGeometry(QtCore.QRect(330, 60, 81, 18)) + self.label_4.setScaledContents(True) + self.label_4.setObjectName("label_4") + self.textEdit_5 = QtWidgets.QTextEdit(parent=self.groupBox) + self.textEdit_5.setGeometry(QtCore.QRect(10, 140, 221, 31)) + self.textEdit_5.setObjectName("textEdit_5") + self.label_5 = QtWidgets.QLabel(parent=self.groupBox) + self.label_5.setGeometry(QtCore.QRect(10, 120, 101, 18)) + self.label_5.setScaledContents(True) + self.label_5.setObjectName("label_5") + self.label_6 = QtWidgets.QLabel(parent=self.groupBox) + self.label_6.setGeometry(QtCore.QRect(240, 120, 161, 18)) + self.label_6.setScaledContents(True) + self.label_6.setObjectName("label_6") + self.textEdit_6 = QtWidgets.QTextEdit(parent=self.groupBox) + self.textEdit_6.setGeometry(QtCore.QRect(230, 140, 221, 31)) + self.textEdit_6.setObjectName("textEdit_6") + self.textEdit_7 = QtWidgets.QTextEdit(parent=self.groupBox) + self.textEdit_7.setGeometry(QtCore.QRect(10, 200, 71, 31)) + self.textEdit_7.setObjectName("textEdit_7") + self.label_7 = QtWidgets.QLabel(parent=self.groupBox) + self.label_7.setGeometry(QtCore.QRect(10, 180, 131, 18)) + self.label_7.setScaledContents(True) + self.label_7.setObjectName("label_7") + self.checkBox = QtWidgets.QCheckBox(parent=self.groupBox) + self.checkBox.setGeometry(QtCore.QRect(140, 200, 301, 31)) + self.checkBox.setObjectName("checkBox") + self.gridLayout_3.addWidget(self.groupBox, 0, 0, 1, 1) + self.groupBox_2 = QtWidgets.QGroupBox(parent=self.tab_5) + self.groupBox_2.setObjectName("groupBox_2") + self.gridLayout_3.addWidget(self.groupBox_2, 0, 1, 1, 1) + self.tabWidget_2.addTab(self.tab_5, "") + self.tab_6 = QtWidgets.QWidget() + self.tab_6.setObjectName("tab_6") + self.tabWidget_2.addTab(self.tab_6, "") + self.gridLayout_2.addWidget(self.tabWidget_2, 0, 0, 1, 1) + self.tabWidget.addTab(self.tab, "") + self.tab_2 = QtWidgets.QWidget() + self.tab_2.setObjectName("tab_2") + self.gridLayout = QtWidgets.QGridLayout(self.tab_2) + self.gridLayout.setObjectName("gridLayout") + self.groupBox_3 = QtWidgets.QGroupBox(parent=self.tab_2) + self.groupBox_3.setTitle("") + self.groupBox_3.setObjectName("groupBox_3") + self.textEdit_8 = QtWidgets.QTextEdit(parent=self.groupBox_3) + self.textEdit_8.setGeometry(QtCore.QRect(10, 30, 441, 31)) + self.textEdit_8.setObjectName("textEdit_8") + self.label_8 = QtWidgets.QLabel(parent=self.groupBox_3) + self.label_8.setGeometry(QtCore.QRect(10, 10, 81, 18)) + self.label_8.setScaledContents(True) + self.label_8.setObjectName("label_8") + self.textEdit_9 = QtWidgets.QTextEdit(parent=self.groupBox_3) + self.textEdit_9.setGeometry(QtCore.QRect(10, 80, 131, 31)) + self.textEdit_9.setObjectName("textEdit_9") + self.label_9 = QtWidgets.QLabel(parent=self.groupBox_3) + self.label_9.setGeometry(QtCore.QRect(10, 60, 81, 18)) + self.label_9.setScaledContents(True) + self.label_9.setObjectName("label_9") + self.textEdit_12 = QtWidgets.QTextEdit(parent=self.groupBox_3) + self.textEdit_12.setGeometry(QtCore.QRect(10, 140, 221, 31)) + self.textEdit_12.setObjectName("textEdit_12") + self.label_12 = QtWidgets.QLabel(parent=self.groupBox_3) + self.label_12.setGeometry(QtCore.QRect(10, 120, 101, 18)) + self.label_12.setScaledContents(True) + self.label_12.setObjectName("label_12") + self.label_13 = QtWidgets.QLabel(parent=self.groupBox_3) + self.label_13.setGeometry(QtCore.QRect(240, 120, 161, 18)) + self.label_13.setScaledContents(True) + self.label_13.setObjectName("label_13") + self.textEdit_13 = QtWidgets.QTextEdit(parent=self.groupBox_3) + self.textEdit_13.setGeometry(QtCore.QRect(230, 140, 221, 31)) + self.textEdit_13.setObjectName("textEdit_13") + self.textEdit_14 = QtWidgets.QTextEdit(parent=self.groupBox_3) + self.textEdit_14.setGeometry(QtCore.QRect(10, 200, 71, 31)) + self.textEdit_14.setObjectName("textEdit_14") + self.label_14 = QtWidgets.QLabel(parent=self.groupBox_3) + self.label_14.setGeometry(QtCore.QRect(10, 180, 131, 18)) + self.label_14.setScaledContents(True) + self.label_14.setObjectName("label_14") + self.gridLayout.addWidget(self.groupBox_3, 0, 0, 1, 1) + self.groupBox_4 = QtWidgets.QGroupBox(parent=self.tab_2) + self.groupBox_4.setObjectName("groupBox_4") + self.gridLayout.addWidget(self.groupBox_4, 0, 1, 1, 1) + self.tabWidget.addTab(self.tab_2, "") + self.horizontalLayout.addWidget(self.tabWidget) + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QtWidgets.QMenuBar(parent=MainWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1552, 30)) + self.menubar.setObjectName("menubar") + MainWindow.setMenuBar(self.menubar) + self.statusbar = QtWidgets.QStatusBar(parent=MainWindow) + self.statusbar.setObjectName("statusbar") + MainWindow.setStatusBar(self.statusbar) + + self.retranslateUi(MainWindow) + self.tabWidget.setCurrentIndex(1) + self.tabWidget_2.setCurrentIndex(0) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) + self.label.setText(_translate("MainWindow", "Имя сессии")) + self.textEdit_2.setHtml(_translate("MainWindow", "\n" +"\n" +"

7777

")) + self.label_2.setText(_translate("MainWindow", "Порт")) + self.label_3.setText(_translate("MainWindow", "Querry порт")) + self.textEdit_3.setHtml(_translate("MainWindow", "\n" +"\n" +"

27015

")) + self.textEdit_4.setHtml(_translate("MainWindow", "\n" +"\n" +"

27042

")) + self.label_4.setText(_translate("MainWindow", "Rcon порт")) + self.label_5.setText(_translate("MainWindow", "Пароль сессии")) + self.label_6.setText(_translate("MainWindow", "Пароль администратора")) + self.label_7.setText(_translate("MainWindow", "Количество игроков")) + self.checkBox.setText(_translate("MainWindow", "Передавать в глобальный список серверов")) + self.groupBox_2.setTitle(_translate("MainWindow", "ini")) + self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_5), _translate("MainWindow", "Tab 1")) + self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_6), _translate("MainWindow", "Tab 2")) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "ARK")) + self.label_8.setText(_translate("MainWindow", "Имя сессии")) + self.textEdit_9.setHtml(_translate("MainWindow", "\n" +"\n" +"


")) + self.label_9.setText(_translate("MainWindow", "Порт")) + self.label_12.setText(_translate("MainWindow", "Пароль сессии")) + self.label_13.setText(_translate("MainWindow", "Пароль администратора")) + self.label_14.setText(_translate("MainWindow", "Количество игроков")) + self.groupBox_4.setTitle(_translate("MainWindow", "xml")) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "7 Days to Die")) From f4eae36605617253da1ab3694eb0e370644260a1 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 12:03:23 +0300 Subject: [PATCH 216/244] gitignore --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4527af5..817b763 100644 --- a/.gitignore +++ b/.gitignore @@ -73,5 +73,5 @@ CMakeLists.txt.user* *.exe #pyproject -.pyproject -.pyproject.user +*.pyproject +*.pyproject.user From 40ad6457475e1aa64459314891b40d13cc9ab86d Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 12:03:50 +0300 Subject: [PATCH 217/244] gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 817b763..3063fa0 100644 --- a/.gitignore +++ b/.gitignore @@ -75,3 +75,4 @@ CMakeLists.txt.user* #pyproject *.pyproject *.pyproject.user +*.ui \ No newline at end of file From 3273a3c837a2afdd0de1a2da463c87e4ec38ea08 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 12:04:07 +0300 Subject: [PATCH 218/244] 1 --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3063fa0..21ee280 100644 --- a/.gitignore +++ b/.gitignore @@ -75,4 +75,4 @@ CMakeLists.txt.user* #pyproject *.pyproject *.pyproject.user -*.ui \ No newline at end of file +*.uig \ No newline at end of file From 4fe61aceb4cc1a3d07bf2a9d632cae9d450aea65 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 12:04:41 +0300 Subject: [PATCH 219/244] 1 --- hlna.ui | 467 -------------------------------------------------------- 1 file changed, 467 deletions(-) delete mode 100644 hlna.ui diff --git a/hlna.ui b/hlna.ui deleted file mode 100644 index 157cdac..0000000 --- a/hlna.ui +++ /dev/null @@ -1,467 +0,0 @@ - - - MainWindow - - - - 0 - 0 - 1552 - 1000 - - - - MainWindow - - - - - - - - 1551 - 941 - - - - 1 - - - - ARK - - - - - - 0 - - - true - - - true - - - - Tab 1 - - - - - - - - - - - 10 - 30 - 441 - 31 - - - - - - - 10 - 10 - 81 - 18 - - - - Имя сессии - - - true - - - - - - 10 - 80 - 131 - 31 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">7777</p></body></html> - - - - - - 10 - 60 - 81 - 18 - - - - Порт - - - true - - - - - - 170 - 60 - 81 - 18 - - - - Querry порт - - - true - - - - - - 170 - 80 - 131 - 31 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">27015</p></body></html> - - - - - - 330 - 80 - 121 - 31 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">27042</p></body></html> - - - - - - 330 - 60 - 81 - 18 - - - - Rcon порт - - - true - - - - - - 10 - 140 - 221 - 31 - - - - - - - 10 - 120 - 101 - 18 - - - - Пароль сессии - - - true - - - - - - 240 - 120 - 161 - 18 - - - - Пароль администратора - - - true - - - - - - 230 - 140 - 221 - 31 - - - - - - - 10 - 200 - 71 - 31 - - - - - - - 10 - 180 - 131 - 18 - - - - Количество игроков - - - true - - - - - - 140 - 200 - 301 - 31 - - - - Передавать в глобальный список серверов - - - - - - - - ini - - - - - - - - Tab 2 - - - - - - - - - 7 Days to Die - - - - - - - - - - - 10 - 30 - 441 - 31 - - - - - - - 10 - 10 - 81 - 18 - - - - Имя сессии - - - true - - - - - - 10 - 80 - 131 - 31 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> - - - - - - 10 - 60 - 81 - 18 - - - - Порт - - - true - - - - - - 10 - 140 - 221 - 31 - - - - - - - 10 - 120 - 101 - 18 - - - - Пароль сессии - - - true - - - - - - 240 - 120 - 161 - 18 - - - - Пароль администратора - - - true - - - - - - 230 - 140 - 221 - 31 - - - - - - - 10 - 200 - 71 - 31 - - - - - - - 10 - 180 - 131 - 18 - - - - Количество игроков - - - true - - - - - - - - xml - - - - - - - - - - - - - 0 - 0 - 1552 - 30 - - - - - - - - From 6cfaa285d5f3bec8e11ff79d786cb77f150717c8 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 12:04:57 +0300 Subject: [PATCH 220/244] 1 --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 21ee280..3063fa0 100644 --- a/.gitignore +++ b/.gitignore @@ -75,4 +75,4 @@ CMakeLists.txt.user* #pyproject *.pyproject *.pyproject.user -*.uig \ No newline at end of file +*.ui \ No newline at end of file From a35018b26491f23ba5c7ece125902bf6a451384d Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 12:06:14 +0300 Subject: [PATCH 221/244] - bot telegram --- hlna_bot.py | 167 ---------------------------------------------------- 1 file changed, 167 deletions(-) delete mode 100755 hlna_bot.py diff --git a/hlna_bot.py b/hlna_bot.py deleted file mode 100755 index 19c2a99..0000000 --- a/hlna_bot.py +++ /dev/null @@ -1,167 +0,0 @@ -#!/usr/bin/env python3 -import errno -import time -import sys -import os -import telebot -from telebot import types -import subprocess -import yaml -import colorama - -import hlna - -list_config = hlna.list_config - - -def start(): - if not os.path.exists(f"{hlna.home_dir}/.config/hlna/bot/hlna_bot"): - key_api = input("Укажите ключ бота\n") - os.chdir(f"{hlna.home_dir}/.config/hlna/") - try: - os.mkdir("bot") - except OSError as e: - if e.errno == errno.EEXIST: - print('Каталог создан') - else: - raise - create_config(key_api) - else: - x = input("Уже есть запомненный ключа api. Запустить его? Y/n \n") - if x == "" or x.lower == 'y': - read_config() - - elif x == "n": - os.remove(f"{hlna.home_dir}/.config/hlna/bot/hlna_bot") - start() - - -def check_status(m): - for i in list_config: - data = hlna.read_yaml(i) - hlna.print_line(data) - x = os.system(f"lsof -w -i :{data['Port']}") - n_srv = data['SessionName'] - if x != 0: - hlna_bot.send_message(m.chat.id, text=f"Сервер {n_srv} не работает 🛑") - elif x == 0: - hlna_bot.send_message(m.chat.id, text=f"Сервер {n_srv} запустился 🟢") - - -def read_config(): - with open(f"{hlna.home_dir}/.config/hlna/bot/hlna_bot", "r") as yamlfile: - data = yaml.load(yamlfile, Loader=yaml.FullLoader) - return data[0] - - -def create_config(key_api): - config_hlna_bot = [ - { - 'key_api': key_api, - } - ] - with open(f"{hlna.home_dir}/.config/hlna/bot/hlna_bot", 'w') as yamlfile: - yaml.dump(config_hlna_bot, yamlfile) - print(colorama.Fore.GREEN + "Конфиг бота создан" + colorama.Style.RESET_ALL) - - -start() - - -data = read_config() -k_api = data['key_api'] -hlna_bot = telebot.TeleBot(f"{k_api}", parse_mode=None) - - -@hlna_bot.message_handler(commands=["start"]) -def m_mainmenu(m): - menu = types.ReplyKeyboardMarkup(resize_keyboard=True) - k_start = types.KeyboardButton("🦖 Старт") - k_stop = types.KeyboardButton("🦇 Выключить") - menu.add(k_start, k_stop) - - k_restart = types.KeyboardButton("🦕 Перезагрузить") - k_update = types.KeyboardButton("🔸 Обновить") - menu.add(k_restart, k_update) - - k_status = types.KeyboardButton("🧾 Статус") - menu.add(k_status) - - k_mods = types.KeyboardButton("⏬ Установка модов") - menu.add(k_mods) - - hlna_bot.send_message(m.chat.id, text="Привет, {0.first_name}! Это панель управления сервером".format(m.from_user), - reply_markup=menu) - - -@hlna_bot.message_handler(content_types=["text"]) -def m_chose(m): - if m.text.strip() == '🦖 Старт': - if list_config == []: - menu_install = types.ReplyKeyboardMarkup(resize_keyboard=True) - k_install = types.KeyboardButton("Установить") - k_back = types.KeyboardButton("Назад") - menu_install.add(k_back, k_install) - hlna_bot.send_message(m.chat.id, text="{0.first_name}, ниодна карта не установлена".format(m.from_user), - reply_markup=menu_install) - hlna_bot.register_next_step_handler(m, m_install) - else: - hlna.read_yaml(list_config[-1], flag=True) - menu_start = types.ReplyKeyboardMarkup(resize_keyboard=True) - for i in list_config: - k_mapname = types.KeyboardButton(i) - menu_start.add(k_mapname) - k_back = types.KeyboardButton("Назад") - menu_start.add(k_back) - hlna_bot.send_message(m.chat.id, text="{0.first_name}, выбери карту".format(m.from_user), reply_markup=menu_start) - elif m.text.strip() == '🧾 Статус': - check_status(m) - elif m.text.strip() == 'Назад': - m_mainmenu(m) - for i in list_config: - if m.text.strip() == f'{i}': - hlna.print_line(f"Старт карты {i}") - hlna.start() - -# @hlna_bot.message_handler(content_types=["text"]) -# def m_mapstart(m): -# hlna.print_line("Старт карты") -# for i in list_config: -# if m.text.strip() == f'{i}': -# hlna.print_line(f"Старт карты {i}") -# hlna.start() - - -def m_install(m): - if m.text.strip() == 'Установить': - hlna_bot.send_message(m.chat.id, subprocess.check_output(hlna.config(), shell=True)) - - -print("Бот запущен") -hlna_bot.polling(none_stop=True, interval=0, timeout=999) - -# subprocess.run(["arkmanager", "start", "--alwaysrestart", "@all"]) -# elif m.text.strip() == '🦇 Выключить': -# subprocess.run(["arkmanager", "stop", "@all"]) -# elif m.text.strip() == '🦕 Перезагрузить': -# subprocess.run(["arkmanager","restart", "--alwaysrestart", "--warn", "@all"]) -# elif (m.text.strip() == '🔸 Обновить'): -# subprocess.run(["arkmanager", "update", "--update-mods", "@all"]) -# -# -# elif (m.text.strip() == '⏬ Установка модов'): -# bot.send_message(m.from_user.id, "Введите id модификации") -# bot.register_next_step_handler(m, mods) -# else: -# pass -# else: -# if m.text.strip() == 'Zxx843Aj': -# th = Thread(target=check, args=(m,)) -# th.start() -# id.append(m.chat.id) -# bot.send_message(m.chat.id, text="{0.first_name} вы авторизованы, нажмите /start для работы с ботом".format(m.from_user)) -# return id -# def mods(m): -# id = m.text.strip() -# subprocess.run(["arkmanager", "installmods", id, "@all"]) -# subprocess.run(["arkmanager", "enablemod", id, "@all"]) From 4760700190abdc33900c3d6c80d9a653e72adc5e Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 21:56:14 +0300 Subject: [PATCH 222/244] =?UTF-8?q?=D1=87=D1=82=D0=BE-=D1=82=D0=BE=20?= =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20=D1=81=20=D0=BC=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0=D0=BC=D0=B8=20(=D0=BD=D0=B5=20=D0=B4=D0=BE=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B0=D0=BB)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hlna.py | 89 ++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 29 deletions(-) diff --git a/hlna.py b/hlna.py index 0e259a0..ec84cb2 100755 --- a/hlna.py +++ b/hlna.py @@ -6,15 +6,18 @@ import zlib import struct import logging import datetime +import requests import subprocess import yaml import click import colorama +import hlnaui + from pathlib import Path from rcon.source import Client -from PyQt6.QtWidgets import QApplication, QWidget, QMainWindow, QLabel, QPushButton +from PyQt6 import QtWidgets home_dir = Path.home() @@ -501,38 +504,75 @@ WantedBy=default.target @hlna.command(help='Скачивание и установка модов ') @click.argument('g', nargs=1) @click.option('-m', default='all', help="Название карты для запуска или all для запуска всех карт") -@click.option("-i/-u", default=True, help="-i установить моды, -u удалить моды") +@click.option("-i/-u", default=True, help="-i установить/обновить моды, -u удалить моды") @click.argument('id_mods_ark', nargs=-1) def mod(g, m, i, id_mods_ark): if g == "ark": + id_game_workshop = "346110" if not os.path.isdir(dir_mods_ark): create_dir(dir_mods_ark) - id_game_workshop = "346110" id_mods_ark = id_mods_ark[0].split(',') for id_mod in id_mods_ark: dir_ark_mods = f"{dir_mods_ark}/{id_mod}" - if i: - os.system(f"steamcmd +login anonymous +workshop_download_item {id_game_workshop} {id_mod} +quit") - modextract(id_mod, id_game_workshop, dir_ark_mods) + if not os.path.isfile(f"{dir_ark_mods}.mod"): + if i: + moddownload(id_mod, id_game_workshop, dir_ark_mods) + else: + os.system(f"rm -rf {dir_ark_mods}") + print_line(f"{dir_ark_mods} удалён") + os.system(f"rm {dir_mods_ark}/{id_mod}.mod") + print_line(f"{dir_mods_ark}/{id_mod}.mod удалён") + os.system(f"mv {dir_workshop_ark}/appworkshop_{id_game_workshop}.acf {dir_ark_mods}/appworkshop_{id_game_workshop}.acf") else: - os.system(f"rm -rf {dir_ark_mods}") - print_line(f"{dir_ark_mods} удалён") - os.system(f"rm {dir_mods_ark}/{id_mod}.mod") - print_line(f"{dir_mods_ark}/{id_mod}.mod удалён") - os.system(f"mv {dir_workshop_ark}/appworkshop_{id_game_workshop}.acf {dir_ark_mods}") + modupdate(g, m, id_mod, dir_ark_mods) -def modupdate(dir_ark_mods, id_game_workshop): - if os.path.exists(f"{dir_ark_mods}/appworkshop_{id_game_workshop}.acf"): - # тут будет проверка необходимости обновления +def modupdate(g, m, id_mod, dir_ark_mods): + if g == "ark": + if not os.path.isfile(os.path.join(dir_ark_mods, f"appworkshop_{id_mod}.acf")): + return + with open(os.path.join(dir_ark_mods, f"appworkshop_{id_mod}.acf"), "r") as f: + content = f.readlines() + content = "".join(content) + locale_date = "" + + for line in content.split("\n"): + if '\t"WorkshopItemsInstalled"' in line: + for line in content.split("\n"): + if f'\t\t"{id_mod}"' in line: + locale_date = line.split('"')[5] + if '}' in line: + break + break + + data = { + 'itemcount': 1, + 'publishedfileids[0]': id_mod + } + zapros = requests.post('http://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1', data=data) + json_zapros = zapros.json() + steam_date = json_zapros['response']['publishedfiledetails'][0]['time_updated'] + + if steam_date and locale_date == steam_date: + return + + if steam_date and locale_date != steam_date: + print_line("хз") + +def modupdateall(): + for file in os.listdir(dir_mods_ark): + if os.path.isfile(os.path.join(dir_mods_ark, file)): + if file.endswith('.mod'): + print(file) -def modextract(id_mod, id_game_workshop, dir_ark_mods): +def moddownload(id_mod, id_game_workshop, dir_ark_mods): """Распаковывает файлы мода и создаёт .mod файл для него""" dir_steam_workshop = f"{dir_workshop_ark}/content/{id_game_workshop}/{id_mod}/WindowsNoEditor" dir_extract = dir_ark_mods if id_mod == "111111111": return + os.system(f"steamcmd +login anonymous +workshop_download_item {id_game_workshop} {id_mod} +quit") try: for curdir, subdirs, files in os.walk(os.path.join(dir_steam_workshop)): for file in files: @@ -860,27 +900,18 @@ create_dir(dir_unit) create_dir(dir_logs) -class MainWindow(QMainWindow): +class HlnaApp(QtWidgets.QMainWindow, hlnaui.Ui_MainWindow): def __init__(self): super().__init__() - - self.setWindowTitle("HLN-A") - button = QPushButton("Выход") - button.setCheckable(True) - button.clicked.connect(self.button_click) - self.setCentralWidget(button) - - def button_click(self): - exit() - + self.setupUi(self) def hlnag(): if len(sys.argv) > 1: hlna() else: - app = QApplication(sys.argv) - hlnag_gui_window = MainWindow() - hlnag_gui_window.show() + app = QtWidgets.QApplication(sys.argv) + window = HlnaApp() + window.show() sys.exit(app.exec()) From 3076c841bd921d8efb78feba1f492e16bb09d5f0 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:20:31 +0300 Subject: [PATCH 223/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 79bf4c8..268c94a 100644 --- a/README.md +++ b/README.md @@ -24,4 +24,6 @@ hlna start Сей софт написан при активном участии Sitisll, Xpamych, Vano, ChatGPT, а так же при моральной поддержке Nezrimka и Vajka)) # Поддержка проекта -https://boosty.to/xpamych/donate +[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt) +[](https://img.shields.io/badge/Telegram-Telegram-blue) +[](https://boosty.to/xpamych/donate) From 04fc08aca8d8259c1cd88dac816677a747e608b5 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:22:50 +0300 Subject: [PATCH 224/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 268c94a..b637224 100644 --- a/README.md +++ b/README.md @@ -25,5 +25,5 @@ hlna start # Поддержка проекта [![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt) -[](https://img.shields.io/badge/Telegram-Telegram-blue) -[](https://boosty.to/xpamych/donate) +[![](https://img.shields.io/badge/Telegram-Telegram-blue&logo=Telegram)](https://t.me/plemyakh) +[![](https://boosty.to/xpamych/donate)] From 275d72bf10bba2177191883e4744156df469df94 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:23:16 +0300 Subject: [PATCH 225/244] =?UTF-8?q?=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b637224..d511d8d 100644 --- a/README.md +++ b/README.md @@ -25,5 +25,5 @@ hlna start # Поддержка проекта [![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt) -[![](https://img.shields.io/badge/Telegram-Telegram-blue&logo=Telegram)](https://t.me/plemyakh) +[![](https://img.shields.io/badge/Telegram-Telegram-blue&logo=telegram)](https://t.me/plemyakh) [![](https://boosty.to/xpamych/donate)] From 260d89e447fd2e9655184caaab9532932b85013b Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:32:34 +0300 Subject: [PATCH 226/244] =?UTF-8?q?=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d511d8d..54be15d 100644 --- a/README.md +++ b/README.md @@ -25,5 +25,5 @@ hlna start # Поддержка проекта [![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt) -[![](https://img.shields.io/badge/Telegram-Telegram-blue&logo=telegram)](https://t.me/plemyakh) +[![](https://img.shields.io/badge/Telegram-Telegram-blue?style=flat&logo=telegram)](https://t.me/plemyakh) [![](https://boosty.to/xpamych/donate)] From 1e1923af6dd91f40515677502d94b2646a7dd741 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:34:54 +0300 Subject: [PATCH 227/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 54be15d..c33362c 100644 --- a/README.md +++ b/README.md @@ -26,4 +26,4 @@ hlna start # Поддержка проекта [![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt) [![](https://img.shields.io/badge/Telegram-Telegram-blue?style=flat&logo=telegram)](https://t.me/plemyakh) -[![](https://boosty.to/xpamych/donate)] +[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&logo=boosty))](https://boosty.to/xpamych/donate) From 99441c0e01cf2c0cdc6aaaa22934f8b460ab3f69 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:36:14 +0300 Subject: [PATCH 228/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c33362c..fde6628 100644 --- a/README.md +++ b/README.md @@ -26,4 +26,4 @@ hlna start # Поддержка проекта [![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt) [![](https://img.shields.io/badge/Telegram-Telegram-blue?style=flat&logo=telegram)](https://t.me/plemyakh) -[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&logo=boosty))](https://boosty.to/xpamych/donate) +[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) From 48bef4815121ccbb4b7c4901ad6f5047c30d4673 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:37:34 +0300 Subject: [PATCH 229/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fde6628..ff2f2e4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ ![](https://gitflic.ru/project/plemyakh/hln-a/blob/raw?file=logo.png&commit=cd31f5b44ee0cafa0ee7c0e683d48f2c70ad4b90) +[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-Telegram-blue?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) + # Описание Этот инструмент позволяет управлять выделенным сервером (dedicated server) ARK Survival Evolved и\или 7Days to Die на Linux. Он предоставляет множество функций, чтобы получить полный список, ознакомьтесь с разделом использования. (находится в разработке и может содержать ошибки) @@ -22,8 +24,3 @@ hlna start # Спасибы Сей софт написан при активном участии Sitisll, Xpamych, Vano, ChatGPT, а так же при моральной поддержке Nezrimka и Vajka)) - -# Поддержка проекта -[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt) -[![](https://img.shields.io/badge/Telegram-Telegram-blue?style=flat&logo=telegram)](https://t.me/plemyakh) -[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) From 49d52d809a136ed2dcc5c01a3380cdfb169df89f Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:37:54 +0300 Subject: [PATCH 230/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ff2f2e4..19acab3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ ![](https://gitflic.ru/project/plemyakh/hln-a/blob/raw?file=logo.png&commit=cd31f5b44ee0cafa0ee7c0e683d48f2c70ad4b90) + [![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-Telegram-blue?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) # Описание From ccc8596c2908682728c01d695815453bb876d29e Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:41:00 +0300 Subject: [PATCH 231/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 19acab3..5f7cb6b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](https://gitflic.ru/project/plemyakh/hln-a/blob/raw?file=logo.png&commit=cd31f5b44ee0cafa0ee7c0e683d48f2c70ad4b90) -[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-Telegram-blue?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) +[](https://img.shields.io/badge/Python-Python-blue?style=flat&logo=python)[](https://img.shields.io/badge/Qt-Qt-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-Telegram-blue?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) # Описание Этот инструмент позволяет управлять выделенным сервером (dedicated server) ARK Survival Evolved и\или 7Days to Die на Linux. From e8565866c88bca58f7433cdf0e555a6e2af9e3c9 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:42:13 +0300 Subject: [PATCH 232/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f7cb6b..75c0862 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](https://gitflic.ru/project/plemyakh/hln-a/blob/raw?file=logo.png&commit=cd31f5b44ee0cafa0ee7c0e683d48f2c70ad4b90) -[](https://img.shields.io/badge/Python-Python-blue?style=flat&logo=python)[](https://img.shields.io/badge/Qt-Qt-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-Telegram-blue?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) +![](https://img.shields.io/badge/Python-Python-blue?style=flat&logo=python)![](https://img.shields.io/badge/Qt-Qt-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-Telegram-blue?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) # Описание Этот инструмент позволяет управлять выделенным сервером (dedicated server) ARK Survival Evolved и\или 7Days to Die на Linux. From 0225e9bd1bc543ce737a5762c7b470dba9157a72 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:42:59 +0300 Subject: [PATCH 233/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 75c0862..233b48c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](https://gitflic.ru/project/plemyakh/hln-a/blob/raw?file=logo.png&commit=cd31f5b44ee0cafa0ee7c0e683d48f2c70ad4b90) -![](https://img.shields.io/badge/Python-Python-blue?style=flat&logo=python)![](https://img.shields.io/badge/Qt-Qt-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-Telegram-blue?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) +![](https://img.shields.io/badge/Python-3.11-blue?style=flat&logo=python)![](https://img.shields.io/badge/Qt-6.0-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-Telegram-blue?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) # Описание Этот инструмент позволяет управлять выделенным сервером (dedicated server) ARK Survival Evolved и\или 7Days to Die на Linux. From b05319cafb237fc2b5345f537c7235475434f342 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:47:10 +0300 Subject: [PATCH 234/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 233b48c..676adb4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](https://gitflic.ru/project/plemyakh/hln-a/blob/raw?file=logo.png&commit=cd31f5b44ee0cafa0ee7c0e683d48f2c70ad4b90) -![](https://img.shields.io/badge/Python-3.11-blue?style=flat&logo=python)![](https://img.shields.io/badge/Qt-6.0-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-Telegram-blue?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) +![](https://img.shields.io/badge/Python-3.11-blue?style=flat&logo=python)![](https://img.shields.io/badge/Qt-6.0-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-Племя-Х-blue?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) # Описание Этот инструмент позволяет управлять выделенным сервером (dedicated server) ARK Survival Evolved и\или 7Days to Die на Linux. From 6e095d9f4a52c3b3d87782cf229ce13f3c49bda5 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:48:15 +0300 Subject: [PATCH 235/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 676adb4..c70932f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](https://gitflic.ru/project/plemyakh/hln-a/blob/raw?file=logo.png&commit=cd31f5b44ee0cafa0ee7c0e683d48f2c70ad4b90) -![](https://img.shields.io/badge/Python-3.11-blue?style=flat&logo=python)![](https://img.shields.io/badge/Qt-6.0-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-Племя-Х-blue?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) +![](https://img.shields.io/badge/Python-3.11-blue?style=flat&logo=python)![](https://img.shields.io/badge/Qt-6.0-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5-blue?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) # Описание Этот инструмент позволяет управлять выделенным сервером (dedicated server) ARK Survival Evolved и\или 7Days to Die на Linux. From 515b6f6788b550e5328fc1c9f7420f5cb21aade3 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:50:29 +0300 Subject: [PATCH 236/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c70932f..27b4390 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](https://gitflic.ru/project/plemyakh/hln-a/blob/raw?file=logo.png&commit=cd31f5b44ee0cafa0ee7c0e683d48f2c70ad4b90) -![](https://img.shields.io/badge/Python-3.11-blue?style=flat&logo=python)![](https://img.shields.io/badge/Qt-6.0-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5-blue?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) +![](https://img.shields.io/badge/Python-3.11-blue?style=flat&logo=python)![](https://img.shields.io/badge/Qt-6.0-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) # Описание Этот инструмент позволяет управлять выделенным сервером (dedicated server) ARK Survival Evolved и\или 7Days to Die на Linux. From 809ae80c3622f9c264e712598c455dab181c16c3 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:51:01 +0300 Subject: [PATCH 237/244] 1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 27b4390..11d4090 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](https://gitflic.ru/project/plemyakh/hln-a/blob/raw?file=logo.png&commit=cd31f5b44ee0cafa0ee7c0e683d48f2c70ad4b90) -![](https://img.shields.io/badge/Python-3.11-blue?style=flat&logo=python)![](https://img.shields.io/badge/Qt-6.0-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) +![](https://img.shields.io/badge/Python-3.11?style=flat&logo=python)![](https://img.shields.io/badge/Qt-6.0-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) # Описание Этот инструмент позволяет управлять выделенным сервером (dedicated server) ARK Survival Evolved и\или 7Days to Die на Linux. From 9ba003d3f9ee270cf4529ba5ca83aabb1effd7a1 Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:52:11 +0300 Subject: [PATCH 238/244] links --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 11d4090..bd95900 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](https://gitflic.ru/project/plemyakh/hln-a/blob/raw?file=logo.png&commit=cd31f5b44ee0cafa0ee7c0e683d48f2c70ad4b90) -![](https://img.shields.io/badge/Python-3.11?style=flat&logo=python)![](https://img.shields.io/badge/Qt-6.0-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) +![](https://img.shields.io/badge/Python-3.11-blue?style=flat&logo=python-yellow)![](https://img.shields.io/badge/Qt-6.0-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) # Описание Этот инструмент позволяет управлять выделенным сервером (dedicated server) ARK Survival Evolved и\или 7Days to Die на Linux. From bce7047030c0963ccd90f8801211a034bc02518d Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:52:41 +0300 Subject: [PATCH 239/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bd95900..d722807 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](https://gitflic.ru/project/plemyakh/hln-a/blob/raw?file=logo.png&commit=cd31f5b44ee0cafa0ee7c0e683d48f2c70ad4b90) -![](https://img.shields.io/badge/Python-3.11-blue?style=flat&logo=python-yellow)![](https://img.shields.io/badge/Qt-6.0-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) +![](https://img.shields.io/badge/Python-yellow-3.11-blue?style=flat&logo=python)![](https://img.shields.io/badge/Qt-6.0-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) # Описание Этот инструмент позволяет управлять выделенным сервером (dedicated server) ARK Survival Evolved и\или 7Days to Die на Linux. From 0f26d4f98e8db3f4e2c397af15a00538dd3c0acf Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 22:54:13 +0300 Subject: [PATCH 240/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d722807..27b4390 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![](https://gitflic.ru/project/plemyakh/hln-a/blob/raw?file=logo.png&commit=cd31f5b44ee0cafa0ee7c0e683d48f2c70ad4b90) -![](https://img.shields.io/badge/Python-yellow-3.11-blue?style=flat&logo=python)![](https://img.shields.io/badge/Qt-6.0-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) +![](https://img.shields.io/badge/Python-3.11-blue?style=flat&logo=python)![](https://img.shields.io/badge/Qt-6.0-green?style=flat&logo=qt)[![](https://img.shields.io/discord/817759634105827358?label=%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5&logo=discord)](https://discord.gg/3cFebGvPQt)[![](https://img.shields.io/badge/Telegram-%D0%9F%D0%BB%D0%B5%D0%BC%D1%8F-%D0%A5?style=flat&logo=telegram)](https://t.me/plemyakh)[![](https://img.shields.io/badge/Boosty-Boosty-blue?style=flat&color=orange&logo=boosty)](https://boosty.to/xpamych/donate) # Описание Этот инструмент позволяет управлять выделенным сервером (dedicated server) ARK Survival Evolved и\или 7Days to Die на Linux. From 142022897a0e2014d0f96bba37435ef8c557a32f Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 23:05:38 +0300 Subject: [PATCH 241/244] 1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 27b4390..b1f5d2b 100644 --- a/README.md +++ b/README.md @@ -24,4 +24,4 @@ hlna start Подробнее в [WIKI](https://gitflic.ru/project/xpamych/hln-a/wiki) # Спасибы -Сей софт написан при активном участии Sitisll, Xpamych, Vano, ChatGPT, а так же при моральной поддержке Nezrimka и Vajka)) +Сей софт написан при активном участии [Sitisll](https://gitflic.ru/sitisll), [Xpamych](https://gitflic.ru/xpamych), Vano, ChatGPT, а так же при моральной поддержке Nezrimka и Vajka)) From 8eff96c18813a977cc5e989daaa8046efe335a6a Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 23:06:14 +0300 Subject: [PATCH 242/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b1f5d2b..3fc12d0 100644 --- a/README.md +++ b/README.md @@ -24,4 +24,4 @@ hlna start Подробнее в [WIKI](https://gitflic.ru/project/xpamych/hln-a/wiki) # Спасибы -Сей софт написан при активном участии [Sitisll](https://gitflic.ru/sitisll), [Xpamych](https://gitflic.ru/xpamych), Vano, ChatGPT, а так же при моральной поддержке Nezrimka и Vajka)) +Сей софт написан при активном участии [Sitisll](https://gitflic.ru/user/sitisll), [Xpamych](https://gitflic.ru/user/xpamych), Vano, ChatGPT, а так же при моральной поддержке Nezrimka и Vajka)) From b359b1f1f6c029d45aa59ad739328d2c7e17a25a Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 23:08:04 +0300 Subject: [PATCH 243/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3fc12d0..902549b 100644 --- a/README.md +++ b/README.md @@ -24,4 +24,4 @@ hlna start Подробнее в [WIKI](https://gitflic.ru/project/xpamych/hln-a/wiki) # Спасибы -Сей софт написан при активном участии [Sitisll](https://gitflic.ru/user/sitisll), [Xpamych](https://gitflic.ru/user/xpamych), Vano, ChatGPT, а так же при моральной поддержке Nezrimka и Vajka)) +Сей софт написан при активном участии [Sitisll](https://gitflic.ru/user/sitisll), [Xpamych](https://gitflic.ru/user/xpamych), Vano, ChatGPT, а так же при моральной поддержке Nezrimka и [Vajka](https://gitflic.ru/user/vajka)) From b9c31d22af906dc65291ebbea0a5ddc6fdf99c7c Mon Sep 17 00:00:00 2001 From: xpamych Date: Sun, 21 May 2023 23:10:16 +0300 Subject: [PATCH 244/244] =?UTF-8?q?=D0=A1=D1=81=D1=8B=D0=BB=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 902549b..f307b69 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ hlna config Для запуска, сконфигурированного сервера или кластера ```bash -hlna start +hlna start -g ark ``` Подробнее в [WIKI](https://gitflic.ru/project/xpamych/hln-a/wiki)