mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-05 09:17:54 +03:00
Moving to new method names. Client keeps backwards compat
This commit is contained in:
parent
16e99aad1d
commit
2d40b5ea5b
@ -23,8 +23,8 @@ def execNewXFreeRdp(xfreerdp):
|
||||
|
||||
|
||||
# Try to locate a xfreerdp and udsrdp. udsrdp will be used if found.
|
||||
xfreerdp = tools.findApp('xfreerdp')
|
||||
udsrdp = tools.findApp('udsrdp')
|
||||
xfreerdp = tools.find_application('xfreerdp')
|
||||
udsrdp = tools.find_application('udsrdp')
|
||||
fnc, app = None, None
|
||||
|
||||
if xfreerdp:
|
||||
|
@ -25,8 +25,8 @@ def execNewXFreeRdp(xfreerdp, port):
|
||||
|
||||
|
||||
# Try to locate a xfreerdp and udsrdp. udsrdp will be used if found.
|
||||
xfreerdp = tools.findApp('xfreerdp')
|
||||
udsrdp = tools.findApp('udsrdp')
|
||||
xfreerdp = tools.find_application('xfreerdp')
|
||||
udsrdp = tools.find_application('udsrdp')
|
||||
fnc, app = None, None
|
||||
|
||||
if xfreerdp:
|
||||
|
@ -16,7 +16,7 @@ msrdc_localized = (
|
||||
)
|
||||
# msrdc_app = '/Contents/MacOS/Microsoft Remote Desktop'
|
||||
|
||||
xfreerdp = tools.findApp('xfreerdp')
|
||||
xfreerdp = tools.find_application('xfreerdp')
|
||||
executable = None
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ if executable is None:
|
||||
)
|
||||
if executable in (msrdc, msrdc_localized):
|
||||
theFile = sp['as_file'] # type: ignore
|
||||
filename = tools.saveTempFile(theFile)
|
||||
filename = tools.save_temp_file(theFile)
|
||||
# Rename as .rdp, so open recognizes it
|
||||
shutil.move(filename, filename + '.rdp')
|
||||
|
||||
@ -101,7 +101,7 @@ if executable in (msrdc, msrdc_localized):
|
||||
]
|
||||
)
|
||||
)
|
||||
tools.addFileToUnlink(filename + '.rdp')
|
||||
tools.register_for_delayed_deletion(filename + '.rdp')
|
||||
elif executable == xfreerdp:
|
||||
# Fix resolution...
|
||||
try:
|
||||
|
@ -38,7 +38,7 @@ msrdc_localized = (
|
||||
'/Applications/Microsoft Remote Desktop.localized/Microsoft Remote Desktop.app'
|
||||
)
|
||||
|
||||
xfreerdp = tools.findApp('xfreerdp')
|
||||
xfreerdp = tools.find_application('xfreerdp')
|
||||
executable = None
|
||||
|
||||
# Check first xfreerdp, allow password redir
|
||||
@ -99,7 +99,7 @@ if fs.check() is False:
|
||||
if executable in (msrdc, msrdc_localized):
|
||||
theFile = theFile = sp['as_file'].format(address=address) # type: ignore
|
||||
|
||||
filename = tools.saveTempFile(theFile)
|
||||
filename = tools.save_temp_file(theFile)
|
||||
# Rename as .rdp, so open recognizes it
|
||||
shutil.move(filename, filename + '.rdp')
|
||||
|
||||
@ -115,7 +115,7 @@ if executable in (msrdc, msrdc_localized):
|
||||
]
|
||||
)
|
||||
)
|
||||
tools.addFileToUnlink(filename + '.rdp')
|
||||
tools.register_for_delayed_deletion(filename + '.rdp')
|
||||
elif executable == xfreerdp:
|
||||
# Fix resolution...
|
||||
try:
|
||||
|
@ -38,7 +38,7 @@ except Exception as e: # nosec: Not really interested in the exception
|
||||
|
||||
# The password must be encoded, to be included in a .rdp file, as 'UTF-16LE' before protecting (CtrpyProtectData) it in order to work with mstsc
|
||||
theFile = sp['as_file'].format(password=password) # type: ignore
|
||||
filename = tools.saveTempFile(theFile)
|
||||
filename = tools.save_temp_file(theFile)
|
||||
|
||||
if sp['optimize_teams'] == True: # type: ignore
|
||||
try:
|
||||
@ -52,7 +52,7 @@ if sp['optimize_teams'] == True: # type: ignore
|
||||
filename = filename + '.rdp'
|
||||
os.startfile(filename) # type: ignore # nosec
|
||||
else:
|
||||
executable = tools.findApp('mstsc.exe')
|
||||
executable = tools.find_application('mstsc.exe')
|
||||
if executable is None:
|
||||
raise Exception(
|
||||
'Unable to find mstsc.exe. Check that path points to your SYSTEM32 folder'
|
||||
@ -60,4 +60,4 @@ else:
|
||||
|
||||
subprocess.Popen([executable, filename]) # nosec
|
||||
|
||||
tools.addFileToUnlink(filename)
|
||||
tools.register_for_delayed_deletion(filename)
|
||||
|
@ -45,7 +45,7 @@ theFile = sp['as_file'].format( # type: ignore
|
||||
password=password, address='127.0.0.1:{}'.format(fs.server_address[1])
|
||||
)
|
||||
|
||||
filename = tools.saveTempFile(theFile)
|
||||
filename = tools.save_temp_file(theFile)
|
||||
|
||||
if sp['optimize_teams']: # type: ignore
|
||||
try:
|
||||
@ -58,10 +58,10 @@ if sp['optimize_teams']: # type: ignore
|
||||
filename = filename + '.rdp'
|
||||
os.startfile(filename) # type: ignore # nosec
|
||||
else:
|
||||
executable = tools.findApp('mstsc.exe')
|
||||
executable = tools.find_application('mstsc.exe')
|
||||
if executable is None:
|
||||
raise Exception('Unable to find mstsc.exe. Check that path points to your SYSTEM32 folder')
|
||||
|
||||
subprocess.Popen([executable, filename]) # nosec
|
||||
|
||||
# tools.addFileToUnlink(filename)
|
||||
# tools.register_for_delayed_deletion(filename)
|
||||
|
@ -7,7 +7,7 @@ import subprocess
|
||||
|
||||
from uds import tools # type: ignore
|
||||
|
||||
executable = tools.findApp('remote-viewer')
|
||||
executable = tools.find_application('remote-viewer')
|
||||
|
||||
if executable is None:
|
||||
raise Exception(
|
||||
@ -20,6 +20,6 @@ if executable is None:
|
||||
|
||||
theFile = sp['as_file'] # type: ignore
|
||||
|
||||
filename = tools.saveTempFile(theFile)
|
||||
filename = tools.save_temp_file(theFile)
|
||||
|
||||
subprocess.Popen([executable, filename])
|
||||
|
@ -8,7 +8,7 @@ import subprocess
|
||||
from uds import tools # type: ignore
|
||||
from uds.tunnel import forward # type: ignore
|
||||
|
||||
executable = tools.findApp('remote-viewer')
|
||||
executable = tools.find_application('remote-viewer')
|
||||
|
||||
if executable is None:
|
||||
raise Exception(
|
||||
@ -52,5 +52,5 @@ theFile = theFile.format(
|
||||
port='-1' if not fs else fs.server_address[1],
|
||||
)
|
||||
|
||||
filename = tools.saveTempFile(theFile)
|
||||
filename = tools.save_temp_file(theFile)
|
||||
subprocess.Popen([executable, filename])
|
||||
|
@ -29,6 +29,6 @@ if not os.path.isfile(remoteViewer):
|
||||
|
||||
theFile = sp['as_file'] # type: ignore
|
||||
|
||||
filename = tools.saveTempFile(theFile)
|
||||
filename = tools.save_temp_file(theFile)
|
||||
|
||||
subprocess.Popen([remoteViewer, filename])
|
||||
|
@ -56,5 +56,5 @@ theFile = theFile.format(
|
||||
port='-1' if not fs else fs.server_address[1],
|
||||
)
|
||||
|
||||
filename = tools.saveTempFile(theFile)
|
||||
filename = tools.save_temp_file(theFile)
|
||||
subprocess.Popen([remoteViewer, filename])
|
||||
|
@ -16,7 +16,7 @@ for env in ('PROGRAMFILES', 'PROGRAMW6432'):
|
||||
if env in os.environ:
|
||||
extraPaths += tuple(p + '\\bin' for p in glob.glob(os.environ[env] + '\\VirtViewer*')) # type: ignore
|
||||
|
||||
executable = tools.findApp('remote-viewer.exe', extraPaths)
|
||||
executable = tools.find_application('remote-viewer.exe', extraPaths)
|
||||
|
||||
if executable is None:
|
||||
raise Exception(
|
||||
@ -32,6 +32,6 @@ if executable is None:
|
||||
|
||||
theFile = sp['as_file'] # type: ignore
|
||||
|
||||
filename = tools.saveTempFile(theFile)
|
||||
filename = tools.save_temp_file(theFile)
|
||||
|
||||
subprocess.Popen([executable, filename])
|
||||
|
@ -17,7 +17,7 @@ for env in ('PROGRAMFILES', 'PROGRAMW6432'):
|
||||
if env in os.environ:
|
||||
extraPaths += tuple(p + '\\bin' for p in glob.glob(os.environ[env] + '\\VirtViewer*')) # type: ignore
|
||||
|
||||
executable = tools.findApp('remote-viewer.exe', extraPaths)
|
||||
executable = tools.find_application('remote-viewer.exe', extraPaths)
|
||||
|
||||
if executable is None:
|
||||
raise Exception(
|
||||
@ -59,6 +59,6 @@ theFile = theFile.format(
|
||||
port='-1' if not fs else fs.server_address[1],
|
||||
)
|
||||
|
||||
filename = tools.saveTempFile(theFile)
|
||||
filename = tools.save_temp_file(theFile)
|
||||
|
||||
subprocess.Popen([executable, filename])
|
||||
|
@ -9,13 +9,13 @@ from os.path import expanduser
|
||||
from uds import tools # type: ignore
|
||||
|
||||
home = expanduser('~') + ':1;/media:1;'
|
||||
keyFile = tools.saveTempFile(sp['key']) # type: ignore
|
||||
keyFile = tools.save_temp_file(sp['key']) # type: ignore
|
||||
theFile = sp['xf'].format(export=home, keyFile=keyFile.replace('\\', '/'), ip=sp['ip'], port=sp['port']) # type: ignore
|
||||
filename = tools.saveTempFile(theFile)
|
||||
filename = tools.save_temp_file(theFile)
|
||||
|
||||
# HOME=[temporal folder, where we create a .x2goclient folder and a sessions inside] pyhoca-cli -P UDS/test-session
|
||||
|
||||
executable = tools.findApp('x2goclient')
|
||||
executable = tools.find_application('x2goclient')
|
||||
if executable is None:
|
||||
raise Exception(
|
||||
'''<p>You must have installed latest X2GO Client in order to connect to this UDS service.</p>
|
||||
@ -33,5 +33,5 @@ subprocess.Popen(
|
||||
'--add-to-known-hosts',
|
||||
]
|
||||
)
|
||||
# tools.addFileToUnlink(filename)
|
||||
# tools.addFileToUnlink(keyFile)
|
||||
# tools.register_for_delayed_deletion(filename)
|
||||
# tools.register_for_delayed_deletion(keyFile)
|
||||
|
@ -20,13 +20,13 @@ if fs.check() is False:
|
||||
)
|
||||
|
||||
home = expanduser('~') + ':1;/media:1;'
|
||||
keyFile = tools.saveTempFile(sp['key']) # type: ignore
|
||||
keyFile = tools.save_temp_file(sp['key']) # type: ignore
|
||||
theFile = sp['xf'].format(export=home, keyFile=keyFile.replace('\\', '/'), ip='127.0.0.1', port=fs.server_address[1]) # type: ignore
|
||||
filename = tools.saveTempFile(theFile)
|
||||
filename = tools.save_temp_file(theFile)
|
||||
|
||||
# HOME=[temporal folder, where we create a .x2goclient folder and a sessions inside] pyhoca-cli -P UDS/test-session
|
||||
|
||||
executable = tools.findApp('x2goclient')
|
||||
executable = tools.find_application('x2goclient')
|
||||
if executable is None:
|
||||
raise Exception(
|
||||
'''<p>You must have installed latest X2GO Client in order to connect to this UDS service.</p>
|
||||
|
@ -10,13 +10,13 @@ from os.path import expanduser
|
||||
from uds import tools # type: ignore
|
||||
|
||||
home = expanduser('~').replace('\\', '\\\\') + '#1;'
|
||||
keyFile = tools.saveTempFile(sp['key']) # type: ignore
|
||||
keyFile = tools.save_temp_file(sp['key']) # type: ignore
|
||||
# On windows, the separator beween active and not is "#"
|
||||
theFile = sp['xf'].format(export='c:\\\\#1;', keyFile=keyFile.replace('\\', '/'), ip=sp['ip'], port=sp['port']) # type: ignore
|
||||
filename = tools.saveTempFile(theFile)
|
||||
filename = tools.save_temp_file(theFile)
|
||||
|
||||
x2goPath = os.environ['PROGRAMFILES(X86)'] + '\\x2goclient'
|
||||
executable = tools.findApp('x2goclient.exe', [x2goPath])
|
||||
executable = tools.find_application('x2goclient.exe', [x2goPath])
|
||||
if executable is None:
|
||||
raise Exception(
|
||||
'''<p>You must have installed latest X2GO Client in order to connect to this UDS service.</p>
|
||||
@ -36,5 +36,5 @@ subprocess.Popen(
|
||||
'--add-to-known-hosts',
|
||||
]
|
||||
)
|
||||
# tools.addFileToUnlink(filename)
|
||||
# tools.addFileToUnlink(keyFile)
|
||||
# tools.register_for_delayed_deletion(filename)
|
||||
# tools.register_for_delayed_deletion(keyFile)
|
||||
|
@ -22,12 +22,12 @@ if fs.check() is False:
|
||||
|
||||
# Care, expanduser is encoding using "mcbs", so treat it as bytes on python 2.7
|
||||
home = expanduser('~').replace('\\', '\\\\') + '#1;'
|
||||
keyFile = tools.saveTempFile(sp['key']) # type: ignore
|
||||
keyFile = tools.save_temp_file(sp['key']) # type: ignore
|
||||
theFile = sp['xf'].format(export=home, keyFile=keyFile.replace('\\', '/'), ip='127.0.0.1', port=fs.server_address[1]) # type: ignore
|
||||
filename = tools.saveTempFile(theFile)
|
||||
filename = tools.save_temp_file(theFile)
|
||||
|
||||
x2goPath = os.environ['PROGRAMFILES(X86)'] + '\\x2goclient'
|
||||
executable = tools.findApp('x2goclient.exe', [x2goPath])
|
||||
executable = tools.find_application('x2goclient.exe', [x2goPath])
|
||||
if executable is None:
|
||||
raise Exception(
|
||||
'''<p>You must have installed latest X2GO Client in default program file folder in order to connect to this UDS service.</p>
|
||||
|
Loading…
Reference in New Issue
Block a user