a lot of ui cleaning up, extending csrf time, adding csrf logging errors to screen
This commit is contained in:
parent
9f5cd7e5d8
commit
015d6fa86d
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
5
main.go
5
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)
|
||||
}
|
||||
|
|
|
@ -145,9 +145,16 @@ func addFormHandler(w http.ResponseWriter, r *http.Request, user *user.User, ses
|
|||
title = getUrlTitle(url)
|
||||
}
|
||||
|
||||
var notes = ""
|
||||
selection := r.URL.Query().Get("selection")
|
||||
if selection != "" {
|
||||
notes = "<quote>" + selection + "</quote>"
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</div>
|
||||
|
||||
<div class="col-xs-6">
|
||||
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
|
||||
</div>
|
||||
<div class="col-xs-4"></div>
|
||||
<div class="col-xs-12"> </div>
|
||||
|
@ -54,6 +54,4 @@
|
|||
{{end}}
|
||||
|
||||
<!-- JS for the launcher of the add bookmarklet -->
|
||||
{{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}}
|
||||
{{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}}
|
Loading…
Reference in New Issue