From 9e0f8c24a02b4d46f8389892d9f3b91629056f11 Mon Sep 17 00:00:00 2001 From: Noah Date: Tue, 18 Feb 2020 11:04:17 -0800 Subject: [PATCH] Bugfix for RSS feeds --- cmd/gophertype/main.go | 16 ++++++++++++---- go.mod | 1 + go.sum | 3 +++ pkg/models/users.go | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/cmd/gophertype/main.go b/cmd/gophertype/main.go index d958f74..e2e0fd8 100644 --- a/cmd/gophertype/main.go +++ b/cmd/gophertype/main.go @@ -7,7 +7,7 @@ import ( "fmt" "os" - "git.kirsle.net/apps/gophertype/pkg" + gophertype "git.kirsle.net/apps/gophertype/pkg" "git.kirsle.net/apps/gophertype/pkg/console" _ "git.kirsle.net/apps/gophertype/pkg/controllers" _ "github.com/jinzhu/gorm/dialects/mysql" @@ -23,9 +23,10 @@ var ( // Command-line flags. var ( - optDebug bool - optBind string - optRoot string + optVersion bool + optDebug bool + optBind string + optRoot string // Database option flags. optSQLite string @@ -38,6 +39,8 @@ var ( ) func init() { + flag.BoolVar(&optVersion, "version", false, "Show version number and exit") + flag.BoolVar(&optVersion, "v", false, "Show version number and exit (alias)") flag.BoolVar(&optDebug, "debug", false, "Debug level logging") flag.StringVar(&optBind, "bind", ":8000", "Bind address for HTTP server") flag.StringVar(&optRoot, "root", "./public_html", "User root for custom web pages") @@ -55,6 +58,11 @@ func init() { func main() { flag.Parse() + if optVersion { + fmt.Printf("This is gophertype v%s build %s (built on %s)\n", gophertype.Version, Build, BuildDate) + os.Exit(0) + } + console.SetDebug(optDebug) // Validate the choice of database. diff --git a/go.mod b/go.mod index da6afd8..d15687d 100644 --- a/go.mod +++ b/go.mod @@ -17,5 +17,6 @@ require ( github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470 github.com/urfave/negroni v1.0.0 golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443 + gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df ) diff --git a/go.sum b/go.sum index ed569ea..7900ed7 100644 --- a/go.sum +++ b/go.sum @@ -175,6 +175,7 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -182,6 +183,8 @@ google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRn google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk= +gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= diff --git a/pkg/models/users.go b/pkg/models/users.go index 265aaa1..bc13911 100644 --- a/pkg/models/users.go +++ b/pkg/models/users.go @@ -113,7 +113,7 @@ func (u *User) VerifyPassword(password string) bool { // FirstAdmin returns the admin user with the lowest ID number. func (m userMan) FirstAdmin() (User, error) { var user User - r := DB.First(&user, "is_admin", true) + r := DB.First(&user, "is_admin = ?", true) return user, r.Error }