diff --git a/README.md b/README.md index 776dfdf..e46f00c 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,14 @@ go get github.com/dballard/transmet sudo apt-get install postgres postgresql-contrib -Setup postgres to hadle a local connection for transmet in pg_hba.conf +Setup postgres to handle a local connection for transmet in pg_hba.conf either: '''host transmet transmet 127.0.0.1/32 md5''' or a more liberal: '''host all all 127.0.0.1/32 md5 ''' +and do the same for +'''host all all ::1/128 md5''' +ipv6 create ssl certs and put them somewhere @@ -36,7 +39,7 @@ ssl_key_file = 'WHERE_YOU_PUT/server.key' Create postgress DB and user '''sh -sudo -u postgres +sudo -u postgres --or-- sudo su - postgres createuser -S -P -E transmet createdb --owner transmet --encoding utf8 transmet psql diff --git a/css/sticky-footer-navbar.css b/css/sticky-footer-navbar.css index d8eeea5..042fd8a 100644 --- a/css/sticky-footer-navbar.css +++ b/css/sticky-footer-navbar.css @@ -23,7 +23,7 @@ body { /* Not required for template or sticky footer method. */ body > .container { - padding: 60px 15px 0; + padding: 0px 15px 0; } .container .text-muted { margin: 20px 0; diff --git a/main.go b/main.go index 661028b..25cb89f 100644 --- a/main.go +++ b/main.go @@ -104,14 +104,15 @@ func main() { dbConnect() initTemplates() muxRouter := init_route_handlers() - //errHandler := csrf.ErrorHandler( CSRFErrorHandler{} ) + errHandler := csrf.ErrorHandler( CSRFErrorHandler{} ) // Terrible. TODO: Get SSL for prod, and then wrap in if(dev) { { csrfSecurityOption := csrf.Secure(false) + csrfMaxTimeOption := csrf.MaxAge(3600 * 24 * 3) // 3 Days - a little more wiggle room fmt.Println("Listening on", config.Port, "...") - err := http.ListenAndServe(":"+config.Port, csrf.Protect([]byte(csrfSecret()) /*errHandler,*/, csrfSecurityOption)(muxRouter)) + err := http.ListenAndServe(":"+config.Port, csrf.Protect([]byte(csrfSecret()), errHandler, csrfSecurityOption, csrfMaxTimeOption)(muxRouter)) if err != nil { fmt.Println("Fatal Error: ", err) } diff --git a/route_handlers.go b/route_handlers.go index 85afa3b..6ee8026 100644 --- a/route_handlers.go +++ b/route_handlers.go @@ -144,10 +144,17 @@ func addFormHandler(w http.ResponseWriter, r *http.Request, user *user.User, ses if title == "" && url != "" { title = getUrlTitle(url) } + + var notes = "" + selection := r.URL.Query().Get("selection") + if selection != "" { + notes = "" + selection + "" + } + popup := r.URL.Query().Get("popup") - ShowTemplate("post", w, r, map[string]interface{}{"mode": "add", "user": user, "flashes": flashes, "link": url, "categories": categories.CategoriesTree, "title": title, "popup": popup, "category_id": -1}) + ShowTemplate("post", w, r, map[string]interface{}{"mode": "add", "user": user, "flashes": flashes, "link": url, "categories": categories.CategoriesTree, "title": title, "popup": popup, "category_id": -1, "notes": notes}) } func addPostHandler(w http.ResponseWriter, r *http.Request, user *user.User, session *sessions.Session) { diff --git a/templates/pages/news.html b/templates/pages/news.html index fbbd8da..7365ada 100644 --- a/templates/pages/news.html +++ b/templates/pages/news.html @@ -7,7 +7,7 @@
- Drag this link to bookmark bar and click anywhere to add a link + Drag this bookmarklet to bookmark bar and click anywhere to add a link
 
@@ -54,6 +54,4 @@ {{end}} -{{define "launch-add"}} -javascript:var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='{{.url}}/news/add',l=d.location,e=encodeURIComponent,u=f+'?popup=1&url='+e(l.href)+'&title='+e(d.title);a=function(){if(!w.open(u,'t','toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=410'))l.href=u;};if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); else a();void(0) -{{end}} \ No newline at end of file +{{define "launch-add"}}javascript:(function() { var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='{{.url}}/news/add',l=d.location,e=encodeURIComponent,u=f+'?popup=1&url='+e(l.href)+'&title='+e(d.title)+'&selection='+e(s);a=function(){if(!w.open(u,'t','toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=480'))l.href=u;};if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); else a();void(0) })();{{end}} \ No newline at end of file