Compare commits

..
1 Commits
Author SHA1 Message Date
Henrique Dias 06200775d5 Version 1.4.2
Former-commit-id: 6dab389efe4eed59f8f39d76e60130ccc74a13ea [formerly 8e106da6d1e25e04a26654435bb180793cc87c3d] [formerly cf02028f5fb706a296a8320fa1d54f222d02f78f [formerly 02f6bb81ccf9c39ea7b1174aa79bd9d2881e0245]]
Former-commit-id: b903fc7a2bf4fdad3a8c89a67b34d99fb3273c35 [formerly 6ea119c7468502d2244108600f0389eb05b502a3]
Former-commit-id: 96de8cafcd6c1ce94f05854a9fb2e9aa3d99eafb
2018-01-04 14:05:19 +00:00
13 changed files with 85 additions and 56 deletions
+4
View File
@@ -73,3 +73,7 @@ this are keywords case:insensitive
# Contributing
The contributing guidelines can be found [here](https://github.com/hacdias/filemanager/blob/master/CONTRIBUTING.md).
# Donate
Enjoying this project? You can [donate to its creator](https://henriquedias.com/donate/). He will appreciate.
+1 -1
View File
@@ -134,7 +134,7 @@ settings:
您可以将该用户设置为管理员,也可以单独选择各项权限。\
如果选择了“管理员”,则其他的选项会被自动勾上,\
同时该用户可以管理其他用户。"
profileSettings: 个人设置
profileSettings: 配置文件设置
ruleExample1: "\
阻止用户访问所有文件夹下任何以 . 开头的文件\
(隐藏文件, 例如: .git, .gitignore)。"
+1 -1
View File
@@ -134,7 +134,7 @@ settings:
您可以將該使用者設置為管理員,也可以單獨選擇各項權限。\
如果選擇了“管理員”,則其他的選項會被自動勾上,\
同時該使用者可以管理其他使用者。"
profileSettings: 個人設定
profileSettings: 設定檔設定
ruleExample1: "\
封鎖使用者存取所有資料夾下任何以 . 開頭的檔案\
(隱藏文件, 例如: .git, .gitignore)。"
+1 -1
View File
@@ -53,7 +53,7 @@
<p class="small"><strong>{{ $t('settings.examples') }}</strong></p>
<ul class="small">
<li><code>disallow regex [\\\/]\..+</code> - {{ $t('settings.ruleExample1') }}</li>
<li><code>disallow regex \\/\\..+</code> - {{ $t('settings.ruleExample1') }}</li>
<li><code>disallow /Caddyfile</code> - {{ $t('settings.ruleExample2') }}</li>
</ul>
-1
View File
@@ -60,7 +60,6 @@
}
body > a h1 {
margin-top: .2em;
word-wrap: break-word;
}
</style>
</head>
+13 -14
View File
@@ -1,14 +1,13 @@
#!/bin/bash
set -e
# Install rice tool if not present
if ! [ -x "$(command -v rice)" ]; then
go get github.com/GeertJohan/go.rice/rice
fi
# Clean the dist folder and build the assets
rm -rf assets/dist
npm run build
# Embed the assets using rice
rice embed-go
#!/bin/bash
# Install rice tool if not present
if ! [ -x "$(command -v rice)" ]; then
go get github.com/GeertJohan/go.rice/rice
fi
# Clean the dist folder and build the assets
rm -rf assets/dist
npm run build
# Embed the assets using rice
rice embed-go
+1 -1
View File
@@ -23,7 +23,7 @@ import (
const (
// Version is the current File Manager version.
Version = "1.4.6"
Version = "1.4.2"
ListViewMode = "list"
MosaicViewMode = "mosaic"
+4 -1
View File
@@ -38,7 +38,10 @@ func reCaptcha(secret string, response string) (bool, error) {
}
var data struct {
Success bool `json:"success"`
Success bool `json:"success"`
ChallengeTS time.Time `json:"challenge_ts"`
Hostname string `json:"hostname"`
ErrorCodes interface{} `json:"error-codes"`
}
err = json.NewDecoder(resp.Body).Decode(&data)
+45 -21
View File
@@ -1,6 +1,8 @@
package http
import (
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
@@ -43,41 +45,72 @@ func downloadHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
files = append(files, c.File.Path)
}
// If the format is true, just set it to "zip".
if query == "true" || query == "" {
query = "zip"
}
var (
extension string
ar archiver.Archiver
temp string
err error
tempfile string
)
// Create a temporary directory.
temp, err = ioutil.TempDir("", "")
if err != nil {
return http.StatusInternalServerError, err
}
defer os.RemoveAll(temp)
tempfile = filepath.Join(temp, "temp")
switch query {
// If the format is true, just set it to "zip".
case "zip", "true", "":
extension, ar = ".zip", archiver.Zip
case "zip":
extension, err = ".zip", archiver.Zip.Make(tempfile, files)
case "tar":
extension, ar = ".tar", archiver.Tar
extension, err = ".tar", archiver.Tar.Make(tempfile, files)
case "targz":
extension, ar = ".tar.gz", archiver.TarGz
extension, err = ".tar.gz", archiver.TarGz.Make(tempfile, files)
case "tarbz2":
extension, ar = ".tar.bz2", archiver.TarBz2
extension, err = ".tar.bz2", archiver.TarBz2.Make(tempfile, files)
case "tarxz":
extension, ar = ".tar.xz", archiver.TarXZ
extension, err = ".tar.xz", archiver.TarXZ.Make(tempfile, files)
default:
return http.StatusNotImplemented, nil
}
if err != nil {
return http.StatusInternalServerError, err
}
// Defines the file name.
name := c.File.Name
if name == "." || name == "" {
name = "archive"
name = "download"
}
name += extension
w.Header().Set("Content-Disposition", "attachment; filename*=utf-8''"+url.QueryEscape(name))
err := ar.Write(w, files)
// Opens the file so it can be downloaded.
file, err := os.Open(temp + "/temp")
if err != nil {
return http.StatusInternalServerError, err
}
defer file.Close()
w.Header().Set("Content-Disposition", "attachment; filename=\""+name+"\"")
_, err = io.Copy(w, file)
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+`"`)
}
file, err := os.Open(c.File.Path)
defer file.Close()
@@ -85,19 +118,10 @@ func downloadFileHandler(c *fm.Context, w http.ResponseWriter, r *http.Request)
return http.StatusInternalServerError, err
}
stat, err := file.Stat()
_, err = io.Copy(w, file)
if err != nil {
return http.StatusInternalServerError, err
}
if r.URL.Query().Get("inline") == "true" {
w.Header().Set("Content-Disposition", "inline")
} else {
// As per RFC6266 section 4.3
w.Header().Set("Content-Disposition", "attachment; filename*=utf-8''"+url.QueryEscape(c.File.Name))
}
http.ServeContent(w, r, stat.Name(), stat.ModTime(), file)
return 0, nil
}
+8 -7
View File
@@ -86,7 +86,7 @@ func serve(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
// Any other request should show the index.html file.
w.Header().Set("x-frame-options", "SAMEORIGIN")
w.Header().Set("x-content-type-options", "nosniff")
w.Header().Set("x-content-type", "nosniff")
w.Header().Set("x-xss-protection", "1; mode=block")
return renderFile(c, w, "index.html")
@@ -223,12 +223,13 @@ func renderFile(c *fm.Context, w http.ResponseWriter, file string) (int, error)
w.Header().Set("Content-Type", contentType+"; charset=utf-8")
data := map[string]interface{}{
"BaseURL": c.RootURL(),
"NoAuth": c.NoAuth,
"Version": fm.Version,
"CSS": template.CSS(c.CSS),
"ReCaptcha": c.ReCaptchaKey != "" && c.ReCaptchaSecret != "",
"ReCaptchaKey": c.ReCaptchaKey,
"BaseURL": c.RootURL(),
"NoAuth": c.NoAuth,
"Version": fm.Version,
"CSS": template.CSS(c.CSS),
"ReCaptcha": c.ReCaptchaKey != "" && c.ReCaptchaSecret != "",
"ReCaptchaKey": c.ReCaptchaKey,
"ReCaptchaSecret": c.ReCaptchaSecret,
}
if c.StaticGen != nil {
+4 -4
View File
@@ -15,9 +15,9 @@
"js-base64": "^2.4.0",
"moment": "^2.19.2",
"normalize.css": "^7.0.0",
"noty": "^3.1.4",
"noty": "^3.1.3",
"vue": "^2.5.8",
"vue-i18n": "^7.3.4",
"vue-i18n": "^7.3.2",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"
},
@@ -34,7 +34,7 @@
"connect-history-api-fallback": "^1.5.0",
"copy-webpack-plugin": "^4.2.1",
"css-loader": "^0.28.7",
"eslint": "^4.15.0",
"eslint": "^4.11.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.9.0",
@@ -64,7 +64,7 @@
"vue-template-compiler": "^2.5.8",
"webpack": "^3.8.1",
"webpack-bundle-analyzer": "^2.9.1",
"webpack-dev-middleware": "^2.0.4",
"webpack-dev-middleware": "^1.12.0",
"webpack-hot-middleware": "^2.20.0",
"webpack-merge": "^4.1.1",
"yml-loader": "^2.1.0"
+2 -3
View File
@@ -1,5 +1,4 @@
#!/bin/bash
set -e
echo "Building assets"
./build.sh
@@ -9,7 +8,7 @@ sed -i "s|(untracked)|$1|g" filemanager.go
echo "Commiting..."
git add -A
git commit -m "chore: version $1"
git commit -m "Version $1"
git push
echo "Creating the tag..."
@@ -19,7 +18,7 @@ git push --tags
echo "Commiting untracked version notice..."
sed -i "s|$1|(untracked)|g" filemanager.go
git add -A
git commit -m "chore: setting untracked version [ci skip]"
git commit -m "[ci skip] auto: setting untracked version"
git push
echo "Done!"
+1 -1
View File
@@ -1 +1 @@
e48e71dd340a2bf3434e06c86032565365132976
6e37237fbee662acdaf51c879107db450ea135ed