pull/1101/head
Geoffroy Arnoud 2022-06-17 11:37:00 +02:00
parent b7ecf0c31b
commit 96a844a014
3 changed files with 26 additions and 9 deletions

View File

@ -8,7 +8,7 @@ const tokenKey = "statping_auth";
class Api {
constructor() {
this.version = "0.91.0";
this.commit = "40f31e3110550754a929a9f848c2eefa4df9ae3f";
this.commit = "b7ecf0c31b0c75c394061d2f6457a925e4440f1e";
}
async oauth() {

View File

@ -172,18 +172,33 @@ func ExecuteResponse(w http.ResponseWriter, r *http.Request, file string, data i
if err != nil {
log.Errorln(err)
}
render, err := source.TmplBox.String(file)
if err != nil {
log.Errorln(err)
}
// render the page requested
if _, err := mainTemplate.Parse(render); err != nil {
log.Errorln(err)
log.Infoln("Ca commence à être intéressant")
asset := file
if source.UsingAssets(utils.Directory) {
asset = utils.Directory + "/assets/" + file
log.Infoln(fmt.Sprintf("asset : %s", asset))
if _, err := mainTemplate.ParseFiles(asset); err != nil {
log.Errorln(err)
}
} else {
render, err := source.TmplBox.String(asset)
if err != nil {
log.Errorln(err)
}
// render the page requested
if _, err := mainTemplate.Parse(render); err != nil {
log.Errorln(err)
}
}
log.Infoln("step 3")
// execute the template
if err := mainTemplate.Execute(w, data); err != nil {
log.Errorln(err)
}
log.Infoln("step 4")
}
func returnJson(d interface{}, w http.ResponseWriter, r *http.Request) {

View File

@ -30,6 +30,7 @@ var (
"scss/mobile.scss",
"scss/variables.scss",
"robots.txt",
"base.gohtml",
}
)
@ -87,6 +88,7 @@ func CompileSASS() error {
// UsingAssets returns true if the '/assets' folder is found in the directory
func UsingAssets(folder string) bool {
log.Infoln(fmt.Sprintf("using assets? checking %s", folder))
if _, err := os.Stat(folder + "/assets"); err == nil {
return true
} else {
@ -174,7 +176,7 @@ func DeleteAllAssets(folder string) error {
// CopyAllToPublic will copy all the files in a rice box into a local folder
func CopyAllToPublic(box *rice.Box) error {
exclude := map[string]bool{
"base.gohtml": true,
// "base.gohtml": true,
"index.html": true,
}