Compare commits

...

10 commits

Author SHA1 Message Date
Victor Dyotte 14f1e6bbb4
Merge 40c33ccc49 into 6f3583559f 2024-09-27 18:49:14 +02:00
kim 6f3583559f
[bugfix] better handle ogg container format (#3365) 2024-09-27 13:16:34 +02:00
kim 497ebd8c4e
[bugfix] fix media limit reader check (#3363)
* return nicer errors for frontend when media / emoji upload limit reached

* fix reader limit check

* add code comment
2024-09-27 13:15:53 +02:00
tobi c1c8849322
[chore] final bits of fiddling with solarized (#3364)
* [chore] final bits of fiddling with solarized

* block quote
2024-09-27 13:14:47 +02:00
kim 2f582e2e33
update gruf / {go-cache, go-maps, go-kv} (#3361) 2024-09-27 10:26:50 +00:00
vdyotte 40c33ccc49
Fix: update swagger doc 2024-09-24 16:13:49 -04:00
Victor Dyotte 90b773ae2a
Merge branch 'main' into profile-boosts 2024-09-24 15:51:41 -04:00
vdyotte 4b7d7f9b8b
Feat: document new hide boots setting 2024-09-24 15:49:56 -04:00
vdyotte af5a766f62
Feat: display boosts on public profile 2024-09-24 15:22:10 -04:00
S0yKaf d9e59820ed Feat: add "HideBoots" option to account settings 2024-09-23 12:53:21 -04:00
31 changed files with 369 additions and 112 deletions

View file

@ -284,6 +284,12 @@ definitions:
example: https://example.org/media/some_user/header/static/header.png example: https://example.org/media/some_user/header/static/header.png
type: string type: string
x-go-name: HeaderStatic x-go-name: HeaderStatic
hide_boosts:
description: |-
Account has opted to hide boosts from their profile.
Key/value omitted if false.
type: boolean
x-go-name: HideBoosts
hide_collections: hide_collections:
description: |- description: |-
Account has opted to hide their followers/following collections. Account has opted to hide their followers/following collections.
@ -2284,6 +2290,12 @@ definitions:
example: https://example.org/media/some_user/header/static/header.png example: https://example.org/media/some_user/header/static/header.png
type: string type: string
x-go-name: HeaderStatic x-go-name: HeaderStatic
hide_boosts:
description: |-
Account has opted to hide boosts from their profile.
Key/value omitted if false.
type: boolean
x-go-name: HideBoosts
hide_collections: hide_collections:
description: |- description: |-
Account has opted to hide their followers/following collections. Account has opted to hide their followers/following collections.

View file

@ -88,9 +88,9 @@ This setting does not affect visibility of your posts over the ActivityPub proto
!!! warning !!! warning
Be aware that changes to this setting also apply retroactively. Be aware that changes to this setting also apply retroactively.
That is, if you previously made a post on Unlisted visibility, while set to show only Public posts on your profile, and you change this setting to show Public and Unlisted, then the Unlisted post you previously made will be visible on your profile alongside your Public posts. That is, if you previously made a post on Unlisted visibility, while set to show only Public posts on your profile, and you change this setting to show Public and Unlisted, then the Unlisted post you previously made will be visible on your profile alongside your Public posts.
Likewise, if you change this setting to show no posts, then all your posts will be hidden from your profile, regardless of when you created them, and what this option was set to at the time. This will apply until you change this setting again. Likewise, if you change this setting to show no posts, then all your posts will be hidden from your profile, regardless of when you created them, and what this option was set to at the time. This will apply until you change this setting again.
!!! tip !!! tip
@ -134,6 +134,11 @@ This feed only includes posts set as 'Public' (see [Privacy Settings](./posts.md
!!! warning !!! warning
Exposing your RSS feed allows *anyone* to subscribe to updates on your Public posts anonymously, bypassing follows and follow requests. Exposing your RSS feed allows *anyone* to subscribe to updates on your Public posts anonymously, bypassing follows and follow requests.
#### Hide boosts from your public page
By default, GoToSocial will display posts boosted by you on your public web profile. If you do not wish to display them, You can hide them by checking this box.
#### Hide Who You Follow / Are Followed By #### Hide Who You Follow / Are Followed By
By default, GoToSocial shows your following/followers counts on your public web profile, and allows others to see who you follow and are followed by. This can be useful for account discovery purposes. However, for privacy + safety reasons you may wish to hide these counts, and to hide your following/followers lists from other accounts. You can do this by checking this box. By default, GoToSocial shows your following/followers counts on your public web profile, and allows others to see who you follow and are followed by. This can be useful for account discovery purposes. However, for privacy + safety reasons you may wish to hide these counts, and to hide your following/followers lists from other accounts. You can do this by checking this box.
@ -196,7 +201,7 @@ If you want to reset all your policies to the initial defaults, you can click on
!!! danger !!! danger
While GoToSocial respects interaction policies, it is not guaranteed that other server softwares will, and it is possible that accounts on other servers will still send out replies and boosts of your post to their followers, even if your instance forbids these interactions. While GoToSocial respects interaction policies, it is not guaranteed that other server softwares will, and it is possible that accounts on other servers will still send out replies and boosts of your post to their followers, even if your instance forbids these interactions.
As more ActivityPub servers roll out support for interaction policies, this issue will hopefully diminish, but in the meantime GoToSocial can offer only a "best effort" attempt to restrict interactions with your posts according to the policies you have set. As more ActivityPub servers roll out support for interaction policies, this issue will hopefully diminish, but in the meantime GoToSocial can offer only a "best effort" attempt to restrict interactions with your posts according to the policies you have set.
## Email & Password ## Email & Password

6
go.mod
View file

@ -8,13 +8,13 @@ require (
codeberg.org/gruf/go-bytes v1.0.2 codeberg.org/gruf/go-bytes v1.0.2
codeberg.org/gruf/go-bytesize v1.0.3 codeberg.org/gruf/go-bytesize v1.0.3
codeberg.org/gruf/go-byteutil v1.3.0 codeberg.org/gruf/go-byteutil v1.3.0
codeberg.org/gruf/go-cache/v3 v3.5.7 codeberg.org/gruf/go-cache/v3 v3.6.1
codeberg.org/gruf/go-debug v1.3.0 codeberg.org/gruf/go-debug v1.3.0
codeberg.org/gruf/go-errors/v2 v2.3.2 codeberg.org/gruf/go-errors/v2 v2.3.2
codeberg.org/gruf/go-fastcopy v1.1.3 codeberg.org/gruf/go-fastcopy v1.1.3
codeberg.org/gruf/go-ffmpreg v0.2.6 codeberg.org/gruf/go-ffmpreg v0.2.6
codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf
codeberg.org/gruf/go-kv v1.6.4 codeberg.org/gruf/go-kv v1.6.5
codeberg.org/gruf/go-list v0.0.0-20240425093752-494db03d641f codeberg.org/gruf/go-list v0.0.0-20240425093752-494db03d641f
codeberg.org/gruf/go-mempool v0.0.0-20240507125005-cef10d64a760 codeberg.org/gruf/go-mempool v0.0.0-20240507125005-cef10d64a760
codeberg.org/gruf/go-mimetypes v1.2.0 codeberg.org/gruf/go-mimetypes v1.2.0
@ -87,7 +87,7 @@ require (
require ( require (
codeberg.org/gruf/go-fastpath/v2 v2.0.0 // indirect codeberg.org/gruf/go-fastpath/v2 v2.0.0 // indirect
codeberg.org/gruf/go-mangler v1.4.1 // indirect codeberg.org/gruf/go-mangler v1.4.1 // indirect
codeberg.org/gruf/go-maps v1.0.3 // indirect codeberg.org/gruf/go-maps v1.0.4 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect github.com/Masterminds/sprig/v3 v3.2.3 // indirect

12
go.sum
View file

@ -36,8 +36,8 @@ codeberg.org/gruf/go-bytesize v1.0.3 h1:Tz8tCxhPLeyM5VryuBNjUHgKmLj4Bx9RbPaUSA3q
codeberg.org/gruf/go-bytesize v1.0.3/go.mod h1:n/GU8HzL9f3UNp/mUKyr1qVmTlj7+xacpp0OHfkvLPs= codeberg.org/gruf/go-bytesize v1.0.3/go.mod h1:n/GU8HzL9f3UNp/mUKyr1qVmTlj7+xacpp0OHfkvLPs=
codeberg.org/gruf/go-byteutil v1.3.0 h1:nRqJnCcRQ7xbfU6azw7zOzJrSMDIJHBqX6FL9vEMYmU= codeberg.org/gruf/go-byteutil v1.3.0 h1:nRqJnCcRQ7xbfU6azw7zOzJrSMDIJHBqX6FL9vEMYmU=
codeberg.org/gruf/go-byteutil v1.3.0/go.mod h1:chgnZz1LUcfaObaIFglxF5MRYQkJGjQf4WwVz95ccCM= codeberg.org/gruf/go-byteutil v1.3.0/go.mod h1:chgnZz1LUcfaObaIFglxF5MRYQkJGjQf4WwVz95ccCM=
codeberg.org/gruf/go-cache/v3 v3.5.7 h1:5hut49a8Wp3hdwrCEJYj6pHY2aRR1hyTmkK4+wHVYq4= codeberg.org/gruf/go-cache/v3 v3.6.1 h1:sY1XhYeskjZAuYeMm5R0o4Qymru5taNbzmZPSn1oXLE=
codeberg.org/gruf/go-cache/v3 v3.5.7/go.mod h1:Thahfuf3PgHSv2+1zHpvhRdX97tx1WXurVNGWpZucAM= codeberg.org/gruf/go-cache/v3 v3.6.1/go.mod h1:JUNjc4E8gRccn3t+B99akxURFrU6NTDkvFVcwiZirnw=
codeberg.org/gruf/go-debug v1.3.0 h1:PIRxQiWUFKtGOGZFdZ3Y0pqyfI0Xr87j224IYe2snZs= codeberg.org/gruf/go-debug v1.3.0 h1:PIRxQiWUFKtGOGZFdZ3Y0pqyfI0Xr87j224IYe2snZs=
codeberg.org/gruf/go-debug v1.3.0/go.mod h1:N+vSy9uJBQgpQcJUqjctvqFz7tBHJf+S/PIjLILzpLg= codeberg.org/gruf/go-debug v1.3.0/go.mod h1:N+vSy9uJBQgpQcJUqjctvqFz7tBHJf+S/PIjLILzpLg=
codeberg.org/gruf/go-errors/v2 v2.3.2 h1:8ItWaOMfhDaqrJK1Pw8MO0Nu+o/tVcQtR5cJ58Vc4zo= codeberg.org/gruf/go-errors/v2 v2.3.2 h1:8ItWaOMfhDaqrJK1Pw8MO0Nu+o/tVcQtR5cJ58Vc4zo=
@ -50,16 +50,16 @@ codeberg.org/gruf/go-ffmpreg v0.2.6 h1:OHlTOF+62/b+VeM3Svg7praweU/NECRIsuhilZLFa
codeberg.org/gruf/go-ffmpreg v0.2.6/go.mod h1:sViRI0BYK2B8PJw4BrOg7DquPD71mZjDfffRAFcDtvk= codeberg.org/gruf/go-ffmpreg v0.2.6/go.mod h1:sViRI0BYK2B8PJw4BrOg7DquPD71mZjDfffRAFcDtvk=
codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf h1:84s/ii8N6lYlskZjHH+DG6jyia8w2mXMZlRwFn8Gs3A= codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf h1:84s/ii8N6lYlskZjHH+DG6jyia8w2mXMZlRwFn8Gs3A=
codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf/go.mod h1:zZAICsp5rY7+hxnws2V0ePrWxE0Z2Z/KXcN3p/RQCfk= codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf/go.mod h1:zZAICsp5rY7+hxnws2V0ePrWxE0Z2Z/KXcN3p/RQCfk=
codeberg.org/gruf/go-kv v1.6.4 h1:3NZiW8HVdBM3kpOiLb7XfRiihnzZWMAixdCznguhILk= codeberg.org/gruf/go-kv v1.6.5 h1:ttPf0NA8F79pDqBttSudPTVCZmGncumeNIxmeM9ztz0=
codeberg.org/gruf/go-kv v1.6.4/go.mod h1:O/YkSvKiS9XsRolM3rqCd9YJmND7dAXu9z+PrlYO4bc= codeberg.org/gruf/go-kv v1.6.5/go.mod h1:c4PsGqw05bDScvISpK+d31SiDEpBorweCL50hsiK3dc=
codeberg.org/gruf/go-list v0.0.0-20240425093752-494db03d641f h1:Ss6Z+vygy+jOGhj96d/GwsYYDd22QmIcH74zM7/nQkw= codeberg.org/gruf/go-list v0.0.0-20240425093752-494db03d641f h1:Ss6Z+vygy+jOGhj96d/GwsYYDd22QmIcH74zM7/nQkw=
codeberg.org/gruf/go-list v0.0.0-20240425093752-494db03d641f/go.mod h1:F9pl4h34iuVN7kucKam9fLwsItTc+9mmaKt7pNXRd/4= codeberg.org/gruf/go-list v0.0.0-20240425093752-494db03d641f/go.mod h1:F9pl4h34iuVN7kucKam9fLwsItTc+9mmaKt7pNXRd/4=
codeberg.org/gruf/go-loosy v0.0.0-20231007123304-bb910d1ab5c4 h1:IXwfoU7f2whT6+JKIKskNl/hBlmWmnF1vZd84Eb3cyA= codeberg.org/gruf/go-loosy v0.0.0-20231007123304-bb910d1ab5c4 h1:IXwfoU7f2whT6+JKIKskNl/hBlmWmnF1vZd84Eb3cyA=
codeberg.org/gruf/go-loosy v0.0.0-20231007123304-bb910d1ab5c4/go.mod h1:fiO8HE1wjZCephcYmRRsVnNI/i0+mhy44Z5dQalS0rM= codeberg.org/gruf/go-loosy v0.0.0-20231007123304-bb910d1ab5c4/go.mod h1:fiO8HE1wjZCephcYmRRsVnNI/i0+mhy44Z5dQalS0rM=
codeberg.org/gruf/go-mangler v1.4.1 h1:Dv58jFfy9On49L11ji6tpADUknwoJA46iaiZvnNXecs= codeberg.org/gruf/go-mangler v1.4.1 h1:Dv58jFfy9On49L11ji6tpADUknwoJA46iaiZvnNXecs=
codeberg.org/gruf/go-mangler v1.4.1/go.mod h1:mDmW8Ia352RvNFaXoP9K60TgcmCZJtX0j6wm3vjAsJE= codeberg.org/gruf/go-mangler v1.4.1/go.mod h1:mDmW8Ia352RvNFaXoP9K60TgcmCZJtX0j6wm3vjAsJE=
codeberg.org/gruf/go-maps v1.0.3 h1:VDwhnnaVNUIy5O93CvkcE2IZXnMB1+IJjzfop9V12es= codeberg.org/gruf/go-maps v1.0.4 h1:K+Ww4vvR3TZqm5jqrKVirmguZwa3v1VUvmig2SE8uxY=
codeberg.org/gruf/go-maps v1.0.3/go.mod h1:D5LNDxlC9rsDuVQVM6JObaVGAdHB6g2dTdOdkh1aXWA= codeberg.org/gruf/go-maps v1.0.4/go.mod h1:ASX7osM7kFwt5O8GfGflcFjrwYGD8eIuRLl/oMjhEi8=
codeberg.org/gruf/go-mempool v0.0.0-20240507125005-cef10d64a760 h1:m2/UCRXhjDwAg4vyji6iKCpomKw6P4PmBOUi5DvAMH4= codeberg.org/gruf/go-mempool v0.0.0-20240507125005-cef10d64a760 h1:m2/UCRXhjDwAg4vyji6iKCpomKw6P4PmBOUi5DvAMH4=
codeberg.org/gruf/go-mempool v0.0.0-20240507125005-cef10d64a760/go.mod h1:E3RcaCFNq4zXpvaJb8lfpPqdUAmSkP5F1VmMiEUYTEk= codeberg.org/gruf/go-mempool v0.0.0-20240507125005-cef10d64a760/go.mod h1:E3RcaCFNq4zXpvaJb8lfpPqdUAmSkP5F1VmMiEUYTEk=
codeberg.org/gruf/go-mimetypes v1.2.0 h1:3rZGXY/SkNYbamiddWXs2gETXIBkGIeWYnbWpp2OEbc= codeberg.org/gruf/go-mimetypes v1.2.0 h1:3rZGXY/SkNYbamiddWXs2gETXIBkGIeWYnbWpp2OEbc=

View file

@ -348,6 +348,7 @@ func parseUpdateAccountForm(c *gin.Context) (*apimodel.UpdateCredentialsRequest,
form.Theme == nil && form.Theme == nil &&
form.CustomCSS == nil && form.CustomCSS == nil &&
form.EnableRSS == nil && form.EnableRSS == nil &&
form.HideBoosts == nil &&
form.HideCollections == nil && form.HideCollections == nil &&
form.WebVisibility == nil) { form.WebVisibility == nil) {
return nil, errors.New("empty form submitted") return nil, errors.New("empty form submitted")

View file

@ -104,6 +104,9 @@ type Account struct {
// Account has enabled RSS feed. // Account has enabled RSS feed.
// Key/value omitted if false. // Key/value omitted if false.
EnableRSS bool `json:"enable_rss,omitempty"` EnableRSS bool `json:"enable_rss,omitempty"`
// Account has opted to hide boosts from their profile.
// Key/value omitted if false.
HideBoosts bool `json:"hide_boosts,omitempty"`
// Account has opted to hide their followers/following collections. // Account has opted to hide their followers/following collections.
// Key/value omitted if false. // Key/value omitted if false.
HideCollections bool `json:"hide_collections,omitempty"` HideCollections bool `json:"hide_collections,omitempty"`
@ -225,6 +228,8 @@ type UpdateCredentialsRequest struct {
CustomCSS *string `form:"custom_css" json:"custom_css"` CustomCSS *string `form:"custom_css" json:"custom_css"`
// Enable RSS feed of public toots for this account at /@[username]/feed.rss // Enable RSS feed of public toots for this account at /@[username]/feed.rss
EnableRSS *bool `form:"enable_rss" json:"enable_rss"` EnableRSS *bool `form:"enable_rss" json:"enable_rss"`
// Hide boosts from this account's profile page.
HideBoosts *bool `form:"hide_boosts" json:"hide_boosts"`
// Hide this account's following/followers collections. // Hide this account's following/followers collections.
HideCollections *bool `form:"hide_collections" json:"hide_collections"` HideCollections *bool `form:"hide_collections" json:"hide_collections"`
// Visibility of statuses to show via the web view. // Visibility of statuses to show via the web view.

View file

@ -118,6 +118,10 @@ type WebStatus struct {
// Override API account with web account. // Override API account with web account.
Account *WebAccount `json:"account"` Account *WebAccount `json:"account"`
// Account that reblogged the status.
// needed to properly render reblogged statuses on profile pages.
ReblogAccount *WebAccount `json:"reblog_account"`
// Web version of media // Web version of media
// attached to this status. // attached to this status.
MediaAttachments []*WebAttachment `json:"media_attachments"` MediaAttachments []*WebAttachment `json:"media_attachments"`

View file

@ -1017,6 +1017,7 @@ func (a *accountDB) GetAccountWebStatuses(
) ([]*gtsmodel.Status, error) { ) ([]*gtsmodel.Status, error) {
// Check for an easy case: account exposes no statuses via the web. // Check for an easy case: account exposes no statuses via the web.
webVisibility := account.Settings.WebVisibility webVisibility := account.Settings.WebVisibility
hideBoosts := *account.Settings.HideBoosts
if webVisibility == gtsmodel.VisibilityNone { if webVisibility == gtsmodel.VisibilityNone {
return nil, db.ErrNoEntries return nil, db.ErrNoEntries
} }
@ -1035,9 +1036,12 @@ func (a *accountDB) GetAccountWebStatuses(
// Select only IDs from table // Select only IDs from table
Column("status.id"). Column("status.id").
Where("? = ?", bun.Ident("status.account_id"), account.ID). Where("? = ?", bun.Ident("status.account_id"), account.ID).
// Don't show replies or boosts. // Don't show replies.
Where("? IS NULL", bun.Ident("status.in_reply_to_uri")). Where("? IS NULL", bun.Ident("status.in_reply_to_uri"))
Where("? IS NULL", bun.Ident("status.boost_of_id"))
if hideBoosts {
q = q.Where("? IS NULL", bun.Ident("status.boost_of_id"))
}
// Select statuses for this account according // Select statuses for this account according
// to their web visibility preference. // to their web visibility preference.

View file

@ -0,0 +1,44 @@
// GoToSocial
// Copyright (C) GoToSocial Authors admin@gotosocial.org
// SPDX-License-Identifier: AGPL-3.0-or-later
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package migrations
import (
"context"
"strings"
"github.com/uptrace/bun"
)
func init() {
up := func(ctx context.Context, db *bun.DB) error {
_, err := db.ExecContext(ctx, "ALTER TABLE ? ADD COLUMN ? BOOLEAN DEFAULT FALSE", bun.Ident("account_settings"), bun.Ident("hide_boosts"))
if err != nil && !(strings.Contains(err.Error(), "already exists") || strings.Contains(err.Error(), "duplicate column name") || strings.Contains(err.Error(), "SQLSTATE 42701")) {
return err
}
return nil
}
down := func(ctx context.Context, db *bun.DB) error {
_, err := db.ExecContext(ctx, "ALTER TABLE ? DROP COLUMN ?", bun.Ident("account_settings"), bun.Ident("hide_boosts"))
return err
}
if err := Migrations.Register(up, down); err != nil {
panic(err)
}
}

View file

@ -40,8 +40,22 @@
notRelevantKey notRelevantKey
spamKey spamKey
notPermittedKey notPermittedKey
limitReachedKey
) )
// LimitReached indicates that this error was caused by
// some kind of limit being reached, e.g. media upload limit.
func LimitReached(err error) bool {
_, ok := errors.Value(err, limitReachedKey).(struct{})
return ok
}
// SetLimitReached will wrap the given error to store a "limit reached"
// flag, returning wrapped error. See LimitReached() for example use-cases.
func SetLimitReached(err error) error {
return errors.WithValue(err, limitReachedKey, struct{}{})
}
// IsUnretrievable indicates that a call to retrieve a resource // IsUnretrievable indicates that a call to retrieve a resource
// (account, status, attachment, etc) could not be fulfilled, either // (account, status, attachment, etc) could not be fulfilled, either
// because it was not found locally, or because some prerequisite // because it was not found locally, or because some prerequisite

View file

@ -33,6 +33,7 @@ type AccountSettings struct {
Theme string `bun:",nullzero"` // Preset CSS theme filename selected by this Account (empty string if nothing set). Theme string `bun:",nullzero"` // Preset CSS theme filename selected by this Account (empty string if nothing set).
CustomCSS string `bun:",nullzero"` // Custom CSS that should be displayed for this Account's profile and statuses. CustomCSS string `bun:",nullzero"` // Custom CSS that should be displayed for this Account's profile and statuses.
EnableRSS *bool `bun:",nullzero,notnull,default:false"` // enable RSS feed subscription for this account's public posts at [URL]/feed EnableRSS *bool `bun:",nullzero,notnull,default:false"` // enable RSS feed subscription for this account's public posts at [URL]/feed
HideBoosts *bool `bun:",nullzero,notnull,default:false"` // Hide boosts from this accounts profile page.
HideCollections *bool `bun:",nullzero,notnull,default:false"` // Hide this account's followers/following collections. HideCollections *bool `bun:",nullzero,notnull,default:false"` // Hide this account's followers/following collections.
WebVisibility Visibility `bun:",nullzero,notnull,default:public"` // Visibility level of statuses that visitors can view via the web profile. WebVisibility Visibility `bun:",nullzero,notnull,default:public"` // Visibility level of statuses that visitors can view via the web profile.
InteractionPolicyDirect *InteractionPolicy `bun:""` // Interaction policy to use for new direct visibility statuses by this account. If null, assume default policy. InteractionPolicyDirect *InteractionPolicy `bun:""` // Interaction policy to use for new direct visibility statuses by this account. If null, assume default policy.

View file

@ -381,11 +381,19 @@ func (res *result) GetFileType() (gtsmodel.FileType, string) {
return gtsmodel.FileTypeAudio, "wma" return gtsmodel.FileTypeAudio, "wma"
} }
case "ogg": case "ogg":
switch { if len(res.video) > 0 {
case len(res.video) > 0: switch res.video[0].codec {
return gtsmodel.FileTypeVideo, "ogv" case "theora", "dirac": // daala, tarkin
case len(res.audio) > 0: return gtsmodel.FileTypeVideo, "ogv"
return gtsmodel.FileTypeAudio, "ogg" }
}
if len(res.audio) > 0 {
switch res.audio[0].codec {
case "opus", "libopus":
return gtsmodel.FileTypeAudio, "opus"
default:
return gtsmodel.FileTypeAudio, "ogg"
}
} }
case "matroska,webm": case "matroska,webm":
switch { switch {

View file

@ -29,6 +29,7 @@
"codeberg.org/gruf/go-bytesize" "codeberg.org/gruf/go-bytesize"
"codeberg.org/gruf/go-iotools" "codeberg.org/gruf/go-iotools"
"codeberg.org/gruf/go-mimetypes" "codeberg.org/gruf/go-mimetypes"
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
) )
// file represents one file // file represents one file
@ -143,8 +144,9 @@ func drainToTmp(rc io.ReadCloser) (string, error) {
// Check to see if limit was reached, // Check to see if limit was reached,
// (produces more useful error messages). // (produces more useful error messages).
if lr != nil && !iotools.AtEOF(lr.R) { if lr != nil && lr.N <= 0 {
return path, fmt.Errorf("reached read limit %s", bytesize.Size(limit)) err := fmt.Errorf("reached read limit %s", bytesize.Size(limit))
return path, gtserror.SetLimitReached(err)
} }
return path, nil return path, nil

View file

@ -42,6 +42,16 @@ func (suite *GetRSSTestSuite) TestGetAccountRSSAdmin() {
<description>Posts from @admin@localhost:8080</description> <description>Posts from @admin@localhost:8080</description>
<pubDate>Wed, 20 Oct 2021 10:41:37 +0000</pubDate> <pubDate>Wed, 20 Oct 2021 10:41:37 +0000</pubDate>
<lastBuildDate>Wed, 20 Oct 2021 10:41:37 +0000</lastBuildDate> <lastBuildDate>Wed, 20 Oct 2021 10:41:37 +0000</lastBuildDate>
<item>
<title>introduction post</title>
<link>http://localhost:8080/@the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY</link>
<description>@the_mighty_zork@localhost:8080 made a new post: &#34;hello everyone!&#34;</description>
<content:encoded><![CDATA[hello everyone!]]></content:encoded>
<author>@the_mighty_zork@localhost:8080</author>
<guid isPermaLink="true">http://localhost:8080/@the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY</guid>
<pubDate>Wed, 20 Oct 2021 10:40:37 +0000</pubDate>
<source>http://localhost:8080/@the_mighty_zork/feed.rss</source>
</item>
<item> <item>
<title>open to see some puppies</title> <title>open to see some puppies</title>
<link>http://localhost:8080/@admin/statuses/01F8MHAAY43M6RJ473VQFCVH37</link> <link>http://localhost:8080/@admin/statuses/01F8MHAAY43M6RJ473VQFCVH37</link>

View file

@ -274,6 +274,11 @@ func (p *Processor) Update(ctx context.Context, account *gtsmodel.Account, form
settingsColumns = append(settingsColumns, "enable_rss") settingsColumns = append(settingsColumns, "enable_rss")
} }
if form.HideBoosts != nil {
account.Settings.HideBoosts = form.HideBoosts
settingsColumns = append(settingsColumns, "hide_boosts")
}
if form.HideCollections != nil { if form.HideCollections != nil {
account.Settings.HideCollections = form.HideCollections account.Settings.HideCollections = form.HideCollections
settingsColumns = append(settingsColumns, "hide_collections") settingsColumns = append(settingsColumns, "hide_collections")

View file

@ -22,6 +22,7 @@
"errors" "errors"
"fmt" "fmt"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/media" "github.com/superseriousbusiness/gotosocial/internal/media"
@ -51,11 +52,18 @@ func (p *Processor) StoreLocalMedia(
// Immediately trigger write to storage. // Immediately trigger write to storage.
attachment, err := processing.Load(ctx) attachment, err := processing.Load(ctx)
if err != nil { switch {
const text = "error processing emoji" case gtserror.LimitReached(err):
limit := config.GetMediaLocalMaxSize()
text := fmt.Sprintf("local media size limit reached: %s", limit)
return nil, gtserror.NewErrorUnprocessableEntity(err, text)
case err != nil:
const text = "error processing media"
err := gtserror.Newf("error processing media: %w", err) err := gtserror.Newf("error processing media: %w", err)
return nil, gtserror.NewErrorUnprocessableEntity(err, text) return nil, gtserror.NewErrorUnprocessableEntity(err, text)
} else if attachment.Type == gtsmodel.FileTypeUnknown {
case attachment.Type == gtsmodel.FileTypeUnknown:
text := fmt.Sprintf("could not process %s type media", attachment.File.ContentType) text := fmt.Sprintf("could not process %s type media", attachment.File.ContentType)
return nil, gtserror.NewErrorUnprocessableEntity(errors.New(text), text) return nil, gtserror.NewErrorUnprocessableEntity(errors.New(text), text)
} }
@ -86,9 +94,15 @@ func (p *Processor) StoreLocalEmoji(
return nil, gtserror.NewErrorInternalError(err) return nil, gtserror.NewErrorInternalError(err)
} }
// Immediately write to storage. // Immediately trigger write to storage.
emoji, err := processing.Load(ctx) emoji, err := processing.Load(ctx)
if err != nil { switch {
case gtserror.LimitReached(err):
limit := config.GetMediaEmojiLocalMaxSize()
text := fmt.Sprintf("local emoji size limit reached: %s", limit)
return nil, gtserror.NewErrorUnprocessableEntity(err, text)
case err != nil:
const text = "error processing emoji" const text = "error processing emoji"
err := gtserror.Newf("error processing emoji %s: %w", shortcode, err) err := gtserror.Newf("error processing emoji %s: %w", shortcode, err)
return nil, gtserror.NewErrorUnprocessableEntity(err, text) return nil, gtserror.NewErrorUnprocessableEntity(err, text)

View file

@ -302,7 +302,7 @@ func (c *Converter) accountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
// Bits that vary between remote + local accounts: // Bits that vary between remote + local accounts:
// - Account (acct) string. // - Account (acct) string.
// - Role. // - Role.
// - Settings things (enableRSS, theme, customCSS, hideCollections). // - Settings things (enableRSS, theme, customCSS, hideBoosts ,hideCollections).
var ( var (
acct string acct string
@ -310,6 +310,7 @@ func (c *Converter) accountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
enableRSS bool enableRSS bool
theme string theme string
customCSS string customCSS string
hideBoosts bool
hideCollections bool hideCollections bool
) )
@ -338,6 +339,7 @@ func (c *Converter) accountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
enableRSS = *a.Settings.EnableRSS enableRSS = *a.Settings.EnableRSS
theme = a.Settings.Theme theme = a.Settings.Theme
customCSS = a.Settings.CustomCSS customCSS = a.Settings.CustomCSS
hideBoosts = *a.Settings.HideBoosts
hideCollections = *a.Settings.HideCollections hideCollections = *a.Settings.HideCollections
} }
@ -380,6 +382,7 @@ func (c *Converter) accountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
Theme: theme, Theme: theme,
CustomCSS: customCSS, CustomCSS: customCSS,
EnableRSS: enableRSS, EnableRSS: enableRSS,
HideBoosts: hideBoosts,
HideCollections: hideCollections, HideCollections: hideCollections,
Roles: roles, Roles: roles,
} }
@ -1092,7 +1095,15 @@ func (c *Converter) StatusToWebStatus(
ctx context.Context, ctx context.Context,
s *gtsmodel.Status, s *gtsmodel.Status,
) (*apimodel.WebStatus, error) { ) (*apimodel.WebStatus, error) {
apiStatus, err := c.statusToFrontend(ctx, s,
isBoost := s.BoostOf != nil
status := s
if isBoost {
status = s.BoostOf
}
apiStatus, err := c.statusToFrontend(ctx, status,
nil, // No authed requester. nil, // No authed requester.
statusfilter.FilterContextNone, // No filters. statusfilter.FilterContextNone, // No filters.
nil, // No filters. nil, // No filters.
@ -1103,7 +1114,7 @@ func (c *Converter) StatusToWebStatus(
} }
// Convert status author to web model. // Convert status author to web model.
acct, err := c.AccountToWebAccount(ctx, s.Account) acct, err := c.AccountToWebAccount(ctx, status.Account)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1113,6 +1124,14 @@ func (c *Converter) StatusToWebStatus(
Account: acct, Account: acct,
} }
if isBoost {
reblogAcct, err := c.AccountToWebAccount(ctx, s.Account)
if err != nil {
return nil, err
}
webStatus.ReblogAccount = reblogAcct
}
// Whack a newline before and after each "pre" to make it easier to outdent it. // Whack a newline before and after each "pre" to make it easier to outdent it.
webStatus.Content = strings.ReplaceAll(webStatus.Content, "<pre>", "\n<pre>") webStatus.Content = strings.ReplaceAll(webStatus.Content, "<pre>", "\n<pre>")
webStatus.Content = strings.ReplaceAll(webStatus.Content, "</pre>", "</pre>\n") webStatus.Content = strings.ReplaceAll(webStatus.Content, "</pre>", "</pre>\n")

View file

@ -1402,6 +1402,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToWebStatus() {
"emojis": [], "emojis": [],
"fields": [] "fields": []
}, },
"reblog_account": null,
"media_attachments": [ "media_attachments": [
{ {
"id": "01HE7Y3C432WRSNS10EZM86SA5", "id": "01HE7Y3C432WRSNS10EZM86SA5",

View file

@ -39,6 +39,12 @@
func (c *Converter) StatusToRSSItem(ctx context.Context, s *gtsmodel.Status) (*feeds.Item, error) { func (c *Converter) StatusToRSSItem(ctx context.Context, s *gtsmodel.Status) (*feeds.Item, error) {
// see https://cyber.harvard.edu/rss/rss.html // see https://cyber.harvard.edu/rss/rss.html
// If status is a boost,
// display the boost instead.
if s.BoostOf != nil {
s = s.BoostOf
}
// Title -- The title of the item. // Title -- The title of the item.
// example: Venice Film Festival Tries to Quit Sinking // example: Venice Film Festival Tries to Quit Sinking
var title string var title string

View file

@ -657,6 +657,7 @@ func NewTestAccountSettings() map[string]*gtsmodel.AccountSettings {
Sensitive: util.Ptr(false), Sensitive: util.Ptr(false),
Language: "en", Language: "en",
EnableRSS: util.Ptr(false), EnableRSS: util.Ptr(false),
HideBoosts: util.Ptr(false),
HideCollections: util.Ptr(false), HideCollections: util.Ptr(false),
WebVisibility: gtsmodel.VisibilityPublic, WebVisibility: gtsmodel.VisibilityPublic,
}, },
@ -668,6 +669,7 @@ func NewTestAccountSettings() map[string]*gtsmodel.AccountSettings {
Sensitive: util.Ptr(false), Sensitive: util.Ptr(false),
Language: "en", Language: "en",
EnableRSS: util.Ptr(true), EnableRSS: util.Ptr(true),
HideBoosts: util.Ptr(false),
HideCollections: util.Ptr(false), HideCollections: util.Ptr(false),
WebVisibility: gtsmodel.VisibilityPublic, WebVisibility: gtsmodel.VisibilityPublic,
}, },
@ -679,6 +681,7 @@ func NewTestAccountSettings() map[string]*gtsmodel.AccountSettings {
Sensitive: util.Ptr(false), Sensitive: util.Ptr(false),
Language: "en", Language: "en",
EnableRSS: util.Ptr(true), EnableRSS: util.Ptr(true),
HideBoosts: util.Ptr(false),
HideCollections: util.Ptr(false), HideCollections: util.Ptr(false),
WebVisibility: gtsmodel.VisibilityUnlocked, WebVisibility: gtsmodel.VisibilityUnlocked,
}, },
@ -690,6 +693,7 @@ func NewTestAccountSettings() map[string]*gtsmodel.AccountSettings {
Sensitive: util.Ptr(true), Sensitive: util.Ptr(true),
Language: "fr", Language: "fr",
EnableRSS: util.Ptr(false), EnableRSS: util.Ptr(false),
HideBoosts: util.Ptr(false),
HideCollections: util.Ptr(true), HideCollections: util.Ptr(true),
WebVisibility: gtsmodel.VisibilityPublic, WebVisibility: gtsmodel.VisibilityPublic,
}, },

View file

@ -9,9 +9,3 @@ A `cache.Cache{}` implementation with much more of the inner workings exposed. D
## ttl ## ttl
A `cache.TTLCache{}` implementation with much more of the inner workings exposed. Designed to be used as a base for your own customizations, or used as-is. A `cache.TTLCache{}` implementation with much more of the inner workings exposed. Designed to be used as a base for your own customizations, or used as-is.
## result
`result.Cache` is an example of a more complex cache implementation using `ttl.Cache{}` as its underpinning.
It provides caching specifically of loadable struct types, with automatic keying by multiple different field members and caching of negative (error) values. All useful when wrapping, for example, a database.

View file

@ -197,7 +197,8 @@ func (f format) AppendBytes(b []byte) {
// Quoted only if spaces/requires escaping // Quoted only if spaces/requires escaping
case f.Key(): case f.Key():
f.AppendStringSafe(b2s(b)) s := byteutil.B2S(b)
f.AppendStringSafe(s)
// Append as separate ASCII quoted bytes in slice // Append as separate ASCII quoted bytes in slice
case f.Verbose(): case f.Verbose():
@ -214,7 +215,8 @@ func (f format) AppendBytes(b []byte) {
// Quoted only if spaces/requires escaping // Quoted only if spaces/requires escaping
case f.Value(): case f.Value():
f.AppendStringSafe(b2s(b)) s := byteutil.B2S(b)
f.AppendStringSafe(s)
// Append as raw bytes // Append as raw bytes
default: default:

View file

@ -98,8 +98,3 @@ func isNil(i interface{}) bool {
type eface struct{ _type, data unsafe.Pointer } //nolint type eface struct{ _type, data unsafe.Pointer } //nolint
return (*(*eface)(unsafe.Pointer(&i))).data == nil //nolint return (*(*eface)(unsafe.Pointer(&i))).data == nil //nolint
} }
// b2s converts a byteslice to string without allocation.
func b2s(b []byte) string {
return *(*string)(unsafe.Pointer(&b))
}

View file

@ -17,7 +17,7 @@ type ordered[K comparable, V any] struct {
} }
// write_check panics if map is not in a safe-state to write to. // write_check panics if map is not in a safe-state to write to.
func (m ordered[K, V]) write_check() { func (m *ordered[K, V]) write_check() {
if m.rnly { if m.rnly {
panic("map write during read loop") panic("map write during read loop")
} }
@ -54,15 +54,17 @@ func (m *ordered[K, V]) Delete(key K) bool {
// Range passes given function over the requested range of the map. // Range passes given function over the requested range of the map.
func (m *ordered[K, V]) Range(start, length int, fn func(int, K, V)) { func (m *ordered[K, V]) Range(start, length int, fn func(int, K, V)) {
// Nil check
if fn == nil {
panic("nil func")
}
// Disallow writes // Disallow writes
m.rnly = true m.rnly = true
defer func() { defer func() {
m.rnly = false m.rnly = false
}() }()
// Nil check
_ = fn
switch end := start + length; { switch end := start + length; {
// No loop to iterate // No loop to iterate
case length == 0: case length == 0:
@ -104,15 +106,17 @@ func (m *ordered[K, V]) Range(start, length int, fn func(int, K, V)) {
// RangeIf passes given function over the requested range of the map. Returns early on 'fn' -> false. // RangeIf passes given function over the requested range of the map. Returns early on 'fn' -> false.
func (m *ordered[K, V]) RangeIf(start, length int, fn func(int, K, V) bool) { func (m *ordered[K, V]) RangeIf(start, length int, fn func(int, K, V) bool) {
// Nil check
if fn == nil {
panic("nil func")
}
// Disallow writes // Disallow writes
m.rnly = true m.rnly = true
defer func() { defer func() {
m.rnly = false m.rnly = false
}() }()
// Nil check
_ = fn
switch end := start + length; { switch end := start + length; {
// No loop to iterate // No loop to iterate
case length == 0: case length == 0:
@ -163,8 +167,8 @@ func (m *ordered[K, V]) Truncate(sz int, fn func(K, V)) {
panic("index out of bounds") panic("index out of bounds")
} }
// Nil check
if fn == nil { if fn == nil {
// move nil check out of loop
fn = func(K, V) {} fn = func(K, V) {}
} }

12
vendor/modules.txt vendored
View file

@ -7,8 +7,8 @@ codeberg.org/gruf/go-bytesize
# codeberg.org/gruf/go-byteutil v1.3.0 # codeberg.org/gruf/go-byteutil v1.3.0
## explicit; go 1.20 ## explicit; go 1.20
codeberg.org/gruf/go-byteutil codeberg.org/gruf/go-byteutil
# codeberg.org/gruf/go-cache/v3 v3.5.7 # codeberg.org/gruf/go-cache/v3 v3.6.1
## explicit; go 1.19 ## explicit; go 1.20
codeberg.org/gruf/go-cache/v3 codeberg.org/gruf/go-cache/v3
codeberg.org/gruf/go-cache/v3/simple codeberg.org/gruf/go-cache/v3/simple
codeberg.org/gruf/go-cache/v3/ttl codeberg.org/gruf/go-cache/v3/ttl
@ -31,8 +31,8 @@ codeberg.org/gruf/go-ffmpreg/embed/ffprobe
# codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf # codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf
## explicit; go 1.21 ## explicit; go 1.21
codeberg.org/gruf/go-iotools codeberg.org/gruf/go-iotools
# codeberg.org/gruf/go-kv v1.6.4 # codeberg.org/gruf/go-kv v1.6.5
## explicit; go 1.19 ## explicit; go 1.20
codeberg.org/gruf/go-kv codeberg.org/gruf/go-kv
codeberg.org/gruf/go-kv/format codeberg.org/gruf/go-kv/format
# codeberg.org/gruf/go-list v0.0.0-20240425093752-494db03d641f # codeberg.org/gruf/go-list v0.0.0-20240425093752-494db03d641f
@ -41,8 +41,8 @@ codeberg.org/gruf/go-list
# codeberg.org/gruf/go-mangler v1.4.1 # codeberg.org/gruf/go-mangler v1.4.1
## explicit; go 1.19 ## explicit; go 1.19
codeberg.org/gruf/go-mangler codeberg.org/gruf/go-mangler
# codeberg.org/gruf/go-maps v1.0.3 # codeberg.org/gruf/go-maps v1.0.4
## explicit; go 1.19 ## explicit; go 1.20
codeberg.org/gruf/go-maps codeberg.org/gruf/go-maps
# codeberg.org/gruf/go-mempool v0.0.0-20240507125005-cef10d64a760 # codeberg.org/gruf/go-mempool v0.0.0-20240507125005-cef10d64a760
## explicit; go 1.22.2 ## explicit; go 1.22.2

View file

@ -1,6 +1,6 @@
/* /*
theme-title: Solarized (dark) theme-title: Solarized dark
theme-description: Solarized sloth (dark) theme-description: Dark green and grey solarized theme with red trim
*/ */
/* /*
@ -46,18 +46,14 @@
--blue3: var(--base1); --blue3: var(--base1);
/* Basic page styling (background + foreground) */ /* Basic page styling (background + foreground) */
--bg: var(--white1); --bg: var(--base03);
--bg-accent: var(--white2); --bg-accent: var(--base02);
--fg-reduced: var(--base0); --fg-reduced: var(--base0);
--fg: var(--base1); --fg: var(--base1);
/* Profile page styling */ /* Profile page styling */
--profile-bg: var(--white2); --profile-bg: var(--white2);
/* Solarize buttons */
--button-bg: var(--blue2);
--button-fg: var(--white1);
/* Solarize statuses */ /* Solarize statuses */
--status-bg: var(--white1); --status-bg: var(--white1);
--status-focus-bg: var(--white1); --status-focus-bg: var(--white1);
@ -65,7 +61,7 @@
--status-focus-info-bg: var(--white2); --status-focus-info-bg: var(--white2);
/* Used around statuses + other items */ /* Used around statuses + other items */
--boxshadow-border: 0.15rem solid var(--base01); --boxshadow-border: 0.1rem solid var(--base01);
--plyr-video-control-color: var(--fg); --plyr-video-control-color: var(--fg);
--plyr-video-control-color-hover: var(--fg-reduced); --plyr-video-control-color-hover: var(--fg-reduced);
@ -84,6 +80,32 @@ html, body {
scrollbar-color: var(--orange2) var(--white1) ; scrollbar-color: var(--orange2) var(--white1) ;
} }
/* Column headers */
.col-header {
border: var(--boxshadow-border);
}
.profile .about-user .col-header {
border-bottom: none;
margin-bottom: 0;
}
/* Header card */
.profile .profile-header {
border: var(--boxshadow-border);
}
/* Fiddle around with borders on about sections */
.profile .about-user .fields,
.profile .about-user .bio,
.profile .about-user .accountstats {
border-left: var(--boxshadow-border);
border-right: var(--boxshadow-border);
}
.profile .about-user .accountstats {
border-bottom: var(--boxshadow-border);
}
/* Profile fields */ /* Profile fields */
.profile .about-user .fields .field { .profile .about-user .fields .field {
border-bottom: var(--boxshadow-border); border-bottom: var(--boxshadow-border);
@ -98,6 +120,7 @@ html, body {
} }
.status .media .media-wrapper details .unknown-attachment .placeholder { .status .media .media-wrapper details .unknown-attachment .placeholder {
color: var(--base01); color: var(--base01);
border: 0.2rem dashed var(--base01);
} }
.status .media .media-wrapper details video.plyr-video { .status .media .media-wrapper details video.plyr-video {
background: transparent; background: transparent;
@ -143,10 +166,10 @@ button, .button,
/* Ensure role badge readable */ /* Ensure role badge readable */
.profile .profile-header .basic-info .namerole .role.admin { .profile .profile-header .basic-info .namerole .role.admin {
color: var(--base03); color: var(--base0);
} }
.col-header a { /* Distinguish bot icon from background */
font-size: 1.2rem; .profile .profile-header .basic-info .namerole .bot-username-wrapper .bot-legend-wrapper {
font-weight: bold; border: var(--boxshadow-border);
} }

View file

@ -1,6 +1,6 @@
/* /*
theme-title: Solarized (dark) theme-title: Solarized light
theme-description: Solarized sloth (dark) theme-description: Beige and grey solarized theme with orange trim
*/ */
/* /*
@ -46,18 +46,14 @@
--blue3: var(--base01); --blue3: var(--base01);
/* Basic page styling (background + foreground) */ /* Basic page styling (background + foreground) */
--bg: var(--white1); --bg: var(--base2);
--bg-accent: var(--white2); --bg-accent: var(--base3);
--fg-reduced: var(--base00); --fg-reduced: var(--base00);
--fg: var(--base01); --fg: var(--base01);
/* Profile page styling */ /* Profile page styling */
--profile-bg: var(--white2); --profile-bg: var(--white2);
/* Solarize buttons */
--button-bg: var(--blue2);
--button-fg: var(--white1);
/* Solarize statuses */ /* Solarize statuses */
--status-bg: var(--white1); --status-bg: var(--white1);
--status-focus-bg: var(--white1); --status-focus-bg: var(--white1);
@ -65,7 +61,7 @@
--status-focus-info-bg: var(--white2); --status-focus-info-bg: var(--white2);
/* Used around statuses + other items */ /* Used around statuses + other items */
--boxshadow-border: 0.15rem solid var(--base1); --boxshadow-border: 0.1rem solid var(--base1);
--plyr-video-control-color: var(--fg); --plyr-video-control-color: var(--fg);
--plyr-video-control-color-hover: var(--fg-reduced); --plyr-video-control-color-hover: var(--fg-reduced);
@ -84,6 +80,36 @@ html, body {
scrollbar-color: var(--orange2) var(--white1) ; scrollbar-color: var(--orange2) var(--white1) ;
} }
/* Column headers */
.col-header {
border: var(--boxshadow-border);
background: var(--base3);
}
.profile .about-user .col-header {
border-bottom: none;
margin-bottom: 0;
}
/* Header card */
.profile .profile-header {
border: var(--boxshadow-border);
background: var(--base3);
}
/* Fiddle around with borders on about sections */
.profile .about-user .fields,
.profile .about-user .bio,
.profile .about-user .accountstats {
background: var(--base3);
color: var(--base01);
border-left: var(--boxshadow-border);
border-right: var(--boxshadow-border);
}
.profile .about-user .accountstats {
border-bottom: var(--boxshadow-border);
}
/* Profile fields */ /* Profile fields */
.profile .about-user .fields .field { .profile .about-user .fields .field {
border-bottom: var(--boxshadow-border); border-bottom: var(--boxshadow-border);
@ -98,6 +124,7 @@ html, body {
} }
.status .media .media-wrapper details .unknown-attachment .placeholder { .status .media .media-wrapper details .unknown-attachment .placeholder {
color: var(--base1); color: var(--base1);
border: 0.2rem dashed var(--base1);
} }
.status .media .media-wrapper details video.plyr-video { .status .media .media-wrapper details video.plyr-video {
background: transparent; background: transparent;
@ -105,10 +132,12 @@ html, body {
/* Status polls */ /* Status polls */
.status .text .poll { .status .text .poll {
background-color: var(--white2); background-color: var(--base3);
border: var(--boxshadow-border);
} }
.status .text .poll .poll-info { .status .text .poll .poll-info {
background-color: var(--white1); background-color: var(--base3);
border: var(--boxshadow-border);
} }
/* Code snippets */ /* Code snippets */
@ -121,7 +150,7 @@ code, code[class*="language-"] {
/* Block quotes */ /* Block quotes */
blockquote { blockquote {
background-color: var(--base3); background-color: var(--base3);
color: var(--base00); color: var(--base01);
} }
button, .button, button, .button,
@ -131,22 +160,32 @@ button, .button,
.button { .button {
color: var(--base01); color: var(--base01);
background: var(--base2); background: var(--base3);
border: var(--boxshadow-border); border: var(--boxshadow-border);
} }
.button:hover { .button:hover {
color: var(--base00); color: var(--base01);
background: var(--base3); background: var(--base2);
border: var(--boxshadow-border); border: var(--boxshadow-border);
} }
/* Ensure role badge readable */ /* Ensure role badge readable */
.profile .profile-header .basic-info .namerole .role.admin { .profile .profile-header .basic-info .namerole .role.admin {
color: var(--base3); background: var(--base3);
color: var(--base01);
} }
.col-header a { /* Back + next links */
font-size: 1.2rem; .backnextlinks {
font-weight: bold; padding: 0.5rem;
background: var(--base3);
border: var(--boxshadow-border);
border-radius: var(--br);
}
.page-footer {
margin-top: 2rem;
background-color: var(--base3);
border-top: var(--boxshadow-border);
} }

View file

@ -41,6 +41,12 @@ main {
text-decoration: none; text-decoration: none;
} }
.boosted {
padding: 0 0.75rem 0.75rem;
color: var(--fg-reduced);
font-weight: bold;
}
.status-header > address { .status-header > address {
/* /*
Avoid stretching so wide that user Avoid stretching so wide that user
@ -59,17 +65,27 @@ main {
"avatar author-strap author-strap"; "avatar author-strap author-strap";
gap: 0 0.5rem; gap: 0 0.5rem;
font-style: normal; font-style: normal;
.avatar { .avatar {
grid-area: avatar; grid-area: avatar;
height: 3.5rem; height: 3.5rem;
width: 3.5rem; width: 3.5rem;
object-fit: cover; object-fit: cover;
position: relative;
border: 0.15rem solid $avatar-border; border: 0.15rem solid $avatar-border;
border-radius: $br; border-radius: $br;
overflow: hidden; /* hides corners from img overflowing */ overflow: hidden; /* hides corners from img overflowing */
.boosted-avatar {
height: 50%;
width: 50%;
z-index: 10;
position: absolute;
bottom: 0;
inset-inline-end: 0;
}
img { img {
height: 100%; height: 100%;
width: 100%; width: 100%;
@ -77,7 +93,7 @@ main {
background: $bg; background: $bg;
} }
} }
.author-strap { .author-strap {
grid-area: author-strap; grid-area: author-strap;
display: grid; display: grid;
@ -87,7 +103,7 @@ main {
"display display" "display display"
"user user"; "user user";
gap: 0 0.5rem; gap: 0 0.5rem;
.displayname, .username { .displayname, .username {
justify-self: start; justify-self: start;
align-self: start; align-self: start;
@ -95,12 +111,12 @@ main {
font-size: 1rem; font-size: 1rem;
line-height: 1.3rem; line-height: 1.3rem;
} }
.displayname { .displayname {
grid-area: display; grid-area: display;
font-weight: bold; font-weight: bold;
} }
.username { .username {
grid-area: user; grid-area: user;
color: $link-fg; color: $link-fg;
@ -200,34 +216,34 @@ main {
.poll { .poll {
background-color: $gray2; background-color: $gray2;
z-index: 2; z-index: 2;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
border-radius: $br; border-radius: $br;
padding: 0.5rem; padding: 0.5rem;
margin: 0; margin: 0;
gap: 1rem; gap: 1rem;
.poll-options { .poll-options {
margin: 0; margin: 0;
padding: 0; padding: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1rem; gap: 1rem;
.poll-option { .poll-option {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 0.1rem; gap: 0.1rem;
label { label {
cursor: default; cursor: default;
} }
meter { meter {
width: 100%; width: 100%;
} }
.poll-vote-summary { .poll-vote-summary {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
@ -236,7 +252,7 @@ main {
} }
} }
} }
.poll-info { .poll-info {
background-color: $gray4; background-color: $gray4;
display: flex; display: flex;
@ -245,7 +261,7 @@ main {
border-radius: $br-inner; border-radius: $br-inner;
padding: 0.25rem; padding: 0.25rem;
gap: 0.25rem; gap: 0.25rem;
span { span {
justify-self: center; justify-self: center;
white-space: nowrap; white-space: nowrap;
@ -301,12 +317,12 @@ main {
width: 100%; width: 100%;
z-index: 3; z-index: 3;
overflow: hidden; overflow: hidden;
display: grid; display: grid;
padding: 1rem; padding: 1rem;
grid-template-columns: 1fr auto 1fr; grid-template-columns: 1fr auto 1fr;
grid-template-rows: 1fr 1fr; grid-template-rows: 1fr 1fr;
grid-template-areas: grid-template-areas:
"eye sensitive ." "eye sensitive ."
". sensitive ."; ". sensitive .";
@ -369,7 +385,7 @@ main {
height: 100%; height: 100%;
padding: 0.8rem; padding: 0.8rem;
border: 0.2rem dashed $white2; border: 0.2rem dashed $white2;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
@ -518,4 +534,4 @@ main {
.plyr { .plyr {
max-height: 100%; max-height: 100%;
} }
} }

View file

@ -77,7 +77,7 @@ function UserProfileForm({ data: profile }) {
maxPinnedFields: instance?.configuration?.accounts?.max_profile_fields ?? 6 maxPinnedFields: instance?.configuration?.accounts?.max_profile_fields ?? 6
}; };
}, [instance]); }, [instance]);
// Parse out available theme options into nice format. // Parse out available theme options into nice format.
const { data: themes } = useAccountThemesQuery(); const { data: themes } = useAccountThemesQuery();
const themeOptions = useMemo(() => { const themeOptions = useMemo(() => {
@ -114,6 +114,7 @@ function UserProfileForm({ data: profile }) {
locked: useBoolInput("locked", { source: profile }), locked: useBoolInput("locked", { source: profile }),
discoverable: useBoolInput("discoverable", { source: profile}), discoverable: useBoolInput("discoverable", { source: profile}),
enableRSS: useBoolInput("enable_rss", { source: profile }), enableRSS: useBoolInput("enable_rss", { source: profile }),
hideBoosts: useBoolInput("hide_boosts", { source: profile }),
hideCollections: useBoolInput("hide_collections", { source: profile }), hideCollections: useBoolInput("hide_collections", { source: profile }),
webVisibility: useTextInput("web_visibility", { source: profile, valueSelector: (p) => p.source?.web_visibility }), webVisibility: useTextInput("web_visibility", { source: profile, valueSelector: (p) => p.source?.web_visibility }),
fields: useFieldArrayInput("fields_attributes", { fields: useFieldArrayInput("fields_attributes", {
@ -158,7 +159,7 @@ function UserProfileForm({ data: profile }) {
autoCapitalize="sentences" autoCapitalize="sentences"
/> />
</div> </div>
<div className="file-input-with-image-description"> <div className="file-input-with-image-description">
<FileInput <FileInput
label="Avatar (1:1 images look best)" label="Avatar (1:1 images look best)"
@ -257,6 +258,10 @@ function UserProfileForm({ data: profile }) {
field={form.enableRSS} field={form.enableRSS}
label="Enable RSS feed of posts." label="Enable RSS feed of posts."
/> />
<Checkbox
field={form.hideBoosts}
label="Hide boosts from your public page"
/>
<Checkbox <Checkbox
field={form.hideCollections} field={form.hideCollections}
label="Hide who you follow / are followed by." label="Hide who you follow / are followed by."

View file

@ -247,6 +247,16 @@
class="status expanded" class="status expanded"
{{- includeAttr "status_attributes.tmpl" . | indentAttr 6 }} {{- includeAttr "status_attributes.tmpl" . | indentAttr 6 }}
> >
{{- if .ReblogAccount }}
<div class="boosted text-cutoff">
<i class="fa fa-retweet" aria-hidden="true"></i>&nbsp
{{- if $.account.DisplayName }}
{{- emojify $.account.Emojis (escape $.account.DisplayName) }} boosted
{{- else }}
{{- $.account.Username }} boosted
{{- end }}
</div>
{{- end }}
{{- include "status.tmpl" . | indent 6 }} {{- include "status.tmpl" . | indent 6 }}
</article> </article>
{{- end }} {{- end }}
@ -264,4 +274,4 @@
</div> </div>
</div> </div>
</main> </main>
{{- end }} {{- end }}

View file

@ -48,6 +48,16 @@
alt="Avatar for {{ .Username -}}" alt="Avatar for {{ .Username -}}"
title="Avatar for {{ .Username -}}" title="Avatar for {{ .Username -}}"
> >
{{ if $.ReblogAccount }}
<img
class="boosted-avatar"
src="{{ $.ReblogAccount.Avatar }}"
alt="Avatar for {{ $.ReblogAccount.Username -}}"
title="Avatar for {{ $.ReblogAccount.Username -}}"
>
{{ end }}
</picture> </picture>
<div class="author-strap"> <div class="author-strap">
<span class="displayname text-cutoff"> <span class="displayname text-cutoff">
@ -63,4 +73,4 @@
<span class="sr-only">(open profile)</span> <span class="sr-only">(open profile)</span>
</a> </a>
</address> </address>
{{- end }} {{- end }}