Fix stale UI after firmware updates (#5120)
Add WEB_BUILD_TIME to html_ui.h and use it for ETag generation Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com> Co-authored-by: Aircoookie <21045690+Aircoookie@users.noreply.github.com>
This commit is contained in:
@@ -113,6 +113,11 @@ function filter(str, type) {
|
||||
}
|
||||
}
|
||||
|
||||
// Generate build timestamp as UNIX timestamp (seconds since epoch)
|
||||
function generateBuildTime() {
|
||||
return Math.floor(Date.now() / 1000);
|
||||
}
|
||||
|
||||
function writeHtmlGzipped(sourceFile, resultFile, page) {
|
||||
console.info("Reading " + sourceFile);
|
||||
new inliner(sourceFile, function (error, html) {
|
||||
@@ -141,7 +146,13 @@ function writeHtmlGzipped(sourceFile, resultFile, page) {
|
||||
* Please see https://mm.kno.wled.ge/advanced/custom-features/#changing-web-ui
|
||||
* to find out how to easily modify the web UI source!
|
||||
*/
|
||||
|
||||
|
||||
// Automatically generated build time for cache busting (UNIX timestamp)
|
||||
#ifdef WEB_BUILD_TIME // avoid duplicate defintions
|
||||
#undef WEB_BUILD_TIME
|
||||
#endif
|
||||
#define WEB_BUILD_TIME ${generateBuildTime()}
|
||||
|
||||
// Autogenerated from ${sourceFile}, do not edit!!
|
||||
const uint16_t PAGE_${page}_L = ${result.length};
|
||||
const uint8_t PAGE_${page}[] PROGMEM = {
|
||||
|
||||
Reference in New Issue
Block a user