Compare commits

...

9 commits

Author SHA1 Message Date
Vivian Lim ⭐ 2ea912e800
Merge 2cd5abfdcf into c023bd30f3 2024-10-06 06:53:20 +03:00
tobi c023bd30f3
[bugfix] Only allow boosting post from non-interaction-policy-aware instance if public or unlisted (#3396) 2024-10-05 19:15:02 +02:00
tobi 18e2f69e85
[bugfix] Return 501 (not implemented) if user tries to schedule post (#3395) 2024-10-05 19:14:53 +02:00
tobi f0376635ad
[chore] Change order of error checking after PostInbox (#3394)
Check for malformed errors embedded inside error *first*, then check for gtserror.WithCode.
2024-10-05 17:08:42 +02:00
tobi 5c055afa08
[feature/frontend] Add Moonlight hunt theme (#3393)
* [feature/frontend] Add Moonlight Hunt theme

* make almost see through a bit less see through

* update
2024-10-05 15:12:40 +02:00
tobi c33b1e89c1
[bugfix] Update select of pending interaction requests to account for potential nil URI (#3392) 2024-10-05 12:27:53 +02:00
tobi 36abd568b1
[docs] Make protocol config option really explicit (#3391) 2024-10-05 12:09:58 +02:00
tobi 37a3d224a7
[bugfix] Account for nil reply when serializing int req (#3389) 2024-10-05 11:36:01 +02:00
vivlim 2cd5abfdcf Add login button to index page which reiterates info about clients 2024-09-29 21:06:13 -07:00
22 changed files with 632 additions and 72 deletions

View file

@ -177,6 +177,10 @@ It's also easy for admins to [add their own custom themes](https://docs.gotosoci
<img src="https://raw.githubusercontent.com/superseriousbusiness/gotosocial/main/docs/assets/theme-midnight-trip.png"/> <img src="https://raw.githubusercontent.com/superseriousbusiness/gotosocial/main/docs/assets/theme-midnight-trip.png"/>
<figcaption>Midnight trip</figcaption> <figcaption>Midnight trip</figcaption>
</figure> </figure>
<figure>
<img src="https://raw.githubusercontent.com/superseriousbusiness/gotosocial/main/docs/assets/theme-moonlight-hunt.png"/>
<figcaption>Moonlight hunt</figcaption>
</figure>
<hr/> <hr/>
<figure> <figure>
<img src="https://raw.githubusercontent.com/superseriousbusiness/gotosocial/main/docs/assets/theme-rainforest.png"/> <img src="https://raw.githubusercontent.com/superseriousbusiness/gotosocial/main/docs/assets/theme-rainforest.png"/>

View file

@ -8947,7 +8947,7 @@ paths:
Providing this parameter will cause ScheduledStatus to be returned instead of Status. Providing this parameter will cause ScheduledStatus to be returned instead of Status.
Must be at least 5 minutes in the future. Must be at least 5 minutes in the future.
This feature isn't implemented yet. This feature isn't implemented yet; attemping to set it will return 501 Not Implemented.
in: formData in: formData
name: scheduled_at name: scheduled_at
type: string type: string
@ -9008,6 +9008,8 @@ paths:
description: not acceptable description: not acceptable
"500": "500":
description: internal server error description: internal server error
"501":
description: scheduled_at was set, but this feature is not yet implemented
security: security:
- OAuth2 Bearer: - OAuth2 Bearer:
- write:statuses - write:statuses

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 KiB

View file

@ -80,10 +80,18 @@ host: "localhost"
# Default: "" # Default: ""
account-domain: "" account-domain: ""
# String. Protocol to use for the server. Only change to http for local testing! # String. Protocol over which the server is reachable from the outside world.
# This should be the protocol part of the URI that your server is actually reachable on. So even if you're #
# running GoToSocial behind a reverse proxy that handles SSL certificates for you, instead of using built-in # ONLY CHANGE THIS TO HTTP FOR LOCAL TESTING! IN 99.99% OF CASES YOU SHOULD NOT CHANGE THIS!
# letsencrypt, it should still be https. #
# This should be the protocol part of the URI that your server is actually reachable on.
# So even if you're running GoToSocial behind a reverse proxy that handles SSL certificates
# for you, instead of using built-in letsencrypt, it should still be https, not http.
#
# Again, ONLY CHANGE THIS TO HTTP FOR LOCAL TESTING! If you set this to `http`, start your instance,
# and then later change it to `https`, you will have already broken URI generation for any created
# users on the instance. You should only touch this setting if you 100% know what you're doing.
#
# Options: ["http","https"] # Options: ["http","https"]
# Default: "https" # Default: "https"
protocol: "https" protocol: "https"

View file

@ -88,10 +88,18 @@ host: "localhost"
# Default: "" # Default: ""
account-domain: "" account-domain: ""
# String. Protocol to use for the server. Only change to http for local testing! # String. Protocol over which the server is reachable from the outside world.
# This should be the protocol part of the URI that your server is actually reachable on. So even if you're #
# running GoToSocial behind a reverse proxy that handles SSL certificates for you, instead of using built-in # ONLY CHANGE THIS TO HTTP FOR LOCAL TESTING! IN 99.99% OF CASES YOU SHOULD NOT CHANGE THIS!
# letsencrypt, it should still be https. #
# This should be the protocol part of the URI that your server is actually reachable on.
# So even if you're running GoToSocial behind a reverse proxy that handles SSL certificates
# for you, instead of using built-in letsencrypt, it should still be https, not http.
#
# Again, ONLY CHANGE THIS TO HTTP FOR LOCAL TESTING! If you set this to `http`, start your instance,
# and then later change it to `https`, you will have already broken URI generation for any created
# users on the instance. You should only touch this setting if you 100% know what you're doing.
#
# Options: ["http","https"] # Options: ["http","https"]
# Default: "https" # Default: "https"
protocol: "https" protocol: "https"

View file

@ -181,7 +181,7 @@
// Providing this parameter will cause ScheduledStatus to be returned instead of Status. // Providing this parameter will cause ScheduledStatus to be returned instead of Status.
// Must be at least 5 minutes in the future. // Must be at least 5 minutes in the future.
// //
// This feature isn't implemented yet. // This feature isn't implemented yet; attemping to set it will return 501 Not Implemented.
// type: string // type: string
// in: formData // in: formData
// - // -
@ -254,6 +254,8 @@
// description: not acceptable // description: not acceptable
// '500': // '500':
// description: internal server error // description: internal server error
// '501':
// description: scheduled_at was set, but this feature is not yet implemented
func (m *Module) StatusCreatePOSTHandler(c *gin.Context) { func (m *Module) StatusCreatePOSTHandler(c *gin.Context) {
authed, err := oauth.Authed(c, true, true, true, true) authed, err := oauth.Authed(c, true, true, true, true)
if err != nil { if err != nil {
@ -286,8 +288,8 @@ func (m *Module) StatusCreatePOSTHandler(c *gin.Context) {
// } // }
// form.Status += "\n\nsent from " + user + "'s iphone\n" // form.Status += "\n\nsent from " + user + "'s iphone\n"
if err := validateNormalizeCreateStatus(form); err != nil { if errWithCode := validateStatusCreateForm(form); errWithCode != nil {
apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1) apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return return
} }
@ -374,46 +376,61 @@ func parseStatusCreateForm(c *gin.Context) (*apimodel.StatusCreateRequest, error
return form, nil return form, nil
} }
// validateNormalizeCreateStatus checks the form // validateStatusCreateForm checks the form for disallowed
// for disallowed combinations of attachments and // combinations of attachments, overlength inputs, etc.
// overlength inputs.
// //
// Side effect: normalizes the post's language tag. // Side effect: normalizes the post's language tag.
func validateNormalizeCreateStatus(form *apimodel.StatusCreateRequest) error { func validateStatusCreateForm(form *apimodel.StatusCreateRequest) gtserror.WithCode {
hasStatus := form.Status != "" var (
hasMedia := len(form.MediaIDs) != 0 chars = len([]rune(form.Status)) + len([]rune(form.SpoilerText))
hasPoll := form.Poll != nil maxChars = config.GetStatusesMaxChars()
mediaFiles = len(form.MediaIDs)
maxMediaFiles = config.GetStatusesMediaMaxFiles()
hasMedia = mediaFiles != 0
hasPoll = form.Poll != nil
)
if !hasStatus && !hasMedia && !hasPoll { if chars == 0 && !hasMedia && !hasPoll {
return errors.New("no status, media, or poll provided") // Status must contain *some* kind of content.
const text = "no status content, content warning, media, or poll provided"
return gtserror.NewErrorBadRequest(errors.New(text), text)
} }
if hasMedia && hasPoll { if chars > maxChars {
return errors.New("can't post media + poll in same status") text := fmt.Sprintf(
"status too long, %d characters provided (including content warning) but limit is %d",
chars, maxChars,
)
return gtserror.NewErrorBadRequest(errors.New(text), text)
} }
maxChars := config.GetStatusesMaxChars() if mediaFiles > maxMediaFiles {
if length := len([]rune(form.Status)) + len([]rune(form.SpoilerText)); length > maxChars { text := fmt.Sprintf(
return fmt.Errorf("status too long, %d characters provided (including spoiler/content warning) but limit is %d", length, maxChars) "too many media files attached to status, %d attached but limit is %d",
} mediaFiles, maxMediaFiles,
)
maxMediaFiles := config.GetStatusesMediaMaxFiles() return gtserror.NewErrorBadRequest(errors.New(text), text)
if len(form.MediaIDs) > maxMediaFiles {
return fmt.Errorf("too many media files attached to status, %d attached but limit is %d", len(form.MediaIDs), maxMediaFiles)
} }
if form.Poll != nil { if form.Poll != nil {
if err := validateNormalizeCreatePoll(form); err != nil { if errWithCode := validateStatusPoll(form); errWithCode != nil {
return err return errWithCode
} }
} }
if form.ScheduledAt != "" {
const text = "scheduled_at is not yet implemented"
return gtserror.NewErrorNotImplemented(errors.New(text), text)
}
// Validate + normalize
// language tag if provided.
if form.Language != "" { if form.Language != "" {
language, err := validate.Language(form.Language) lang, err := validate.Language(form.Language)
if err != nil { if err != nil {
return err return gtserror.NewErrorBadRequest(err, err.Error())
} }
form.Language = language form.Language = lang
} }
// Check if the deprecated "federated" field was // Check if the deprecated "federated" field was
@ -425,9 +442,36 @@ func validateNormalizeCreateStatus(form *apimodel.StatusCreateRequest) error {
return nil return nil
} }
func validateNormalizeCreatePoll(form *apimodel.StatusCreateRequest) error { func validateStatusPoll(form *apimodel.StatusCreateRequest) gtserror.WithCode {
maxPollOptions := config.GetStatusesPollMaxOptions() var (
maxPollChars := config.GetStatusesPollOptionMaxChars() maxPollOptions = config.GetStatusesPollMaxOptions()
pollOptions = len(form.Poll.Options)
maxPollOptionChars = config.GetStatusesPollOptionMaxChars()
)
if pollOptions == 0 {
const text = "poll with no options"
return gtserror.NewErrorBadRequest(errors.New(text), text)
}
if pollOptions > maxPollOptions {
text := fmt.Sprintf(
"too many poll options provided, %d provided but limit is %d",
pollOptions, maxPollOptions,
)
return gtserror.NewErrorBadRequest(errors.New(text), text)
}
for _, option := range form.Poll.Options {
optionChars := len([]rune(option))
if optionChars > maxPollOptionChars {
text := fmt.Sprintf(
"poll option too long, %d characters provided but limit is %d",
optionChars, maxPollOptionChars,
)
return gtserror.NewErrorBadRequest(errors.New(text), text)
}
}
// Normalize poll expiry if necessary. // Normalize poll expiry if necessary.
// If we parsed this as JSON, expires_in // If we parsed this as JSON, expires_in
@ -440,27 +484,15 @@ func validateNormalizeCreatePoll(form *apimodel.StatusCreateRequest) error {
case string: case string:
expiresIn, err := strconv.Atoi(e) expiresIn, err := strconv.Atoi(e)
if err != nil { if err != nil {
return fmt.Errorf("could not parse expires_in value %s as integer: %w", e, err) text := fmt.Sprintf("could not parse expires_in value %s as integer: %v", e, err)
return gtserror.NewErrorBadRequest(errors.New(text), text)
} }
form.Poll.ExpiresIn = expiresIn form.Poll.ExpiresIn = expiresIn
default: default:
return fmt.Errorf("could not parse expires_in type %T as integer", ei) text := fmt.Sprintf("could not parse expires_in type %T as integer", ei)
} return gtserror.NewErrorBadRequest(errors.New(text), text)
}
if len(form.Poll.Options) == 0 {
return errors.New("poll with no options")
}
if len(form.Poll.Options) > maxPollOptions {
return fmt.Errorf("too many poll options provided, %d provided but limit is %d", len(form.Poll.Options), maxPollOptions)
}
for _, p := range form.Poll.Options {
if length := len([]rune(p)); length > maxPollChars {
return fmt.Errorf("poll option too long, %d characters provided but limit is %d", length, maxPollChars)
} }
} }

View file

@ -365,6 +365,25 @@ func (suite *StatusCreateTestSuite) TestPostNewStatusMessedUpIntPolicy() {
}`, out) }`, out)
} }
func (suite *StatusCreateTestSuite) TestPostNewScheduledStatus() {
out, recorder := suite.postStatus(map[string][]string{
"status": {"this is a brand new status! #helloworld"},
"spoiler_text": {"hello hello"},
"sensitive": {"true"},
"visibility": {string(apimodel.VisibilityMutualsOnly)},
"scheduled_at": {"2080-10-04T15:32:02.018Z"},
}, "")
// We should have 501 from
// our call to the function.
suite.Equal(http.StatusNotImplemented, recorder.Code)
// We should have a helpful error message.
suite.Equal(`{
"error": "Not Implemented: scheduled_at is not yet implemented"
}`, out)
}
func (suite *StatusCreateTestSuite) TestPostNewStatusMarkdown() { func (suite *StatusCreateTestSuite) TestPostNewStatusMarkdown() {
out, recorder := suite.postStatus(map[string][]string{ out, recorder := suite.postStatus(map[string][]string{
"status": {statusMarkdown}, "status": {statusMarkdown},

View file

@ -302,9 +302,9 @@ func (i *interactionDB) GetInteractionsRequestsForAcct(
bun.Ident("interaction_request"), bun.Ident("interaction_request"),
). ).
// Select only interaction requests that // Select only interaction requests that
// are neither accepted or rejected yet, // are neither accepted or rejected yet.
// ie., without an Accept or Reject URI. Where("? IS NULL", bun.Ident("accepted_at")).
Where("? IS NULL", bun.Ident("uri")) Where("? IS NULL", bun.Ident("rejected_at"))
// Select interactions targeting status. // Select interactions targeting status.
if statusID != "" { if statusID != "" {

View file

@ -0,0 +1,57 @@
// 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"
"github.com/uptrace/bun"
)
func init() {
up := func(ctx context.Context, db *bun.DB) error {
return db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error {
for idx, col := range map[string]string{
"interaction_requests_accepted_at_idx": "accepted_at",
"interaction_requests_rejected_at_idx": "rejected_at",
} {
if _, err := tx.
NewCreateIndex().
Table("interaction_requests").
Index(idx).
Column(col).
IfNotExists().
Exec(ctx); err != nil {
return err
}
}
return nil
})
}
down := func(ctx context.Context, db *bun.DB) error {
return db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error {
return nil
})
}
if err := Migrations.Register(up, down); err != nil {
panic(err)
}
}

View file

@ -170,12 +170,6 @@ func (f *federatingActor) PostInboxScheme(ctx context.Context, w http.ResponseWr
// //
// Post the activity to the Actor's inbox and trigger side effects. // Post the activity to the Actor's inbox and trigger side effects.
if err := f.sideEffectActor.PostInbox(ctx, inboxID, activity); err != nil { if err := f.sideEffectActor.PostInbox(ctx, inboxID, activity); err != nil {
// Check if a function in the federatingDB
// has returned an explicit errWithCode for us.
if errWithCode, ok := err.(gtserror.WithCode); ok {
return false, errWithCode
}
// Check if it's a bad request because the // Check if it's a bad request because the
// object or target props weren't populated, // object or target props weren't populated,
// or we failed parsing activity details. // or we failed parsing activity details.
@ -193,6 +187,12 @@ func (f *federatingActor) PostInboxScheme(ctx context.Context, w http.ResponseWr
return false, gtserror.NewErrorBadRequest(errors.New(text), text) return false, gtserror.NewErrorBadRequest(errors.New(text), text)
} }
// Check if a function in the federatingDB
// has returned an explicit errWithCode for us.
if errWithCode, ok := err.(gtserror.WithCode); ok {
return false, errWithCode
}
// Default: there's been some real error. // Default: there's been some real error.
err := gtserror.Newf("error calling sideEffectActor.PostInbox: %w", err) err := gtserror.Newf("error calling sideEffectActor.PostInbox: %w", err)
return false, gtserror.NewErrorInternalError(err) return false, gtserror.NewErrorInternalError(err)

View file

@ -306,7 +306,7 @@ func (f *Filter) StatusBoostable(
status.InteractionPolicy.CanAnnounce, status.InteractionPolicy.CanAnnounce,
) )
// If status is local and has no policy set, // If status has no policy set but it's local,
// check against the default policy for this // check against the default policy for this
// visibility, as we're interaction-policy aware. // visibility, as we're interaction-policy aware.
case *status.Local: case *status.Local:
@ -318,13 +318,21 @@ func (f *Filter) StatusBoostable(
policy.CanAnnounce, policy.CanAnnounce,
) )
// Otherwise, assume the status is from an // Status is from an instance that does not use
// instance that does not use / does not care // or does not care about interaction policies.
// about interaction policies, and just return OK. // We can boost it if it's unlisted or public.
default: case status.Visibility == gtsmodel.VisibilityPublic ||
status.Visibility == gtsmodel.VisibilityUnlocked:
return &gtsmodel.PolicyCheckResult{ return &gtsmodel.PolicyCheckResult{
Permission: gtsmodel.PolicyPermissionPermitted, Permission: gtsmodel.PolicyPermissionPermitted,
}, nil }, nil
// Not permitted by any of the
// above checks, so it's forbidden.
default:
return &gtsmodel.PolicyCheckResult{
Permission: gtsmodel.PolicyPermissionForbidden,
}, nil
} }
} }

View file

@ -191,6 +191,19 @@ func NewErrorGone(original error, helpText ...string) WithCode {
} }
} }
// NewErrorNotImplemented returns an ErrorWithCode 501 with the given original error and optional help text.
func NewErrorNotImplemented(original error, helpText ...string) WithCode {
safe := http.StatusText(http.StatusNotImplemented)
if helpText != nil {
safe = safe + ": " + strings.Join(helpText, ": ")
}
return withCode{
original: original,
safe: errors.New(safe),
code: http.StatusNotImplemented,
}
}
// NewErrorClientClosedRequest returns an ErrorWithCode 499 with the given original error. // NewErrorClientClosedRequest returns an ErrorWithCode 499 with the given original error.
// This error type should only be used when an http caller has already hung up their request. // This error type should only be used when an http caller has already hung up their request.
// See: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#nginx // See: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#nginx

View file

@ -2711,7 +2711,7 @@ func (c *Converter) InteractionReqToAPIInteractionReq(
} }
var reply *apimodel.Status var reply *apimodel.Status
if req.InteractionType == gtsmodel.InteractionReply { if req.InteractionType == gtsmodel.InteractionReply && req.Reply != nil {
reply, err = c.statusToAPIStatus( reply, err = c.statusToAPIStatus(
ctx, ctx,
req.Reply, req.Reply,

View file

@ -60,7 +60,7 @@ func (m *Module) indexHandler(c *gin.Context) {
Instance: instance, Instance: instance,
OGMeta: apiutil.OGBase(instance), OGMeta: apiutil.OGBase(instance),
Stylesheets: []string{cssAbout, cssIndex}, Stylesheets: []string{cssAbout, cssIndex},
Extra: map[string]any{"showStrap": true}, Extra: map[string]any{"showStrap": true, "showLoginButton": true},
} }
apiutil.TemplateWebPage(c, page) apiutil.TemplateWebPage(c, page)

63
internal/web/login.go Normal file
View file

@ -0,0 +1,63 @@
// 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 web
import (
"context"
"github.com/gin-gonic/gin"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util"
"github.com/superseriousbusiness/gotosocial/internal/gtserror"
)
const (
loginPath = "/login"
)
func (m *Module) loginGETHandler(c *gin.Context) {
instance, errWithCode := m.processor.InstanceGetV1(c.Request.Context())
if errWithCode != nil {
apiutil.WebErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return
}
// Return instance we already got from the db,
// don't try to fetch it again when erroring.
instanceGet := func(ctx context.Context) (*apimodel.InstanceV1, gtserror.WithCode) {
return instance, nil
}
// We only serve text/html at this endpoint.
if _, err := apiutil.NegotiateAccept(c, apiutil.TextHTML); err != nil {
apiutil.WebErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), instanceGet)
return
}
page := apiutil.WebPage{
Template: "login.tmpl",
Instance: instance,
OGMeta: apiutil.OGBase(instance),
Stylesheets: []string{cssLogin},
Extra: map[string]any{
"showStrap": false,
},
}
apiutil.TemplateWebPage(c, page)
}

View file

@ -61,6 +61,7 @@
cssFA = assetsPathPrefix + "/Fork-Awesome/css/fork-awesome.min.css" cssFA = assetsPathPrefix + "/Fork-Awesome/css/fork-awesome.min.css"
cssAbout = distPathPrefix + "/about.css" cssAbout = distPathPrefix + "/about.css"
cssIndex = distPathPrefix + "/index.css" cssIndex = distPathPrefix + "/index.css"
cssLogin = distPathPrefix + "/login.css"
cssStatus = distPathPrefix + "/status.css" cssStatus = distPathPrefix + "/status.css"
cssThread = distPathPrefix + "/thread.css" cssThread = distPathPrefix + "/thread.css"
cssProfile = distPathPrefix + "/profile.css" cssProfile = distPathPrefix + "/profile.css"
@ -119,6 +120,7 @@ func (m *Module) Route(r *router.Router, mi ...gin.HandlerFunc) {
r.AttachHandler(http.MethodPost, confirmEmailPath, m.confirmEmailPOSTHandler) r.AttachHandler(http.MethodPost, confirmEmailPath, m.confirmEmailPOSTHandler)
r.AttachHandler(http.MethodGet, robotsPath, m.robotsGETHandler) r.AttachHandler(http.MethodGet, robotsPath, m.robotsGETHandler)
r.AttachHandler(http.MethodGet, aboutPath, m.aboutGETHandler) r.AttachHandler(http.MethodGet, aboutPath, m.aboutGETHandler)
r.AttachHandler(http.MethodGet, loginPath, m.loginGETHandler)
r.AttachHandler(http.MethodGet, domainBlockListPath, m.domainBlockListGETHandler) r.AttachHandler(http.MethodGet, domainBlockListPath, m.domainBlockListGETHandler)
r.AttachHandler(http.MethodGet, tagsPath, m.tagGETHandler) r.AttachHandler(http.MethodGet, tagsPath, m.tagGETHandler)
r.AttachHandler(http.MethodGet, signupPath, m.signupGETHandler) r.AttachHandler(http.MethodGet, signupPath, m.signupGETHandler)

View file

@ -0,0 +1,166 @@
/*
theme-title: Moonlight Hunt
theme-description: Ominous dark blue / black with a tinge of blood red. You may think it all a mere bad dream.
*/
:root {
/* Define our palette */
--bleached-bone: #f3e3d4;
--void-blue: #0e131f;
--outer-space: #06080e;
--ghastly-blue: #88bebe;
--blood-red: #6c1619;
--bright-red: #f61a1ae6;
--feral-orange: #f78d17;
/* Restyle basic colors */
--white1: var(--void-blue);
--white2: var(--void-blue);
--orange2: var(--bright-red);
--blue1: var(--ghastly-blue);
--blue2: var(--ghastly-blue);
--blue3: var(--ghastly-blue);
/* Basic page styling (background + foreground) */
--bg: var(--void-blue);
--bg-accent: var(--void-blue);
--fg: var(--bleached-bone);
--fg-reduced: var(--bleached-bone);
--profile-bg: var(--void-blue);
/* Buttons */
--bloodshot: linear-gradient(
var(--blood-red) 0%,
var(--feral-orange) 2%,
var(--bright-red) 5%,
var(--blood-red) 40%,
var(--blood-red) 60%,
var(--bright-red) 95%,
var(--feral-orange) 98%,
var(--blood-red) 100%
);
--button-bg: var(--bloodshot);
--button-fg: var(--bleached-bone);
/* Statuses */
--status-bg: var(--void-blue);
--status-focus-bg: var(--void-blue);
/* Used around statuses + other items */
--ghastly-border: 0.1rem solid var(--ghastly-blue);
--boxshadow-border: var(--ghastly-border);
}
/* Main page background */
body {
background: linear-gradient(
90deg,
var(--blood-red),
black 20%,
black 80%,
var(--blood-red)
);
}
/* Scroll bar */
html, body {
scrollbar-color: var(--bright-red) var(--outer-space);
text-shadow: 1px 1px var(--blood-red);
}
/* Instance title color */
.page-header a h1 {
color: var(--bleached-bone);
}
.profile .profile-header {
border: var(--ghastly-border);
}
.col-header {
border: var(--ghastly-border);
background: var(--outer-space);
}
.profile .about-user .col-header {
background: var(--void-blue);
border-bottom: none;
margin-bottom: 0;
}
/* Fiddle around with borders on about sections */
.profile .about-user .fields,
.profile .about-user .bio,
.profile .about-user .accountstats {
border-left: var(--ghastly-border);
border-right: var(--ghastly-border);
}
.profile .about-user .accountstats {
border-bottom: var(--ghastly-border);
background: var(--outer-space);
}
/* Role and bot badge backgrounds */
.profile .profile-header .basic-info .namerole .role,
.profile .profile-header .basic-info .namerole .bot-username-wrapper .bot-legend-wrapper {
background: var(--outer-space);
}
/* Status media */
.status .media .media-wrapper {
border: var(--ghastly-border);
}
.status .media .media-wrapper details .unknown-attachment .placeholder {
color: var(--bleached-bone);
}
.status .media .media-wrapper details video.plyr-video {
background: var(--outer-space);
}
/* Status polls */
.status .text .poll {
background-color: var(--outer-space);
border: var(--ghastly-border);
}
.status .text .poll .poll-info {
background-color: var(--void-blue);
}
/* Code snippets */
pre, pre[class*="language-"],
code, code[class*="language-"] {
background-color: var(--outer-space);
color: var(--bleached-bone);
}
/* Block quotes */
blockquote {
background-color: var(--outer-space);
color: var(--bleached-bone);
}
/* Status info bars */
.status .status-info,
.status.expanded .status-info {
color: var(--ghastly-blue);
border-top: 0.1rem dotted var(--ghastly-blue);
background: var(--outer-space);
}
/* Make show more/less buttons more legible */
.status .button {
border: 1px solid var(--feral-orange);
}
.status .button:hover {
border: 1px solid var(--bleached-bone);
background: var(--bloodshot);
}
/* Back + next links */
.profile .statuses .backnextlinks a {
color: var(--bleached-bone);
}
.page-footer nav ul li a {
color: var(--bleached-bone);
}

119
web/source/css/login.css Normal file
View file

@ -0,0 +1,119 @@
/*
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/>.
*/
.about-section.settings {
display: flex;
flex-direction: row;
gap: 1rem;
align-items: center;
justify-content: center;
padding-top: 1rem !important;
padding-bottom: 1rem !important;
p.settings-text {
margin-top: auto;
margin-bottom: auto;
flex: auto;
}
.settings-button {
flex: auto;
}
}
/*
Reuse about styling, but rework it
to separate sections a bit more.
*/
.about {
display: flex;
flex-direction: column;
gap: 2rem;
padding: 0;
background: initial;
box-shadow: initial;
border: initial;
border-radius: initial;
.about-section {
padding: 2rem;
background: $bg-accent;
box-shadow: $boxshadow;
border: $boxshadow-border;
border-radius: $br;
h3 {
margin-top: 0px;
}
}
}
.apps {
align-self: start;
.applist {
margin: 0;
padding: 0;
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 0.5rem;
align-content: start;
.applist-entry {
display: grid;
grid-template-columns: 25% 1fr;
grid-template-areas: "logo text";
gap: 1.5rem;
padding: 0.5rem;
.applist-logo {
grid-area: logo;
align-self: center;
justify-self: center;
width: 100%;
object-fit: contain;
flex: 1 1 auto;
}
.applist-logo.redraw {
fill: $fg;
stroke: $fg;
}
.applist-text {
grid-area: text;
a {
font-weight: bold;
}
}
}
}
}
@media screen and (max-width: 600px) {
.apps .applist {
grid-template-columns: 1fr;
}
}

View file

@ -116,3 +116,9 @@
text-align: center; text-align: center;
} }
} }
.login {
position: absolute;
top: 2vh;
right: 2vh;
}

28
web/template/login.tmpl Normal file
View file

@ -0,0 +1,28 @@
{{- /*
// 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/>.
*/ -}}
<main class="about">
<section role="region" class="about-section settings">
<p class="settings-text">
Looking to configure your profile and other settings?
</p>
<a href="/settings" class="settings-button button with-icon">Settings</a>
</section>
{{- include "index_apps.tmpl" . | indent 1 }}
</main>

View file

@ -0,0 +1,22 @@
{{- /*
// 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/>.
*/ -}}
{{- if .showLoginButton }}
<div class="login"><a href="/login" class="button with-icon">Log in</a></div>
{{- end }}

View file

@ -71,7 +71,9 @@ image/webp
{{- end }} {{- end }}
<title>{{- template "instanceTitle" . -}}</title> <title>{{- template "instanceTitle" . -}}</title>
</head> </head>
<body class="page"> <body>
{{- include "login_button.tmpl" . | indent 3 }}
<div class="page">
<header class="page-header"> <header class="page-header">
{{- include "page_header.tmpl" . | indent 3 }} {{- include "page_header.tmpl" . | indent 3 }}
</header> </header>
@ -81,5 +83,6 @@ image/webp
<footer class="page-footer"> <footer class="page-footer">
{{- include "page_footer.tmpl" . | indent 3 }} {{- include "page_footer.tmpl" . | indent 3 }}
</footer> </footer>
</div>
</body> </body>
</html> </html>