summaryrefslogtreecommitdiff
path: root/internal/web/assets.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/web/assets.go')
-rw-r--r--internal/web/assets.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/internal/web/assets.go b/internal/web/assets.go
index f67f38363..397870862 100644
--- a/internal/web/assets.go
+++ b/internal/web/assets.go
@@ -20,9 +20,12 @@ package web
import (
"net/http"
+ "path/filepath"
"strings"
"github.com/gin-gonic/gin"
+ "github.com/superseriousbusiness/gotosocial/internal/config"
+ "github.com/superseriousbusiness/gotosocial/internal/log"
)
type fileSystem struct {
@@ -49,7 +52,12 @@ func (fs fileSystem) Open(path string) (http.File, error) {
}
func (m *Module) mountAssetsFilesystem(group *gin.RouterGroup) {
- fs := fileSystem{http.Dir(m.webAssetsAbsFilePath)}
+ webAssetsAbsFilePath, err := filepath.Abs(config.GetWebAssetBaseDir())
+ if err != nil {
+ log.Panicf("mountAssetsFilesystem: error getting absolute path of assets dir: %s", err)
+ }
+
+ fs := fileSystem{http.Dir(webAssetsAbsFilePath)}
// use the cache middleware on all handlers in this group
group.Use(m.cacheControlMiddleware(fs))