3 Commits
Author SHA1 Message Date
Henrique DiasandGitHub f0ca85e570 docs: add disclaimer 2022-09-26 11:58:28 +02:00
Ethan DavisandGitHub 436a3b05a1 fix: 'modify:false' is respected 2022-01-18 15:17:20 +01:00
Rui SunandGitHub 1a610b17ba feat: add armv7 support 2022-01-18 15:17:01 +01:00
6 changed files with 74 additions and 19 deletions
+7
View File
@@ -25,6 +25,13 @@ jobs:
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
# https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
- name: Print Go version and environment
id: vars
+52 -9
View File
@@ -42,8 +42,7 @@ build:
goarm: 6
archives:
-
name_template: "{{.Os}}-{{.Arch}}{{if .Arm}}v{{.Arm}}{{end}}-{{ .ProjectName }}"
- name_template: "{{.Os}}-{{.Arch}}{{if .Arm}}v{{.Arm}}{{end}}-{{ .ProjectName }}"
format: tar.gz
format_overrides:
- goos: windows
@@ -57,12 +56,56 @@ release:
prerelease: auto
dockers:
-
goos: linux
- goos: linux
goarch: amd64
goarm: ''
goarm: ""
use: buildx
image_templates:
- "hacdias/webdav:latest"
- "hacdias/webdav:{{ .Tag }}"
- "hacdias/webdav:v{{ .Major }}.{{ .Minor }}"
- "hacdias/webdav:v{{ .Major }}"
- "hacdias/webdav:amd64-latest"
- "hacdias/webdav:amd64-{{ .Tag }}"
- "hacdias/webdav:amd64-v{{ .Major }}.{{ .Minor }}"
- "hacdias/webdav:amd64-v{{ .Major }}"
- goos: linux
goarch: arm
goarm: 7
use: buildx
build_flag_templates:
- "--platform=linux/arm/v7"
image_templates:
- "hacdias/webdav:armv7-latest"
- "hacdias/webdav:armv7-{{ .Tag }}"
- "hacdias/webdav:armv7-v{{ .Major }}.{{ .Minor }}"
- "hacdias/webdav:armv7-v{{ .Major }}"
- goos: linux
goarch: arm64
goarm: ""
use: buildx
build_flag_templates:
- "--platform=linux/arm64"
image_templates:
- "hacdias/webdav:arm64-latest"
- "hacdias/webdav:arm64-{{ .Tag }}"
- "hacdias/webdav:arm64-v{{ .Major }}.{{ .Minor }}"
- "hacdias/webdav:arm64-v{{ .Major }}"
docker_manifests:
- name_template: hacdias/webdav:latest
image_templates:
- hacdias/webdav:amd64-latest
- hacdias/webdav:armv7-latest
- hacdias/webdav:arm64-latest
- name_template: hacdias/webdav:{{ .Tag }}
image_templates:
- hacdias/webdav:amd64-{{ .Tag }}
- hacdias/webdav:armv7-{{ .Tag }}
- hacdias/webdav:arm64-{{ .Tag }}
- name_template: hacdias/webdav:v{{ .Major }}.{{ .Minor }}
image_templates:
- hacdias/webdav:amd64-v{{ .Major }}.{{ .Minor }}
- hacdias/webdav:armv7-v{{ .Major }}.{{ .Minor }}
- hacdias/webdav:arm64-v{{ .Major }}.{{ .Minor }}
- name_template: hacdias/webdav:v{{ .Major }}
image_templates:
- hacdias/webdav:amd64-v{{ .Major }}
- hacdias/webdav:armv7-v{{ .Major }}
- hacdias/webdav:arm64-v{{ .Major }}
+3
View File
@@ -1,3 +1,5 @@
> ⚠️ Disclaimer: this repository is not actively maintained. If you are interested in maintaining it, please [contact me](https://github.com/hacdias/webdav/issues/144).
# webdav
![Build](https://github.com/hacdias/webdav/workflows/Tests/badge.svg)
@@ -22,6 +24,7 @@ tls: false
cert: cert.pem
key: key.pem
prefix: /
debug: false
# Default user settings (will be merged)
scope: .
+1
View File
@@ -190,6 +190,7 @@ func readConfig(flags *pflag.FlagSet) *lib.Config {
LockSystem: webdav.NewMemLS(),
},
},
Debug: getOptB(flags, "debug"),
Auth: getOptB(flags, "auth"),
NoSniff: getOptB(flags, "nosniff"),
Cors: lib.CorsCfg{
+3
View File
@@ -71,6 +71,9 @@ set WD_CERT.`,
}
loggerConfig := zap.NewProductionConfig()
loggerConfig.DisableCaller = true
if cfg.Debug {
loggerConfig.Level = zap.NewAtomicLevelAt(zap.DebugLevel)
}
loggerConfig.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
loggerConfig.Encoding = cfg.LogFormat
logger, err := loggerConfig.Build()
+8 -10
View File
@@ -22,6 +22,7 @@ type CorsCfg struct {
type Config struct {
*User
Auth bool
Debug bool
NoSniff bool
Cors CorsCfg
Users map[string]*User
@@ -107,17 +108,14 @@ func (c *Config) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
// Checks for user permissions relatively to this PATH.
noModification := r.Method == "GET" ||
r.Method == "HEAD" ||
r.Method == "OPTIONS" ||
r.Method == "PROPFIND" ||
r.Method == "PUT" ||
r.Method == "LOCK" ||
r.Method == "UNLOCK" ||
r.Method == "MOVE" ||
r.Method == "DELETE"
noModification := r.Method == "GET" || r.Method == "HEAD" ||
r.Method == "OPTIONS" || r.Method == "PROPFIND"
if !u.Allowed(r.URL.Path, noModification) {
allowed := u.Allowed(r.URL.Path, noModification)
zap.L().Debug("allowed & method & path", zap.Bool("allowed", allowed), zap.String("method", r.Method), zap.String("path", r.URL.Path))
if !allowed {
w.WriteHeader(http.StatusForbidden)
return
}