Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
005b184d59 | ||
|
|
372bd813d9 | ||
|
|
52599314b0 | ||
|
|
f61e71e44f | ||
|
|
e5265b6632 | ||
|
|
003f361956 | ||
|
|
cc8369d83e | ||
|
|
aeb583a0bc | ||
|
|
41f07c64eb | ||
|
|
98588a66a7 | ||
|
|
49f32f876d | ||
|
|
aeb0f37e20 | ||
|
|
59a0daa293 | ||
|
|
c716d126eb | ||
|
|
5dc210c000 | ||
|
|
3bb3fdb956 | ||
|
|
b96a4a63c0 | ||
|
|
3d54b2bd90 | ||
|
|
95d43a344c |
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
language: go
|
language: go
|
||||||
|
|
||||||
go: 1.8.3
|
go: 1.x
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- "PATH=/home/travis/gopath/bin:$PATH"
|
- "PATH=/home/travis/gopath/bin:$PATH"
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ RUN mv filemanager /go/bin/filemanager
|
|||||||
FROM scratch
|
FROM scratch
|
||||||
COPY --from=0 /go/bin/filemanager /filemanager
|
COPY --from=0 /go/bin/filemanager /filemanager
|
||||||
|
|
||||||
|
VOLUME /tmp
|
||||||
VOLUME /srv
|
VOLUME /srv
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
|
|||||||
@@ -119,9 +119,21 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.shiftKey && this.selected.length === 1) {
|
if (event.shiftKey && this.selected.length === 1) {
|
||||||
let fi = (this.index > this.selected[0]) ? this.selected[0] : this.index
|
let fi = 0
|
||||||
let la = (this.index > this.selected[0]) ? this.index : this.selected[0]
|
let la = 0
|
||||||
for (; fi <= la; fi++) this.addSelected(fi)
|
|
||||||
|
if (this.index > this.selected[0]) {
|
||||||
|
fi = this.selected[0] + 1
|
||||||
|
la = this.index
|
||||||
|
} else {
|
||||||
|
fi = this.index
|
||||||
|
la = this.selected[0] - 1
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; fi <= la; fi++) {
|
||||||
|
this.addSelected(fi)
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import Router from 'vue-router'
|
|||||||
import Login from '@/views/Login'
|
import Login from '@/views/Login'
|
||||||
import Layout from '@/views/Layout'
|
import Layout from '@/views/Layout'
|
||||||
import Files from '@/views/Files'
|
import Files from '@/views/Files'
|
||||||
import Users from '@/views/Settings/Users'
|
import Users from '@/views/settings/Users'
|
||||||
import User from '@/views/Settings/User'
|
import User from '@/views/settings/User'
|
||||||
import Settings from '@/views/Settings'
|
import Settings from '@/views/Settings'
|
||||||
import GlobalSettings from '@/views/settings/Global'
|
import GlobalSettings from '@/views/settings/Global'
|
||||||
import ProfileSettings from '@/views/settings/Profile'
|
import ProfileSettings from '@/views/settings/Profile'
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
scroll (event) {
|
scroll (event) {
|
||||||
if (this.req.kind !== 'listing' || this.$store.state.req.display === 'mosaic') return
|
if (this.req.kind !== 'listing' || this.$store.state.user.viewMode === 'mosaic') return
|
||||||
|
|
||||||
let top = 112 - window.scrollY
|
let top = 112 - window.scrollY
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,21 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
|
<p>
|
||||||
|
<label for="username">{{ $t('settings.username') }}</label>
|
||||||
|
<input type="text" v-model="username" id="username">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<label for="password">{{ $t('settings.password') }}</label>
|
||||||
|
<input type="password" :placeholder="passwordPlaceholder" v-model="password" id="password">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<label for="scope">{{ $t('settings.scope') }}</label>
|
||||||
|
<input type="text" v-model="filesystem" id="scope">
|
||||||
|
</p>
|
||||||
|
|
||||||
<p><label for="username">{{ $t('settings.username') }}</label><input type="text" v-model="username" id="username"></p>
|
|
||||||
<p><label for="password">{{ $t('settings.password') }}</label><input type="password" :placeholder="passwordPlaceholder" v-model="password" id="password"></p>
|
|
||||||
<p><label for="scope">{{ $t('settings.scope') }}</label><input type="text" v-model="filesystem" id="scope"></p>
|
|
||||||
<p>
|
<p>
|
||||||
<label for="locale">{{ $t('settings.language') }}</label>
|
<label for="locale">{{ $t('settings.language') }}</label>
|
||||||
<languages id="locale" :selected.sync="locale"></languages>
|
<languages id="locale" :selected.sync="locale"></languages>
|
||||||
@@ -91,6 +102,7 @@ export default {
|
|||||||
components: { Languages },
|
components: { Languages },
|
||||||
data: () => {
|
data: () => {
|
||||||
return {
|
return {
|
||||||
|
originalUser: null,
|
||||||
id: 0,
|
id: 0,
|
||||||
admin: false,
|
admin: false,
|
||||||
allowNew: false,
|
allowNew: false,
|
||||||
@@ -141,6 +153,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getUser(user).then(user => {
|
getUser(user).then(user => {
|
||||||
|
this.originalUser = user
|
||||||
this.id = user.ID
|
this.id = user.ID
|
||||||
this.admin = user.admin
|
this.admin = user.admin
|
||||||
this.allowCommands = user.allowCommands
|
this.allowCommands = user.allowCommands
|
||||||
@@ -242,23 +255,21 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
parseForm () {
|
parseForm () {
|
||||||
let user = {
|
let user = this.originalUser
|
||||||
ID: this.id,
|
user.username = this.username
|
||||||
username: this.username,
|
user.password = this.password
|
||||||
password: this.password,
|
user.lockPassword = this.lockPassword
|
||||||
lockPassword: this.lockPassword,
|
user.filesystem = this.filesystem
|
||||||
filesystem: this.filesystem,
|
user.admin = this.admin
|
||||||
admin: this.admin,
|
user.allowCommands = this.allowCommands
|
||||||
allowCommands: this.allowCommands,
|
user.allowNew = this.allowNew
|
||||||
allowNew: this.allowNew,
|
user.allowEdit = this.allowEdit
|
||||||
allowEdit: this.allowEdit,
|
user.allowPublish = this.allowPublish
|
||||||
allowPublish: this.allowPublish,
|
user.permissions = this.permissions
|
||||||
permissions: this.permissions,
|
user.css = this.css
|
||||||
css: this.css,
|
user.locale = this.locale
|
||||||
locale: this.locale,
|
user.commands = this.commands.split(' ')
|
||||||
commands: this.commands.split(' '),
|
user.rules = []
|
||||||
rules: []
|
|
||||||
}
|
|
||||||
|
|
||||||
let rules = this.rules.split('\n')
|
let rules = this.rules.split('\n')
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
"github.com/asdine/storm"
|
"github.com/asdine/storm"
|
||||||
|
|
||||||
lumberjack "gopkg.in/natefinch/lumberjack.v2"
|
"gopkg.in/natefinch/lumberjack.v2"
|
||||||
|
|
||||||
"github.com/hacdias/filemanager"
|
"github.com/hacdias/filemanager"
|
||||||
"github.com/hacdias/filemanager/bolt"
|
"github.com/hacdias/filemanager/bolt"
|
||||||
|
|||||||
@@ -133,6 +133,16 @@ func (i *File) GetListing(u *User, r *http.Request) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(f.Mode().String(), "L") {
|
||||||
|
// It's a symbolic link
|
||||||
|
// The FileInfo from Readdir treats symbolic link as a file only.
|
||||||
|
info, err := os.Stat(f.Name())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
f = info
|
||||||
|
}
|
||||||
|
|
||||||
if f.IsDir() {
|
if f.IsDir() {
|
||||||
name += "/"
|
name += "/"
|
||||||
dirCount++
|
dirCount++
|
||||||
@@ -418,6 +428,7 @@ var textExtensions = [...]string{
|
|||||||
".sh", ".bash", ".ps1", ".bat", ".cmd",
|
".sh", ".bash", ".ps1", ".bat", ".cmd",
|
||||||
".php", ".pl", ".py",
|
".php", ".pl", ".py",
|
||||||
"Caddyfile",
|
"Caddyfile",
|
||||||
|
".htaccess",
|
||||||
".c", ".cc", ".h", ".hh", ".cpp", ".hpp", ".f90",
|
".c", ".cc", ".h", ".hh", ".cpp", ".hpp", ".f90",
|
||||||
".f", ".bas", ".d", ".ada", ".nim", ".cr", ".java", ".cs", ".vala", ".vapi",
|
".f", ".bas", ".d", ".ada", ".nim", ".cr", ".java", ".cs", ".vala", ".vapi",
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-4
@@ -15,16 +15,15 @@ import (
|
|||||||
|
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
|
||||||
rice "github.com/GeertJohan/go.rice"
|
"github.com/GeertJohan/go.rice"
|
||||||
"github.com/hacdias/fileutils"
|
"github.com/hacdias/fileutils"
|
||||||
"github.com/mholt/caddy"
|
"github.com/mholt/caddy"
|
||||||
"github.com/robfig/cron"
|
"github.com/robfig/cron"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version is the current File Manager version.
|
|
||||||
const (
|
const (
|
||||||
// Version is the current File Manager version.
|
// Version is the current File Manager version.
|
||||||
Version = "1.3.7"
|
Version = "1.3.10"
|
||||||
|
|
||||||
ListViewMode = "list"
|
ListViewMode = "list"
|
||||||
MosaicViewMode = "mosaic"
|
MosaicViewMode = "mosaic"
|
||||||
@@ -39,7 +38,7 @@ var (
|
|||||||
ErrEmptyScope = errors.New("scope is empty")
|
ErrEmptyScope = errors.New("scope is empty")
|
||||||
ErrWrongDataType = errors.New("wrong data type")
|
ErrWrongDataType = errors.New("wrong data type")
|
||||||
ErrInvalidUpdateField = errors.New("invalid field to update")
|
ErrInvalidUpdateField = errors.New("invalid field to update")
|
||||||
ErrInvalidOption = errors.New("Invalid option")
|
ErrInvalidOption = errors.New("invalid option")
|
||||||
)
|
)
|
||||||
|
|
||||||
// FileManager is a file manager instance. It should be creating using the
|
// FileManager is a file manager instance. It should be creating using the
|
||||||
|
|||||||
+11
-10
@@ -1,7 +1,6 @@
|
|||||||
package http
|
package http
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -9,27 +8,28 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
jwt "github.com/dgrijalva/jwt-go"
|
"github.com/dgrijalva/jwt-go"
|
||||||
"github.com/dgrijalva/jwt-go/request"
|
"github.com/dgrijalva/jwt-go/request"
|
||||||
fm "github.com/hacdias/filemanager"
|
fm "github.com/hacdias/filemanager"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const reCaptchaAPI = "https://www.google.com/recaptcha/api/siteverify"
|
||||||
|
|
||||||
type cred struct {
|
type cred struct {
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
Recaptcha string `json:"recaptcha"`
|
ReCaptcha string `json:"recaptcha"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// recaptcha checks the recaptcha code.
|
// reCaptcha checks the reCaptcha code.
|
||||||
func recaptcha(secret string, response string) (bool, error) {
|
func reCaptcha(secret string, response string) (bool, error) {
|
||||||
api := "https://www.google.com/recaptcha/api/siteverify"
|
|
||||||
|
|
||||||
body := url.Values{}
|
body := url.Values{}
|
||||||
body.Set("secret", secret)
|
body.Set("secret", secret)
|
||||||
body.Add("response", response)
|
body.Add("response", response)
|
||||||
|
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
resp, err := client.Post(api, "application/x-www-form-urlencoded", bytes.NewBufferString(body.Encode()))
|
|
||||||
|
resp, err := client.Post(reCaptchaAPI, "application/x-www-form-urlencoded", strings.NewReader(body.Encode()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ func recaptcha(secret string, response string) (bool, error) {
|
|||||||
return data.Success, nil
|
return data.Success, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// authHandler proccesses the authentication for the user.
|
// authHandler processes the authentication for the user.
|
||||||
func authHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
|
func authHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
|
||||||
// NoAuth instances shouldn't call this method.
|
// NoAuth instances shouldn't call this method.
|
||||||
if c.NoAuth {
|
if c.NoAuth {
|
||||||
@@ -73,7 +73,7 @@ func authHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, er
|
|||||||
|
|
||||||
// If ReCaptcha is enabled, check the code.
|
// If ReCaptcha is enabled, check the code.
|
||||||
if len(c.ReCaptchaSecret) > 0 {
|
if len(c.ReCaptchaSecret) > 0 {
|
||||||
ok, err := recaptcha(c.ReCaptchaSecret, cred.Recaptcha)
|
ok, err := reCaptcha(c.ReCaptchaSecret, cred.ReCaptcha)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return http.StatusForbidden, err
|
return http.StatusForbidden, err
|
||||||
@@ -179,6 +179,7 @@ func validateAuth(c *fm.Context, r *http.Request) (bool, *fm.User) {
|
|||||||
keyFunc := func(token *jwt.Token) (interface{}, error) {
|
keyFunc := func(token *jwt.Token) (interface{}, error) {
|
||||||
return c.Key, nil
|
return c.Key, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var claims claims
|
var claims claims
|
||||||
token, err := request.ParseFromRequestWithClaims(r,
|
token, err := request.ParseFromRequestWithClaims(r,
|
||||||
extractor{},
|
extractor{},
|
||||||
|
|||||||
+13
-10
@@ -17,21 +17,13 @@ import (
|
|||||||
// downloadHandler creates an archive in one of the supported formats (zip, tar,
|
// downloadHandler creates an archive in one of the supported formats (zip, tar,
|
||||||
// tar.gz or tar.bz2) and sends it to be downloaded.
|
// tar.gz or tar.bz2) and sends it to be downloaded.
|
||||||
func downloadHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
|
func downloadHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
|
||||||
query := r.URL.Query().Get("format")
|
|
||||||
|
|
||||||
// If the file isn't a directory, serve it using http.ServeFile. We display it
|
// If the file isn't a directory, serve it using http.ServeFile. We display it
|
||||||
// inline if it is requested.
|
// inline if it is requested.
|
||||||
if !c.File.IsDir {
|
if !c.File.IsDir {
|
||||||
if r.URL.Query().Get("inline") == "true" {
|
return downloadFileHandler(c, w, r)
|
||||||
w.Header().Set("Content-Disposition", "inline")
|
|
||||||
} else {
|
|
||||||
w.Header().Set("Content-Disposition", "attachment; filename=\""+c.File.Name+"\"")
|
|
||||||
}
|
|
||||||
|
|
||||||
http.ServeFile(w, r, c.File.Path)
|
|
||||||
return 0, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
query := r.URL.Query().Get("format")
|
||||||
files := []string{}
|
files := []string{}
|
||||||
names := strings.Split(r.URL.Query().Get("files"), ",")
|
names := strings.Split(r.URL.Query().Get("files"), ",")
|
||||||
|
|
||||||
@@ -111,3 +103,14 @@ func downloadHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
|
|||||||
_, err = io.Copy(w, file)
|
_, err = io.Copy(w, file)
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func downloadFileHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
|
||||||
|
if r.URL.Query().Get("inline") == "true" {
|
||||||
|
w.Header().Set("Content-Disposition", "inline")
|
||||||
|
} else {
|
||||||
|
w.Header().Set("Content-Disposition", `attachment; filename="`+c.File.Name+`"`)
|
||||||
|
}
|
||||||
|
|
||||||
|
http.ServeFile(w, r, c.File.Path)
|
||||||
|
return 0, nil
|
||||||
|
}
|
||||||
@@ -160,6 +160,11 @@ func usersPostHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (in
|
|||||||
u.Rules = []*fm.Rule{}
|
u.Rules = []*fm.Rule{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the view mode is empty, initialize with the default one.
|
||||||
|
if u.ViewMode == "" {
|
||||||
|
u.ViewMode = c.DefaultUser.ViewMode
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize commands if not initialized.
|
// Initialize commands if not initialized.
|
||||||
if u.Commands == nil {
|
if u.Commands == nil {
|
||||||
u.Commands = []string{}
|
u.Commands = []string{}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
882c59547968e4fb9a65aa8d1c838409f198e51b
|
46ab215d06908088047a47fa5a4bf4fc8c66b727
|
||||||
Reference in new issue
Block a user