mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-07 16:49:32 -06:00
[feature] Set default header and avatar for API accounts to GtS ones (#799)
* validate web-asset-base-dir * move default icons into converter * always ensure avatar + header on api accounts * update tests * add default header * don't return error from web module creation anymore * tidy a bit * use pngs for default avatars rather than svgs
This commit is contained in:
parent
4e13408fd4
commit
006c8b604b
30 changed files with 205 additions and 1039 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue