Browse Source

GA/UserVoice opt-in

tags/v1.0.0
Andrea Spacca 5 years ago
parent
commit
7c25f986aa
5 changed files with 20880 additions and 407 deletions
  1. +2
    -0
      README.md
  2. +18
    -0
      cmd/cmd.go
  3. +4
    -0
      server/handlers.go
  4. +15
    -1
      server/server.go
  5. +20841
    -406
      vendor/github.com/dutchcoders/transfer.sh-web/bindata_gen.go

+ 2
- 0
README.md View File

@@ -59,6 +59,8 @@ http-auth-user | user for basic http auth on upload | |
http-auth-pass | pass for basic http auth on upload | |
temp-path | path to temp folder | system temp |
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) |
aws-access-key | aws access key | | AWS_ACCESS_KEY
aws-secret-key | aws access key | | AWS_SECRET_KEY


+ 18
- 0
cmd/cmd.go View File

@@ -72,6 +72,16 @@ var globalFlags = []cli.Flag{
Usage: "path to static web files",
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{
Name: "provider",
Usage: "s3|gdrive|local",
@@ -206,6 +216,14 @@ func New() *Cmd {
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 != "" {
options = append(options, server.TempPath(v))
}


+ 4
- 0
server/handlers.go View File

@@ -153,12 +153,16 @@ func (s *Server) previewHandler(w http.ResponseWriter, r *http.Request) {
Filename string
Url string
ContentLength uint64
GAKey string
UserVoiceKey string
}{
contentType,
content,
filename,
r.URL.String(),
contentLength,
s.gaKey,
s.userVoiceKey,
}

if err := htmlTemplates.ExecuteTemplate(w, templatePath, data); err != nil {


+ 15
- 1
server/server.go View File

@@ -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 {
return func(srvr *Server) {
srvr.TLSListenerString = s
@@ -210,7 +222,9 @@ type Server struct {

tempPath string

webPath string
webPath string
gaKey string
userVoiceKey string

ListenerString string
TLSListenerString string


+ 20841
- 406
vendor/github.com/dutchcoders/transfer.sh-web/bindata_gen.go
File diff suppressed because it is too large
View File


Loading…
Cancel
Save