diff options
author | 2021-07-14 17:22:51 +0200 | |
---|---|---|
committer | 2021-07-14 17:22:51 +0200 | |
commit | bbc2494c58bc742b0d01a4cec6076b94b3e955de (patch) | |
tree | e395004549f8930748b71dd024be4ff2f4439817 /internal/router/router.go | |
parent | frontpage template tweaks (#99) (diff) | |
download | gotosocial-bbc2494c58bc742b0d01a4cec6076b94b3e955de.tar.xz |
Static fileserver improvements, optional admin panel route (#100)
* better asset serving, optional admin panel route
* linting
Diffstat (limited to 'internal/router/router.go')
-rw-r--r-- | internal/router/router.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/router/router.go b/internal/router/router.go index 87a84922c..100e0b38e 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -46,6 +46,8 @@ type Router interface { AttachMiddleware(handler gin.HandlerFunc) // Attach 404 NoRoute handler AttachNoRouteHandler(handler gin.HandlerFunc) + // Add Gin StaticFile handler + AttachStaticFS(relativePath string, fs http.FileSystem) // Start the router Start() // Stop the router @@ -61,6 +63,11 @@ type router struct { certManager *autocert.Manager } +// Add Gin StaticFile handler +func (r *router) AttachStaticFS(relativePath string, fs http.FileSystem) { + r.engine.StaticFS(relativePath, fs) +} + // Start starts the router nicely. // // Different ports and handlers will be served depending on whether letsencrypt is enabled or not. |