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, Debug: cfg.WebServerDebug,
Designation: cfg.Designation, Designation: cfg.Designation,
MaxVoteChangeRecords: maxVoteChangeRecords, MaxVoteChangeRecords: maxVoteChangeRecords,
VspdVersion: version.String(),
} }
err = webapi.Start(ctx, shutdownRequestChannel, &shutdownWg, cfg.Listen, db, err = webapi.Start(ctx, shutdownRequestChannel, &shutdownWg, cfg.Listen, db,
dcrd, wallets, apiCfg) dcrd, wallets, apiCfg)

View File

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

View File

@ -8,9 +8,9 @@
<title>Decred VSP - {{ .VspStats.Designation }}</title> <title>Decred VSP - {{ .VspStats.Designation }}</title>
<link rel="stylesheet" href="/public/css/vendor/bootstrap.min.css" /> <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. --> <!-- 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 --> <!-- Custom favicon -->
<!-- Apple PWA --> <!-- Apple PWA -->

View File

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