mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
fix: recaptcha fixes, auth fixes and line endings
* http: auth: remove unnecessary fields in recaptcha validation * http: render: never expose ReCaptchaSecret to public * build: dos2unix build.sh
This commit is contained in:
parent
93566aceef
commit
9b8c2862e2
28
build.sh
28
build.sh
@ -1,14 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Install rice tool if not present
|
# Install rice tool if not present
|
||||||
if ! [ -x "$(command -v rice)" ]; then
|
if ! [ -x "$(command -v rice)" ]; then
|
||||||
go get github.com/GeertJohan/go.rice/rice
|
go get github.com/GeertJohan/go.rice/rice
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clean the dist folder and build the assets
|
# Clean the dist folder and build the assets
|
||||||
rm -rf assets/dist
|
rm -rf assets/dist
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
# Embed the assets using rice
|
# Embed the assets using rice
|
||||||
rice embed-go
|
rice embed-go
|
||||||
|
@ -38,10 +38,7 @@ func reCaptcha(secret string, response string) (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var data struct {
|
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)
|
err = json.NewDecoder(resp.Body).Decode(&data)
|
||||||
|
13
http/http.go
13
http/http.go
@ -223,13 +223,12 @@ func renderFile(c *fm.Context, w http.ResponseWriter, file string) (int, error)
|
|||||||
w.Header().Set("Content-Type", contentType+"; charset=utf-8")
|
w.Header().Set("Content-Type", contentType+"; charset=utf-8")
|
||||||
|
|
||||||
data := map[string]interface{}{
|
data := map[string]interface{}{
|
||||||
"BaseURL": c.RootURL(),
|
"BaseURL": c.RootURL(),
|
||||||
"NoAuth": c.NoAuth,
|
"NoAuth": c.NoAuth,
|
||||||
"Version": fm.Version,
|
"Version": fm.Version,
|
||||||
"CSS": template.CSS(c.CSS),
|
"CSS": template.CSS(c.CSS),
|
||||||
"ReCaptcha": c.ReCaptchaKey != "" && c.ReCaptchaSecret != "",
|
"ReCaptcha": c.ReCaptchaKey != "" && c.ReCaptchaSecret != "",
|
||||||
"ReCaptchaKey": c.ReCaptchaKey,
|
"ReCaptchaKey": c.ReCaptchaKey,
|
||||||
"ReCaptchaSecret": c.ReCaptchaSecret,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.StaticGen != nil {
|
if c.StaticGen != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user