cf7e0396f0
ci / build-test (push) Successful in 1m13s
The instance had no idea what version it was: VERSION drives tagging and the image publish, but was never stamped into the assemblies, so a running build reported 1.0.0 forever. Directory.Build.props now stamps it into every project. The dashboard compares that against the newest tag in the source repository and shows a banner when behind. A plain GET of a public tag list -- nothing about the instance is sent -- cached six hours, failing quiet. Two things it deliberately does not do. It never blocks a render: the banner paints from the cached answer and refreshes after first render, so a cold start or an unreachable repository costs nothing rather than holding the dashboard open for an HTTP timeout. And it never guesses: an unknown version on either side shows no banner at all, because a banner that cannot clear trains people to ignore the next real one. Version comparison is numeric on exactly three components, not System.Version and not string order. Tags are written vX.Y.Z, the assembly reports X.Y.Z with a +commithash suffix, and "0.10.0" sorts below "0.9.0" as a string -- each of those is a way the banner sticks or never appears. Prerelease suffixes compare equal to their release so an rc tag does not nag. Gitea does not promise semver ordering, so the highest tag wins rather than the first. The command shown depends on the install: the LXC has `update`, a container is replaced by pulling an image, and telling container users to run `update` sends them after a command that does not exist. No update *button*. The UI has no authentication and the LXC runs the app as root, and `update` builds whatever is on master, so a click would be an unauthenticated path to arbitrary code execution for anything on the LAN. The README now states the no-auth position plainly rather than leaving it implied. Tests cover the parse and ordering cases that would strand a banner, the Gitea payload shape captured from the live API, unreachable and garbage responses, and that the VERSION file actually reaches the assembly -- read from MeterVault's own assembly rather than GetEntryAssembly(), which under `dotnet test` is the test host and reported a confident wrong answer. The suite makes no outbound request: the app factory disables the check. Claude-Session: https://claude.ai/code/session_01V6joyergfvVLFEizH1hJLd
35 lines
1.7 KiB
XML
35 lines
1.7 KiB
XML
<Project>
|
|
|
|
<PropertyGroup>
|
|
<TargetFramework>net10.0</TargetFramework>
|
|
<LangVersion>latest</LangVersion>
|
|
<Nullable>enable</Nullable>
|
|
<ImplicitUsings>enable</ImplicitUsings>
|
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
|
<EnableNETAnalyzers>true</EnableNETAnalyzers>
|
|
<AnalysisLevel>latest</AnalysisLevel>
|
|
<AnalysisMode>Default</AnalysisMode>
|
|
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
|
|
<!-- The German-dialect CSV importer parses/formats with explicit CultureInfo("de-DE");
|
|
invariant globalization would break it and the container needs ICU. -->
|
|
<InvariantGlobalization>false</InvariantGlobalization>
|
|
</PropertyGroup>
|
|
|
|
<!-- VERSION on master is the single source of release truth: editing it tags and publishes
|
|
(.gitea/workflows/version-tag.yml). Stamp it into the assemblies too, so a running instance
|
|
can say which version it is and compare itself against the newest tag. Without this the app
|
|
reports 1.0.0 forever and an update banner would be meaningless. -->
|
|
<PropertyGroup>
|
|
<MeterVaultVersionFile>$(MSBuildThisFileDirectory)VERSION</MeterVaultVersionFile>
|
|
<MeterVaultVersion Condition="Exists('$(MeterVaultVersionFile)')">$([System.IO.File]::ReadAllText('$(MeterVaultVersionFile)').Trim().TrimStart('v'))</MeterVaultVersion>
|
|
<Version Condition="'$(MeterVaultVersion)' != ''">$(MeterVaultVersion)</Version>
|
|
</PropertyGroup>
|
|
|
|
<!-- Test projects: mirror under tests/, name *.Tests, never packed, relaxed warnings. -->
|
|
<PropertyGroup Condition="$(MSBuildProjectName.EndsWith('Tests'))">
|
|
<IsPackable>false</IsPackable>
|
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
|
</PropertyGroup>
|
|
|
|
</Project>
|