mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-03 07:08:06 -06:00
[feature] Use blurhashes in frontend, tidy up gallery view a bit
This commit is contained in:
parent
13e7ac3e6a
commit
df425ac08a
16 changed files with 421 additions and 123 deletions
|
|
@ -68,7 +68,6 @@ func (m *Module) domainBlockListGETHandler(c *gin.Context) {
|
|||
Instance: instance,
|
||||
OGMeta: apiutil.OGBase(instance),
|
||||
Stylesheets: []string{cssFA},
|
||||
Javascript: []string{jsFrontend},
|
||||
Extra: map[string]any{"blocklist": domainBlocks},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -142,11 +142,22 @@ func (m *Module) prepareProfile(c *gin.Context) *profile {
|
|||
}
|
||||
}
|
||||
|
||||
// Limit varies depending on whether this is a gallery view or not.
|
||||
// If gallery view, we want a nice full screen of media, else we
|
||||
// don't want to overwhelm the viewer with a shitload of posts.
|
||||
var limit int
|
||||
if account.WebLayout == "gallery" {
|
||||
limit = 40
|
||||
} else {
|
||||
limit = 20
|
||||
}
|
||||
|
||||
// Get statuses from maxStatusID onwards (or from top if empty string).
|
||||
statusResp, errWithCode := m.processor.Account().WebStatusesGet(
|
||||
ctx,
|
||||
account.ID,
|
||||
mediaOnly,
|
||||
limit,
|
||||
maxStatusID,
|
||||
)
|
||||
if errWithCode != nil {
|
||||
|
|
@ -230,7 +241,17 @@ func (m *Module) profileMicroblog(c *gin.Context, p *profile) {
|
|||
Instance: p.instance,
|
||||
OGMeta: apiutil.OGBase(p.instance).WithAccount(p.account),
|
||||
Stylesheets: stylesheets,
|
||||
Javascript: []string{jsFrontend},
|
||||
Javascript: []apiutil.JavascriptEntry{
|
||||
{
|
||||
Src: jsFrontend,
|
||||
Async: true,
|
||||
Defer: true,
|
||||
},
|
||||
{
|
||||
Bottom: true,
|
||||
Src: jsBlurhash,
|
||||
},
|
||||
},
|
||||
Extra: map[string]any{
|
||||
"account": p.account,
|
||||
"rssFeed": p.rssFeed,
|
||||
|
|
@ -294,7 +315,17 @@ func (m *Module) profileGallery(c *gin.Context, p *profile) {
|
|||
Instance: p.instance,
|
||||
OGMeta: apiutil.OGBase(p.instance).WithAccount(p.account),
|
||||
Stylesheets: stylesheets,
|
||||
Javascript: []string{jsFrontend},
|
||||
Javascript: []apiutil.JavascriptEntry{
|
||||
{
|
||||
Src: jsFrontend,
|
||||
Async: true,
|
||||
Defer: true,
|
||||
},
|
||||
{
|
||||
Bottom: true,
|
||||
Src: jsBlurhash,
|
||||
},
|
||||
},
|
||||
Extra: map[string]any{
|
||||
"account": p.account,
|
||||
"rssFeed": p.rssFeed,
|
||||
|
|
|
|||
|
|
@ -54,7 +54,13 @@ func (m *Module) SettingsPanelHandler(c *gin.Context) {
|
|||
cssStatus, // Used for rendering stub/fake statuses.
|
||||
cssSettings,
|
||||
},
|
||||
Javascript: []string{jsSettings},
|
||||
Javascript: []apiutil.JavascriptEntry{
|
||||
{
|
||||
Src: jsSettings,
|
||||
Async: true,
|
||||
Defer: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
apiutil.TemplateWebPage(c, page)
|
||||
|
|
|
|||
|
|
@ -146,7 +146,17 @@ func (m *Module) threadGETHandler(c *gin.Context) {
|
|||
Instance: instance,
|
||||
OGMeta: apiutil.OGBase(instance).WithStatus(context.Status),
|
||||
Stylesheets: stylesheets,
|
||||
Javascript: []string{jsFrontend},
|
||||
Javascript: []apiutil.JavascriptEntry{
|
||||
{
|
||||
Src: jsFrontend,
|
||||
Async: true,
|
||||
Defer: true,
|
||||
},
|
||||
{
|
||||
Bottom: true,
|
||||
Src: jsBlurhash,
|
||||
},
|
||||
},
|
||||
Extra: map[string]any{
|
||||
"context": context,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ const (
|
|||
cssTag = distPathPrefix + "/tag.css"
|
||||
|
||||
jsFrontend = distPathPrefix + "/frontend.js" // Progressive enhancement frontend JS.
|
||||
jsBlurhash = distPathPrefix + "/blurhash.js" // Blurhash rendering JS.
|
||||
jsSettings = distPathPrefix + "/settings.js" // Settings panel React application.
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue