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