Use vspd version as cache buster for .css files.

This will ensure when VSP admins update to a new version of vspd, web visitors will not use cached old .css files.
This commit is contained in:
Jamie Holdstock 2021-06-08 22:52:33 +08:00 committed by Jamie Holdstock
parent 25ae1b89d6
commit b9d4db40e9
4 changed files with 6 additions and 2 deletions

View File

@ -94,6 +94,7 @@ func run(ctx context.Context) error {
Debug: cfg.WebServerDebug,
Designation: cfg.Designation,
MaxVoteChangeRecords: maxVoteChangeRecords,
VspdVersion: version.String(),
}
err = webapi.Start(ctx, shutdownRequestChannel, &shutdownWg, cfg.Listen, db,
dcrd, wallets, apiCfg)

View File

@ -35,6 +35,7 @@ type vspStats struct {
BlockHeight uint32
NetworkProportion float32
RevokedProportion float32
VspdVersion string
}
var statsMtx sync.RWMutex
@ -62,6 +63,7 @@ func initVSPStats() {
VspClosed: cfg.VspClosed,
Debug: cfg.Debug,
Designation: cfg.Designation,
VspdVersion: cfg.VspdVersion,
}
}

View File

@ -8,9 +8,9 @@
<title>Decred VSP - {{ .VspStats.Designation }}</title>
<link rel="stylesheet" href="/public/css/vendor/bootstrap.min.css" />
<link rel="stylesheet" href="/public/css/vspd.css" />
<link rel="stylesheet" href="/public/css/vspd.css?v={{ .VspStats.VspdVersion }}" />
<!-- fonts.css should be last to ensure dcr fonts take precedence. -->
<link rel="stylesheet" href="/public/css/fonts.css" />
<link rel="stylesheet" href="/public/css/fonts.css?v={{ .VspStats.VspdVersion }}" />
<!-- Custom favicon -->
<!-- Apple PWA -->

View File

@ -35,6 +35,7 @@ type Config struct {
Debug bool
Designation string
MaxVoteChangeRecords int
VspdVersion string
}
const (