fix: custom client, msi, conn type (#8944)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou 2024-08-03 22:29:30 +08:00 committed by GitHub
parent 31a1b7a80b
commit 508dd5b383
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,10 +65,10 @@ def make_parser():
"-c", "--custom", action="store_true", help="Is custom client", default=False "-c", "--custom", action="store_true", help="Is custom client", default=False
) )
parser.add_argument( parser.add_argument(
"--custom-client-props", "--conn-type",
type=str, type=str,
default="{}", default="",
help='Custom client properties, e.g. \'{"connection-type": "outgoing"}\'', help='Connection type, e.g. "incoming", "outgoing". Default is empty, means incoming-outgoing',
) )
parser.add_argument( parser.add_argument(
"--app-name", type=str, default="RustDesk", help="The app name." "--app-name", type=str, default="RustDesk", help="The app name."
@ -391,21 +391,14 @@ def gen_custom_ARPSYSTEMCOMPONENT(args, dist_dir):
else: else:
return gen_custom_ARPSYSTEMCOMPONENT_False(args) return gen_custom_ARPSYSTEMCOMPONENT_False(args)
def gen_custom_client_properties(args): def gen_conn_type(args):
try:
props = json.loads(args.custom_client_props)
except json.JSONDecodeError as e:
print(f"Failed to decode custom props: {e}")
return False
def func(lines, index_start): def func(lines, index_start):
indent = g_indent_unit * 3 indent = g_indent_unit * 3
lines_new = [] lines_new = []
if args.conn_type != "":
if 'connection-type' in props:
lines_new.append( lines_new.append(
f"""{indent}<Property Id="CC_CONNECTION_TYPE" Value="{props['connection-type']}" />\n""" f"""{indent}<Property Id="CC_CONNECTION_TYPE" Value="{args.conn_type}" />\n"""
) )
for i, line in enumerate(lines_new): for i, line in enumerate(lines_new):
@ -539,7 +532,7 @@ if __name__ == "__main__":
if not gen_custom_ARPSYSTEMCOMPONENT(args, dist_dir): if not gen_custom_ARPSYSTEMCOMPONENT(args, dist_dir):
sys.exit(-1) sys.exit(-1)
if not gen_custom_client_properties(args): if not gen_conn_type(args):
sys.exit(-1) sys.exit(-1)
if not gen_auto_component(app_name, dist_dir): if not gen_auto_component(app_name, dist_dir):