Fix version display
This commit is contained in:
parent
5bd7601faa
commit
e65ae41a4a
@ -5,9 +5,9 @@
|
|||||||
<div x-data="index()" x-init="fetch_data(); fetch_version()">
|
<div x-data="index()" x-init="fetch_data(); fetch_version()">
|
||||||
|
|
||||||
<p x-cloak x-show="version && version.upgrade_available">
|
<p x-cloak x-show="version && version.upgrade_available">
|
||||||
<a href="https://github.com/tardisx/gropple/releases">Upgrade is available</a> -
|
<a href="https://github.com/tardisx/gropple/releases">Upgrade is available</a> -
|
||||||
you have
|
you have
|
||||||
<span x-text="version.current_version"></span> and
|
<span x-text="version.current_version"></span> and
|
||||||
<span x-text="version.github_version"></span>
|
<span x-text="version.github_version"></span>
|
||||||
is available.</p>
|
is available.</p>
|
||||||
|
|
||||||
|
11
web/web.go
11
web/web.go
@ -278,10 +278,10 @@ func fetchInfoRESTHandler(dm *download.Manager) func(w http.ResponseWriter, r *h
|
|||||||
}
|
}
|
||||||
|
|
||||||
// fetchHandler shows the popup, either the initial form (for create) or the form when in
|
// fetchHandler shows the popup, either the initial form (for create) or the form when in
|
||||||
// progress (to be updated by REST) - this is determined by GET vs POST
|
// progress (to be updated by REST). It also handles the form POST for creating a new download.
|
||||||
func fetchHandler(cs *config.ConfigService, vm *version.Manager, dm *download.Manager) func(w http.ResponseWriter, r *http.Request) {
|
func fetchHandler(cs *config.ConfigService, vm *version.Manager, dm *download.Manager) func(w http.ResponseWriter, r *http.Request) {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Printf("fetchHandler ")
|
log.Printf("fetchHandler")
|
||||||
|
|
||||||
method := r.Method
|
method := r.Method
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ func fetchHandler(cs *config.ConfigService, vm *version.Manager, dm *download.Ma
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
templateData := map[string]interface{}{"dl": dl, "config": cs.Config, "canStop": download.CanStopDownload}
|
templateData := map[string]interface{}{"dl": dl, "config": cs.Config, "canStop": download.CanStopDownload, "Version": vm.GetInfo()}
|
||||||
|
|
||||||
err = t.ExecuteTemplate(w, "layout", templateData)
|
err = t.ExecuteTemplate(w, "layout", templateData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -373,8 +373,7 @@ func fetchHandler(cs *config.ConfigService, vm *version.Manager, dm *download.Ma
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// a GET, show the popup so they can start the download (or just close
|
// a GET, show the popup so they can start the download
|
||||||
// the popup if they didn't mean it)
|
|
||||||
log.Print("loading popup for a new download")
|
log.Print("loading popup for a new download")
|
||||||
query := r.URL.Query()
|
query := r.URL.Query()
|
||||||
url, present := query["url"]
|
url, present := query["url"]
|
||||||
@ -389,7 +388,7 @@ func fetchHandler(cs *config.ConfigService, vm *version.Manager, dm *download.Ma
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
templateData := map[string]interface{}{"config": cs.Config, "url": url[0]}
|
templateData := map[string]interface{}{"config": cs.Config, "url": url[0], "Version": vm.GetInfo()}
|
||||||
|
|
||||||
err = t.ExecuteTemplate(w, "layout", templateData)
|
err = t.ExecuteTemplate(w, "layout", templateData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user