Fixed PWA folder paths

This commit is contained in:
Caleb Gardner
2024-08-07 02:37:32 -05:00
parent 2afbd64dc2
commit b7c63ca794
3 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ import (
)
const (
blogTitle = "<h1 class='blog-title'><a href='%v' onclick=\"return setToPath('%v')\" style='text-decoration:none'>%v</a></h1>"
blogTitle = "<h1 class='blog-title'><a href='https://darkstorm.tech/%v' onclick=\"return setToPath('%v')\" style='text-decoration:none'>%v</a></h1>"
blogAuthor = "<h4 class='blog-author'><i><b>By %v</b></i></h4>"
blogCreate = "<h5 class='blog-time'><i>Written on: %v</i></h5>"
blogMain = "<div class='blog'>%v</div>"
+1
View File
@@ -39,6 +39,7 @@ func (b *Backend) countLog(w http.ResponseWriter, r *http.Request) {
if r.URL.Query().Get("platform") != "" {
//TODO: remove legacy code
req.Platform = r.URL.Query().Get("platform")
req.ID = r.URL.Query().Get("id")
} else {
ReturnError(w, http.StatusBadRequest, "invalidBody", "Bad request")
return
+5 -2
View File
@@ -103,8 +103,11 @@ func mainHandle(w http.ResponseWriter, r *http.Request) {
if err == nil && !stat.IsDir() {
http.ServeFile(w, r, filepath.Join(*webRoot, path))
return
} else if stat.IsDir() {
ind := filepath.Join(*webRoot, path, "index.html")
}
spl := strings.Split(path, "/")
stat, err = os.Stat(filepath.Join(*webRoot, spl[0]))
if stat.IsDir() {
ind := filepath.Join(*webRoot, spl[0], "index.html")
stat, err = os.Stat(ind)
if err == nil {
http.ServeFile(w, r, ind)