From b5b17284a756d241f8afc402d474953c1854b5e6 Mon Sep 17 00:00:00 2001
From: Taiizor <41683699+Taiizor@users.noreply.github.com>
Date: Mon, 11 Dec 2023 03:11:46 +0300
Subject: [PATCH] Infrastructure Preparation 48
---
.../Taiizor.Starterkit.Demo/DemoSettings.json | 6 ++++
.../Taiizor.Starterkit.Demo.csproj | 2 +-
src/Taiizor.Starterkit/Extension/Theme.cs | 28 +++++++++++++++++--
src/Taiizor.Starterkit/Extension/ThemeBase.cs | 4 +++
.../Extension/ThemeSettings.cs | 12 ++++++++
.../Extension/ThemeTempData.cs | 11 ++++++++
src/Taiizor.Starterkit/Interface/ITheme.cs | 8 ++++++
.../Resources/FactorySettings.json | 6 ++++
.../Taiizor.Starterkit.csproj | 2 +-
.../install-from-nuget.csproj | 2 +-
10 files changed, 76 insertions(+), 5 deletions(-)
create mode 100644 src/Taiizor.Starterkit/Extension/ThemeTempData.cs
diff --git a/demo/Taiizor.Starterkit.Demo/Taiizor.Starterkit.Demo/DemoSettings.json b/demo/Taiizor.Starterkit.Demo/Taiizor.Starterkit.Demo/DemoSettings.json
index 27c5f07..b99470e 100644
--- a/demo/Taiizor.Starterkit.Demo/Taiizor.Starterkit.Demo/DemoSettings.json
+++ b/demo/Taiizor.Starterkit.Demo/Taiizor.Starterkit.Demo/DemoSettings.json
@@ -9,6 +9,7 @@
"ModeSwitchEnabled": true,
"LocaleDefault": "en-GB",
"SvgDir": "media/icons/",
+ "DevelopmentMode": true,
"ModeDefault": "system",
"AssetsDir": "assets/",
"PagesDir": "~/Pages",
@@ -61,6 +62,11 @@
"CookieName": "Factorial",
"CookieExpires": 30
},
+ "TempData": {
+ "CookieDomain": ".vegalya.com",
+ "CookieName": "Factorial",
+ "CookieExpires": 30
+ },
"Compression": {
"StaticFile": {
"CacheControl": "public, max-age={0}",
diff --git a/demo/Taiizor.Starterkit.Demo/Taiizor.Starterkit.Demo/Taiizor.Starterkit.Demo.csproj b/demo/Taiizor.Starterkit.Demo/Taiizor.Starterkit.Demo/Taiizor.Starterkit.Demo.csproj
index 8910900..685bd9e 100644
--- a/demo/Taiizor.Starterkit.Demo/Taiizor.Starterkit.Demo/Taiizor.Starterkit.Demo.csproj
+++ b/demo/Taiizor.Starterkit.Demo/Taiizor.Starterkit.Demo/Taiizor.Starterkit.Demo.csproj
@@ -14,7 +14,7 @@
-
+
\ No newline at end of file
diff --git a/src/Taiizor.Starterkit/Extension/Theme.cs b/src/Taiizor.Starterkit/Extension/Theme.cs
index fdddc32..d43345a 100644
--- a/src/Taiizor.Starterkit/Extension/Theme.cs
+++ b/src/Taiizor.Starterkit/Extension/Theme.cs
@@ -159,6 +159,18 @@ public string GetIcon(string iconName, string iconClass = "", string iconType =
return output;
}
+ // Set development mode from settings
+ public void SetDevelopmentMode(bool flag)
+ {
+ ThemeSettings.Config.DevelopmentMode = flag;
+ }
+
+ // Get development mode from settings
+ public bool GetDevelopmentMode()
+ {
+ return ThemeSettings.Config.DevelopmentMode;
+ }
+
// Set preloader option from settings
public void SetPreloader(bool flag)
{
@@ -315,13 +327,13 @@ public string GetLocaleDefaultReplace()
return _localeDefault.Replace("-", "_");
}
- // Set dark mode enabled status
+ // Set mode enabled status
public void SetModeSwitch(bool flag)
{
_modeSwitchEnabled = flag;
}
- // Check dark mode status
+ // Check mode status
public bool IsModeSwitchEnabled()
{
return _modeSwitchEnabled;
@@ -705,6 +717,18 @@ public string GetAntiforgeryCookieDomain()
return ThemeSettings.Config.Antiforgery.CookieDomain;
}
+ // Set the tempdata cookie domain
+ public void SetTempDataCookieDomain(string flag)
+ {
+ ThemeSettings.Config.TempData.CookieDomain = flag;
+ }
+
+ // Get the tempdata cookie domain
+ public string GetTempDataCookieDomain()
+ {
+ return ThemeSettings.Config.TempData.CookieDomain;
+ }
+
// Include favicon from settings
public string GetManifest()
{
diff --git a/src/Taiizor.Starterkit/Extension/ThemeBase.cs b/src/Taiizor.Starterkit/Extension/ThemeBase.cs
index 1f0233f..ff41e62 100644
--- a/src/Taiizor.Starterkit/Extension/ThemeBase.cs
+++ b/src/Taiizor.Starterkit/Extension/ThemeBase.cs
@@ -35,6 +35,10 @@ public class ThemeBase
public string LocaleDefault { get; set; }
+ public bool DevelopmentMode { get; set; }
+
+ public ThemeTempData TempData { get; set; }
+
public bool ModeSwitchEnabled { get; set; }
public string MapFallbackPage { get; set; }
diff --git a/src/Taiizor.Starterkit/Extension/ThemeSettings.cs b/src/Taiizor.Starterkit/Extension/ThemeSettings.cs
index 3700477..93de9d0 100644
--- a/src/Taiizor.Starterkit/Extension/ThemeSettings.cs
+++ b/src/Taiizor.Starterkit/Extension/ThemeSettings.cs
@@ -18,6 +18,18 @@ public static void Init(string Path, string Key)
public static void Init(IConfiguration Configuration, string Key)
{
Config = Configuration.GetSection(Key).Get() ?? Config;
+
+ if (Config.DevelopmentMode)
+ {
+ Config.Domain = "https://localhost/";
+
+ Config.TempData.CookieDomain = "localhost";
+ Config.Languages.CookieDomain = "localhost";
+ Config.Application.CookieDomain = "localhost";
+ Config.Antiforgery.CookieDomain = "localhost";
+ Config.Authenticator.CookieDomain = "localhost";
+ Config.Authentication.CookieDomain = "localhost";
+ }
}
}
}
\ No newline at end of file
diff --git a/src/Taiizor.Starterkit/Extension/ThemeTempData.cs b/src/Taiizor.Starterkit/Extension/ThemeTempData.cs
new file mode 100644
index 0000000..57948a5
--- /dev/null
+++ b/src/Taiizor.Starterkit/Extension/ThemeTempData.cs
@@ -0,0 +1,11 @@
+namespace Taiizor.Starterkit.Extension
+{
+ public class ThemeTempData
+ {
+ public int CookieExpires { get; set; }
+
+ public string CookieName { get; set; }
+
+ public string CookieDomain { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Taiizor.Starterkit/Interface/ITheme.cs b/src/Taiizor.Starterkit/Interface/ITheme.cs
index b7a32bb..2a4e911 100644
--- a/src/Taiizor.Starterkit/Interface/ITheme.cs
+++ b/src/Taiizor.Starterkit/Interface/ITheme.cs
@@ -22,6 +22,10 @@ public interface ITheme
string GetIcon(string iconName, string iconClass = "", string iconType = "");
+ void SetDevelopmentMode(bool flag);
+
+ bool GetDevelopmentMode();
+
void SetPreloader(bool flag);
bool GetPreloader();
@@ -178,6 +182,10 @@ public interface ITheme
string GetAntiforgeryCookieDomain();
+ void SetTempDataCookieDomain(string flag);
+
+ string GetTempDataCookieDomain();
+
string GetManifest();
string GetFavicon();
diff --git a/src/Taiizor.Starterkit/Resources/FactorySettings.json b/src/Taiizor.Starterkit/Resources/FactorySettings.json
index ec73096..bf4f5bd 100644
--- a/src/Taiizor.Starterkit/Resources/FactorySettings.json
+++ b/src/Taiizor.Starterkit/Resources/FactorySettings.json
@@ -9,6 +9,7 @@
"ModeSwitchEnabled": true,
"LocaleDefault": "en-GB",
"SvgDir": "media/icons/",
+ "DevelopmentMode": true,
"ModeDefault": "system",
"AssetsDir": "assets/",
"PagesDir": "~/Pages",
@@ -61,6 +62,11 @@
"CookieName": "Factorial",
"CookieExpires": 30
},
+ "TempData": {
+ "CookieDomain": ".vegalya.com",
+ "CookieName": "Factorial",
+ "CookieExpires": 30
+ },
"Compression": {
"StaticFile": {
"CacheControl": "public, max-age={0}",
diff --git a/src/Taiizor.Starterkit/Taiizor.Starterkit.csproj b/src/Taiizor.Starterkit/Taiizor.Starterkit.csproj
index b4bbfc8..596ca4b 100644
--- a/src/Taiizor.Starterkit/Taiizor.Starterkit.csproj
+++ b/src/Taiizor.Starterkit/Taiizor.Starterkit.csproj
@@ -13,7 +13,7 @@
Resources\Taiizor.Starterkit.ico
- 1.1.4.2
+ 1.1.4.3
$(Version)
true
Taiizor.Starterkit
diff --git a/tutorial/C#/#002 install-from-nuget/install-from-nuget/install-from-nuget.csproj b/tutorial/C#/#002 install-from-nuget/install-from-nuget/install-from-nuget.csproj
index d2b708e..bf75564 100644
--- a/tutorial/C#/#002 install-from-nuget/install-from-nuget/install-from-nuget.csproj
+++ b/tutorial/C#/#002 install-from-nuget/install-from-nuget/install-from-nuget.csproj
@@ -8,7 +8,7 @@
-
+
\ No newline at end of file