Skip to content

Commit

Permalink
Merge pull request #61 from qJake/project-updates
Browse files Browse the repository at this point in the history
1.0.3: More Hass.io Fixes
  • Loading branch information
qJake authored Feb 8, 2020
2 parents 638aaeb + 7597f31 commit f7571fa
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Docker/BuildHaccContainers.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$version = '1.0.1'
$version = '1.0.3'

function Test-ExitCode ([int] $Expected = 0)
{
Expand Down
9 changes: 8 additions & 1 deletion HADotNet.CommandCenter/Controllers/AdminController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,14 @@ public async Task<IActionResult> Settings(SystemSettings newSettings)
{
if (ModelState.IsValid)
{
newSettings.BaseUri = newSettings.BaseUri.TrimEnd('/');
if (newSettings.IsHassIo)
{
newSettings.BaseUri = "http://hassio/homeassistant";
}
else
{
newSettings.BaseUri = newSettings.BaseUri.TrimEnd('/');
}
await ConfigStore.ManipulateConfig(c => c.Settings = newSettings);

TempData["check-settings"] = true;
Expand Down
4 changes: 2 additions & 2 deletions HADotNet.CommandCenter/HADotNet.CommandCenter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<RuntimeIdentifiers>win10;alpine.3.10-x64;debian.10-arm</RuntimeIdentifiers>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<AssemblyVersion>1.0.2.0</AssemblyVersion>
<FileVersion>1.0.2.0</FileVersion>
<AssemblyVersion>1.0.3.0</AssemblyVersion>
<FileVersion>1.0.3.0</FileVersion>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Deterministic>false</Deterministic>
Expand Down
29 changes: 27 additions & 2 deletions HADotNet.CommandCenter/Middleware/HAClientInitialization.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using HADotNet.CommandCenter.Models.Config;
using HADotNet.CommandCenter.Models.Config.Pages;
using HADotNet.CommandCenter.Models.Config.Tiles;
using HADotNet.CommandCenter.Services.Interfaces;
using HADotNet.Core;
using HADotNet.Core.Clients;
Expand Down Expand Up @@ -85,7 +86,7 @@ await ConfigStore.ManipulateConfig(c =>

// Pages Migration

#pragma warning disable CS0612
#pragma warning disable CS0612
if ((config.TileLayout?.Count > 0 || config.Tiles?.Count > 0) && (config.Pages?.Count ?? 0) == 0)
{
await ConfigStore.ManipulateConfig(config =>
Expand All @@ -106,7 +107,31 @@ await ConfigStore.ManipulateConfig(config =>
});
context.Response.Redirect("/admin/pageMigration");
}
#pragma warning restore CS0612
else if (config.Pages.Count == 0)
{
await ConfigStore.ManipulateConfig(config =>
{
config.Pages = new List<Page>
{
new Page
{
Name = "default",
Description = "Default Page",
IsDefaultPage = true,
Tiles = new List<BaseTile>(),
TileLayout = new List<TileLayout>(),
LayoutSettings = new LayoutSettings
{
DeviceHeightPx = 1280,
DeviceWidthPx = 720,
BaseTileSizePx = 92,
TileSpacingPx = 6,
}
}
};
});
}
#pragma warning restore CS0612

await Next(context);
}
Expand Down

0 comments on commit f7571fa

Please sign in to comment.