From 3fbd723bb157c62b67b9b623e6d8919dcb35fe62 Mon Sep 17 00:00:00 2001 From: Falkvinge Date: Wed, 10 May 2017 09:36:34 +0200 Subject: [PATCH] Fix for Arabic calendar --- Backend/BackendLoop.cs | 2 +- FrontSocket/FrontendLoop.cs | 3 +++ Logic/Support/General.cs | 10 ++++++++++ Site/Bases/DataV5Base.cs | 6 ++++++ Site/Global.asax | 3 ++- 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Backend/BackendLoop.cs b/Backend/BackendLoop.cs index 0a7ce62b..f227f551 100644 --- a/Backend/BackendLoop.cs +++ b/Backend/BackendLoop.cs @@ -55,7 +55,7 @@ namespace Swarmops.Backend // Other one-time initializations FinancialTransactions.FixAllUnsequenced(); - + SupportFunctions.OperatingTopology = OperatingTopology.Backend; // Begin main loop diff --git a/FrontSocket/FrontendLoop.cs b/FrontSocket/FrontendLoop.cs index 9e51fb03..0186b6c5 100644 --- a/FrontSocket/FrontendLoop.cs +++ b/FrontSocket/FrontendLoop.cs @@ -48,6 +48,9 @@ namespace Swarmops.Frontend.Socket // Disable SSL cert checking (because Mono doesn't have a cert repo, dammit) Swarmops.Logic.Support.SupportFunctions.DisableSslCertificateChecks(); + // Other one-off initializations + SupportFunctions.OperatingTopology = OperatingTopology.FrontendSocket; + // Initiate main loop UnixSignal[] killSignals = null; diff --git a/Logic/Support/General.cs b/Logic/Support/General.cs index 58866a69..d157ae34 100644 --- a/Logic/Support/General.cs +++ b/Logic/Support/General.cs @@ -102,5 +102,15 @@ namespace Swarmops.Logic.Support { SwarmDb.GetDatabaseForWriting().CreateExceptionLogEntry (DateTime.UtcNow, source, exception); } + + public static OperatingTopology OperatingTopology { get; set; } + } + + public enum OperatingTopology + { + Unknown = 0, + Backend, + FrontendSocket, + FrontendWeb } } diff --git a/Site/Bases/DataV5Base.cs b/Site/Bases/DataV5Base.cs index bd32df29..187c097a 100644 --- a/Site/Bases/DataV5Base.cs +++ b/Site/Bases/DataV5Base.cs @@ -71,6 +71,12 @@ namespace Swarmops.Frontend { CurrentAuthority = null; // unauthenticated! } + + // Regardless of auth data and culture, set Gregorian calendar + // (avoids problems with Arabic, etc, calendars and bookkeeping in localization) + + GregorianCalendar normalizedCalendar = new GregorianCalendar(); + normalizedCalendar.CalendarType = GregorianCalendarTypes.USEnglish; } diff --git a/Site/Global.asax b/Site/Global.asax index 1177582a..8febd512 100644 --- a/Site/Global.asax +++ b/Site/Global.asax @@ -15,6 +15,7 @@ // Set supported cultures HttpContext.Current.Application["Cultures"] = new[] {"sv-SE", "en-US", "en-GB", "de-DE", "de-AT", "fi-FI"}; HttpContext.Current.Application["UserRoleCache"] = new Dictionary(); + SupportFunctions.OperatingTopology = OperatingTopology.FrontendWeb; } private void Application_End(object sender, EventArgs e) @@ -58,7 +59,7 @@ return; // prevent further matching } - // Rewrite of general URLs + // Rewrite of general URLs, candidates in order, assuming host is "dev.swarmops.com" and {0} given path string[] rewriteCandidates = {