aboutsummaryrefslogtreecommitdiff
path: root/service/transport.go
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2019-12-25 04:30:21 +0000
committerr <r@freesoftwareextremist.com>2019-12-25 04:30:21 +0000
commitf6f7b27e40f97ffe88323be01bea1d04ca39d6b0 (patch)
tree2aad7592cc20bc9d1d59e5e9da5d83b1d15774cc /service/transport.go
parent51bdb20402abc08102e83a234bb4f6720c5a1166 (diff)
downloadbloat-f6f7b27e40f97ffe88323be01bea1d04ca39d6b0.tar.gz
bloat-f6f7b27e40f97ffe88323be01bea1d04ca39d6b0.zip
Add local and twkn timelines
Diffstat (limited to 'service/transport.go')
-rw-r--r--service/transport.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/service/transport.go b/service/transport.go
index 437d32f..438b39d 100644
--- a/service/transport.go
+++ b/service/transport.go
@@ -26,7 +26,7 @@ func NewHandler(s Service, staticDir string) http.Handler {
sessionID, _ := req.Cookie("session_id")
if sessionID != nil && len(sessionID.Value) > 0 {
- location = "/timeline"
+ location = "/timeline/home"
}
w.Header().Add("Location", location)
@@ -63,18 +63,24 @@ func NewHandler(s Service, staticDir string) http.Handler {
return
}
- w.Header().Add("Location", "/timeline")
+ w.Header().Add("Location", "/timeline/home")
w.WriteHeader(http.StatusFound)
}).Methods(http.MethodGet)
r.HandleFunc("/timeline", func(w http.ResponseWriter, req *http.Request) {
+ w.Header().Add("Location", "/timeline/home")
+ w.WriteHeader(http.StatusFound)
+ }).Methods(http.MethodGet)
+
+ r.HandleFunc("/timeline/{type}", func(w http.ResponseWriter, req *http.Request) {
ctx := getContextWithSession(context.Background(), req)
+ timelineType, _ := mux.Vars(req)["type"]
maxID := req.URL.Query().Get("max_id")
sinceID := req.URL.Query().Get("since_id")
minID := req.URL.Query().Get("min_id")
- err := s.ServeTimelinePage(ctx, w, nil, maxID, sinceID, minID)
+ err := s.ServeTimelinePage(ctx, w, nil, timelineType, maxID, sinceID, minID)
if err != nil {
s.ServeErrorPage(ctx, w, err)
return
@@ -166,7 +172,7 @@ func NewHandler(s Service, staticDir string) http.Handler {
return
}
- location := "/timeline" + "#status-" + id
+ location := "/timeline/home" + "#status-" + id
if len(replyToID) > 0 {
location = "/thread/" + replyToID + "#status-" + id
}