Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ImmichFrame.Core/Interfaces/IServerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public interface IGeneralSettings
public string Style { get; }
public string? BaseFontSize { get; }
public bool ShowWeatherDescription { get; }
public bool UseWholeNumberTemperatures { get; }
public string? WeatherIconUrl { get; }
public bool ImageZoom { get; }
public bool ImagePan { get; }
Expand Down
12 changes: 10 additions & 2 deletions ImmichFrame.WebApi.Tests/Helpers/Config/ConfigLoaderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void TestLoadConfigV2Yaml()

private void VerifyConfig(IServerSettings serverSettings, bool usePrefix, bool expectNullApiKeyFile)
{
VerifyProperties(serverSettings.GeneralSettings);
VerifyProperties(serverSettings.GeneralSettings, "", expectNullApiKeyFile);
VerifyAccounts(serverSettings.Accounts, usePrefix, expectNullApiKeyFile);
}

Expand Down Expand Up @@ -117,7 +117,15 @@ private void VerifyProperties(object o, string? prefix = "", bool expectNullApiK
}
break;
case var t when t == typeof(Boolean):
Assert.That(value, Is.EqualTo(true), prop.Name);
// V1 config doesn't support UseWholeNumberTemperatures, so it defaults to false
if (prop.Name.Equals("UseWholeNumberTemperatures") && expectNullApiKeyFile)
{
Assert.That(value, Is.EqualTo(false), prop.Name);
}
else
{
Assert.That(value, Is.EqualTo(true), prop.Name);
}
break;
case var t when t == typeof(int):
Assert.That(value, Is.EqualTo(7), prop.Name);
Expand Down
1 change: 1 addition & 0 deletions ImmichFrame.WebApi.Tests/Resources/TestV2.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"Style": "Style_TEST",
"BaseFontSize": "BaseFontSize_TEST",
"ShowWeatherDescription": true,
"UseWholeNumberTemperatures": true,
"WeatherIconUrl": "WeatherIconUrl_TEST",
"ImageZoom": true,
"ImagePan": true,
Expand Down
1 change: 1 addition & 0 deletions ImmichFrame.WebApi.Tests/Resources/TestV2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ General:
Style: Style_TEST
BaseFontSize: BaseFontSize_TEST
ShowWeatherDescription: true
UseWholeNumberTemperatures: true
WeatherIconUrl: WeatherIconUrl_TEST
ImageZoom: true
ImagePan: true
Expand Down
1 change: 1 addition & 0 deletions ImmichFrame.WebApi/Helpers/Config/ServerSettingsV1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class GeneralSettingsV1Adapter(ServerSettingsV1 _delegate) : IGeneralSettings
public string Style => _delegate.Style;
public string? BaseFontSize => _delegate.BaseFontSize;
public bool ShowWeatherDescription => _delegate.ShowWeatherDescription;
public bool UseWholeNumberTemperatures => false;
public string? WeatherIconUrl => _delegate.WeatherIconUrl;
public bool ImageZoom => _delegate.ImageZoom;
public bool ImagePan => _delegate.ImagePan;
Expand Down
2 changes: 2 additions & 0 deletions ImmichFrame.WebApi/Models/ClientSettingsDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class ClientSettingsDto
public string Style { get; set; }
public string? BaseFontSize { get; set; }
public bool ShowWeatherDescription { get; set; }
public bool UseWholeNumberTemperatures { get; set; }
public string? WeatherIconUrl { get; set; }
public bool ImageZoom { get; set; }
public bool ImagePan { get; set; }
Expand Down Expand Up @@ -54,6 +55,7 @@ public static ClientSettingsDto FromGeneralSettings(IGeneralSettings generalSett
dto.Style = generalSettings.Style;
dto.BaseFontSize = generalSettings.BaseFontSize;
dto.ShowWeatherDescription = generalSettings.ShowWeatherDescription;
dto.UseWholeNumberTemperatures = generalSettings.UseWholeNumberTemperatures;
dto.WeatherIconUrl = generalSettings.WeatherIconUrl;
dto.ImageZoom = generalSettings.ImageZoom;
dto.ImagePan = generalSettings.ImagePan;
Expand Down
1 change: 1 addition & 0 deletions ImmichFrame.WebApi/Models/ServerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class GeneralSettings : IGeneralSettings, IConfigSettable
public string Style { get; set; } = "none";
public string? BaseFontSize { get; set; }
public bool ShowWeatherDescription { get; set; } = true;
public bool UseWholeNumberTemperatures { get; set; } = false;
public string? WeatherIconUrl { get; set; } = "https://openweathermap.org/img/wn/{IconId}.png";
public bool ImageZoom { get; set; } = true;
public bool ImagePan { get; set; } = false;
Expand Down
2 changes: 1 addition & 1 deletion immichFrame.Web/src/lib/components/elements/clock.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<img src="{ $configStore.weatherIconUrl.replace('{IconId}', encodeURIComponent(weather.iconId)) }" class="icon-weather" alt="{weather.description}">
{/if}
<div class="weather-location">{weather.location},</div>
<div class="weather-temperature">{weather.temperature?.toFixed(1)}</div>
<div class="weather-temperature">{$configStore.useWholeNumberTemperatures ? Math.round(weather.temperature ?? 0) : (weather.temperature ?? 0).toFixed(1)}</div>
<div class="weather-unit">{weather.unit}</div>
</div>
{#if $configStore.showWeatherDescription}
Expand Down
1 change: 1 addition & 0 deletions immichFrame.Web/src/lib/immichFrameApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ export type ClientSettingsDto = {
style?: string | null;
baseFontSize?: string | null;
showWeatherDescription?: boolean;
useWholeNumberTemperatures?: boolean;
weatherIconUrl?: string | null;
imageZoom?: boolean;
imagePan?: boolean;
Expand Down