diff --git a/README.md b/README.md index 9232afe9..efc1c496 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. diff --git a/front/handler.go b/front/handler.go index 11a29bd8..a904de20 100644 --- a/front/handler.go +++ b/front/handler.go @@ -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 diff --git a/front/me.go b/front/me.go new file mode 100644 index 00000000..5ce63056 --- /dev/null +++ b/front/me.go @@ -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://")) +} diff --git a/front/menu.go b/front/menu.go index 328127f6..82fd5409 100644 --- a/front/menu.go +++ b/front/menu.go @@ -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") diff --git a/front/static/users/help.gmi b/front/static/users/help.gmi index fe3b32eb..8fb99309 100644 --- a/front/static/users/help.gmi +++ b/front/static/users/help.gmi @@ -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.