Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Add cache busting to index.html (#33)

Leendert de Borst8d4024860b7a
diff --git a/.gitignore b/.gitignore
index 147b5ae38..a2fb22c01 100644
--- a/.gitignore
+++ b/.gitignore
@@ -370,3 +370,7 @@ FodyWeavers.xsd
.idea
*.licenseheader
+
+# AliasVault specific
+# index.html is generated by the build process from index.template.html and therefore should be ignored
+src/AliasVault.Web/wwwroot/index.html
diff --git a/src/AliasVault.WebApp/AliasVault.WebApp.csproj b/src/AliasVault.WebApp/AliasVault.WebApp.csproj
index c821f52f8..2cc039857 100644
--- a/src/AliasVault.WebApp/AliasVault.WebApp.csproj
+++ b/src/AliasVault.WebApp/AliasVault.WebApp.csproj
@@ -5,8 +5,18 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
+ <CacheBuster Condition=" '$(Configuration)' == 'Release' ">$(UtcNow:yyyyMMddHHmmss)</CacheBuster>
+ <CacheBuster Condition=" '$(Configuration)' != 'Release' ">dev</CacheBuster>
</PropertyGroup>
+ <Target Name="GenerateCacheBustedIndexHtml" BeforeTargets="Build">
+ <Exec Command="dotnet msbuild -target:ReplaceText -property:CacheBuster=$(CacheBuster)" />
+ </Target>
+
+ <Target Name="ReplaceText">
+ <Exec Command="sed 's/@CacheBuster/$(CacheBuster)/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>
diff --git a/src/AliasVault.WebApp/wwwroot/index.html b/src/AliasVault.WebApp/wwwroot/index.template.html
similarity index 61%
rename from src/AliasVault.WebApp/wwwroot/index.html
rename to src/AliasVault.WebApp/wwwroot/index.template.html
index 818b8b825..4c6664ec1 100644
--- a/src/AliasVault.WebApp/wwwroot/index.html
+++ b/src/AliasVault.WebApp/wwwroot/index.template.html
@@ -2,14 +2,30 @@
<html lang="en">
<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
+
+
+ AliasVault - Free open-source password manager.
+ Source code: https://github.com/lanedirt/AliasVault
+ License: MIT
+ -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AliasVault.WebApp</title>
<base href="/" />
- <link rel="stylesheet" href="css/app.css" />
+ <link rel="stylesheet" href="css/app.css?v=@CacheBuster" />
<link rel="icon" type="image/png" href="favicon.png" />
- <link href="css/tailwind.css" rel="stylesheet">
- <link href="AliasVault.WebApp.styles.css" rel="stylesheet" />
+ <link href="css/tailwind.css?v=@CacheBuster" rel="stylesheet">
+ <link href="AliasVault.WebApp.styles.css?v=@CacheBuster" rel="stylesheet" />
</head>
<body class="bg-gray-50 dark:bg-gray-800">
@@ -26,7 +42,7 @@
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
- <script src="js/dark-mode.js"></script>
+ <script src="js/dark-mode.js?v=@CacheBuster"></script>
<script>
window.initTopMenu = function() {
@@ -59,7 +75,7 @@
};
</script>
- <script src="_framework/blazor.webassembly.js"></script>
+ <script src="_framework/blazor.webassembly.js?v=@CacheBuster"></script>
</body>
</html>