Skip to content

Commit

Permalink
Refactor function names in RDP scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dkmstr committed Oct 10, 2024
1 parent a39da82 commit 3f8554f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions server/src/uds/transports/RDP/scripts/linux/direct.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
globals()['sp'] = sp # type: ignore # pylint: disable=undefined-variable


def execUdsRdp(udsrdp: str) -> None:
def exec_udsrdp(udsrdp: str) -> None:
import subprocess
import os.path

params: typing.List[str] = [os.path.expandvars(i) for i in [udsrdp] + sp['as_new_xfreerdp_params'] + ['/v:{}'.format(sp['address'])]] # type: ignore
tools.addTaskToWait(subprocess.Popen(params))


def execNewXFreeRdp(xfreerdp: str) -> None:
def exec_new_xfreerdp(xfreerdp: str) -> None:
import subprocess # @Reimport
import os.path

Expand All @@ -31,15 +31,15 @@ def execNewXFreeRdp(xfreerdp: str) -> None:


# Try to locate a xfreerdp and udsrdp. udsrdp will be used if found.
xfreerdp: typing.Optional[str] = tools.findApp('xfreerdp')
xfreerdp: typing.Optional[str] = tools.findApp('xfreerdp3') or tools.findApp('xfreerdp')
udsrdp: typing.Optional[str] = tools.findApp('udsrdp')
fnc, app = None, None

if xfreerdp:
fnc, app = execNewXFreeRdp, xfreerdp
fnc, app = exec_new_xfreerdp, xfreerdp

if udsrdp is not None:
fnc, app = execUdsRdp, udsrdp
fnc, app = exec_udsrdp, udsrdp

if app is None or fnc is None:
raise Exception(
Expand Down
10 changes: 5 additions & 5 deletions server/src/uds/transports/RDP/scripts/linux/tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
globals()['sp'] = sp # type: ignore # pylint: disable=undefined-variable


def execUdsRdp(udsrdp: str, port: int) -> None:
def exec_udsrdp(udsrdp: str, port: int) -> None:
import subprocess # @Reimport
import os.path

params: typing.List[str] = [os.path.expandvars(i) for i in [udsrdp] + sp['as_new_xfreerdp_params'] + ['/v:127.0.0.1:{}'.format(port)]] # type: ignore
tools.addTaskToWait(subprocess.Popen(params))


def execNewXFreeRdp(xfreerdp: str, port: int) -> None:
def exec_new_xfreerdp(xfreerdp: str, port: int) -> None:
import subprocess # @Reimport
import os.path

Expand All @@ -38,15 +38,15 @@ def execNewXFreeRdp(xfreerdp: str, port: int) -> None:


# Try to locate a xfreerdp and udsrdp. udsrdp will be used if found.
xfreerdp = tools.findApp('xfreerdp')
xfreerdp: typing.Optional[str] = tools.findApp('xfreerdp3') or tools.findApp('xfreerdp')
udsrdp = tools.findApp('udsrdp')
fnc, app = None, None

if xfreerdp:
fnc, app = execNewXFreeRdp, xfreerdp
fnc, app = exec_new_xfreerdp, xfreerdp

if udsrdp:
fnc, app = execUdsRdp, udsrdp
fnc, app = exec_udsrdp, udsrdp

if app is None or fnc is None:
raise Exception(
Expand Down

0 comments on commit 3f8554f

Please sign in to comment.