small pixel drawing of a pufferfish vore

rename feeds -> settings
Jes Olson j3s@c3f.net
Thu, 14 Sep 2023 23:18:13 -0500
commit

fccfe127fdc6a4031a86b409acf8c6a6609436c3

parent

a15d482a9d76380177c60418dd81a73f57e7bf8b

5 files changed, 13 insertions(+), 9 deletions(-)

jump to
M files/feeds.tmpl.htmlfiles/settings.tmpl.html

@@ -1,4 +1,4 @@

-{{ define "feeds" }} +{{ define "settings" }} {{ template "head" . }} {{ template "nav" . }} <h3>Settings</h3>

@@ -6,7 +6,7 @@ <p>your public url: <a href="/{{ .Username }}">vore.website/{{ .Username }}</a>

{{ len .Data }} subscriptions: </p> -<form method="POST" action="/feeds/submit"> +<form method="POST" action="/settings/submit"> <textarea name="submit" rows="10" cols="50"> {{ range .Data -}} {{ .UpdateURL }}
M files/nav.tmpl.htmlfiles/nav.tmpl.html

@@ -5,7 +5,7 @@ <a href="/{{ .Username }}">Vore</a>

</h2> <a href="/discover">discover</a> {{ if .LoggedIn }} - <a href="/feeds">settings</a> + <a href="/settings">settings</a> <a href="/logout">logout</a> {{ else }} <a href="/login">login</a>
M files/user.tmpl.htmlfiles/user.tmpl.html

@@ -7,7 +7,7 @@ {{ if .LoggedIn }}

<p> you don't seem to have any feeds yet. -<a href="/feeds">add your first feed here!</a> +<a href="/settings">add your first feed here!</a> </p> {{ end }} {{ end }}
M main.gomain.go

@@ -15,13 +15,17 @@ mux.HandleFunc("GET /{$}", s.indexHandler)

mux.HandleFunc("GET /{username}", s.userHandler) mux.HandleFunc("GET /static/{file}", s.staticHandler) mux.HandleFunc("GET /discover", s.discoverHandler) - mux.HandleFunc("GET /feeds", s.settingsHandler) - mux.HandleFunc("POST /feeds/submit", s.feedsSubmitHandler) + mux.HandleFunc("GET /settings", s.settingsHandler) + mux.HandleFunc("POST /settings/submit", s.settingsSubmitHandler) mux.HandleFunc("GET /login", s.loginHandler) mux.HandleFunc("POST /login", s.loginHandler) mux.HandleFunc("GET /logout", s.logoutHandler) mux.HandleFunc("POST /logout", s.logoutHandler) mux.HandleFunc("POST /register", s.registerHandler) + + // left in-place for backwards compat + mux.HandleFunc("GET /feeds", s.settingsHandler) + mux.HandleFunc("POST /feeds/submit", s.settingsSubmitHandler) log.Println("main: listening on http://localhost:5544") log.Fatal(http.ListenAndServe(":5544", mux))
M site.gosite.go

@@ -139,7 +139,7 @@ }

var feeds []*rss.Feed feeds = s.reaper.GetUserFeeds(s.username(r)) - s.renderPage(w, r, "feeds", feeds) + s.renderPage(w, r, "settings", feeds) } // TODO:

@@ -147,7 +147,7 @@ //

// show diff before submission (like tf plan) // check if feed exists in db already? // validate that title exists -func (s *Site) feedsSubmitHandler(w http.ResponseWriter, r *http.Request) { +func (s *Site) settingsSubmitHandler(w http.ResponseWriter, r *http.Request) { if !s.loggedIn(r) { s.renderErr(w, "", http.StatusUnauthorized) return

@@ -194,7 +194,7 @@ s.db.UnsubscribeAll(s.username(r))

for _, url := range validatedURLs { s.db.Subscribe(s.username(r), url) } - http.Redirect(w, r, "/feeds", http.StatusSeeOther) + http.Redirect(w, r, "/settings", http.StatusSeeOther) } // username fetches a client's username based