summaryrefslogtreecommitdiff
path: root/internal/web/base.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/web/base.go')
-rw-r--r--internal/web/base.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/internal/web/base.go b/internal/web/base.go
index 9eea4a6ef..c0b85b613 100644
--- a/internal/web/base.go
+++ b/internal/web/base.go
@@ -24,7 +24,6 @@ import (
"os"
"path/filepath"
- "github.com/gin-contrib/static"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
"github.com/superseriousbusiness/gotosocial/internal/api"
@@ -93,7 +92,11 @@ func (m *Module) Route(s router.Router) error {
return fmt.Errorf("error getting current working directory: %s", err)
}
assetPath := filepath.Join(cwd, m.config.TemplateConfig.AssetBaseDir)
- s.AttachMiddleware(static.Serve("/assets", static.LocalFile(assetPath, false)))
+ s.AttachStaticFS("/assets", FileSystem{http.Dir(assetPath)})
+
+ // Admin panel route, if it exists
+ adminPath := filepath.Join(cwd, m.config.TemplateConfig.AssetBaseDir, "/admin")
+ s.AttachStaticFS("/admin", FileSystem{http.Dir(adminPath)})
// serve front-page
s.AttachHandler(http.MethodGet, "/", m.baseHandler)
@@ -101,9 +104,5 @@ func (m *Module) Route(s router.Router) error {
// 404 handler
s.AttachNoRouteHandler(m.NotFoundHandler)
- if err != nil {
- return fmt.Errorf("error setting router FuncMap: %s", err)
- }
-
return nil
}