rename feeds -> settings
Jes Olson j3s@c3f.net
Thu, 14 Sep 2023 23:18:13 -0500
5 files changed,
13 insertions(+),
9 deletions(-)
M
files/feeds.tmpl.html
→
files/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/user.tmpl.html
→
files/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.go
→
main.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.go
→
site.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