Fix cache buster for release mode (#29)

This commit is contained in:
Leendert de Borst
2024-06-20 00:56:23 +02:00
parent c5d2b1da37
commit d51ae8d913
3 changed files with 27 additions and 12 deletions

View File

@@ -5,21 +5,21 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<CacheBuster Condition=" '$(Configuration)' == 'Release' ">$(UtcNow:yyyyMMddHHmmss)</CacheBuster>
<CacheBuster Condition=" '$(Configuration)' != 'Release' ">dev</CacheBuster>
<BuildVersion>$([System.DateTime]::UtcNow.ToString("yyyy-MM-dd HH:mm:ss"))</BuildVersion>
</PropertyGroup>
<Target Name="GenerateCacheBustedIndexHtml" BeforeTargets="Build">
<Exec Command="dotnet msbuild -target:ReplaceText -property:CacheBuster=$(CacheBuster)" />
<Exec Command="dotnet msbuild -t:ReplaceText -p:CacheBuster=$(CacheBuster);BuildVersion='$(BuildVersion)'" />
</Target>
<Target Name="ReplaceText">
<Exec Command="sed 's/@CacheBuster/$(CacheBuster)/g' wwwroot/index.template.html > wwwroot/index.html" />
<Exec Command="sed 's/@CacheBuster/$(CacheBuster)/g;s/@BuildVersion/$(BuildVersion)/g' wwwroot/index.template.html > wwwroot/index.html" />
</Target>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DocumentationFile>bin\Debug\net8.0\AliasVault.WebApp.xml</DocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CacheBuster>dev</CacheBuster>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
@@ -27,6 +27,7 @@
<DocumentationFile>bin\Release\net8.0\AliasVault.WebApp.xml</DocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Optimize>True</Optimize>
<CacheBuster>$([System.DateTime]::UtcNow.ToString("yyyyMMddHHmmss"))</CacheBuster>
</PropertyGroup>
<ItemGroup>

View File

@@ -19,6 +19,16 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"http-release": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "http://localhost:5067",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Release"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,

View File

@@ -3,18 +3,22 @@
<head>
<!--
==========================================================================================================
db 88 88 8b d8 88
d88b 88 "" `8b d8' 88 ,d
d8'`8b 88 `8b d8' 88 88
d8' `8b 88 88 ,adPPYYba, ,adPPYba, `8b d8' ,adPPYYba, 88 88 88 MM88MMM
d8YaaaaY8b 88 88 "" `Y8 I8[ "" `8b d8' "" `Y8 88 88 88 88
d8""""""""8b 88 88 ,adPPPPP88 `"Y8ba, `8b d8' ,adPPPPP88 88 88 88 88
d8' `8b 88 88 88, ,88 aa ]8I `888' 88, ,88 "8a, ,a88 88 88,
d8' `8b 88 88 `"8bbdP"Y8 `"YbbdP"' `8' `"8bbdP"Y8 `"YbbdP'Y8 88 "Y888
db 88 88 8b d8 88
d88b 88 "" `8b d8' 88 ,d
d8'`8b 88 `8b d8' 88 88
d8' `8b 88 88 ,adPPYYba, ,adPPYba, `8b d8' ,adPPYYba, 88 88 88 MM88MMM
d8YaaaaY8b 88 88 "" `Y8 I8[ "" `8b d8' "" `Y8 88 88 88 88
d8""""""""8b 88 88 ,adPPPPP88 `"Y8ba, `8b d8' ,adPPPPP88 88 88 88 88
d8' `8b 88 88 88, ,88 aa ]8I `888' 88, ,88 "8a, ,a88 88 88,
d8' `8b 88 88 `"8bbdP"Y8 `"YbbdP"' `8' `"8bbdP"Y8 `"YbbdP'Y8 88 "Y888
==========================================================================================================
AliasVault - Free open-source password manager.
Build (UTC): @BuildVersion
Source code: https://github.com/lanedirt/AliasVault
License: MIT
-->