mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2024-11-30 08:00:19 +01:00
GA/UserVoice opt-in
This commit is contained in:
parent
e284bff214
commit
7c25f986aa
5 changed files with 20880 additions and 407 deletions
|
@ -59,6 +59,8 @@ http-auth-user | user for basic http auth on upload | |
|
||||||
http-auth-pass | pass for basic http auth on upload | |
|
http-auth-pass | pass for basic http auth on upload | |
|
||||||
temp-path | path to temp folder | system temp |
|
temp-path | path to temp folder | system temp |
|
||||||
web-path | path to static web files (for development) | |
|
web-path | path to static web files (for development) | |
|
||||||
|
ga-key | google analytics key for the front end | |
|
||||||
|
uservoice-key | user voice key for the front end | |
|
||||||
provider | which storage provider to use | (s3, grdrive or local) |
|
provider | which storage provider to use | (s3, grdrive or local) |
|
||||||
aws-access-key | aws access key | | AWS_ACCESS_KEY
|
aws-access-key | aws access key | | AWS_ACCESS_KEY
|
||||||
aws-secret-key | aws access key | | AWS_SECRET_KEY
|
aws-secret-key | aws access key | | AWS_SECRET_KEY
|
||||||
|
|
18
cmd/cmd.go
18
cmd/cmd.go
|
@ -72,6 +72,16 @@ var globalFlags = []cli.Flag{
|
||||||
Usage: "path to static web files",
|
Usage: "path to static web files",
|
||||||
Value: "",
|
Value: "",
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "ga-key",
|
||||||
|
Usage: "key for google analytics (front end)",
|
||||||
|
Value: "",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "uservoice-key",
|
||||||
|
Usage: "key for user voice (front end)",
|
||||||
|
Value: "",
|
||||||
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "provider",
|
Name: "provider",
|
||||||
Usage: "s3|gdrive|local",
|
Usage: "s3|gdrive|local",
|
||||||
|
@ -206,6 +216,14 @@ func New() *Cmd {
|
||||||
options = append(options, server.WebPath(v))
|
options = append(options, server.WebPath(v))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v := c.String("ga-key"); v != "" {
|
||||||
|
options = append(options, server.GoogleAnalytics(v))
|
||||||
|
}
|
||||||
|
|
||||||
|
if v := c.String("uservoice-key"); v != "" {
|
||||||
|
options = append(options, server.UserVoice(v))
|
||||||
|
}
|
||||||
|
|
||||||
if v := c.String("temp-path"); v != "" {
|
if v := c.String("temp-path"); v != "" {
|
||||||
options = append(options, server.TempPath(v))
|
options = append(options, server.TempPath(v))
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,12 +153,16 @@ func (s *Server) previewHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
Filename string
|
Filename string
|
||||||
Url string
|
Url string
|
||||||
ContentLength uint64
|
ContentLength uint64
|
||||||
|
GAKey string
|
||||||
|
UserVoiceKey string
|
||||||
}{
|
}{
|
||||||
contentType,
|
contentType,
|
||||||
content,
|
content,
|
||||||
filename,
|
filename,
|
||||||
r.URL.String(),
|
r.URL.String(),
|
||||||
contentLength,
|
contentLength,
|
||||||
|
s.gaKey,
|
||||||
|
s.userVoiceKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := htmlTemplates.ExecuteTemplate(w, templatePath, data); err != nil {
|
if err := htmlTemplates.ExecuteTemplate(w, templatePath, data); err != nil {
|
||||||
|
|
|
@ -82,6 +82,18 @@ func Listener(s string) OptionFn {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GoogleAnalytics(gaKey string) OptionFn {
|
||||||
|
return func(srvr *Server) {
|
||||||
|
srvr.gaKey = gaKey
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func UserVoice(userVoiceKey string) OptionFn {
|
||||||
|
return func(srvr *Server) {
|
||||||
|
srvr.userVoiceKey = userVoiceKey
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TLSListener(s string) OptionFn {
|
func TLSListener(s string) OptionFn {
|
||||||
return func(srvr *Server) {
|
return func(srvr *Server) {
|
||||||
srvr.TLSListenerString = s
|
srvr.TLSListenerString = s
|
||||||
|
@ -211,6 +223,8 @@ type Server struct {
|
||||||
tempPath string
|
tempPath string
|
||||||
|
|
||||||
webPath string
|
webPath string
|
||||||
|
gaKey string
|
||||||
|
userVoiceKey string
|
||||||
|
|
||||||
ListenerString string
|
ListenerString string
|
||||||
TLSListenerString string
|
TLSListenerString string
|
||||||
|
|
21239
vendor/github.com/dutchcoders/transfer.sh-web/bindata_gen.go
generated
vendored
21239
vendor/github.com/dutchcoders/transfer.sh-web/bindata_gen.go
generated
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue