Add quick bookmarklet
This commit is contained in:
@@ -110,12 +110,13 @@ func (s *Server) AddHandler() httprouter.Handle {
|
||||
return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
||||
ctx := NewContext(s.config, s.db, r)
|
||||
|
||||
if r.Method == http.MethodGet {
|
||||
url := NormalizeURL(strings.TrimSpace(r.FormValue("url")))
|
||||
|
||||
if url == "" && r.Method == http.MethodGet {
|
||||
s.render("add", w, ctx)
|
||||
return
|
||||
}
|
||||
|
||||
url := NormalizeURL(strings.TrimSpace(r.FormValue("url")))
|
||||
if url == "" {
|
||||
ctx.Error = true
|
||||
ctx.Message = "Invalid URL"
|
||||
|
||||
Reference in New Issue
Block a user