diff --git a/routes/handler.go b/routes/handler.go
index 377cd8b..f1134d1 100644
--- a/routes/handler.go
+++ b/routes/handler.go
@@ -56,8 +56,9 @@ func Setup(c *config.Config, db *db.DB) (http.Handler, error) {
auth: auth,
}
+ r.Get("/", h.Timeline)
+
r.Group(func(r chi.Router) {
- r.Use(h.AuthMiddleware)
r.Get("/login", h.Login)
r.Post("/login", h.Login)
})
diff --git a/routes/routes.go b/routes/routes.go
index 3075768..62437d8 100644
--- a/routes/routes.go
+++ b/routes/routes.go
@@ -464,7 +464,7 @@ func (h *Handle) Login(w http.ResponseWriter, r *http.Request) {
}
log.Printf("successfully saved session for %s (%s)", atSession.Handle, atSession.Did)
- http.Redirect(w, r, "/", http.StatusPermanentRedirect)
+ http.Redirect(w, r, "/", http.StatusSeeOther)
return
}
}
@@ -564,3 +564,19 @@ func (h *Handle) NewRepo(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
}
+
+func (h *Handle) Timeline(w http.ResponseWriter, r *http.Request) {
+ session, err := h.s.Get(r, "bild-session")
+ user := make(map[string]string)
+ if err != nil || session.IsNew {
+ // user is not logged in
+ } else {
+ user["handle"] = session.Values["handle"].(string)
+ user["did"] = session.Values["did"].(string)
+ }
+
+ if err := h.t.ExecuteTemplate(w, "timeline", user); err != nil {
+ log.Println(err)
+ return
+ }
+}
diff --git a/templates/layouts/topbar.html b/templates/layouts/topbar.html
new file mode 100644
index 0000000..18e2dee
--- /dev/null
+++ b/templates/layouts/topbar.html
@@ -0,0 +1,12 @@
+
+
diff --git a/templates/timeline.html b/templates/timeline.html
new file mode 100644
index 0000000..1e83910
--- /dev/null
+++ b/templates/timeline.html
@@ -0,0 +1,14 @@
+{{ define "timeline" }}
+
+{{ template "layouts/head" . }}
+
+ timeline
+