Merge pull request #138 from geoffroya/issues/137

dev: Add base.gohtml in assets [#137](https://github.com/statping-ng/
pull/1101/head
Adam 2022-07-25 13:45:21 +01:00 committed by GitHub
commit ffd830fb29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 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,13 +172,24 @@ 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)
asset := file
if source.UsingAssets(utils.Directory) {
asset = utils.Directory + "/assets/" + file
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)
}
}
// execute the template
if err := mainTemplate.Execute(w, data); err != nil {

View File

@ -30,6 +30,7 @@ var (
"scss/mobile.scss",
"scss/variables.scss",
"robots.txt",
"base.gohtml",
}
)
@ -174,7 +175,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,
}