mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 15:22:26 -05:00
Static fileserver improvements, optional admin panel route (#100)
* better asset serving, optional admin panel route * linting
This commit is contained in:
parent
eef88ae31d
commit
bbc2494c58
3 changed files with 59 additions and 6 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue