From df7cd6ce713f224d2fb6e49147b307ce5766c7cb Mon Sep 17 00:00:00 2001 From: derwin12 <4643499+derwin12@users.noreply.github.com> Date: Thu, 30 Apr 2026 12:26:55 -0400 Subject: [PATCH] Fix *ms and failcount fields in xSchedule (#6231) and WSS websockets (#2516) --- .gitignore | 2 ++ bin/xScheduleWeb/guestbuttons.html | 2 +- bin/xScheduleWeb/js/webSocket.js | 2 +- xSchedule/ScheduleManager.cpp | 22 +++++++++++----------- xSchedule/xSchedule.vcxproj | 16 ++++++++-------- 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 7dd9fd71..cbb75531 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ xSchedule/xSMSDaemon/xSMSDaemon.cbp.mak xSchedule/xSMSDaemon/xSMSDaemon.cbp.mak.orig xSchedule/xSchedule.cbp.mak xSchedule/xSchedule.cbp.mak.orig +*.json +*.wsuo diff --git a/bin/xScheduleWeb/guestbuttons.html b/bin/xScheduleWeb/guestbuttons.html index 735ef197..f9a5878e 100644 --- a/bin/xScheduleWeb/guestbuttons.html +++ b/bin/xScheduleWeb/guestbuttons.html @@ -45,7 +45,7 @@ // Pass is replaced by a valid value when the page is served - assuming you are allowing authenticated pages var pass = "!PASS!"; - url = 'ws://' + location.hostname + (location.port ? ':' + location.port : ''); + url = (window.location.protocol === 'https:' ? 'wss://' : 'ws://') + location.hostname + (location.port ? ':' + location.port : ''); const socket = new ReconnectingWebSocket(url); socket.addEventListener('message', function(event) { diff --git a/bin/xScheduleWeb/js/webSocket.js b/bin/xScheduleWeb/js/webSocket.js index 40eb6076..b89061d9 100644 --- a/bin/xScheduleWeb/js/webSocket.js +++ b/bin/xScheduleWeb/js/webSocket.js @@ -1,5 +1,5 @@ // Create WebSocket connection. -url = 'ws://' + location.hostname + (location.port ? ':' + location.port : ''); +url = (window.location.protocol === 'https:' ? 'wss://' : 'ws://') + location.hostname + (location.port ? ':' + location.port : ''); const socket = new ReconnectingWebSocket(url); // Connection opened socket.addEventListener('open', function(event) { diff --git a/xSchedule/ScheduleManager.cpp b/xSchedule/ScheduleManager.cpp index 0671a892..6fc25f90 100644 --- a/xSchedule/ScheduleManager.cpp +++ b/xSchedule/ScheduleManager.cpp @@ -2801,7 +2801,7 @@ bool ScheduleManager::Query(const wxString& command, const wxString& parameters, "\",\"id\":\"" + wxString::Format(wxT("%i"), it->GetId()).ToStdString() + "\",\"nextscheduled\":\"" + it->GetNextScheduledTime() + "\",\"length\":\"" + FormatTime(it->GetLengthMS()) + - "\",\"lengthms\":\"" + wxString::Format("{}", (long)it->GetLengthMS()) + "\"}"; + "\",\"lengthms\":\"" + wxString::Format("%ld", (long)it->GetLengthMS()) + "\"}"; } data += "],\"reference\":\"" + reference + "\"}"; } else if (c == "getplayingeffects") { @@ -2850,7 +2850,7 @@ bool ScheduleManager::Query(const wxString& command, const wxString& parameters, "\",\"everystep\":\"" + ((*it)->GetEveryStep() ? _("true") : _("false")) + "\",\"offset\":\"" + (*it)->GetStartTime(p) + "\",\"length\":\"" + FormatTime((*it)->GetLengthMS()) + - "\",\"lengthms\":\"" + wxString::Format("{}", (long)(*it)->GetLengthMS()) + "\"}"; + "\",\"lengthms\":\"" + wxString::Format("%ld", (long)(*it)->GetLengthMS()) + "\"}"; } data += "],\"reference\":\"" + reference + "\"}"; } else { @@ -2896,8 +2896,8 @@ bool ScheduleManager::Query(const wxString& command, const wxString& parameters, if (!first) { data += ","; } - data += "{\"startchannel\":\"" + wxString::Format("{}", (long)it->GetStartChannel()) + - "\",\"channels\":\"" + wxString::Format(wxT("{}"), (long)it->GetSize()) + + data += "{\"startchannel\":\"" + wxString::Format("%ld", (long)it->GetStartChannel()) + + "\",\"channels\":\"" + wxString::Format(wxT("%ld"), (long)it->GetSize()) + "\"}"; first = false; } @@ -2914,7 +2914,7 @@ bool ScheduleManager::Query(const wxString& command, const wxString& parameters, data += "{\"name\":\"" + (*it)->GetNameNoTime() + "\",\"id\":\"" + wxString::Format(wxT("%i"), (*it)->GetId()).ToStdString() + "\",\"length\":\"" + FormatTime((*it)->GetLengthMS()) + - "\",\"lengthms\":\"" + wxString::Format("{}", (long)((*it)->GetLengthMS())) + "\"}"; + "\",\"lengthms\":\"" + wxString::Format("%ld", (long)((*it)->GetLengthMS())) + "\"}"; } data += "],\"reference\":\"" + reference + "\"}"; } else if (c == "listwebfolders") { @@ -3063,15 +3063,15 @@ bool ScheduleManager::Query(const wxString& command, const wxString& parameters, "\",\"steplooping\":\"" + (p->IsStepLooping() || p->GetRunningStep()->GetLoopsLeft() > 0 ? "true" : "false") + "\",\"steploopsleft\":\"" + wxString::Format(wxT("%i"), p->GetRunningStep()->GetLoopsLeft()).ToStdString() + "\",\"length\":\"" + FormatTime(p->GetRunningStep()->GetLengthMS()) + - "\",\"lengthms\":\"" + wxString::Format("{}", (long)(p->GetRunningStep()->GetLengthMS())) + + "\",\"lengthms\":\"" + wxString::Format("%ld", (long)(p->GetRunningStep()->GetLengthMS())) + "\",\"position\":\"" + FormatTime(p->GetRunningStep()->GetPosition()) + - "\",\"positionms\":\"" + wxString::Format("{}", (long)(p->GetRunningStep()->GetPosition())) + + "\",\"positionms\":\"" + wxString::Format("%ld", (long)(p->GetRunningStep()->GetPosition())) + "\",\"left\":\"" + FormatTime(p->GetRunningStep()->GetLengthMS() - p->GetRunningStep()->GetPosition()) + - "\",\"leftms\":\"" + wxString::Format("{}", (long)(p->GetRunningStep()->GetLengthMS() - p->GetRunningStep()->GetPosition())) + + "\",\"leftms\":\"" + wxString::Format("%ld", (long)(p->GetRunningStep()->GetLengthMS() - p->GetRunningStep()->GetPosition())) + "\",\"playlistposition\":\"" + FormatTime(p->GetPosition()) + - "\",\"playlistpositionms\":\"" + wxString::Format("{}", (long)(p->GetPosition())) + + "\",\"playlistpositionms\":\"" + wxString::Format("%ld", (long)(p->GetPosition())) + "\",\"playlistleft\":\"" + FormatTime(p->GetLengthMS() - p->GetPosition()) + - "\",\"playlistleftms\":\"" + wxString::Format("{}", (long)(p->GetLengthMS() - p->GetPosition())) + + "\",\"playlistleftms\":\"" + wxString::Format("%ld", (long)(p->GetLengthMS() - p->GetPosition())) + "\",\"trigger\":\"" + std::string(IsCurrentPlayListScheduled() ? "scheduled" : (_immediatePlay != nullptr) ? "manual" : "queued") + "\",\"schedulename\":\"" + std::string((IsCurrentPlayListScheduled() && rs != nullptr) ? rs->GetSchedule()->GetName() : "N/A") + @@ -3141,7 +3141,7 @@ std::string ScheduleManager::GetPingStatus() { res += "{\"controller\":\"" + it->GetIP() + " " + it->GetName() + "\",\"ip\":\"" + it->GetIP() + "\",\"result\":\"" + APinger::GetPingResultName(it->GetPingResult()) + - "\",\"failcount\":\"" + wxString::Format("{}", it->GetFailCount()) + "\"}"; + "\",\"failcount\":\"" + wxString::Format("%i", it->GetFailCount()) + "\"}"; } } diff --git a/xSchedule/xSchedule.vcxproj b/xSchedule/xSchedule.vcxproj index 84ba35b2..868d9e81 100644 --- a/xSchedule/xSchedule.vcxproj +++ b/xSchedule/xSchedule.vcxproj @@ -75,29 +75,29 @@ true - ..\..\wxWidgets\include;..\..\wxWidgets\include\msvc;$(IncludePath);..\xlights\xLights\ffmpeg-dev\include;..\xlights\include;..\xlights\include\zlib;..\xlights\xLights;..\xlights\xLights\utils;..\xlights\xLights\ui;..\xlights\common;..\dependencies;..\dependencies\pugixml\src;..\dependencies\spdlog\include;..\xlights\dependencies - ..\..\wxWidgets\lib\vc_lib;..\xlights\lib\windows;..\xlights\xLights\ffmpeg-dev\lib;GL;$(LibraryPath);$(VCToolsInstallDir)lib\x86 + ..\..\wxWidgets\include;..\..\wxWidgets\include\msvc;$(IncludePath);..\xlights\include\ffmpeg-6\include;..\xlights\include;..\xlights\include\zlib;..\xlights\xLights;..\xlights\xLights\utils;..\xlights\xLights\ui;..\xlights\common;..\dependencies;..\dependencies\pugixml\src;..\dependencies\spdlog\include;..\xlights\dependencies + ..\..\wxWidgets\lib\vc_lib;..\xlights\lib\windows;GL;$(LibraryPath);$(VCToolsInstallDir)lib\x86 true - ..\..\wxWidgets\include;..\..\wxWidgets\include\msvc;$(IncludePath);../xlights/xLights/ffmpeg-dev/include;..\xlights\include;..\xlights\include\zlib;..\xlights\xLights;..\xlights\xLights\utils;..\xlights\xLights\ui;..\xlights\common;..\dependencies;..\dependencies\pugixml\src;..\dependencies\spdlog\include;..\xlights\dependencies - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;..\..\wxWidgets\lib\vc_x64_lib;..\xlights\lib\windows64;..\xlights\xLights\ffmpeg-dev\lib;GL;$(VCToolsInstallDir)lib\x64 + ..\..\wxWidgets\include;..\..\wxWidgets\include\msvc;$(IncludePath);..\xlights\include\ffmpeg-6\include;..\xlights\include;..\xlights\include\zlib;..\xlights\xLights;..\xlights\xLights\utils;..\xlights\xLights\ui;..\xlights\common;..\dependencies;..\dependencies\pugixml\src;..\dependencies\spdlog\include;..\xlights\dependencies + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;..\..\wxWidgets\lib\vc_x64_lib;..\xlights\lib\windows64;GL;$(VCToolsInstallDir)lib\x64 false - ..\..\wxWidgets\include;..\..\wxWidgets\include\msvc;$(IncludePath);..\xlights\xLights\ffmpeg-dev\include;..\xlights\include;..\xlights\include\zlib;..\xlights\xLights;..\xlights\xLights\utils;..\xlights\xLights\ui;..\xlights\common;..\dependencies;..\dependencies\pugixml\src;..\dependencies\spdlog\include;..\xlights\dependencies - ..\..\wxWidgets\lib\vc_lib;..\xlights\lib\windows;..\xlights\xLights\ffmpeg-dev\lib;GL;$(LibraryPath) + ..\..\wxWidgets\include;..\..\wxWidgets\include\msvc;$(IncludePath);..\xlights\include\ffmpeg-6\include;..\xlights\include;..\xlights\include\zlib;..\xlights\xLights;..\xlights\xLights\utils;..\xlights\xLights\ui;..\xlights\common;..\dependencies;..\dependencies\pugixml\src;..\dependencies\spdlog\include;..\xlights\dependencies + ..\..\wxWidgets\lib\vc_lib;..\xlights\lib\windows;GL;$(LibraryPath) false - ..\..\wxWidgets\include;..\..\wxWidgets\include\msvc;$(IncludePath);..\xlights\include;../xlights/xLights/ffmpeg-dev/include;..\xlights\include\zlib;..\xlights\xLights;..\xlights\xLights\utils;..\xlights\xLights\ui;..\xlights\common;..\dependencies;..\dependencies\pugixml\src;..\dependencies\spdlog\include;..\xlights\dependencies - $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;..\..\wxWidgets\lib\vc_x64_lib;..\xlights\lib\windows64;..\xlights\xLights\ffmpeg-dev\lib; + ..\..\wxWidgets\include;..\..\wxWidgets\include\msvc;$(IncludePath);..\xlights\include\ffmpeg-6\include;..\xlights\include;..\xlights\include\zlib;..\xlights\xLights;..\xlights\xLights\utils;..\xlights\xLights\ui;..\xlights\common;..\dependencies;..\dependencies\pugixml\src;..\dependencies\spdlog\include;..\xlights\dependencies + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;..\..\wxWidgets\lib\vc_x64_lib;..\xlights\lib\windows64;