Added settings for WebSocket ports
This commit is contained in:
@@ -67,6 +67,18 @@ namespace Swarmops.Logic.Support
|
||||
}
|
||||
}
|
||||
|
||||
static public int WebsocketPortServer
|
||||
{
|
||||
get { return Int32.Parse(GetDefaultedPersistedKey("WebsocketPortServer", "12172")); }
|
||||
set { Persistence.Key["WebsocketPortServer"] = value.ToString(CultureInfo.InvariantCulture); }
|
||||
}
|
||||
|
||||
static public int WebsocketPortClient
|
||||
{
|
||||
get { return Int32.Parse(GetDefaultedPersistedKey("WebsocketPortClient", "12172")); }
|
||||
set { Persistence.Key["WebsocketPortClient"] = value.ToString(CultureInfo.InvariantCulture); }
|
||||
}
|
||||
|
||||
static public string ExternalUrl
|
||||
{
|
||||
get
|
||||
|
||||
@@ -660,4 +660,7 @@
|
||||
<data name="Global_Working" xml:space="preserve">
|
||||
<value>Working...</value>
|
||||
</data>
|
||||
<data name="Global_Error_WebsocketFailure" xml:space="preserve">
|
||||
<value>Unable to connect WebSocket. Live updates will not be available.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -233,4 +233,10 @@
|
||||
<data name="SystemSettings_Warning_Insecure" xml:space="preserve">
|
||||
<value>You really, really, REALLY should use HTTPS for a website like this. But you knew that already, didn't you?</value>
|
||||
</data>
|
||||
<data name="SystemSettings_WebsocketPortClient" xml:space="preserve">
|
||||
<value>WebSocket Port (Client)</value>
|
||||
</data>
|
||||
<data name="SystemSettings_WebsocketPortServer" xml:space="preserve">
|
||||
<value>WebSocket Port (Server)</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -173,6 +173,9 @@
|
||||
<value>Invoice #{0:N0} from {1} was UN-attested. It will not be paid unless attested again.</value>
|
||||
<comment>When somebody undoes a previous attestation.</comment>
|
||||
</data>
|
||||
<data name="AttestCosts_OutOfBudget" xml:space="preserve">
|
||||
<value>There is not enough funds in the budget to attest this cost.</value>
|
||||
</data>
|
||||
<data name="AttestCosts_PageTitle" xml:space="preserve">
|
||||
<value>Attest Costs</value>
|
||||
</data>
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextExternalUrl" Cookie="ExtUrl" OnChange="onUrlChange" AjaxCallbackUrl="/Pages/v5/Admin/SystemSettings.aspx/StoreCallback" Placeholder="https://swarmops.example.com/" />​<br/>
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextAdminSender" Cookie="AdminSender" AjaxCallbackUrl="/Pages/v5/Admin/SystemSettings.aspx/StoreCallback" Placeholder="Swarmops Admin" />​<br/>
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextAdminAddress" Cookie="AdminAddress" AjaxCallbackUrl="/Pages/v5/Admin/SystemSettings.aspx/StoreCallback" Placeholder="swarmops-admin@example.com" />​<br/>
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextWebsocketPortServer" Cookie="WebsocketServer" AjaxCallbackUrl="/Pages/v5/Admin/SystemSettings.aspx/StoreCallback" Placeholder="12172" />​<br/>
|
||||
<Swarmops5:AjaxTextBox runat="server" ID="TextWebsocketPortClient" Cookie="WebsocketClient" AjaxCallbackUrl="/Pages/v5/Admin/SystemSettings.aspx/StoreCallback" Placeholder="12172" />​<br/>
|
||||
</div>
|
||||
<div class="entryLabels">
|
||||
<asp:Label ID="LabelSmtpServer" runat="server" /><br/>
|
||||
@@ -47,6 +49,8 @@
|
||||
<asp:Label ID="LabelExternalUrl" runat="server" /><br />
|
||||
<asp:Label ID="LabelAdminSender" runat="server" /><br />
|
||||
<asp:Label ID="LabelAdminAddress" runat="server" /><br />
|
||||
<asp:Label ID="LabelWebsocketPortServer" runat="server" /><br />
|
||||
<asp:Label ID="LabelWebsocketPortClient" runat="server" /><br />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -36,6 +36,8 @@ namespace Swarmops.Frontend.Pages.v5.Admin
|
||||
this.TextInstallationName.Text = SystemSettings.InstallationName;
|
||||
this.TextAdminAddress.Text = SystemSettings.AdminNotificationAddress;
|
||||
this.TextAdminSender.Text = SystemSettings.AdminNotificationSender;
|
||||
this.TextWebsocketPortServer.Text = SystemSettings.WebsocketPortServer.ToString(CultureInfo.InvariantCulture);
|
||||
this.TextWebsocketPortClient.Text = SystemSettings.WebsocketPortClient.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
Localize();
|
||||
}
|
||||
@@ -132,6 +134,8 @@ namespace Swarmops.Frontend.Pages.v5.Admin
|
||||
this.LabelInstallationName.Text = Resources.Pages.Admin.SystemSettings_InstallationName;
|
||||
this.LabelAdminAddress.Text = Resources.Pages.Admin.SystemSettings_AdminAddress;
|
||||
this.LabelAdminSender.Text = Resources.Pages.Admin.SystemSettings_AdminSender;
|
||||
this.LabelWebsocketPortServer.Text = Resources.Pages.Admin.SystemSettings_WebsocketPortServer;
|
||||
this.LabelWebsocketPortClient.Text = Resources.Pages.Admin.SystemSettings_WebsocketPortClient;
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
@@ -224,6 +228,45 @@ namespace Swarmops.Frontend.Pages.v5.Admin
|
||||
SystemSettings.AdminNotificationAddress = result.NewData;
|
||||
break;
|
||||
|
||||
case "WebsocketServer":
|
||||
try
|
||||
{
|
||||
int newPort = Int32.Parse(newValue);
|
||||
if (newPort < 1 || newPort > 32767)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
result.ResultCode = AjaxTextBox.CodeSuccess;
|
||||
result.NewData = newValue.Trim();
|
||||
SystemSettings.WebsocketPortServer = newPort;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result.ResultCode = AjaxTextBox.CodeInvalid;
|
||||
result.NewData = SystemSettings.WebsocketPortServer.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
break;
|
||||
|
||||
case "WebsocketClient":
|
||||
try
|
||||
{
|
||||
int newPort = Int32.Parse(newValue);
|
||||
if (newPort < 1 || newPort > 32767)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
|
||||
result.ResultCode = AjaxTextBox.CodeSuccess;
|
||||
result.NewData = newValue.Trim();
|
||||
SystemSettings.WebsocketPortClient = newPort;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result.ResultCode = AjaxTextBox.CodeInvalid;
|
||||
result.NewData = SystemSettings.WebsocketPortClient.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException("Unknown cookie in StoreCallback");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user