mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-07-02 10:38:16 +00:00
feat: Add DevelopmentServerAddress property for direct communication and update URL handling in MobileControl classes
This commit is contained in:
parent
153922c3fe
commit
bb029221c0
3 changed files with 24 additions and 5 deletions
|
|
@ -519,7 +519,7 @@ namespace PepperDash.Essentials.Touchpanel
|
|||
return false;
|
||||
}) ? csIpAddress.ToString() : processorIp;
|
||||
|
||||
var match = Regex.Match(url, @"^http://([^:/]+):\d+/mc/app\?token=.+$");
|
||||
var match = Regex.Match(url, @"^http://([^:/]+):\d+/mc/app/?\?token=.+$");
|
||||
if (match.Success)
|
||||
{
|
||||
string ipa = match.Groups[1].Value;
|
||||
|
|
@ -583,7 +583,17 @@ namespace PepperDash.Essentials.Touchpanel
|
|||
/// </summary>
|
||||
public void SetAppUrl(string url)
|
||||
{
|
||||
_appUrl = GetUrlWithCorrectIp(url);
|
||||
if(localConfig.DevelopmentServerAddress != null)
|
||||
{
|
||||
url = Regex.Replace(url, @"^http://[^/]+", $"http://{localConfig.DevelopmentServerAddress}");
|
||||
this.LogInformation("Using development server IP, updated URL: {url}", url);
|
||||
}
|
||||
else
|
||||
{
|
||||
url = GetUrlWithCorrectIp(url);
|
||||
}
|
||||
|
||||
_appUrl = url;
|
||||
|
||||
AppUrlFeedback.FireUpdate();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,15 @@ public class MobileControlTouchpanelProperties : CrestronTouchpanelPropertiesCon
|
|||
[JsonProperty("useDirectServer")]
|
||||
public bool UseDirectServer { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the DevelopmentServerIp. Optional. If UseDirectServer is true,
|
||||
/// this IP address will be used for direct communication between the mobile control and a development server running on the same local network.
|
||||
/// This allows development using a Vite server for hot module replacement (HMR) and live reloading during development.
|
||||
/// Specifying this property will override the default behavior of mobile control.
|
||||
/// </summary>
|
||||
[JsonProperty("developmentServerAddress", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string DevelopmentServerAddress { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ZoomRoomController
|
||||
|
|
|
|||
|
|
@ -403,11 +403,11 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||
ip = csIpAddress.ToString();
|
||||
}
|
||||
|
||||
var appUrl = $"http://{ip}:{_parent.Config.DirectServer.Port}/mc/app?token={touchpanel.Key}";
|
||||
var appUrl = $"http://{ip}:{_parent.Config.DirectServer.Port}/mc/app/?token={touchpanel.Key}";
|
||||
|
||||
this.LogVerbose("Sending URL {appUrl} to touchpanel {touchpanelKey}", appUrl, touchpanel.Touchpanel.Key);
|
||||
|
||||
touchpanel.Touchpanel.SetAppUrl($"http://{ip}:{_parent.Config.DirectServer.Port}/mc/app?token={touchpanel.Key}");
|
||||
touchpanel.Touchpanel.SetAppUrl($"http://{ip}:{_parent.Config.DirectServer.Port}/mc/app/?token={touchpanel.Key}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1228,7 +1228,7 @@ namespace PepperDash.Essentials.WebSocketServer
|
|||
Config = _parent.GetConfigWithPluginVersion(),
|
||||
CodeExpires = new DateTime().AddYears(1),
|
||||
UserCode = bridge.UserCode,
|
||||
UserAppUrl = string.Format("http://{0}:{1}/mc/app",
|
||||
UserAppUrl = string.Format("http://{0}:{1}/mc/app/",
|
||||
CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0),
|
||||
Port),
|
||||
WebSocketUrl = wsUrl,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue