rename File Manager to File Browser

This commit is contained in:
1138-4EB 2018-04-18 18:06:32 +02:00
parent cd0ab77388
commit 4815bc043b
5 changed files with 112 additions and 112 deletions

View File

@ -1,11 +1,11 @@
### Instructions (remove before submitting): ### Instructions (remove before submitting):
1. Are you asking for help with using Caddy or File Manager? Please use our forum instead: https://forum.caddyserver.com. 1. Are you asking for help with using Caddy or File Browser? Please use our forum instead: https://forum.caddyserver.com.
2. If you are filing a bug report, please answer the following questions. 2. If you are filing a bug report, please answer the following questions.
3. If your issue is not a bug report, you do not need to use this template. 3. If your issue is not a bug report, you do not need to use this template.
4. If not using with Caddy, ignore questions 1 and 2. 4. If not using with Caddy, ignore questions 1 and 2.
### 1. Have you downloaded File Manager from caddyserver.com? If yes, when have you done that? If no, and you are running a custom build, which is the revision of File Manager's repository? ### 1. Have you downloaded File Browser from caddyserver.com? If yes, when have you done that? If no, and you are running a custom build, which is the revision of File Browser's repository?
### 2. What is your entire Caddyfile? ### 2. What is your entire Caddyfile?
```text ```text

View File

@ -32,7 +32,7 @@ Listings of your files, available in two styles: mosaic and list. You can delete
![Mosaic Listing](https://user-images.githubusercontent.com/5447088/28432384-9771bb4c-6d7f-11e7-8564-3a9bd6a3ce3a.jpg) ![Mosaic Listing](https://user-images.githubusercontent.com/5447088/28432384-9771bb4c-6d7f-11e7-8564-3a9bd6a3ce3a.jpg)
File Manager editor is powered by [Codemirror](https://codemirror.net/) and if you're working with markdown files with metadata, both parts will be separated from each other so you can focus on the content. File Browser editor is powered by [Codemirror](https://codemirror.net/) and if you're working with markdown files with metadata, both parts will be separated from each other so you can focus on the content.
![Markdown Editor](https://user-images.githubusercontent.com/5447088/28432383-9756fdac-6d7f-11e7-8e58-fec49470d15f.jpg) ![Markdown Editor](https://user-images.githubusercontent.com/5447088/28432383-9756fdac-6d7f-11e7-8e58-fec49470d15f.jpg)

8
doc.go
View File

@ -1,7 +1,7 @@
/* /*
Package filebrowser provides a web interface to access your files Package filebrowser provides a web interface to access your files
wherever you are. To use this package as a middleware for your app, wherever you are. To use this package as a middleware for your app,
you'll need to import both File Manager and File Manager HTTP packages. you'll need to import both File Browser and File Browser HTTP packages.
import ( import (
fm "github.com/filebrowser/filebrowser" fm "github.com/filebrowser/filebrowser"
@ -49,11 +49,11 @@ functions:
m.SetPrefixURL("/") m.SetPrefixURL("/")
The Prefix URL is a part of the path that is already stripped from the The Prefix URL is a part of the path that is already stripped from the
r.URL.Path variable before the request arrives to File Manager's handler. r.URL.Path variable before the request arrives to File Browser's handler.
This is a function that will rarely be used. You can see one example on Caddy This is a function that will rarely be used. You can see one example on Caddy
filemanager plugin. filemanager plugin.
The Base URL is the URL path where you want File Manager to be available in. If The Base URL is the URL path where you want File Browser to be available in. If
you want to be available at the root path, you should call: you want to be available at the root path, you should call:
m.SetBaseURL("/") m.SetBaseURL("/")
@ -62,7 +62,7 @@ But if you want to access it at '/admin', you would call:
m.SetBaseURL("/admin") m.SetBaseURL("/admin")
Now, that you already have a File Manager instance created, you just need to Now, that you already have a File Browser instance created, you just need to
add it to your handlers using m.ServeHTTP which is compatible to http.Handler. add it to your handlers using m.ServeHTTP which is compatible to http.Handler.
We also have a m.ServeWithErrorsHTTP that returns the status code and an error. We also have a m.ServeWithErrorsHTTP that returns the status code and an error.

View File

@ -22,7 +22,7 @@ import (
) )
const ( const (
// Version is the current File Manager version. // Version is the current File Browser version.
Version = "(untracked)" Version = "(untracked)"
ListViewMode = "list" ListViewMode = "list"
@ -58,7 +58,7 @@ type FileBrowser struct {
Store *Store Store *Store
// PrefixURL is a part of the URL that is already trimmed from the request URL before it // PrefixURL is a part of the URL that is already trimmed from the request URL before it
// arrives to our handlers. It may be useful when using File Manager as a middleware // arrives to our handlers. It may be useful when using File Browser as a middleware
// such as in caddy-filemanager plugin. It is only useful in certain situations. // such as in caddy-filemanager plugin. It is only useful in certain situations.
PrefixURL string PrefixURL string
@ -115,9 +115,9 @@ type FSBuilder func(scope string) FileSystem
// Setup loads the configuration from the database and configures // Setup loads the configuration from the database and configures
// the Assets and the Cron job. It must always be run after // the Assets and the Cron job. It must always be run after
// creating a File Manager object. // creating a File Browser object.
func (m *FileBrowser) Setup() error { func (m *FileBrowser) Setup() error {
// Creates a new File Manager instance with the Users // Creates a new File Browser instance with the Users
// map and Assets box. // map and Assets box.
m.Assets = rice.MustFindBox("./node_modules/filebrowser-frontend/dist") m.Assets = rice.MustFindBox("./node_modules/filebrowser-frontend/dist")
m.Cron = cron.New() m.Cron = cron.New()
@ -221,7 +221,7 @@ func (m *FileBrowser) Setup() error {
} }
// RootURL returns the actual URL where // RootURL returns the actual URL where
// File Manager interface can be accessed. // File Browser interface can be accessed.
func (m FileBrowser) RootURL() string { func (m FileBrowser) RootURL() string {
return m.PrefixURL + m.BaseURL return m.PrefixURL + m.BaseURL
} }
@ -235,7 +235,7 @@ func (m *FileBrowser) SetPrefixURL(url string) {
m.PrefixURL = strings.TrimSuffix(url, "/") m.PrefixURL = strings.TrimSuffix(url, "/")
} }
// SetBaseURL updates the baseURL of a File Manager // SetBaseURL updates the baseURL of a File Browser
// object. // object.
func (m *FileBrowser) SetBaseURL(url string) { func (m *FileBrowser) SetBaseURL(url string) {
url = strings.TrimPrefix(url, "/") url = strings.TrimPrefix(url, "/")
@ -244,7 +244,7 @@ func (m *FileBrowser) SetBaseURL(url string) {
m.BaseURL = strings.TrimSuffix(url, "/") m.BaseURL = strings.TrimSuffix(url, "/")
} }
// Attach attaches a static generator to the current File Manager. // Attach attaches a static generator to the current File Browser.
func (m *FileBrowser) Attach(s StaticGen) error { func (m *FileBrowser) Attach(s StaticGen) error {
if reflect.TypeOf(s).Kind() != reflect.Ptr { if reflect.TypeOf(s).Kind() != reflect.Ptr {
return errors.New("data should be a pointer to interface, not interface") return errors.New("data should be a pointer to interface, not interface")
@ -290,7 +290,7 @@ func (m FileBrowser) ShareCleaner() {
func (m FileBrowser) 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{} commands := []string{}
// Get the commands from the File Manager instance itself. // Get the commands from the File Browser instance itself.
if val, ok := m.Commands[event]; ok { if val, ok := m.Commands[event]; ok {
commands = append(commands, val...) commands = append(commands, val...)
} }

View File

@ -125,7 +125,7 @@ func printToken(c *fm.Context, w http.ResponseWriter) (int, error) {
u, u,
jwt.StandardClaims{ jwt.StandardClaims{
ExpiresAt: time.Now().Add(time.Hour * 24).Unix(), ExpiresAt: time.Now().Add(time.Hour * 24).Unix(),
Issuer: "File Manager", Issuer: "File Browser",
}, },
} }