Skip to content

Commit

Permalink
add user's outbox to menu
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Feb 22, 2024
1 parent f1164f4 commit dc9535b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Welcome, fedinaut! localhost.localdomain:8443 is an instance of tootik, a federa
📻 My radio
📞 Mentions
⚡️ Followed users
😈 My profile
📡 This planet
✨ FOMO from outer space
🔥 Hashtags
Expand Down Expand Up @@ -139,6 +140,7 @@ Users are authenticated using TLS client certificates; see [Gemini protocol spec
* /users/mentions is like /users but shows only posts that mention the user.
* /users/register creates a new user.
* /users/follows shows a list of followed users, ordered by activity.
* /users/me redirects the user to their outbox.
* /users/resolve looks up federated user *user@domain* or local user *user*.
* /users/dm creates a post visible to mentioned users.
* /users/whisper creates a post visible to followers.
Expand Down
1 change: 1 addition & 0 deletions front/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func NewHandler(domain string, closed bool, cfg *cfg.Config) Handler {

h.handlers[regexp.MustCompile(`^/outbox/(\S+)$`)] = withUserMenu(h.userOutbox)
h.handlers[regexp.MustCompile(`^/users/outbox/(\S+)$`)] = withUserMenu(h.userOutbox)
h.handlers[regexp.MustCompile(`^/users/me$`)] = withUserMenu(me)

h.handlers[regexp.MustCompile(`^/users/bio$`)] = h.bio
h.handlers[regexp.MustCompile(`^/users/name$`)] = h.name
Expand Down
31 changes: 31 additions & 0 deletions front/me.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Copyright 2024 Dima Krasner
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package front

import (
"github.com/dimkr/tootik/front/text"
"strings"
)

func me(w text.Writer, r *request, args ...string) {
if r.User == nil {
w.Redirect("/users")
return
}

w.Redirect("/users/outbox/" + strings.TrimPrefix(r.User.ID, "https://"))
}
1 change: 1 addition & 0 deletions front/menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func writeUserMenu(w text.Writer, user *ap.Actor) {
w.Link("/users", "📻 My radio")
w.Link("/users/mentions", "📞 Mentions")
w.Link("/users/follows", "⚡️ Followed users")
w.Link("/users/me", "😈 My profile")
}

w.Link(prefix+"/local", "📡 This planet")
Expand Down
4 changes: 4 additions & 0 deletions front/static/users/help.gmi
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ This page shows posts by followed users that mention you.

This page shows a list of users you follow, sorted by last activity.

> 😈 My profile

This page shows your profile.

> 📡 This planet

This page shows public posts published on this server.
Expand Down

0 comments on commit dc9535b

Please sign in to comment.