diff --git a/README.md b/README.md index c85b15cf..cc6b6f43 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,12 @@ # filebrowser -[![Build](https://img.shields.io/travis/hacdias/filemanager.svg?style=flat-square)](https://travis-ci.org/hacdias/filemanager) -[![Go Report Card](https://goreportcard.com/badge/github.com/filebrowser/filebrowser?style=flat-square)](https://goreportcard.com/report/hacdias/filemanager) +[![Build](https://img.shields.io/travis/filebrowser/filebrowser.svg?style=flat-square)](https://travis-ci.org/filebrowser/filebrowser) +[![Go Report Card](https://goreportcard.com/badge/github.com/filebrowser/filebrowser?style=flat-square)](https://goreportcard.com/report/github.com/filebrowser/filebrowser) [![Documentation](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](http://godoc.org/github.com/filebrowser/filebrowser) -[![Version](https://img.shields.io/github/release/hacdias/filemanager.svg?style=flat-square)](https://github.com/filebrowser/filebrowser/releases/latest) +[![Version](https://img.shields.io/github/release/filebrowser/filebrowser.svg?style=flat-square)](https://github.com/filebrowser/filebrowser/releases/latest) -filemanager provides a file managing interface within a specified directory and it can be used to upload, delete, preview, rename and edit your files. It allows the creation of multiple users and each user can have its own directory. It can be used as a standalone app or as a middleware. +filebrowser provides a file managing interface within a specified directory and it can be used to upload, delete, preview, rename and edit your files. It allows the creation of multiple users and each user can have its own directory. It can be used as a standalone app or as a middleware. # Table of contents @@ -20,7 +20,7 @@ filemanager provides a file managing interface within a specified directory and # Getting started -You can find the Getting Started guide on the [documentation](https://henriquedias.com/filemanager/quick-start/). +You can find the Getting Started guide on the [documentation](https://filebrowser.github.io/quick-start/). # Features @@ -50,7 +50,7 @@ We support multiple users and each user can have its own scope and custom styles ## Search -FileManager allows you to search through your files and it has some options. By default, your search will be something like this: +File Browser allows you to search through your files and it has some options. By default, your search will be something like this: ``` this are keywords diff --git a/cmd/filebrowser/main.go b/cmd/filebrowser/main.go index 368b3fd8..b9317b33 100644 --- a/cmd/filebrowser/main.go +++ b/cmd/filebrowser/main.go @@ -50,7 +50,7 @@ func init() { flag.StringVarP(&config, "config", "c", "", "Configuration file") flag.IntVarP(&port, "port", "p", 0, "HTTP Port (default is random)") flag.StringVarP(&addr, "address", "a", "", "Address to listen to (default is all of them)") - flag.StringVarP(&database, "database", "d", "./filemanager.db", "Database file") + flag.StringVarP(&database, "database", "d", "./filebrowser.db", "Database file") flag.StringVarP(&logfile, "log", "l", "stdout", "Errors logger; can use 'stdout', 'stderr' or file") flag.StringVarP(&scope, "scope", "s", ".", "Default scope option for new users") flag.StringVarP(&baseurl, "baseurl", "b", "", "Base URL") @@ -72,7 +72,7 @@ func init() { func setupViper() { viper.SetDefault("Address", "") viper.SetDefault("Port", "0") - viper.SetDefault("Database", "./filemanager.db") + viper.SetDefault("Database", "./filebrowser.db") viper.SetDefault("Scope", ".") viper.SetDefault("Logger", "stdout") viper.SetDefault("Commands", []string{"git", "svn", "hg"}) @@ -85,7 +85,7 @@ func setupViper() { viper.SetDefault("NoAuth", false) viper.SetDefault("BaseURL", "") viper.SetDefault("PrefixURL", "") - viper.SetDefault("ViewMode", filemanager.MosaicViewMode) + viper.SetDefault("ViewMode", filebrowser.MosaicViewMode) viper.SetDefault("ReCaptchaKey", "") viper.SetDefault("ReCaptchaSecret", "") @@ -108,12 +108,12 @@ func setupViper() { viper.BindPFlag("ReCaptchaKey", flag.Lookup("recaptcha-key")) viper.BindPFlag("ReCaptchaSecret", flag.Lookup("recaptcha-secret")) - viper.SetConfigName("filemanager") + viper.SetConfigName("filebrowser") viper.AddConfigPath(".") } func printVersion() { - fmt.Println("filemanager version", filemanager.Version) + fmt.Println("filebrowser version", filebrowser.Version) os.Exit(0) } @@ -186,31 +186,31 @@ func handler() http.Handler { log.Fatal(err) } - fm := &filemanager.FileManager{ + fm := &filebrowser.FileBrowser{ NoAuth: viper.GetBool("NoAuth"), BaseURL: viper.GetString("BaseURL"), PrefixURL: viper.GetString("PrefixURL"), ReCaptchaKey: viper.GetString("ReCaptchaKey"), ReCaptchaSecret: viper.GetString("ReCaptchaSecret"), - DefaultUser: &filemanager.User{ + DefaultUser: &filebrowser.User{ AllowCommands: viper.GetBool("AllowCommands"), AllowEdit: viper.GetBool("AllowEdit"), AllowNew: viper.GetBool("AllowNew"), AllowPublish: viper.GetBool("AllowPublish"), Commands: viper.GetStringSlice("Commands"), - Rules: []*filemanager.Rule{}, + Rules: []*filebrowser.Rule{}, Locale: viper.GetString("Locale"), CSS: "", Scope: viper.GetString("Scope"), FileSystem: fileutils.Dir(viper.GetString("Scope")), ViewMode: viper.GetString("ViewMode"), }, - Store: &filemanager.Store{ + Store: &filebrowser.Store{ Config: bolt.ConfigStore{DB: db}, Users: bolt.UsersStore{DB: db}, Share: bolt.ShareStore{DB: db}, }, - NewFS: func(scope string) filemanager.FileSystem { + NewFS: func(scope string) filebrowser.FileSystem { return fileutils.Dir(scope) }, } diff --git a/filebrowser.go b/filebrowser.go index da5403e8..5868dd36 100644 --- a/filebrowser.go +++ b/filebrowser.go @@ -107,7 +107,7 @@ var commandEvents = []string{ } // Command is a command function. -type Command func(r *http.Request, m *FileManager, u *User) error +type Command func(r *http.Request, m *FileBrowser, u *User) error // FSBuilder is the File System Builder. type FSBuilder func(scope string) FileSystem @@ -115,7 +115,7 @@ type FSBuilder func(scope string) FileSystem // Setup loads the configuration from the database and configures // the Assets and the Cron job. It must always be run after // creating a File Manager object. -func (m *FileManager) Setup() error { +func (m *FileBrowser) Setup() error { // Creates a new File Manager instance with the Users // map and Assets box. m.Assets = rice.MustFindBox("./assets/dist") @@ -229,13 +229,13 @@ func (m *FileManager) Setup() error { // RootURL returns the actual URL where // File Manager interface can be accessed. -func (m FileManager) RootURL() string { +func (m FileBrowser) RootURL() string { return m.PrefixURL + m.BaseURL } // SetPrefixURL updates the prefixURL of a File // Manager object. -func (m *FileManager) SetPrefixURL(url string) { +func (m *FileBrowser) SetPrefixURL(url string) { url = strings.TrimPrefix(url, "/") url = strings.TrimSuffix(url, "/") url = "/" + url @@ -244,7 +244,7 @@ func (m *FileManager) SetPrefixURL(url string) { // SetBaseURL updates the baseURL of a File Manager // object. -func (m *FileManager) SetBaseURL(url string) { +func (m *FileBrowser) SetBaseURL(url string) { url = strings.TrimPrefix(url, "/") url = strings.TrimSuffix(url, "/") url = "/" + url @@ -252,7 +252,7 @@ func (m *FileManager) SetBaseURL(url string) { } // Attach attaches a static generator to the current File Manager. -func (m *FileManager) Attach(s StaticGen) error { +func (m *FileBrowser) Attach(s StaticGen) error { if reflect.TypeOf(s).Kind() != reflect.Ptr { return errors.New("data should be a pointer to interface, not interface") } @@ -274,7 +274,7 @@ func (m *FileManager) Attach(s StaticGen) error { // ShareCleaner removes sharing links that are no longer active. // This function is set to run periodically. -func (m FileManager) ShareCleaner() { +func (m FileBrowser) ShareCleaner() { // Get all links. links, err := m.Store.Share.Gets() if err != nil { @@ -294,7 +294,7 @@ func (m FileManager) ShareCleaner() { } // Runner runs the commands for a certain event type. -func (m FileManager) Runner(event string, path string, destination string, user *User) error { +func (m FileBrowser) Runner(event string, path string, destination string, user *User) error { commands := []string{} // Get the commands from the File Manager instance itself. @@ -530,7 +530,7 @@ type FileSystem interface { // Context contains the needed information to make handlers work. type Context struct { - *FileManager + *FileBrowser User *User File *File // On API handlers, Router is the APi handler we want.