Add windows client mode updates
This commit is contained in:
parent
927f61e124
commit
02ab16a566
29
client.bat
Normal file
29
client.bat
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
@echo off
|
||||
|
||||
:: BatchGotAdmin
|
||||
:-------------------------------------
|
||||
REM --> Check for permissions
|
||||
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
|
||||
|
||||
REM --> If error flag set, we do not have admin.
|
||||
if '%errorlevel%' NEQ '0' (
|
||||
echo Requesting administrative privileges...
|
||||
goto UACPrompt
|
||||
) else ( goto gotAdmin )
|
||||
|
||||
:UACPrompt
|
||||
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
|
||||
set params = %*:"=""
|
||||
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
|
||||
|
||||
"%temp%\getadmin.vbs"
|
||||
del "%temp%\getadmin.vbs"
|
||||
exit /B
|
||||
|
||||
:gotAdmin
|
||||
pushd "%CD%"
|
||||
CD /D "%~dp0"
|
||||
python run.py
|
||||
:--------------------------------------
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit a2e94baadc8a8cc702d2a5ceb1170914e690d0e7
|
||||
Subproject commit 8fe33095ddd16d1b975453b0ee0e7a52767605f8
|
1
led_demo.bat
Normal file
1
led_demo.bat
Normal file
@ -0,0 +1 @@
|
||||
python led_control.py
|
28
run.py
28
run.py
@ -937,13 +937,17 @@ def run_loading_app():
|
||||
app.run(debug=True, use_reloader=False, port=7000)
|
||||
|
||||
def setup_client(pool):
|
||||
# Windows client setup
|
||||
fprint("Opening browser...")
|
||||
firefox = webdriver.Firefox()
|
||||
firefox.fullscreen_window()
|
||||
global config
|
||||
global vm_ready
|
||||
global serverproc
|
||||
if config["core"]["server"] == "Hyper-V":
|
||||
run_cmd("Start-VM -Name Jukebox*") # any and all VMs starting with "Jukebox"
|
||||
# Windows client setup
|
||||
fprint("Opening browser...")
|
||||
|
||||
firefox = webdriver.Firefox()
|
||||
firefox.fullscreen_window()
|
||||
|
||||
# Open loading wepage
|
||||
p = Process(target=run_loading_app)
|
||||
p.start()
|
||||
@ -952,12 +956,22 @@ def setup_client(pool):
|
||||
firefox.get('http://localhost:7000')
|
||||
|
||||
# start Linux server VM
|
||||
if config["core"]["server"] == "Hyper-V":
|
||||
run_cmd("Start-VM -Name Jukebox*") # any and all VMs starting with "Jukebox"
|
||||
|
||||
|
||||
sleep(20)
|
||||
sleep(35)
|
||||
p.terminate()
|
||||
firefox.get('http://192.168.1.25:3000')
|
||||
# import time
|
||||
# while True:
|
||||
# time.sleep(2) # Wait for a given interval
|
||||
# logs = firefox.get_log('browser')
|
||||
# for entry in logs:
|
||||
# if "WebSocket connection" in entry['message'] or "ERR_" in entry['message'] or "Failed to connect" in entry['message'] or "failed to connect" in entry['message']:
|
||||
# print(f"Error detected in console: {entry['message']}")
|
||||
# firefox.refresh() # Refresh the page on error
|
||||
# # else:
|
||||
# # break # Exit the loop or continue depending on your logic
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
4
util.py
4
util.py
@ -26,8 +26,8 @@ if win32:
|
||||
#if not getattr(sys, "frozen", False):
|
||||
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW # hide powershell window
|
||||
res = subprocess.check_output(["WMIC", "ComputerSystem", "GET", "UserName"], universal_newlines=True, startupinfo=startupinfo)
|
||||
_, username = res.strip().rsplit("\n", 1)
|
||||
userid, sysdom = username.rsplit("\\", 1)
|
||||
# _, username = res.strip().rsplit("\n", 1)
|
||||
# userid, sysdom = username.rsplit("\\", 1)
|
||||
|
||||
if linux or macos:
|
||||
sysid = hex(uuid.getnode())
|
||||
|
Loading…
x
Reference in New Issue
Block a user