mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 19:08:29 +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;
|
return false;
|
||||||
}) ? csIpAddress.ToString() : processorIp;
|
}) ? 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)
|
if (match.Success)
|
||||||
{
|
{
|
||||||
string ipa = match.Groups[1].Value;
|
string ipa = match.Groups[1].Value;
|
||||||
|
|
@ -583,7 +583,17 @@ namespace PepperDash.Essentials.Touchpanel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SetAppUrl(string url)
|
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();
|
AppUrlFeedback.FireUpdate();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,15 @@ public class MobileControlTouchpanelProperties : CrestronTouchpanelPropertiesCon
|
||||||
[JsonProperty("useDirectServer")]
|
[JsonProperty("useDirectServer")]
|
||||||
public bool UseDirectServer { get; set; } = false;
|
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>
|
/// <summary>
|
||||||
/// Gets or sets the ZoomRoomController
|
/// Gets or sets the ZoomRoomController
|
||||||
|
|
|
||||||
|
|
@ -403,11 +403,11 @@ namespace PepperDash.Essentials.WebSocketServer
|
||||||
ip = csIpAddress.ToString();
|
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);
|
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(),
|
Config = _parent.GetConfigWithPluginVersion(),
|
||||||
CodeExpires = new DateTime().AddYears(1),
|
CodeExpires = new DateTime().AddYears(1),
|
||||||
UserCode = bridge.UserCode,
|
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),
|
CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0),
|
||||||
Port),
|
Port),
|
||||||
WebSocketUrl = wsUrl,
|
WebSocketUrl = wsUrl,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue