diff --git a/FrontSocket/Frontend-Socket.csproj b/FrontSocket/Frontend-Socket.csproj index a89d54fa..3f30becb 100644 --- a/FrontSocket/Frontend-Socket.csproj +++ b/FrontSocket/Frontend-Socket.csproj @@ -60,6 +60,7 @@ + diff --git a/FrontSocket/FrontendLoop.cs b/FrontSocket/FrontendLoop.cs index c79ac14a..d46075cb 100644 --- a/FrontSocket/FrontendLoop.cs +++ b/FrontSocket/FrontendLoop.cs @@ -203,6 +203,10 @@ namespace Swarmops.Frontend.Socket private static int _sandboxDummy1 = 500; private static int _sandboxDummy2 = 50000; + /* + private static int _malfunctionTestCounter = 0; + private static string[] malfunctionStrings = {"One", "Two", "Three", "Four"};*/ + private static void OnEveryTenSeconds() { SystemSettings.HeartbeatFrontend = DateTime.UtcNow.ToUnix(); @@ -212,12 +216,37 @@ namespace Swarmops.Frontend.Socket _sandboxDummy1 += new Random().Next(10) - 3; _sandboxDummy2 += new Random().Next(1000) - 200; - JObject data = new JObject(); - data["MessageType"] = "SandboxUpdate"; - data["Local"] = _sandboxDummy1.ToString(CultureInfo.InvariantCulture); - data["Profit"] = _sandboxDummy2.ToString(CultureInfo.InvariantCulture); + JObject data1 = new JObject(); + data1["MessageType"] = "SandboxUpdate"; + data1["Local"] = _sandboxDummy1.ToString(CultureInfo.InvariantCulture); + data1["Profit"] = _sandboxDummy2.ToString(CultureInfo.InvariantCulture); - _socketServer.WebSocketServices.Broadcast(data.ToString()); + _socketServer.WebSocketServices.Broadcast(data1.ToString()); + + /* + JArray malfunctionsArray = new JArray(); + for (int loop = 0; loop < _malfunctionTestCounter; loop++) + { + if (loop < _malfunctionTestCounter - 2) + { + continue; + } + + JObject malfunctionObject = new JObject(); + malfunctionObject["Id"] = "Mal" + loop.ToString(); + malfunctionObject["Text"] = malfunctionStrings[loop] + " (Test code, ignore - and let's make this a multiline point to test flow)"; + malfunctionsArray.Add(malfunctionObject); + } + + if (++_malfunctionTestCounter > 4) + { + _malfunctionTestCounter = 0; + } + + JObject data2 = new JObject(); + data2["MessageType"] = "Malfunctions"; + data2["MalfunctionsList"] = malfunctionsArray; + _socketServer.WebSocketServices.Broadcast(data2.ToString());*/ } } @@ -271,11 +300,15 @@ namespace Swarmops.Frontend.Socket public static void OnBackendClose(object sender, CloseEventArgs args) { Console.WriteLine(" - Backend socket closed: " + args.Code + " " + args.Reason); + + // TODO: Try reconnecting } public static void OnBackendError(object sender, ErrorEventArgs args) { Console.WriteLine(" - Backend socket error: " + args.Message); + + // TODO: Try reconnecting } @@ -292,6 +325,11 @@ namespace Swarmops.Frontend.Socket } + public static void BroadcastMalfunctions() + { + + } + // --------------------------------- LEGACY CODE BELOW THIS MARK ------------------------------- diff --git a/FrontSocket/FrontendMalfunctions.cs b/FrontSocket/FrontendMalfunctions.cs new file mode 100644 index 00000000..89bf0a14 --- /dev/null +++ b/FrontSocket/FrontendMalfunctions.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Swarmops.Frontend.Socket +{ + public enum FrontendMalfunctions + { + Unknown = 0, + BackendConnectionFault, + BackendHeartbeatLost + } +} diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj index 5ee14ce2..ff915372 100644 --- a/Logic/Logic.csproj +++ b/Logic/Logic.csproj @@ -156,6 +156,11 @@ True Logic.Structure.Geography.resx + + True + True + Logic.Support.ErrorMessages.resx + True True @@ -191,6 +196,7 @@ + @@ -629,6 +635,10 @@ + + ResXFileCodeGenerator + Logic.Support.ErrorMessages.Designer.cs + diff --git a/Logic/Resources/Logic.Support.ErrorMessages.Designer.cs b/Logic/Resources/Logic.Support.ErrorMessages.Designer.cs new file mode 100644 index 00000000..2c39f387 --- /dev/null +++ b/Logic/Resources/Logic.Support.ErrorMessages.Designer.cs @@ -0,0 +1,171 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Swarmops.Logic.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Logic_Support_ErrorMessages { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Logic_Support_ErrorMessages() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Swarmops.Logic.Resources.Logic.Support.ErrorMessages", typeof(Logic_Support_ErrorMessages).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Operations have returned to nominal.. + /// + internal static string AllClear_Text { + get { + return ResourceManager.GetString("AllClear_Text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to All Clear. + /// + internal static string AllClear_Title { + get { + return ResourceManager.GetString("AllClear_Title", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The server has lost the connection to the bitcoin blockchain. Bitcoin transactions won't be detected in real time.. + /// + internal static string Backend_BlockchainSocketLost_Text { + get { + return ResourceManager.GetString("Backend_BlockchainSocketLost_Text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Blockchain Connection Lost. + /// + internal static string Backend_BlockchainSocketLost_Title { + get { + return ResourceManager.GetString("Backend_BlockchainSocketLost_Title", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The web browser is unable to hear the server's heartbeat. Real-time updates may not be available.. + /// + internal static string Client_ServerHeartbeatLost_Text { + get { + return ResourceManager.GetString("Client_ServerHeartbeatLost_Text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Heartbeat Failure Level 1. + /// + internal static string Client_ServerHeartbeatLost_Title { + get { + return ResourceManager.GetString("Client_ServerHeartbeatLost_Title", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Unable to connect to the server for real-time updates.. + /// + internal static string Client_SocketConnectionFault_Text { + get { + return ResourceManager.GetString("Client_SocketConnectionFault_Text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to WebSocket Failure. + /// + internal static string Client_SocketConnectionFault_Title { + get { + return ResourceManager.GetString("Client_SocketConnectionFault_Title", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The server is unable to connect to the backend process. Real-time updates will be largely unavailable.. + /// + internal static string Frontend_BackendConnectionFault_Text { + get { + return ResourceManager.GetString("Frontend_BackendConnectionFault_Text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Backend Connection Failure. + /// + internal static string Frontend_BackendConnectionFault_Title { + get { + return ResourceManager.GetString("Frontend_BackendConnectionFault_Title", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The server cannot hear the heartbeat from the backend process.. + /// + internal static string Frontend_BackendHeartbeatLost_Text { + get { + return ResourceManager.GetString("Frontend_BackendHeartbeatLost_Text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Heartbeat Failure Level 2. + /// + internal static string Frontend_BackendHeartbeatLost_Title { + get { + return ResourceManager.GetString("Frontend_BackendHeartbeatLost_Title", resourceCulture); + } + } + } +} diff --git a/Logic/Resources/Logic.Support.ErrorMessages.resx b/Logic/Resources/Logic.Support.ErrorMessages.resx new file mode 100644 index 00000000..2ee0f00f --- /dev/null +++ b/Logic/Resources/Logic.Support.ErrorMessages.resx @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Operations have returned to nominal. + + + All Clear + + + The server has lost the connection to the bitcoin blockchain. Bitcoin transactions won't be detected in real time. + + + Blockchain Connection Lost + + + The web browser is unable to hear the server's heartbeat. Real-time updates may not be available. + + + Heartbeat Failure Level 1 + + + Unable to connect to the server for real-time updates. + + + WebSocket Failure + + + The server is unable to connect to the backend process. Real-time updates will be largely unavailable. + + + Backend Connection Failure + + + The server cannot hear the heartbeat from the backend process. + + + Heartbeat Failure Level 2 + + \ No newline at end of file diff --git a/Logic/Resources/SourceResourceFiles.txt b/Logic/Resources/SourceResourceFiles.txt index 123a1d43..93931b3a 100644 --- a/Logic/Resources/SourceResourceFiles.txt +++ b/Logic/Resources/SourceResourceFiles.txt @@ -9,3 +9,4 @@ Logic.Structure.Geography.resx Logic.Swarm.DashboardTodos.resx Logic.Swarm.ParticipantTitle.resx Logic.Swarm.Position.resx +Logic.Support.ErrorMessages.resx \ No newline at end of file diff --git a/Logic/Support/ErrorMessages.cs b/Logic/Support/ErrorMessages.cs new file mode 100644 index 00000000..59420606 --- /dev/null +++ b/Logic/Support/ErrorMessages.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Resources; +using System.Text; +using System.Threading.Tasks; +using Swarmops.Logic.Resources; + +namespace Swarmops.Logic.Support +{ + public class ErrorMessages + { + public static string Localized(string errorMessage, string culture = null) + { + if (String.IsNullOrEmpty(culture)) + { + return @"" + Logic_Support_ErrorMessages.ResourceManager.GetString(errorMessage + "_Title") + + @": " + + Logic_Support_ErrorMessages.ResourceManager.GetString(errorMessage + "_Text"); + } + else + { + return @"" + + Logic_Support_ErrorMessages.ResourceManager.GetString(errorMessage + "_Title", + CultureInfo.CreateSpecificCulture(culture)) + + @": " + + Logic_Support_ErrorMessages.ResourceManager.GetString(errorMessage + "_Text", + CultureInfo.CreateSpecificCulture(culture)); + } + } + } +} diff --git a/README.md b/README.md index c58b52bc..9ec72f58 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ If you're daring enough to install a pilot of Swarmops, you're most welcome to d > `wget -qO- http://packages.swarmops.com/swarmops-packages.gpg.key | apt-key add -` -Then, add the Swarmops repository to your list of software sources: -> `echo deb http://packages.swarmops.com/ squeeze contrib > /etc/apt/sources.list.d/swarmops.list` +Then, add the Swarmops repository to your list of software sources, where [your_distribution] below is xenial (Ubuntu) or stretch (Debian): +> `echo deb http://packages.swarmops.com/ [your_distribution] contrib > /etc/apt/sources.list.d/swarmops.list` Then, run this to install the Swarmops frontend: > `apt-get update; apt-get install swarmops-frontend` diff --git a/Site/App_GlobalResources/Pages.Security.designer.cs b/Site/App_GlobalResources/Pages.Security.designer.cs index 60a596fe..0391c621 100644 --- a/Site/App_GlobalResources/Pages.Security.designer.cs +++ b/Site/App_GlobalResources/Pages.Security.designer.cs @@ -314,11 +314,11 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Manual Login. + /// Looks up a localized string similar to Manual Password Login. /// - internal static string Login_ManualLogin { + internal static string Login_ManualLoginHeader { get { - return ResourceManager.GetString("Login_ManualLogin", resourceCulture); + return ResourceManager.GetString("Login_ManualLoginHeader", resourceCulture); } } @@ -341,7 +341,7 @@ namespace Resources.Pages { } /// - /// Looks up a localized string similar to Reset Password. + /// Looks up a localized string similar to Help, I forgot my password!. /// internal static string Login_ResetPassword { get { @@ -376,6 +376,24 @@ namespace Resources.Pages { } } + /// + /// Looks up a localized string similar to Use BitID two-factor authentication?. + /// + internal static string Login_UseBitIdLogin { + get { + return ResourceManager.GetString("Login_UseBitIdLogin", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Use manual password login?. + /// + internal static string Login_UseManualLogin { + get { + return ResourceManager.GetString("Login_UseManualLogin", resourceCulture); + } + } + /// /// Looks up a localized string similar to User. /// diff --git a/Site/App_GlobalResources/Pages.Security.resx b/Site/App_GlobalResources/Pages.Security.resx index 941d22d1..37e7e1e7 100644 --- a/Site/App_GlobalResources/Pages.Security.resx +++ b/Site/App_GlobalResources/Pages.Security.resx @@ -203,8 +203,9 @@ Logging in, please wait... - - Manual Login + + Manual Password Login + Header to manual username/password form Login @@ -213,7 +214,7 @@ Pass - Reset Password + Help, I forgot my password! Sign me up for {0}! @@ -225,6 +226,14 @@ Swarmops doesn't recognize this address. Please log in manually and activate your address before using it to login. + + Use BitID two-factor authentication? + Switches from manual to BitID + + + Use manual password login? + Switches from BitId to Username/Password form + User diff --git a/Site/Controls/v5/Financial/CurrencyTextBox.ascx b/Site/Controls/v5/Financial/CurrencyTextBox.ascx index 2fc622e8..5fdbdd1a 100644 --- a/Site/Controls/v5/Financial/CurrencyTextBox.ascx +++ b/Site/Controls/v5/Financial/CurrencyTextBox.ascx @@ -1,5 +1,8 @@ <%@ Control Language="C#" AutoEventWireup="true" Inherits="Swarmops.Frontend.Controls.Financial.CurrencyTextBox" Codebehind="CurrencyTextBox.ascx.cs" %> +<%@ Import Namespace="Swarmops.Common.Enums" %> -
\ No newline at end of file + <% if (this.Layout == LayoutDirection.Vertical) { %>
<% } %> + + <% if (this.Layout == LayoutDirection.Vertical) { %>
<% } %> \ No newline at end of file diff --git a/Site/Controls/v5/Financial/CurrencyTextBox.ascx.cs b/Site/Controls/v5/Financial/CurrencyTextBox.ascx.cs index 4c619fd6..39db0411 100644 --- a/Site/Controls/v5/Financial/CurrencyTextBox.ascx.cs +++ b/Site/Controls/v5/Financial/CurrencyTextBox.ascx.cs @@ -1,5 +1,6 @@ using System; using System.Globalization; +using Swarmops.Common.Enums; using System.Web.UI; namespace Swarmops.Frontend.Controls.Financial @@ -13,6 +14,11 @@ namespace Swarmops.Frontend.Controls.Financial protected void Page_Load (object sender, EventArgs e) { this.Input.Attributes["role"] = "note"; // disable Lastpass trying to autofill + + if (this.Layout == LayoutDirection.Unknown) + { + this.Layout = LayoutDirection.Vertical; + } } public Int64 Cents @@ -66,6 +72,8 @@ namespace Swarmops.Frontend.Controls.Financial // TODO: Add other-currency parsing + public LayoutDirection Layout { get; set; } + public new void Focus() { this.Input.Focus(); diff --git a/Site/Controls/v5/Swarm/ImpersonationWarningBox.ascx b/Site/Controls/v5/Swarm/ImpersonationWarningBox.ascx index 911cca8b..7e32f089 100644 --- a/Site/Controls/v5/Swarm/ImpersonationWarningBox.ascx +++ b/Site/Controls/v5/Swarm/ImpersonationWarningBox.ascx @@ -13,26 +13,7 @@ } }); } - - function flashOrangeHeader() { - if (!_orangeFlashState) { - $('h2.flashheader').addClass("orangeDark").removeClass("orange"); - _orangeFlashState = true; - setTimeout("flashOrangeHeader();", 250); - } else { - $('h2.flashheader').removeClass("orangeDark").addClass("orange"); - _orangeFlashState = false; - setTimeout("flashOrangeHeader();", 1750); - } - } - - $(document).ready(function() { - flashOrangeHeader(); - }); - - - - var _orangeFlashState = false; + diff --git a/Site/Master-v5.master b/Site/Master-v5.master index 350fbe5e..7c260081 100644 --- a/Site/Master-v5.master +++ b/Site/Master-v5.master @@ -12,8 +12,10 @@ - - + + + + @@ -145,6 +147,26 @@ }); + // flashing boxes + + function flashOrangeHeader() { + if (!_orangeFlashState) { + $('h2.flashheader').addClass("orangeDark").removeClass("orange"); + _orangeFlashState = true; + setTimeout("flashOrangeHeader();", 250); + } else { + $('h2.flashheader').removeClass("orangeDark").addClass("orange"); + _orangeFlashState = false; + setTimeout("flashOrangeHeader();", 1750); + } + } + + $(document).ready(function() { + flashOrangeHeader(); + }); + + var _orangeFlashState = false; + @@ -230,6 +252,14 @@ + + diff --git a/Site/Master-v5.master.cs b/Site/Master-v5.master.cs index b29959f8..59f6fcc7 100644 --- a/Site/Master-v5.master.cs +++ b/Site/Master-v5.master.cs @@ -520,6 +520,25 @@ namespace Swarmops.Frontend } + public string Localized_ClientError_SocketFail + { + get + { + return + CommonV5.JavascriptEscape( + ErrorMessages.Localized("Client_SocketConnectionFault")); + } + } + + public string Localized_ClientError_HeartbeatFail + { + get { return CommonV5.JavascriptEscape(ErrorMessages.Localized("Client_ServerHeartbeatLost")); } + } + + public string Localized_AllErrorsClear + { + get { return CommonV5.JavascriptEscape(ErrorMessages.Localized("AllClear")); } + } public string GenerateBitIdToken { diff --git a/Site/Pages/v5/Ledgers/InspectLedgers.aspx b/Site/Pages/v5/Ledgers/InspectLedgers.aspx index 54f23697..3ea07781 100644 --- a/Site/Pages/v5/Ledgers/InspectLedgers.aspx +++ b/Site/Pages/v5/Ledgers/InspectLedgers.aspx @@ -344,7 +344,7 @@

-

,

+

,

diff --git a/Site/Pages/v5/Swarm/ListFindPeople.aspx b/Site/Pages/v5/Swarm/ListFindPeople.aspx index f4a05eb8..f3647aba 100644 --- a/Site/Pages/v5/Swarm/ListFindPeople.aspx +++ b/Site/Pages/v5/Swarm/ListFindPeople.aspx @@ -176,7 +176,7 @@
-  
+