version string in js url (cache)
This commit is contained in:
parent
50df43eac6
commit
e3afa3a6b5
@ -6,8 +6,6 @@ Bouquins in Go
|
||||
|
||||
* translations
|
||||
* tests
|
||||
* UI book: cover in background
|
||||
* auth downloads
|
||||
* version string in js url (cache)
|
||||
* csrf
|
||||
* vue.js dev/prod
|
||||
|
@ -16,6 +16,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
Version = "master"
|
||||
|
||||
tplBooks = "book.html"
|
||||
tplAuthors = "author.html"
|
||||
tplSeries = "series.html"
|
||||
@ -43,11 +45,11 @@ const (
|
||||
// URLAbout url of about page
|
||||
URLAbout = "/about/"
|
||||
// URLJs url of js assets
|
||||
URLJs = "/js/"
|
||||
URLJs = "/" + Version + "/js/"
|
||||
// URLCss url of css assets
|
||||
URLCss = "/css/"
|
||||
URLCss = "/" + Version + "/css/"
|
||||
// URLFonts url of fonts assets
|
||||
URLFonts = "/fonts/"
|
||||
URLFonts = "/" + Version + "/fonts/"
|
||||
// URLCalibre url of calibre resources (covers, ebooks files)
|
||||
URLCalibre = "/calibre/"
|
||||
)
|
||||
@ -138,11 +140,12 @@ type SeriesFull struct {
|
||||
type Model struct {
|
||||
Title string
|
||||
Page string
|
||||
Version string
|
||||
}
|
||||
|
||||
// NewModel constuctor for Model
|
||||
func NewModel(title, page string) *Model {
|
||||
return &Model{title, page}
|
||||
return &Model{title, page, Version}
|
||||
}
|
||||
|
||||
// IndexModel is the model for index page
|
||||
|
6
main.go
6
main.go
@ -75,9 +75,9 @@ func initApp() *BouquinsConf {
|
||||
}
|
||||
|
||||
func assets(calibre string) {
|
||||
http.Handle(bouquins.URLJs, http.FileServer(http.Dir("assets")))
|
||||
http.Handle(bouquins.URLCss, http.FileServer(http.Dir("assets")))
|
||||
http.Handle(bouquins.URLFonts, http.FileServer(http.Dir("assets")))
|
||||
http.Handle(bouquins.URLJs, http.StripPrefix("/"+bouquins.Version, http.FileServer(http.Dir("assets"))))
|
||||
http.Handle(bouquins.URLCss, http.StripPrefix("/"+bouquins.Version, http.FileServer(http.Dir("assets"))))
|
||||
http.Handle(bouquins.URLFonts, http.StripPrefix("/"+bouquins.Version, http.FileServer(http.Dir("assets"))))
|
||||
http.Handle(bouquins.URLCalibre, http.StripPrefix(bouquins.URLCalibre, http.FileServer(http.Dir(calibre))))
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<script src="/js/vue.js"></script>
|
||||
<script src="/js/bouquins.js"></script>
|
||||
<script src="/{{ .Version }}/js/vue.js"></script>
|
||||
<script src="/{{ .Version }}/js/bouquins.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -4,11 +4,11 @@
|
||||
<title>{{ if .Title }}{{ .Title }} | {{ end }}Bouquins</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
||||
<link rel="preload" href="/js/vue.js" as="script">
|
||||
<link rel="prefetch" href="/js/vue.js">
|
||||
<link rel="preload" href="/js/bouquins.js" as="script">
|
||||
<link rel="prefetch" href="/js/bouquins.js">
|
||||
<link rel="stylesheet" href="/{{ .Version }}/css/bootstrap.min.css">
|
||||
<link rel="preload" href="/{{ .Version }}/js/vue.js" as="script">
|
||||
<link rel="prefetch" href="/{{ .Version }}/js/vue.js">
|
||||
<link rel="preload" href="/{{ .Version }}/js/bouquins.js" as="script">
|
||||
<link rel="prefetch" href="/{{ .Version }}/js/bouquins.js">
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-inverse" id="nav">
|
||||
|
Loading…
Reference in New Issue
Block a user