Skip to content

Commit

Permalink
Infrastructure Preparation 48
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Dec 11, 2023
1 parent 6b597de commit b5b1728
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"ModeSwitchEnabled": true,
"LocaleDefault": "en-GB",
"SvgDir": "media/icons/",
"DevelopmentMode": true,
"ModeDefault": "system",
"AssetsDir": "assets/",
"PagesDir": "~/Pages",
Expand Down Expand Up @@ -61,6 +62,11 @@
"CookieName": "Factorial",
"CookieExpires": 30
},
"TempData": {
"CookieDomain": ".vegalya.com",
"CookieName": "Factorial",
"CookieExpires": 30
},
"Compression": {
"StaticFile": {
"CacheControl": "public, max-age={0}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Taiizor.Starterkit" Version="1.1.4.1" />
<PackageReference Include="Taiizor.Starterkit" Version="1.1.4.2" />
</ItemGroup>

</Project>
28 changes: 26 additions & 2 deletions src/Taiizor.Starterkit/Extension/Theme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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()
{
Expand Down
4 changes: 4 additions & 0 deletions src/Taiizor.Starterkit/Extension/ThemeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
12 changes: 12 additions & 0 deletions src/Taiizor.Starterkit/Extension/ThemeSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ThemeBase>() ?? 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";
}
}
}
}
11 changes: 11 additions & 0 deletions src/Taiizor.Starterkit/Extension/ThemeTempData.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
}
8 changes: 8 additions & 0 deletions src/Taiizor.Starterkit/Interface/ITheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -178,6 +182,10 @@ public interface ITheme

string GetAntiforgeryCookieDomain();

void SetTempDataCookieDomain(string flag);

string GetTempDataCookieDomain();

string GetManifest();

string GetFavicon();
Expand Down
6 changes: 6 additions & 0 deletions src/Taiizor.Starterkit/Resources/FactorySettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"ModeSwitchEnabled": true,
"LocaleDefault": "en-GB",
"SvgDir": "media/icons/",
"DevelopmentMode": true,
"ModeDefault": "system",
"AssetsDir": "assets/",
"PagesDir": "~/Pages",
Expand Down Expand Up @@ -61,6 +62,11 @@
"CookieName": "Factorial",
"CookieExpires": 30
},
"TempData": {
"CookieDomain": ".vegalya.com",
"CookieName": "Factorial",
"CookieExpires": 30
},
"Compression": {
"StaticFile": {
"CacheControl": "public, max-age={0}",
Expand Down
2 changes: 1 addition & 1 deletion src/Taiizor.Starterkit/Taiizor.Starterkit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<PropertyGroup>
<ApplicationIcon>Resources\Taiizor.Starterkit.ico</ApplicationIcon>
<Version>1.1.4.2</Version>
<Version>1.1.4.3</Version>
<AssemblyVersion>$(Version)</AssemblyVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Title>Taiizor.Starterkit</Title>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Taiizor.Starterkit" Version="1.1.4.1" />
<PackageReference Include="Taiizor.Starterkit" Version="1.1.4.2" />
</ItemGroup>

</Project>

0 comments on commit b5b1728

Please sign in to comment.